/* 弹出窗口 */
function JS_opWindow(url, oWidth, oHeight, oResizable)
{
	if (!oWidth)
		oWidth = 550;
	else
		oWidth= oWidth + 38;
	if (!oHeight)
		oHeight = 420;
	if (!oResizable)
		oResizable = "no";
	window.open(url, 'opWindow', 'width='+oWidth+', height='+oHeight+', resizable='+oResizable+', scrollbars=yes, top=0');
}  //\ End Function

/* 鼠标经过图片JS */
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

/* 版权信息 */
function JS_gb_copyRight() {
document.write('');
}  //\ End Funcion
function JS_en_copyRight() {
document.write('');
}  //\ End Funcion

/* 搜索检查 */
function JS_gb_checkSearch(theform) {
	if (theform.keyword.value=="")
	{
		alert ('提示: 请输入搜索关键字后再进行查询.');
		theform.keyword.focus();
		return false;
	}
}  //\ End Function
function JS_en_checkSearch(theform) {
	if (theform.keyword.value=="")
	{
		alert ('Tips: you must input the keyword field.');
		theform.keyword.focus();
		return false;
	}
}  //\ End Function

/* 发送邮件 */
function checkSM() {
	if (formContact.companyname.value.length==0)
	{
		alert("提示: 请填写公司全称.");
		formContact.companyname.focus();
		return false;
	}
	if (formContact.linkman.value.length==0)
	{
		alert("提示: 请填写联系人姓名.");
		formContact.linkman.focus();
		return false;
	}
	var email = formContact.email.value; 
	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;
	flag = pattern.test(email); 

	if (!flag) {
		alert("提示: 请填写正确的邮箱地址.");
		formContact.email.focus();
		return false;
	}
	formContact.mailBody.value=formContact.innerHTML;
	formContact.submit();
}  //\ End Function

/* 页面装载程序 */
document.writeln("<script language=\"VBScript\">");
document.writeln("Dim mtlBar, mtlLine, mtlSP");
document.writeln("mtlBar = 0");
document.writeln("mtlLine = \"*\"");
document.writeln("mtlSP = 100");
document.writeln("Function Window_onLoad()");
document.writeln("mtlBar = 95");
document.writeln("mtlSP = 10");
document.writeln("End Function");
document.writeln("Function Count()");
document.writeln("If mtlBar < 100 Then");
document.writeln("mtlBar = mtlBar + 1");
document.writeln("Window.Status = \"Start loading: \" & mtlBar & \"%\" & \" \" & String(mtlBar, mtlLine)");
document.writeln("setTimeout \"Count()\", mtlSP");
document.writeln("Else");
document.writeln("Window.Status = \"\"");  // document.writeln("Window.Status = \"页面载入状态：完成！\"");
document.writeln("Document.Body.Style.Display = \"\"");
document.writeln("End If");
document.writeln("End Function");
document.writeln("Call Count()");
document.writeln("<\/script>");
document.writeln("")

/* 选择页面上所有CHECKBOX元素 */
/**
 * Checks/unchecks all tables
 *
 * @param   string   the form name
 * @param   boolean  whether to check or to uncheck the element
 *
 * @return  boolean  always true
 */
function JS_setCheckboxes(the_form, do_check)
{
    var elts      = (typeof(document.forms[the_form].elements['myCheckbox[]']) != 'undefined')
                  ? document.forms[the_form].elements['myCheckbox[]']
                  : (typeof(document.forms[the_form].elements['selected_tbl[]']) != 'undefined')
          ? document.forms[the_form].elements['selected_tbl[]']
          : document.forms[the_form].elements['selected_fld[]'];
    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else

    return true;
}  //\ End Function

/* 问题解答显示 */
var FaQold='';
function JS_faq(name) {
		submenu="submenu_"+name;
        if (FaQold!=submenu) {
                if (FaQold!='') {
					document.getElementById(FaQold).style.display='none';
                }
                document.getElementById(submenu).style.display='';
                FaQold=submenu;
        }
        else {
                document.getElementById(submenu).style.display='none';
                FaQold='';
        }
}  //\ End Function

/* 登陆检查 */
function JS_gb_checkLogin(theform) {
	if (theform.username.value=="" || theform.password.value=="")
	{
		alert ('提示: 请输入帐号及密码.');
		if (theform.username.value=="")  // 如果用户名栏为空则光标转向之
		{
			theform.username.focus();
		}
		else  // 否则转向密码栏
		{
			theform.password.focus();
		}
		return false;
	}
}  //\ End Function
function JS_en_checkLogin(theform) {
	if (theform.username.value=="" || theform.password.value=="")
	{
		alert ('Tips: you must input the username & password field.');
		if (theform.username.value=="")  // 如果用户名栏为空则光标转向之
		{
			theform.username.focus();
		}
		else  // 否则转向密码栏
		{
			theform.password.focus();
		}
		return false;
	}
}  //\ End Function

/* 注销登陆 */
function JS_gb_logOut() {
	if (confirm("提示: 确定离开吗?"))
		return true;
	else
		return false;
}
function JS_en_logOut() {
	if (confirm("Tips: Do you want to leave?"))
		return true;
	else
		return false;
}  //\ End Function

