function SearchBreed(id)
{
	var breedList= document.getElementById(id);
	var value= breedList.value
	if(value=="-1")
	{
		var name="";
		if(id=="select_guochan")
		{
			name="国产车型";
		}
		else
		{
			name="进口车型";
		}
		alert("请选择"+name+"后在点击搜索");
	}
	else
	{
		var verform=document.getElementById("Form1");
		verform.action=value;
		verform.submit();
	}
}

function SearchBreed1(id)
{
	var breedList= document.getElementById(id);
	var value= breedList.value
	if(value=="-1")
	{
		var name="";
		if(id=="select_guochan")
		{
			name="国产车型";
		}
		else
		{
			name="进口车型";
		}
		alert("请选择"+name+"后在点击搜索");
	}
	else
	{
		var verform=document.getElementById("Form1");
		verform.action="http://www.chetx.com/brand_"+ value +"/";
		verform.submit();
	}
}

function SearchPrice(searchtype,urlName,city)
{
//http://price.chetx.com/price"/"+ 
   
   var url=urlName +".aspx?type="+searchtype;
    if(city!="")
    {
		url+="&city="+city;
    }
    if(searchtype=="1")
    {
      var typeid = document.getElementById("typeid").value;
      var classid = document.getElementById("class").value;
      if(typeid==0&&classid==0)
      {alert("汽车类型和价格范围至少选一项");return;}
      else
      {
		//url+="&typeid="+ typeid +"&class="+classid;
		
        url="http://price.chetx.com/model/"+ typeid +"0001,"+ classid +",/";
        
		var verform=document.getElementById("Form1");
		verform.action=url;
		verform.submit();
      }
    }
    else
    {
      var kword = document.getElementById("keyword").value.replace(/(\s*$)/g, "").replace(/(^\s*)/g, ""); 
      if(kword=="")
      {alert("请输入关键词");return false;}
      else
      {
		//url+="&keyword="+kword;
		url="http://price.chetx.com/model/00001,,"+UrlEncode(kword)+"/";
		var verform=document.getElementById("Form1");
		verform.action=url;
		verform.submit();
		return false;
      }
    } 
}
function SearchPrice1(searchtype,urlName)
{
   var url="/price/"+ urlName +".aspx?type="+searchtype;

    if(searchtype=="1")
    {
      var typeid = document.getElementById("typeid").value;
      var classid = document.getElementById("class").value;
      if(typeid==0&&classid==0)
      {alert("汽车类型和价格范围至少选一项");return;}
      else
      {
		//url+="&typeid="+ typeid +"&class="+classid;
		url="http://price.chetx.com/model/"+ typeid +"0001,"+ classid +",/";
		var verform=document.getElementById("Form1");
		verform.action=url;
		verform.submit();
      }
    }
    else
    {
      var kword = document.getElementById("keyword").value.replace(/(\s*$)/g, "").replace(/(^\s*)/g, ""); 
      if(kword=="")
      {alert("请输入关键词");return;}
      else
      {
        
		//url+="&keyword="+kword;
		url="http://price.chetx.com/model/00001,,"+UrlEncode(kword)+"/";
		var verform=document.getElementById("Form1");
		verform.action=url;
		verform.submit();
      }
    } 
}



var moneyList0="5万以下,5-8万,8-10万,10-15万,15-20万,20-25万,25-35万,35-50万,50-70万,70-100万,100-150万,150-300万,300万以上";//默认
var moneyList1="4万以下,4万以上";//微型车
var moneyList2="5万以下,5-8万,8-10万,10万以上";//小型车
var moneyList3="5万以下,5-10万,10-13万,13-15万,15-18万,18-22万,22-30万,30万以上";//紧凑型车
var moneyList4="10万以下,10-15万,15-18万,18-22万,22-25万,25-30万,30-40万,40万以上";//中型车
var moneyList5="40万以下,40-50万,50-60万,60-70万,70万以上";//大型车
var moneyList6="80万以下,80-100万,100-150万,150-200万,200万以上";//豪华车
var moneyList7="25万以下,25-60万,60-100万,100-200万,200万以上";//跑车
var moneyList8="10万以下,10-15万,15-20万,20-25万,25-40万,40万以上";//MPV
var moneyList9="20万以下,20-40万,40-60万,60-80万,80-150万,150万以上";//SUV

function SearchCheXing(id)
{
	var moneys = document.getElementById("class");
	for (var i=moneys.options.length; i>0; i--) 
	{
		moneys.remove(i);
	}
	var a = eval("moneyList"+ id).split(','); 
    for (var i=0; i<a.length; i++)
    {	
		var value=a[i].substring(0,a[i].indexOf("万"));
		if(i==0)
		{
			value="0-"+value;
		}
		else if(i==a.length-1)
		{
			value=value+"-10000";
		}
		moneys.options.add(new Option(a[i],value));
    }
	moneys.selctedIndex=4;
}
function $$(id)
		{
			return document.getElementById(id);
		}
		
		var xmlHttp_zyc;
			//构造XMLHTTPRequest
		function createRequest_zyc()
		{
			xmlHttp_zyc = false;
			
			try {
  				xmlHttp_zyc = new ActiveXObject("Msxml2.XMLHTTP");
				} 
			catch (e) {
  				try 
				{					
  		  			xmlHttp_zyc = new ActiveXObject("Microsoft.XMLHTTP");
  				} 
				catch (e2) 
				{
  		  			xmlHttp_zyc = false;
 				}
			}
			
			if (!xmlHttp_zyc && typeof XMLHttpRequest != 'undefined')
			{				
				xmlHttp_zyc = new XMLHttpRequest();
			}			
		}
		//异步发送请求并处理返回
		function setSelect() 
		{
				createRequest_zyc();
				var url ="/Price/setSelect.aspx";
				xmlHttp_zyc.open("GET",url,true);
				xmlHttp_zyc.onreadystatechange = updatePages_zyc;
				xmlHttp_zyc.send(null);
		}		
		function updatePages_zyc()
		{
			if(xmlHttp_zyc.readyState == 4)
			{
				if(xmlHttp_zyc.status == 200)
				{	
					var response = xmlHttp_zyc.responseText.split("<")[0].split("?");
					
					var guochan=response[0].split("|");
					var jinkou=response[1].split("|");		
					selectguochan=document.getElementById("select_guochan");	
					selectjinkou=document.getElementById("select_jinkou");
					
					for(var i=1;i<=guochan[0];i++)
					{
						var id=guochan[i].split(",")[0];
						var name=guochan[i].split(",")[1];
						selectguochan.options.add(new Option(name,id));
					}
					
					for(var i=1;i<=jinkou[0];i++)
					{
						var id=jinkou[i].split(",")[0];
						var name=jinkou[i].split(",")[1];
						selectjinkou.options.add(new Option(name,id));
					}
				}
			}
		}
		
		function jiachu(id)
		{
			if(document.getElementById(id) != null)
			{
				document.getElementById(id).className="jiachu";
			}
		}
		function typeidSelected(id)
		{
			if(id!="")
			{
				document.getElementById("typeid").select.selctedIndex=id;	
			}
		}
		function classidSelected(id)
		{
			if(id!="")
			{
				document.getElementById("class").value=id;		
			}
		}
		function jumpPageUrl()
		{
			 var url=document.getElementById("pageUrl").value+"&page="+document.getElementById("djy").value;
			 var verform=document.getElementById("Form1");
			 verform.action=url;
			 verform.submit();
		}	