﻿function spec_sn(mouseobj)
{ 
    var obj=document.getElementById('ddlCar');
    var obj_br=document.getElementById('ddlBrand');
    var obj_fct=document.getElementById('ddlFactory');
    
    if(obj.value!=0 && obj.value!='')
    {
        var path='//newcar.dizo.com.cn/ncar-{carid}.html';
        path= path.replace("{carid}", obj.value);
        mouseobj.href = path;
        mouseobj.target = "_blank";
    }
    else
    {
        if (obj_br.value!=0 && obj_br.value!='')
        { 
            var path='//newcar.dizo.com.cn/brand-{brandid}.html';
            path= path.replace("{brandid}", obj_br.value);
            mouseobj.href = path;
            mouseobj.target = "_blank";
        }  
        else
        {
            mouseobj.href = "javascript:alert('请选择厂商和品牌！');";
            mouseobj.target = "_self";
        }
    }
}

function spec_sn2(mouseobj)
{ 
    var obj=document.getElementById('ddlCar');
    var obj_br=document.getElementById('ddlBrand');
    var obj_fct=document.getElementById('ddlFactory');
    
    var cpath='//newcar.dizo.com.cn/comparecar.aspx?carid={carid}';
    cpath = cpath.replace("{carid}", obj.value);
    mouseobj.href = cpath;
}

function UsedCardSearchList(mouseobj)
{
    var obj_Scope=$get('ddlScope1');
    var obj_Factory=$get('ddlFactory1');
    var obj_Brand=$get('ddlBrand1');

    if(obj_Scope.value==0 || obj_Scope.value=='') {
        mouseobj.href="javascript:alert('请选择产地')";
    }
    else {
        if(obj_Factory.value==0 || obj_Factory.value=='') {
            var path='//usedcar.dizo.com.cn/result.html';
            path=path+"?Scope="+obj_Scope.value
            mouseobj.href=path;
            mouseobj.target="_blank";
        }
        else {
            if(obj_Brand.value==0 || obj_Brand.value=='') {
                  var path='//usedcar.dizo.com.cn/result.html';
                  path=path+"?Scope="+obj_Scope.value+"&Factory="+obj_Factory.value;
                  mouseobj.href=path;
                  mouseobj.target="_blank";
            }
            else {
                  var path='//usedcar.dizo.com.cn/result.html';
                  path=path+"?Scope="+obj_Scope.value+"&Factory="+obj_Factory.value+"&Brand="+obj_Brand.value;
                  mouseobj.href=path;
                  mouseobj.target="_blank";
            }
        }
    }
}

function GetCarprice(sub)
{
	for (var i=0;i<4;i++)
	{
		$get("Content" + i).style.display = "none";
		$get("image" + i).style.background = "none";
		$get("image" + i).style.fontWeight='';
		$get("image" + i).style.cursor = "pointer";
	}
	$get("Content" + sub).style.display = "";
	$get("image" + sub).style.background = "url(img/onmouseoveimg.gif)";
	$get("image" + sub).style.fontWeight='bolder';
}

function chinacars()
{  
    SetText("chinacar", "");
    $get("chinacar").style.background="url(img/button099.gif) no-repeat center center";
    $get("Content4").style.display="none";
    $get("importecar").style.background="";
    SetText("importecar", "进口车");
    $get("carprice").style.display="";
    GetCarprice(0)
}

function importecars()
{
    SetText("importecar", "");
    $get("importecar").style.background="url(img/button104.gif) no-repeat center center";
    $get("chinacar").style.background="";
    SetText("chinacar", "国产车");
    $get("carprice").style.display="none";
    for (var i=0;i<4;i++)
        $get("Content" + i).style.display = "none";
    $get("Content4").style.display="";
}

function SetText(objid, text)
{
    if(isIE)
        document.getElementById(objid).innerText = text;
    else
        document.getElementById(objid).textContent = text;
}

function ChangeSearch()
{
    var SearchAnchor = document.getElementById("SearchAnchor");
    if (typeof SearchAnchor.baseHref == 'undefined') 
        SearchAnchor.baseHref = SearchAnchor.href;
    SearchAnchor.href = SearchAnchor.baseHref +
        document.getElementById("SearchType").options[document.getElementById("SearchType").selectedIndex].value +
        ".aspx?q=" + encodeURIComponent(document.getElementById("SearchKey").value);
}

function addBookmark(title,url) {
    if (!title) title = document.title;
    if (!url) url = document.location.href;
    if( document.all ) {
        window.external.AddFavorite( url, title);
    } else if (window.sidebar) {
        window.sidebar.addPanel(title, url, '');
    } else if( window.opera && window.print ) {
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
}

function ShowCountDown(divname)
{
    var endDate = new Date(2008,8,8,19);
    var leftTime=endDate.getTime()-dateNow.getTime();
    var leftsecond = parseInt(leftTime/1000);
    var day1=Math.floor(leftsecond/(60*60*24)); 
    var cc = document.getElementById(divname);
    document.getElementById(divname).style.fontFamily = "黑体";
    document.getElementById(divname).style.color = "#FFFF01";
    document.getElementById(divname).style.fontSize = "40px";
    document.getElementById(divname).style.fontWeight = "bolder";
    cc.innerHTML = day1;
}

function Cascading(ControlID, Category, ParentControlID, PromptText)
{
    var CascadingID = ControlID + "_Cascading";
    var ClientStateID = CascadingID + "_ClientState";
    var input = document.createElement("INPUT");
    input.type = "hidden";
    input.id = CascadingID;
    document.forms[0].appendChild(input);

    $create(Dizo.Controls.Ajax.CascadingDropDownBehavior,
    {
        "Category":Category,
        "ClientStateFieldID":ClientStateID,
        "LoadingText":"正在加载...",
        "ParentControlID":ParentControlID,
        "PromptText":PromptText,
        "ServiceMethod":"GetDropDownContents",
        "ServicePath":"/CarData.asmx",
        "id":CascadingID
    }, null, null, $get(ControlID));

}

function redirectUrl(url) {
    var frm = document.createElement("form");
    document.body.insertBefore(frm);
    frm.method = "post";
    frm.action = url;
    frm.target = '_top';
    frm.submit();
}



function GetSearchUrl()
{

    var SearchA=document.getElementById("SearchUrl");
    SearchA.href="search.aspx?q="+escape(document.getElementById("SearchText").value);
    
}
        
function addFav()
{
if (document.all)
    {
       window.external.addFavorite(window.location,document.title);
   }
   else if (window.sidebar)
   {
       window.sidebar.addPanel(document.title, window.location, "");
}
}    