﻿/**
	 * 实现跳转的函数
	 */
	 function gotoSearch(Opt)
	 {
	    var formatString = "http://www.castinnet.com\/{0}i{1}cp{2}t{3}g{4}_{5}v{6}.htm";
	    
	    var vIndexArea=document.getElementById('IndexArea').value;
	    if(vIndexArea !="sell" && vIndexArea !="buy" && vIndexArea !="company")
	    {
	        vIndexArea = "sell";
	    }    	    
	    var vSearchText=document.getElementById('SearchText').value;
	    
	    var vCategory=document.getElementById('CatId').value;
        
	    //替换并跳转
	    var gotoUrl = formatString.replace("{0}",encodeURI(vIndexArea));
	    var gotoUrl = gotoUrl.replace("{6}",encodeURI(vSearchText));
	    var gotoUrl = gotoUrl.replace("{1}",encodeURI(vCategory));
	    
	    if(Opt=='2')
	    {
	        var vCountry=document.getElementById('Country').value;
	        var gotoUrl = gotoUrl.replace("{4}",encodeURI(vCountry));
	        var vProvince=document.getElementById('Province').value;
	        var gotoUrl = gotoUrl.replace("{5}",encodeURI(vProvince)); 
	        var vPostTime=document.getElementById('PostTime').value;
	        var gotoUrl = gotoUrl.replace("{2}",encodeURI(vPostTime));
	        if(vIndexArea =="company")
	        {
	            var vCompanyType=document.getElementById('CompanyType').value;
	            var gotoUrl = gotoUrl.replace("{3}",encodeURI(vCompanyType));
	        }
	        else
	        {
	            var gotoUrl = gotoUrl.replace("{3}","");
	        } 
	    }
	    else
	    {
	        var gotoUrl = gotoUrl.replace("{2}","");
	        var gotoUrl = gotoUrl.replace("{3}","");
	        var gotoUrl = gotoUrl.replace("{4}","");
	        var gotoUrl = gotoUrl.replace("{5}","");
	    }
	    
	    //alert(gotoUrl);
	  	document.location = gotoUrl;
	  	return false;
	 }
  
    function countryChange(countrySelect) {
    Province=document.getElementById("Province");
    if(countrySelect.options[countrySelect.selectedIndex].value == "CN"){
		Province.style.display = "inline" ;
	}else{
	    Province.style.display = "none" ;
	}

    }
    
    function typeChange(indexSelect) {
    Company=document.getElementById("CompanyType");
    if(indexSelect.options[indexSelect.selectedIndex].value == "company"){
		Company.style.display = "inline" ;
	}else{
	    Company.style.display = "none" ;
	}

    }
    
    function InquiryNow(id,tid)
    {
        var gotoUrl;
        if(id)
        {
            gotoUrl="http://my.3mb.cn/global/message/contact.aspx?id="+id;
            if(tid)
            {
                gotoUrl=gotoUrl+"&tid="+tid;
            }
            window.open(gotoUrl);
        }
    }