/* 弹出窗口 */
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

/* 设置各元素各类型(TYPE)样式 */
window.onload=input_style;
function input_style(){
/* 设置 Input 样式 */
	var obj=document.body.getElementsByTagName("input");
	for (var i=0;i<obj.length;i++)
	{
		if (obj[i].type=="text"||obj[i].type=="password"||obj[i].type=="file")
		{
			obj[i].style.border="solid 1px green";  // 设置边框
			obj[i].style.padding="1px 2px 1px 2px";  // 设置补白
			obj[i].onmouseover=function(){this.style.border="solid 1px red";}  // onmouseover 事件
			obj[i].onmouseout=function(){this.style.border="solid 1px green";}  // onmouseout 事件
			obj[i].onfocus=function(){this.style.border="solid 1px blue";}  // onFocus 事件
		}
		else
			obj[i].style.border="0px";
		if (obj[i].type=="submit"||obj[i].type=="reset"||obj[i].type=="button")
		{
			obj[i].style.cursor="pointer";  // 设置指针
			obj[i].style.padding="2px 5px 2px 5px";  // 设置补白
			obj[i].style.backgroundColor="#151514";
			obj[i].style.color="#C7C7C7";
			obj[i].style.border="solid 1px #4A4645";
			obj[i].onmouseover=function(){this.style.border="solid 1px #666666";}  // onmouseover 事件
			obj[i].onmouseout=function(){this.style.border="solid 1px #4A4645";}  // onmouseout 事件
//			obj[i].style.filter="progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr=#ffffff,EndColorStr=#A6A6A6)";  // 设置背景渐变 only for ie
		}
		else
			obj[i].style.cursor="auto";
		if (obj[i].type=="checkbox"||obj[i].type=="radio")
			obj[i].onfocus=function(){this.blur()}  // 去除焦点
	}
/* 设置 Textarea 样式 */
	var obj=document.body.getElementsByTagName("textarea");
	for (var i=0;i<obj.length;i++)
	{
		obj[i].style.border="solid 1px green";  // 设置边框
		obj[i].onmouseover=function(){this.style.border="solid 1px red";}  // onmouseover 事件
		obj[i].onmouseout=function(){this.style.border="solid 1px green";}  // onmouseout 事件
		obj[i].onfocus=function(){this.style.border="solid 1px blue";}  // onFocus 事件
	}

}  //\ End Function

