

function checkLogin(form){
  if(isEmpty(form.userId.value)){
     alert("请输入您的用户名！");
	 var userId=form.userId.value;
	 form.userId.value=userId;
	 form.userId.focus();
	 form.userId.select();
  }else if(isEmpty(form.userPassword.value)){
     alert("请输入您的口令！");
	 var userPassword=form.userPassword.value;
	 form.userPassword.value=userPassword;
	 form.userPassword.focus();
	 form.userPassword.select();
  }else{
	  return true;
  }
  return false;
  
}

function checkNoUser(form){
  if(isEmpty(form.name.value)){
     alert("请输入您的姓名！");
	 var name=form.name.value;
	 form.name.value=name;
	 form.name.focus();
	 form.name.select();
  }else if(form.area.value=="0"){
     alert("请选择您所在的地区！");
	 form.area.focus();
  }else if(isEmpty(form.company.value)){
     alert("请输入公司名称！");
	 var company=form.company.value;
	 form.company.value=company;
	 form.company.focus();
	 form.company.select();
  }else if(isEmpty(form.address.value)){
     alert("请输入公司地址！");
	 var address=form.address.value;
	 form.address.value=address;
	 form.address.focus();
	 form.address.select();
  }else if(isEmpty(form.zip.value)){
     alert("请输入邮政编码！");
	 var zip=form.zip.value;
	 form.zip.value=zip;
	 form.zip.focus();
	 form.zip.select();
  }else if(isEmpty(form.tel.value)){
     alert("请输入联系电话！");
	 var tel=form.tel.value;
	 form.tel.value=tel;
	 form.tel.focus();
	 form.tel.select();
  }else if(!isEmail(form.email.value)||isEmpty(form.email.value)){
     alert("请正确输入您的Email地址！");
	 var email=form.email.value;
	 form.email.value=email;
	 form.email.focus();
	 form.email.select();
  }else{
	  return true;
  }
  return false;
}

function checkdata_search(){
  if(document.searchform.select.value=="0"){
    alert("请选择查询类别！");
	document.searchform.select.focus();
  }else if(document.searchform.text.value=="请您输入查询字段..."||document.searchform.text.value.length<=0){
		alert("请输入查询字段！");
		var text=document.searchform.text.value;
		document.searchform.text.value=text;
		document.searchform.text.focus();
		document.searchform.text.select();
  }else{
	  return true;
  }
  return false;
}

function checkNum(form){
  var flagNum=0;
  var num=form.the_count.value;
  var zcountArray=new Array(num);
  for(var ii=0;ii<num;ii++){
    zcountArray[ii]=eval("form.zcount"+ii+".value");
  }
  for(var i=0;i<num;i++){
    if(isNaN(zcountArray[i])==true||zcountArray[i]==0){
       alert("请输入正整数！");
	   flagNum++;
    }
  }
  if(flagNum!=0){
	 return false;
  }else{
     return true;
  }
}

function linkOpen(url) {         
 window.open(url,'','toolbar=yes,location=yes,directories=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=790,height=415,left=0,top=0'); 

}

function linkOpenDetail(url) {         
 window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500,height=300,left=50,top=20'); 

}

function addtocart(url)
{
window.open(url,'mycart','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=1,width=700,top=0,left='+(window.screen.availWidth-710)+',height=250')
}

function addtozip(url)
{
window.open(url,'zip','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=1,width=400,top=0,left='+(window.screen.availWidth-410)+',height=200')
}


function getvalue_compare(){//推荐时所调用的功能，向下一个php程序传值！
   var max=document.productsCompare.count.value;
   var mvalue="";
   if(max==1&&document.productsCompare.checkname.checked == true){
      mvalue=document.productsCompare.checkname.value+","+mvalue;
   }else if(max!=1){
	 for (k=0;k<max;k++){
       if (document.productsCompare.checkname[k].checked == true){
          mvalue=document.productsCompare.checkname[k].value+","+mvalue;
       }
     }
   }
   document.productsCompare.mvalue.value=mvalue;
   if(mvalue==""){
      alert("请至少选择一项！");
   }else{
	   return true;
   }
   return false;
}


function allclick(){//推荐中全选功能
 if(document.productsCompare.checkname.length==null){
   document.productsCompare.checkname.checked=document.productsCompare.allcheck.checked;
 }else{
   for(var i=0;i<document.productsCompare.checkname.length;i++){
      document.productsCompare.checkname[i].checked=document.productsCompare.allcheck.checked;
   }
 }
}

function allclick1(){//推荐中全选功能
 if(document.productsCompare.checkname.length==null){
   document.productsCompare.checkname.checked=document.productsCompare.allcheck1.checked;
 }else{
   for(var i=0;i<document.productsCompare.checkname.length;i++){
      document.productsCompare.checkname[i].checked=document.productsCompare.allcheck1.checked;
   }
 }
}