﻿//车辆类型 

function GetCarsType(value,obj)
{
    if(value=="0" || value =="2")
    {
        obj.options.length = 0;
        obj.options[obj.length]=new Option("请选择","");
        obj.options[obj.length]=new Option("普通车");
		obj.options[obj.length]=new Option("平板车");
		obj.options[obj.length]=new Option("冷藏车");
		obj.options[obj.length]=new Option("半挂车");
		obj.options[obj.length]=new Option("箱式车");
        obj.options[obj.length]=new Option("后八轮");
        obj.options[obj.length]=new Option("自卸车");
        obj.options[obj.length]=new Option("半封车");
        obj.options[obj.length]=new Option("保温车");
        obj.options[obj.length]=new Option("双桥车");
        obj.options[obj.length]=new Option("单桥车");
        obj.options[obj.length]=new Option("高栏车");
        obj.options[obj.length]=new Option("低栏车");
        obj.options[obj.length]=new Option("起重车");
        obj.options[obj.length]=new Option("篷车");
        obj.options[obj.length]=new Option("前四后八");
        obj.options[obj.length]=new Option("集装箱车");
        obj.options[obj.length]=new Option("加长挂车");
        document.getElementById("dvShow").style.display = "block"
        if(value=="2")
        {
            document.getElementById("dvShow").style.display = "none";
        }
    }
    else if(value=="1")
    {
        obj.options.length = 0;
        obj.options[obj.length]=new Option("请选择","");
        obj.options[obj.length]=new Option("敞车");
		obj.options[obj.length]=new Option("家畜车");
		obj.options[obj.length]=new Option("平车");
		obj.options[obj.length]=new Option("水泥车");
		obj.options[obj.length]=new Option("保温车");
        obj.options[obj.length]=new Option("粮食车");
        obj.options[obj.length]=new Option("罐车");
        obj.options[obj.length]=new Option("特种车");
        obj.options[obj.length]=new Option("集装箱车");
        obj.options[obj.length]=new Option("长大货物车");
        document.getElementById("dvShow").style.display = "block"
    }
}

function BendCarsType(obj,bendobj)
{
    var count = obj.length;
    for(i=0;i<count;i++)
    {
        if(obj[i].checked==true)
        {
            GetCarsType(obj[i].value,bendobj)
            i = count;
        }
    }
}

function ShowSelectValue(objSelect,strValue)
{
  var obj = document.getElementById(objSelect);

  var objLen = obj.options.length

     for (i=0;i<objLen;i++)        
     {
          if (obj.options[i].text == strValue)
          {
              obj.options[i].selected = true;
              break;
          }
      }
}

function SearchTo(obj1,obj2,obj3)
{
    if(document.getElementById("TopSelectType").selectedIndex == 0)
    {
        //window.open('http://www.jctrans.com/supply/lst-proad.html',"_blank");
        //location.href="/Carsinfo/list.rails?type=0&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
        window.open('/Carsinfo/index.rails?type=0&start='+obj2.value.replace(/(请输入起始地)/g,'')+'&end='+obj3.value.replace(/(请输入目的地)/g,'')+'&cartype='+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,'')),"_blank");
        //alert("list.rails?type=0&start="+obj1.value+"&end="+obj2.value+"&cartype="+obj3.value);
    }
    else if(document.getElementById("TopSelectType").selectedIndex == 1)
    {
        //window.open('http://www.jctrans.com/supply/lst-ptl.html',"_blank");
        //location.href="/Carsinfo/list.rails?type=1&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
        window.open('/Carsinfo/index.rails?type=1&start='+obj2.value.replace(/(请输入起始地)/g,'')+'&end='+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,'')),"_blank");
        //alert("list.rails?type=0&start="+obj1.value+"&end="+obj2.value+"&cartype="+obj3.value);
    }
    else
    {
        window.open('/Carsinfo/index.rails?type=2&start='+obj2.value.replace(/(请输入起始地)/g,'')+'&end='+obj3.value.replace(/(请输入目的地)/g,'')+'&cartype='+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,'')),"_blank");
        //location.href="/Carsinfo/list.rails?type=2&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
    }

}
//全国
function SearchTo5(obj1,obj2,obj3)
{
    if(document.getElementById("TopSelectType").selectedIndex == 0)
    {
        //window.open('http://www.jctrans.com/supply/lst-proad.html',"_blank");
        location.href="/Carsinfo/index.rails?type=0&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
    //    alert("list.rails?type=0&start="+obj1.value+"&end="+obj2.value+"&cartype="+obj3.value);
    }
    else if(document.getElementById("TopSelectType").selectedIndex == 1)
    {
        //window.open('http://www.jctrans.com/supply/lst-ptl.html',"_blank");
        location.href="/Carsinfo/index.rails?type=1&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
    //    alert("list.rails?type=0&start="+obj1.value+"&end="+obj2.value+"&cartype="+obj3.value);
    }
    else
    {
        location.href="/Carsinfo/index.rails?type=2&start="+obj2.value.replace(/(请输入起始地)/g,'')+"&end="+obj3.value.replace(/(请输入目的地)/g,'')+"&cartype="+encodeURI(obj1.options[obj1.selectedIndex].text.replace(/(请选择)/g,''));
    }

}
function GetText(obj,value)
{
	if(obj.value==value)
	{
		obj.value = "";
	}
}

function SetText(obj,value)
{
	if(obj.value=="")
	{
		obj.value = value;
	}
}
//用在挂靠列表页
function GetCarsTypeDB(value,obj)
{
    if(value=="0" || value =="2")
    {
        obj.options.length = 0;
        obj.options[obj.length]=new Option("请选择","");
        obj.options[obj.length]=new Option("普通车");
		obj.options[obj.length]=new Option("平板车");
		obj.options[obj.length]=new Option("冷藏车");
		obj.options[obj.length]=new Option("半挂车");
		obj.options[obj.length]=new Option("箱式车");
        obj.options[obj.length]=new Option("后八轮");
        obj.options[obj.length]=new Option("自卸车");
        obj.options[obj.length]=new Option("半封车");
        obj.options[obj.length]=new Option("保温车");
        obj.options[obj.length]=new Option("双桥车");
        obj.options[obj.length]=new Option("单桥车");
        obj.options[obj.length]=new Option("高栏车");
        obj.options[obj.length]=new Option("低栏车");
        obj.options[obj.length]=new Option("起重车");
        obj.options[obj.length]=new Option("篷车");
        obj.options[obj.length]=new Option("前四后八");
        obj.options[obj.length]=new Option("集装箱车");
        obj.options[obj.length]=new Option("加长挂车");
    }
    else if(value=="1")
    {
        obj.options.length = 0;
        obj.options[obj.length]=new Option("请选择","");
        obj.options[obj.length]=new Option("敞车");
		obj.options[obj.length]=new Option("家畜车");
		obj.options[obj.length]=new Option("平车");
		obj.options[obj.length]=new Option("水泥车");
		obj.options[obj.length]=new Option("保温车");
        obj.options[obj.length]=new Option("粮食车");
        obj.options[obj.length]=new Option("罐车");
        obj.options[obj.length]=new Option("特种车");
        obj.options[obj.length]=new Option("集装箱车");
        obj.options[obj.length]=new Option("长大货物车");
    }
}
