function indexcheckform(){
    var obj = document.search.wd;
    var re = validateFirstName(obj);
    switch(re){
       case 1:
         {
          alert('搜索字符过长！');
          document.search.wd.focus();
          return false;
         }
       case -1:
         {
          return false;
         }
       case 2:
         {
          alert('搜索非法字符！');
          document.search.wd.focus();
          return false;
         }
        return true;
    }
  }
  
  function indexcheckform2(){
    var obj = document.search2.wd;
    var re = validateFirstName(obj);
    switch(re){
       case 1:
         {
          alert('搜索字符过长！');
          document.search2.wd.focus();
          return false;
         }
       case -1:
         {
          return false;
         }
       case 2:
         {
          alert('搜索非法字符！');
          document.search2.wd.focus();
          return false;
         }
        return true;
    }
  }
  function indexurl(obj){
   var str = document.search.wd.value;
   str = escape(str);
   switch(obj){
     case 1:
       {
        document.location.href="index2.aspx?wd=" + str;
        return false;
       }
    case 2:
       {
        document.location.href="index.aspx?wd=" + str;
        return false;
       }
   case 3:
       {
        document.location.href="index3.aspx?wd=" + str;
        return false;
       }
    case 4:
       {
        document.location.href="index4.aspx?wd=" + str;
        return false;
       }
   case 5:
       {
        document.location.href="index5.aspx?wd=" + str;
        return false;
       }
   case 6:
       {
        document.location.href="index6.aspx?wd=" + str;
        return false;
       }
   }
  
  }
   function loginPassword(obj){//密码检测
	var str = obj.value;
	if(!checkByteLength(str,6,20)) return 6;										
	if(isNumberContinue(str) == 1) return 3;
	if(isSameLetter(str) == 1) return 4;
	return 0; 
}
 
  function logincheck(){
   var u = validateUsername(document.LoginForms.username);
  var p = loginPassword(document.LoginForms.password);
  if(!u==0){
  alert("用户名格式错误！");
  return false;
  }
   if(!p==0){
  alert("密码格式错误！");
  return false;
  }
document.LoginForms.submit();
return true;
}

  var request = false;
   try {
     request = new XMLHttpRequest();
   } catch (trymicrosoft) {
     try {
       request = new ActiveXObject("Msxml2.XMLHTTP");
     } catch (othermicrosoft) {
       try {
         request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (failed) {
         request = false;
       }  
     }
   }
 if (!request)
     alert("Error initializing XMLHttpRequest!");

function changProvince(Sel){
	
		  var id = Sel.options[Sel.selectedIndex].value;
		  var id2 = Sel.options[Sel.selectedIndex].id;
		  if(id2 == -1){
		   search.SelCity.length = 1;
		   search.SelCity.options[0].text = "请选择城市名";
           search.SelCity.options[0].value = -1;  
           search.SelCity.options[0].selected = true; 
           
		  }else{
		  var url = "cs/city.aspx?id=" + escape(id);
		  request.open("GET", url, true);
          request.onreadystatechange = updatePage;
          request.send(null);	
		  }
		
		}
		
function updatePage(){
       
	    if (request.readyState == 4)
	    {
       if (request.status == 200)
       {
      
       var response = request.responseText.split(",");
         var i =0;
         search.SelCity.length = response.length + 1;
           for(i=0;i<response.length;i++){     
                var responsee = response[i].split("|");                 
                search.SelCity.options[i+1].text = responsee[0];
                search.SelCity.options[i+1].value = responsee[1];           
           }     
             
        }
      else if (request.status == 404)
         alert("Request URL does not exist");
       else
         alert("Error: status code is " + request.status);
	}
	
	}
	
	//搜索函数
	
	function so(obj){
	  if(obj == 0){
	    document.getElementById("0").innerHTML = '<b style="color:#000000">产品</b>';
	    document.search.action="http://www.wtianx.com/spro.aspx";
	  }else{
	     document.getElementById("0").innerHTML = '<a href="http://www.wtianx.com/pro.aspx" title="查询产品信息" onclick="return so(0)">产品</a>';
	  }
	  if(obj == 1){
	   document.getElementById("1").innerHTML = '<b style="color:#000000">供应</b>';
	   document.search.action="http://www.wtianx.com/sbiz.aspx";
	   document.search.t.value="0";
	  }else{
	   document.getElementById("1").innerHTML = '<a href="http://www.wtianx.com/gy.aspx" title="查询供应信息" onclick="return so(1)">供应</a>';
	  }
	  if(obj == 2){
	   document.getElementById("2").innerHTML = '<b style="color:#000000">求购</b>';
	   document.search.action="http://www.wtianx.com/sbiz.aspx";
	   document.search.t.value="1";
	  }else{
	   document.getElementById("2").innerHTML = '<a href="http://www.wtianx.com/qg.aspx" title="查询求购信息" onclick="return so(2)">求购</a>';
	  }
	  if(obj == 3){
	   document.getElementById("3").innerHTML = '<b style="color:#000000">合作</b>';
	   document.search.action="http://www.wtianx.com/sbiz.aspx";
	   document.search.t.value="2";
	  }else{
	   document.getElementById("3").innerHTML = '<a href="http://www.wtianx.com/hz.aspx" title="查询合作信息" onclick="return so(3)">合作</a>';
	  }
	  if(obj == 4){
	   document.getElementById("4").innerHTML = '<b style="color:#000000">代理</b>';
	   document.search.action="http://www.wtianx.com/sbiz.aspx";
	   document.search.t.value="3";
	  }else{
	   document.getElementById("4").innerHTML = '<a href="http://www.wtianx.com/dl.aspx" title="查询代理信息" onclick="return so(4)">代理</a>';
	  }
	  if(obj == 5){
	   document.getElementById("5").innerHTML = '<b style="color:#000000">公司</b>';
	   document.search.action="http://www.wtianx.com/scompany.aspx";
	  }else{
	   document.getElementById("5").innerHTML = '<a href="http://www.wtianx.com/company.aspx" title="查询公司信息" onclick="return so(5)">公司</a>';
	  }
	return false;
	}
	
	function so2(obj){
	 
	  if(obj == 6){
	    document.getElementById("6").innerHTML = '<b style="color:#000000">产品</b>';
	    document.search2.action="http://www.wtianx.com/spro.aspx";
	  }else{
	     document.getElementById("6").innerHTML = '<a href="http://www.wtianx.com/pro.aspx" title="查询产品信息" onclick="return so2(6)">产品</a>';
	  }
	  if(obj == 7){
	   document.getElementById("7").innerHTML = '<b style="color:#000000">供应</b>';
	   document.search2.action="http://www.wtianx.com/sbiz.aspx";
	   document.search2.t.value="0";
	  }else{
	   document.getElementById("7").innerHTML = '<a href="http://www.wtianx.com/gy.aspx" title="查询供应信息" onclick="return so2(7)">供应</a>';
	  }
	  if(obj == 8){
	   document.getElementById("8").innerHTML = '<b style="color:#000000">求购</b>';
	   document.search2.action="http://www.wtianx.com/sbiz.aspx";
	   document.search2.t.value="1";
	  }else{
	   document.getElementById("8").innerHTML = '<a href="http://www.wtianx.com/qg.aspx" title="查询求购信息" onclick="return so2(8)">求购</a>';
	  }
	  if(obj == 9){
	   document.getElementById("9").innerHTML = '<b style="color:#000000">合作</b>';
	   document.search2.action="http://www.wtianx.com/sbiz.aspx";
	   document.search2.t.value="2";
	  }else{
	   document.getElementById("9").innerHTML = '<a href="http://www.wtianx.com/hz.aspx" title="查询合作信息" onclick="return so2(9)">合作</a>';
	  }
	  if(obj == 10){
	   document.getElementById("10").innerHTML = '<b style="color:#000000">代理</b>';
	   document.search2.action="http://www.wtianx.com/sbiz.aspx";
	   document.search2.t.value="3";
	  }else{
	   document.getElementById("10").innerHTML = '<a href="http://www.wtianx.com/dl.aspx" title="查询代理信息" onclick="return so2(10)">代理</a>';
	  }
	  if(obj == 11){
	   document.getElementById("11").innerHTML = '<b style="color:#000000">公司</b>';
	   document.search2.action="http://www.wtianx.com/scompany.aspx";
	  }else{
	   document.getElementById("11").innerHTML = '<a href="http://www.wtianx.com/company.aspx" title="查询公司信息" onclick="return so2(11)">公司</a>';
	  }
	return false;
	}