﻿function SearchTo2()
{
    var a = "";
    var selGLorTLorKC = document.getElementById('selGLorTLorKC').options[document.getElementById('selGLorTLorKC').selectedIndex].value;
    if(selGLorTLorKC == "请输入起始地")
    {
        selGLorTLorKC == "";
    }
	var selGLorTL = document.getElementById('selGLorTL').options[document.getElementById('selGLorTL').selectedIndex].value;
	if(selGLorTL == "请输入目的地")
	{
	   selGLorTL= "";
	}
	var staradd = "";
    var endadd = "";

    var selGoodsType="";
    var chxIsJct="";
	
	staradd = document.getElementById("txtStarAdd").value;
    endadd = document.getElementById("txtEndAdd").value;
    

    if(staradd == "请输入起始地")
    {
    staradd = "";
    }
    if(endadd == "请输入目的地")
    {
    endadd = "";
    }

    if(document.getElementById("li_huopan").style.display == "block")
    {
        var a  = staradd +"-"+  endadd+"-"+selGoodsType+"-"+chxIsJct +"-";
       
        self.location='/CargoInfo/index_'+a+'_'+selGLorTL+'_1.html',"_blank";

    }
    else
    {
        var startid =jQuery("#txtStarAdd").attr("vid");
	    var endid = jQuery("#txtEndAdd").attr("vid");
	    startid  = startid =="0" || startid ==undefined?"":startid;
	    endid = endid =="0" || endid==undefined?"":endid; 
        if(document.getElementById('selGLorTLorKC').selectedIndex == 0)
        {
//            a = "0-0--" +staradd +"-"+endadd+"----1";
            self.location = "/carsinfo/newlist-0---"+startid+"--"+endid+"--1---------20-1.html";
        }
        else if(document.getElementById('selGLorTLorKC').selectedIndex == 1)
        {
//            a = "0-1--" +staradd +"-"+endadd+"----1";
            self.location = "/carsinfo/newlist-1---"+startid+"--"+endid+"--1---------20-1.html";
        }
        else if(document.getElementById('selGLorTLorKC').selectedIndex == 2)
        {
//            a = "0-2-" +staradd +"-"+endadd+"---1";
            self.location = "/carsinfo/newlist-2-0--"+startid+"--"+endid+"--0---------20-1.html";
        }
    }

}

function GetText(obj,value)
{
	if(obj.value==value)
	{
		obj.value = "";
	}
}

function SetText(obj,value)
{
	if(obj.value=="")
	{
		obj.value = value;
	}
}

function Trim(inputString)
{
    return inputString.replace(/^ +/,"").replace(/ +$/,"");
}

function ChecklandType(obj)
{
	var objType = document.getElementById(obj);
	if(objType.checked == true && objType.value == "huopan")	
	{
		document.getElementById("li_yunjia").style.display = "none";
		document.getElementById("li_huopan").style.display = "block";
	}
	else
	{
	    document.getElementById("li_yunjia").style.display = "block";
		document.getElementById("li_huopan").style.display = "none";
	}
}
 
 
function SetRadioType()
{
	if(GetCookie('hp_search') == "true")
	{
		document.getElementById("rdhuopan").click();
	}
	else
	{
	document.getElementById("rdyunjia").click();
	}
}
 
function SetCookie(name, value)
{
	var expdate = new Date();
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	var expires = (argc > 2) ? argv[2] : null;
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	if(expires!=null) expdate.setTime(expdate.getTime() + ( expires * 1000 ));
	document.cookie = name + "=" + escape (value) +((expires == null) ? "" : ("; expires="+ expdate.toGMTString()))
		+((path == null) ? "" : ("; path=" + path)) +((domain == null) ? "" : ("; domain=" + domain))
		+((secure == true) ? "; secure" : "");
}


function GetCookie(sName)
{
	var aCookie = document.cookie.split("; ");
	for (var i=0; i < aCookie.length; i++)
	{
   		var aCrumb = aCookie[i].split("=");
   		if (sName == aCrumb[0]) 
    	return unescape(aCrumb[1]);
	}
	return null;		
}

function YjHpChanged(){
    var yjHpSelect = document.getElementById("YjHpSelect");
    if(yjHpSelect.options[yjHpSelect.selectedIndex].value == "1"){
        document.getElementById("li_yunjia").style.display = "block";
	    document.getElementById("li_huopan").style.display = "none";
    }
    else{
        document.getElementById("li_yunjia").style.display = "none";
	    document.getElementById("li_huopan").style.display = "block";
    }
}
function SetLandTab(){
    var url = location.href.toLowerCase();
    if(url.indexOf("default") > 0){
        TabOn("LyHomePage","TcHomePage","ZxHomePage");
    }
    else if(url.indexOf("servicesearch") > 0){
        TabOn("TcHomePage","LyHomePage","ZxHomePage");
    }
    else if(url.indexOf("specialline") > 0){
        TabOn("ZxHomePage","TcHomePage","LyHomePage");
    }
    else{
        TabOff();
    }
}
function TabOn(on1,off1,off2){
    document.getElementById(on1).className = "tab-on";
    document.getElementById(off1).className = "";
    document.getElementById(off2).className = "";
}
function TabOff(){
    document.getElementById("LyHomePage").className = "";
    document.getElementById("TcHomePage").className = "";
    document.getElementById("ZxHomePage").className = "";
}
