<!--
// 输出函数
function p$(string){
document.write(string);
}

//获取对象
function $(id){
	return document.getElementById(id);
}

function sl(st){
	sl1=st.length;
	strLen=0;
	for(i=0;i<sl1;i++){
		if(st.charCodeAt(i)>255) strLen+=2;
	 else strLen++;
	}
	return strLen;
}

function chkdiv(divid){
	var chkid=document.getElementById(divid);
	if(chkid != null){return true; }
	else {return false; }
}

//tab标签切换 
function change_menu(id,content_id,num,total_ztc_menu,menu_on,menu_off){
for (var i=1;i<=total_ztc_menu;i++){
$(id+i).className=menu_off;
$(content_id+i).style.display='none';
}
$(id+num).className=menu_on;
$(content_id+num).style.display='block';
}

function Falsh(url,w,h){
        document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"> ');
        document.write('<param name="movie" value="' + url + '">');
        document.write('<param name="quality" value="high"> ');
        //document.write('<param name="wmode" value="transparent"> ');
        document.write('<param name="menu" value="false"> ');
		document.write('<embed src="' + url + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed> ');
        document.write('</object> ');
}
//-->

function makeRequest(url, functionName, httpType, sendData) {
	http_request = false;
	if (!httpType) httpType = "GET";
	if (window.XMLHttpRequest) { 
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/plain');
		}
		} else if (window.ActiveXObject) {
			try {
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request) {
		alert('Cannot send an XMLHTTP request');
		return false;
	}
	var changefunc="http_request.onreadystatechange = "+functionName;
	eval (changefunc);
	http_request.open(httpType, url, true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(sendData);
}

function getReturnedText () {
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			var http_msg = http_request.responseText;
			if (http_msg=='0') {
				frm.submits.disabled="disabled";
				show.style.display='';
			}else{
				frm.submits.disabled="";
				show.style.display='none';
			}
		}
	}
}

// 返回操作(AJAX) ///////////////////

// 返回: 仅出错提示用
function ReturnOnlyAlert(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200){
			var vback=http_request.responseText.split('|');
			//alert(vback[1]);
			if(vback[0]=='False')
			{alert(vback[1]);}
			else
			{alert(vback[1]);
			//window.location.reload()
			}
		}
	}
}
// 返回: 返回正常数据写入对象,返回失败就ALERT报错
function ReturnInnerHTML(){
	if (http_request.readyState == 4) {
		if (http_request.status == 200){
			var vback=http_request.responseText.split('|');
			if(vback[0]=='False'){alert(vback[1]);}else{callobj.innerHTML=vback[1];}
		}
	}
}

// JavaScript Document
//下拉汽车搜索
function doSearch(){
	var bid = document.getElementById("sBrandID").value;
	var smid = document.getElementById("sModelID").value;
    var action = document.getElementById("car_search").action;
	if (bid == ""){
		alert("请选择品牌！");
		return false;
	}else if (smid==""){
		action = "/brand/brand.asp?bid=" + bid;
	}else if (smid.substring(0,1)=="-"){
		action = "/brand/serial.asp?sid=" + smid.substring(1);
	}else{
		action = "/brand/Model.asp?mid=" + smid;
	}
	window.open(action);
	//window.location.href = action;
    return true;
}
function doSearch1(){
	var price = document.getElementById("price").value;
	var action = document.getElementById("s1").action;
	if(price==""){
		alert("请选择价格！");
		return false;
	}
	action = action + "?price=" + price
	window.open(action);
	//window.location.href = action;
    return true;
}

function doSearch2(){
		var keyword = document.getElementById("k").value;
	var action = document.getElementById("s2").action;
	if(keyword==""){
		alert("请填写关键字！");
		return false;
	}
	action = action + "?keyword=" + keyword
	window.open(action);
	//window.location.href = action;
    return true;
}

function doSearch3(){
	var ctjg = document.getElementById("ctjg").value;
	var action = document.getElementById("s3").action;
	if(ctjg==""){
		alert("请选择类型！");
		return false;
	}
	action = action + "?ctjg=" + ctjg
	window.open(action);
	//window.location.href = action;
    return true;
}
