function initAd() {
　　 document.all.AdLayer_l.style.posTop = -200;//设置onLoad事件激发以后，广告层相对于固定后的y方向位置
　　 document.all.AdLayer_l.style.visibility = 'visible'//设置层为可见　  
     document.all.AdLayer_r.style.posTop = -200;//设置onLoad事件激发以后，广告层相对于固定后的y方向位置
	 document.all.AdLayer_r.style.posLeft = 885;
　　 document.all.AdLayer_r.style.visibility = 'visible'//设置层为可见　   
　　　MoveLayer();//调用函数MoveLayer()　　　
　　 }
function MoveLayer(){
　　 var x = 0;
　　 var y = document.body.scrollTop ;
　　 document.all.AdLayer_l.style.posTop = y;
     document.all.AdLayer_r.style.posTop = y;	 
　　 setTimeout("MoveLayer();", 20);//设置20毫秒后再调用函数MoveLayer()
}




function hidelayer(src) {  
  src.style.visibility='hidden';
}

function showlayer(src) {
  src.style.visibility='visible';
}

function showhidden(src) {
  if (src.style.display=="none") {
    src.style.display="";
  }
  else {
    src.style.display="none";
  }
}

function changeimg(name,src2) {
  name.src="../images/"+src2;
}

function changeimg2(name,src2) {
  name.src="images/"+src2;
}


 function dologin() {
   var Fn = document.userlogin;
   if (Fn.username.value=="") {alert("请输入你的账号。");Fn.username.focus();return;}
   if (Fn.userpassword.value=="") {alert("请输入密码。");Fn.userpassword.focus();return;}
   Fn.submit();
 }

 function checklogin() {
   var Fn = document.userlogin;
   if (Fn.user.value=="") {alert("请输入你的账号。");Fn.user.focus();return false;}
   else if (Fn.password.value=="") {alert("请输入密码。");Fn.password.focus();return false;}
   else {return true;}
 }

 function windowgo(url) {
   document.location=url;
 }

 function windowopen(url) {
   window.open(url,"","");
 }

 function windowopen2(url) {
   window.open(url,"","");
   window.close();
 }

 function checkemail(objName)  {
   var mail = objName.value;
   if (mail.charAt(mail.length-1)==".") {alert("电子邮箱不正确");objName.focus();return false}
   re=/(\w+)@(\w+)\.(\w+)\.*(\w*)/i;
   re.exec(mail);
   if (RegExp.$4!="") strr=RegExp.$1+"@"+RegExp.$2+"."+RegExp.$3+"."+RegExp.$4;
   else strr=RegExp.$1+"@"+RegExp.$2+"."+RegExp.$3;
   if (strr!=mail.substr(0,strr.length)) {alert("电子邮箱不正确");objName.focus();return false}
   else return true;
 }

 function checkuser(objName) {
   var user = objName.value;
   if (user.length<4) {alert("用户账号不正确");objName.focus();return false;}
   re=/([0-9a-zA-Z]{4,12})/;
   re.exec(user);
   if (RegExp.$1 != user) {alert("用户账号不正确");objName.focus();return false;}
   else return true;
 }

 function checkpassword(objName) {
   var password = objName.value;
   re=/([0-9a-zA-Z]{4,12})/;
   re.exec(password);
   if (RegExp.$1 != password) {alert("密码不正确");objName.focus();return false;}
   else return true;
 }

function checknumber(objName,name) {
  var number = objName.value;
  if (number=="") return true;
  var checkOK = "0123456789";
  for (i=0;i<number.length;i++) {
    ch=number.charAt(i);
    for(j=0;j<checkOK.length;j++)
      if(ch==checkOK.charAt(j))
        break;
    if(j==checkOK.length) {
	  alert(name+" 错误");
	  objName.focus();
      return false;
    }
  }
  return true;
}
 
function checknull(objName,name) {
  if (objName.value=="") {
	alert (" 请输入"+name);
	objName.focus();
	return false;
  }
  return true;
}

function checkchecked (form,name) {
  if (form.usertitle[1].checked) return true;
  if (form.usertitle[0].checked) return true;
  alert (" 请选择"+name);
  return false;  
}

function gonexthornor () {
   var thissrc = location.href;
 var no2 = thissrc.indexOf(".jsp");
  var no3 = thissrc.charAt(no2-1);
  var no = parseInt(no3);
  no= no+1;
  if (no>6)  {
	no=6;
  }
  if (no<1)  {
	no=1;
  }
  document.location="hornor"+no+".jsp";
}

function goprevhornor () {
   var thissrc = location.href;
  var no2 = thissrc.indexOf(".jsp");
  var no3 = thissrc.charAt(no2-1);
  var no = parseInt(no3);
  no= no-1;
  if (no>6)  {
	no=6;
  }
  if (no<1)  {
	no=1;
  }
  document.location="hornor"+no+".jsp";
}

function typeselect() { 
  var typeno=document.producttype.SelectType.value;
  document.location="product.jsp?type="+typeno;
}

function typego(typeno) { 
  if (!checknull(document.typegoform.gopageno,"页数")) return false;
  if (!checknumber(document.typegoform.gopageno,"页数")) return false;
  var page=document.typegoform.gopageno.value;
  document.location="product.jsp?type="+typeno+"&page="+page;
}

function samplego() { 
  if (!checknull(document.typegoform.gopageno,"页数")) return false;
  if (!checknumber(document.typegoform.gopageno,"页数")) return false;
  var page=document.typegoform.gopageno.value;
  document.location="sample.jsp?page="+page;
}


