function check()
{
    if (strlogin.cname.value=="") 
		alert("请输入用户名！");
	else if (strlogin.password.value=="") 
		alert("请输入登录密码！");
	else
		strlogin.submit();
}
function fucPWDchk(str)
{
  var strSource ="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_";
  var ch;
  var i;
  var temp;

  for (i=0;i<=(str.length-1);i++)
  {

    ch = str.charAt(i);
    temp = strSource.indexOf(ch);
    if (temp==-1)
    {
     return 0;
    }
  }
  if (strSource.indexOf(ch)==-1)
  {
    return 0;
  }
  else
  {
    return 1;
  }
}
function checkreg1() {
  	if (document.inputForm1.cname.value == ""){
		alert ("请输入您的姓名!");
		 }
		 else if (fucPWDchk(document.inputForm1.cname.value)==0)
    {
    alert('用户名只能包含字母和数字以及下划线_等');
    document.inputForm1.cname.focus();
    }
	else if (document.inputForm1.cname.value.length>20){
	     alert ("您的用户帐号不能超过20个字符!");
		 }
    else if (document.inputForm1.name.value == "" || document.inputForm1.name.value == ""){
	     alert ("请输入您的真实姓名!");
		 }

    else if (document.inputForm1.password.value == "" || document.inputForm1.password1.value == ""){
	     alert ("请输入您的用户密码!");
		 }
    else  if ( document.inputForm1.password.value != document.inputForm1.password1.value ){
          alert("请确认您的用户密码!");
         }
else if (document.inputForm1.password.value.length<4){
	     alert ("您的用户密码不能小于4个字符!");
		 }		
 else if (document.inputForm1.password.value.length>16){
	     alert ("您的用户密码不能超过16个字符!");
		 }
	 else if (document.inputForm1.company.value == "" ){
	     alert ("请输入公司名称!");
		 }
	 else if (document.inputForm1.company.value.length>40){
	     alert ("企业名称不能超过40个字符!");
		 }
		 else if (document.inputForm1.postcode.value == "" ){
	     alert ("请输入邮政编码!");
		 }
		else if (document.inputForm1.province.value == "" ){
	     alert ("请选择您所在的省份! ");
		 return false;
		 }
		else if (document.inputForm1.city.value == "" ){
	     alert ("请输入您所在的城市! ");
		 return false;
		 }  
		else if (document.inputForm1.city.value.length>30 ){
	     alert ("所在城市不能超过30个字符!");
		 }
	else if (document.inputForm1.address.value == "" ){
	     alert ("请输入详细通讯地址!");
		 }
		 else if (document.inputForm1.address.value.length>100 ){
	     alert ("具体通讯地址不能超过100个字符!");
		 }
		else if (document.inputForm1.tel.value == "" ){
	     alert ("请输入您的电话号码!");		 
}
		 
	else if (document.inputForm1.email.value == "" ){
	     alert ("请输入您的电子邮件地址!");		 
}
	else if (document.inputForm1.email.value.length>50 ){
	     alert ("电子邮件地址不能超过50个字符!");
		 }

         	

         else {
   var invalidcheck=0; 
var str=document.inputForm1.email.value 
var filter=/^.+@.+\..{2,3}$/ 
if (filter.test(str)){ 
          document.inputForm1.submit()	
} 
else{ 
alert("您输入的电子邮件格式错误，请重新输入!") 
return false; 
} 
		  
            }
 						
		

}
function checkreg2() {
  	if (document.inputForm1.cname.value == ""){
		alert ("请输入您的用户帐号!");
		 }
		 else if (document.inputForm1.cname.value.length>20){
	     alert ("您的用户帐号不能超过20个字符!");
		 }

    else if (document.inputForm1.password.value == "" || document.inputForm1.password1.value == ""){
	     alert ("请输入您的用户密码!");
		 }
    else  if ( document.inputForm1.password.value != document.inputForm1.password1.value ){
          alert("请确认您的用户密码!");
         }
else if (document.inputForm1.password.value.length<4){
	     alert ("您的用户密码不能小于4个字符!");
		 }		
 else if (document.inputForm1.password.value.length>16){
	     alert ("您的用户密码不能超过16个字符!");
		 }
	 else if (document.inputForm1.company.value == "" ){
	     alert ("请输入企业正式名称!");
		 }
	 else if (document.inputForm1.company.value.length>40){
	     alert ("企业名称不能超过40个字符!");
		 }
		 else if (document.inputForm1.postcode.value == "" ){
	     alert ("请输入邮政编码!");
		 }
		  else if (document.inputForm1.products.value == "" ){
	     alert ("请输入主要产品!");
		 }
		 else if (document.inputForm1.products.value.length>255 ){
	     alert ("主要产品不能超过255个字符!");
		 }
		  else if (document.inputForm1.comments.value == "" ){
	     alert ("请输入公司及产品介绍!");
		 }
		 else if (document.inputForm1.comments.value.length<1 || document.inputForm1.comments.value.length>2000 ){
	     alert ("请填写至少100字，最多2000字的公司及产品介绍!");
		 }
		 else if (document.inputForm1.keywords.value == "" ){
	     alert ("请输入搜索关键词!");
		 }
		 else if (document.inputForm1.keywords.value.length<1 || document.inputForm1.keywords.value.length>100 ){
	     alert ("请填写至少10字，最多100字的搜索关键词!");
		 }
    else if (document.inputForm1.name.value == "" ){
	     alert ("请输入联系人姓名!");
		 }
		 else if (document.inputForm1.name.value.length>20 ){
	     alert ("联系人姓名不能超过20个字符!");
		 }
		else if (document.inputForm1.province.value == "" ){
	     alert ("请选择您所在的省份! ");
		 return false;
		 }
		  else if (document.inputForm1.city.value.length == ""){
	     alert ("请输入您所在城市!");
		 }
		else if (document.inputForm1.city.value.length>30 ){
	     alert ("所在城市不能超过30个字符!");
		 }
	else if (document.inputForm1.address.value == "" ){
	     alert ("请输入详细通讯地址!");
		 }
		 else if (document.inputForm1.address.value.length>100 ){
	     alert ("具体通讯地址不能超过100个字符!");
		 }
		else if (document.inputForm1.tel.value == "" ){
	     alert ("请输入您的电话号码!");		 
}
		 
	else if (document.inputForm1.email.value == "" ){
	     alert ("请输入您的电子邮件地址!");		 
}
	else if (document.inputForm1.email.value.length>50 ){
	     alert ("电子邮件地址不能超过50个字符!");
		 }
		 else if (document.inputForm1.website.value.length>80 ){
	     alert ("主页网址不能超过80个字符!");
		 }

         	

         else {
   var invalidcheck=0; 
var str=document.inputForm1.email.value 
var filter=/^.+@.+\..{2,3}$/ 
if (filter.test(str)){ 
          document.inputForm1.submit()	
} 
else{ 
alert("您输入的电子邮件格式错误，请重新输入!") 
return false; 
} 
		  
            }
 						
		

}

function pagesizechg()
		{
	form3.submit();
		}
function pailiechg()
		{
	form2.submit();
		}

function pailieechg()
		{
	form4.submit();
		}

function go(formobject)
{
if (formobject.options[formobject.selectedIndex].value!="")
{
window.open(formobject.options[formobject.selectedIndex].value)
}
}


function winclick()
{
  var newWindow;
  newWindow=window.open('','content','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,top=0,left=40,width=600,height=450');
  
 newWindow.focus();
}



function CheckValue(theValue)
	{
		if (theValue=="")
		{
			alert("错误！\n\n请输入正确数字！");
			return false;
		}		
		else if (theValue.indexOf(" ")>=0)
		{
			alert("错误！\n\n请输入正确数字！\n勿包含空格！");
			return false;
		}
		else if (isNaN(theValue)) 
		{	
			alert("错误！\n\n请输入正确数字！");
			return false;
		}
		else if (theValue.indexOf('.')>=0)
		{
			alert("错误！\n\n请输入整数！")
			return false;
		}
		else if (parseInt(theValue)<=0)
		{
			alert("错误！\n\n请输入正确数字！");
			return false;
		}
		return true;
	}
	
function AddToCart(straction,lngprodustsid,quantity)
	{
		straction = "insert";
	
		
		url = "buy.asp?action=" + straction + "&produstsid=" + lngprodustsid + "&quantity=" + quantity
		var newWindow;
  newWindow=window.open(url , 'basket','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=0,width=570,top=0,left='+(window.screen.availWidth-570)+',height=250')
  newWindow.focus();
	}
	
function winclick1()
	{
		var newWindow;
  newWindow=window.open('', 'basket','menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=1,resizable=0,width=570,top=0,left='+(window.screen.availWidth-570)+',height=250')
  newWindow.focus();
	}



var x;
x=1;

function subc(no)
 { 
  switch(x)
  {
    case 1: sub1.style.visibility="hidden";break;
    case 2: sub2.style.visibility="hidden";break;
    case 3: sub3.style.visibility="hidden";break;
    case 4: sub4.style.visibility="hidden";break;
    case 5: sub5.style.visibility="hidden";break;
    case 6: sub6.style.visibility="hidden";break;
    case 7: sub7.style.visibility="hidden";break;
	case 8: sub8.style.visibility="hidden";break;
	case 9: sub9.style.visibility="hidden";break;
	case 10: sub10.style.visibility="hidden";break;
	case 11: sub11.style.visibility="hidden";break;
	case 12: sub12.style.visibility="hidden";break;
	case 13: sub13.style.visibility="hidden";break;
	case 14: sub14.style.visibility="hidden";break;
	case 15: sub15.style.visibility="hidden";break;
	case 16: sub16.style.visibility="hidden";break;
	case 17: sub17.style.visibility="hidden";break;
    } 
  
  switch(no)
  {
    case 1: sub1.style.visibility="visible";x=1;break;
    case 2: sub2.style.visibility="visible";x=2;break;
    case 3: sub3.style.visibility="visible";x=3;break;
    case 4: sub4.style.visibility="visible";x=4;break;
    case 5: sub5.style.visibility="visible";x=5;break;
    case 6: sub6.style.visibility="visible";x=6;break;
    case 7: sub7.style.visibility="visible";x=7;break;
	case 8: sub8.style.visibility="visible";x=8;break;
	case 9: sub9.style.visibility="visible";x=9;break;
	case 10: sub10.style.visibility="visible";x=10;break;
	case 11: sub11.style.visibility="visible";x=11;break;
	case 12: sub12.style.visibility="visible";x=12;break;
	case 13: sub13.style.visibility="visible";x=13;break;
	case 14: sub14.style.visibility="visible";x=14;break;
	case 15: sub15.style.visibility="visible";x=15;break;
	case 16: sub16.style.visibility="visible";x=16;break;
	case 17: sub17.style.visibility="visible";x=17;break;
    } 
  }
function viewPage2(ipage){
        document.frmList2.Page.value=ipage
        document.frmList2.submit()        
     }  
function viewPage1(ipage){
        document.frmList2.Page.value=ipage
        document.frmList2.submit()        
     }	 

var currentpos,timer; 
function initialize() 
{timer=setInterval("scrollwindow()",1);} 
function sc(){clearInterval(timer);} 
function scrollwindow() 
{currentpos=document.body.scrollTop; window.scroll(0,++currentpos); 
if (currentpos != document.body.scrollTop) sc();} 
document.onmousedown=sc 
document.ondblclick=initialize 

function winclickurl(url)
{
  var newWindow;
  newWindow=window.open(url,'content','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=0,left='+(window.screen.availWidth-638)+',width=630,height=450');
  
 newWindow.focus();
}

   //判断是输入栏否为空
   function is_null(object_name,tishi,word,kongge)  // object_name 为对象名称，tishi=1 为是否显示对话框,word 为提示语句,kongge=1 为去除空格,
   {
   var string;
   string=new String(object_name);
   if (kongge==1)
   {
     string=javaTrim(string); //删除空格的字符 
   }
   
   
   //alert("返回的字符集="+string+"长度为="+string.length)

     if (string.length==0)
    {
      if (tishi==1)
      {
      alert(word);
      }
      return false;
      
    }
   }
   
   //删除字符开头和结尾的空格
   
  function javaTrim(str){
		var i=0;
		var j;
		var len=str.length;
		
		trimstr="";
		if(j<0) return trimstr;
		flagbegin= true;
		flagend= true;
		
        while (flagbegin== true){
			if (str.charAt(i)==" "){
				i++;
				flagbegin=true;
			}
			else
            {
			    
                flagbegin=false;
			}
		} 
           //前面有i个空格
        
       
        
        j=len-1;
		var k=0;
        while (flagend==true)
       {
			if (str.charAt(j)==" ")
            {
				j--;
                flagend=true;
                k++;
			}
			else{
				flagend=false;
			}
		}
        
        //后面有k个空格
        //alert('前面有'+i+'个空格！');
        //alert('后面有'+k+'个空格！');
        
        if (str.length==i)
        {
         //alert("你的输入全为空格！")
         trimstr="";
         return trimstr;
         
        }

		trimstr=str.substring(i,j+1);
	    //alert("bf"+trimstr+"fb");
        return trimstr;
	}

   // 判断电子邮件是否格式正确

  function is_email(object_name)
  {
    
    var string;
    string=new String(object_name);
    var len=string.length;
    if (string.indexOf("@",1)==-1||string.indexOf(".",1)==-1||string.length<7)
      {
        alert("电子邮箱的格式不对，请重新填写！");
        return false;
      }
    
    //if (string.charAt(1)=="."||string.charAt(1)=="@")
     // {
     //   alert("电子邮箱的格式不对，请重新填写！");
     //   return false;
    //  }

    if (string.charAt(len-1)=="."||string.charAt(len-1)=="@")
      {
        alert("电子邮箱的格式不对，请重新填写！");
        return false;
      }
     
    
    

   }
   

   //判断输入栏的最小和最大长度是否越界
   function over_length(object_name,max,min,max_word,min_word,kongge) //kongge=1 为处理掉字符串中的空格
   {
    
    var string;
    string=new String(object_name);
    if (kongge==1)
    {
     string=javaTrim(string);
    }
    if (string.length>max)
    	{
   		 alert(max_word);
         return false;
		}
    if (string.length<min)
        {
		 alert(min_word);
         return false;
		}
   
    }
   
   
   //判断输入栏格式是否为身份证
   function is_shenfenzheng(object_name)
   {
    
        var string
        
       
        string=new String(object_name)
        
        if (isNaN(string))
        {
         alert("身份证号码应为数字，你的输入有误，请重新填写！");
         return false;
         
        }
        
        if (string.length!=15 && string.length!=18)
		{
		   alert("身份证号码应为18-15位数字，你的输入有误，请重新填写！");
		     
		   return false;
		}

    }
   
   function is_postcode(object_name)
   {
    var string;
    string=new String(object_name);
    if (string.length!=6)
    {
     alert("邮政编码应为6位数字，你的输入有误，请重新填写！");
     return false;
     }
     
    if (isNaN(string))
    {
     alert("邮政编码应为数字，你的输入有误，请重新填写！");
     return false;
     }
        
   }

   function is_year(object_name,max_year,min_year) //判断是否为界于min_year和max_year之间的年份！
   {
    var string;
    string=new String(object_name);
    
    //alert(string.length)   
    if (string.length!=4)
    {
        alert("年份必须为4位年，例如2000，您的格式不对，请重新填写！");
        return false;
     }

     if (isNaN(string))
     {
        alert("年份必须为数字，您的格式不对，请重新填写！");
        return false;
       
     }
     
     if (object_name>max_year)
     {
        alert("输入的年份要小于"+max_year+"年！");
        return false;
     } 

     if (object_name<min_year)
     {
        alert("输入的年份要大于"+min_year+"年！");
        return false;
     } 
   
     
     
    
    }
    

   function is_date(year,month,day,word)
   {
  	    var string;
   		var string_year;
   		var string_day;
   		var string_month;
        string_year=new String(year);
        string_month=new String(month);
        string_day=new String(day);

   		string=new String(string_year+"/"+string_month+"/"+string_day);
   		
        var birthday;
        birthday=new Date(string);
       
        var string_day_2;
        string_day_2=new String(birthday.getDate());
        
        //alert(string_day_2.length);
        //alert(string_day.length);
        //alert(string_day.length!=string_day_2.length);
        
        if (string_day.length!=string_day_2.length)
        {
           alert(word);
           return false;
         }
        


   }

   function isWhitespace (s) //是否包涵空格
    {  
  		var whitespace = " \t\n\r";
 	    var i;
  		for (i = 0; i < s.length; i++)
  		 {   
   		    var c = s.charAt(i);
   		    if (whitespace.indexOf(c) >= 0) 
			   {
			  return true;
	 			 }
  			}

     return false;
    }

