function EW_onFocus(form_object, input_object, object_type) {
	if (object_type == "RADIO" || object_type == "CHECKBOX") {
		if (input_object[0]) {
			input_object[0].focus();
		} else {
			input_object.focus();
		}
	} else {
		if (!(document.all && document.all["_" + input_object.name + "_editor"])) {
			input_object.focus();
		}
	}
	if (object_type == "TEXT" || object_type == "PASSWORD" || object_type == "TEXTAREA" || object_type == "FILE") {
		if (!(document.all && document.all["_" + input_object.name + "_editor"])) {
			input_object.select();
		}
	}
	return false;
}
function getRadioValue(obj){
for (i = 0; i < obj.length; i++) {
						if (obj[i].checked) {
							return obj[i].value;
						}
					}
		return null;
}
function EW_getCookieByName(name) {
	var search = name + "=";
	var returnvalue = "";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(search);
		if (offset != -1) { // if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1) {
				end = document.cookie.length;
			}
			returnvalue = unescape(document.cookie.substring(offset, end));
		}
	}
	return returnvalue;
}
function EW_addCookieByName(name, value) {
	var exp = new Date();    //new Date("December 31, 9998");
	exp.setTime(exp.getTime() + 24 * 60 * 60 * 1000);
	document.cookie = name + "=" + value + ";expires=" + exp.toGMTString();
}
//
function relocation(paramname,paramvalue,whereClause){
		if(paramvalue==0){
			if(paramname=="x_TradeProvince"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=province";
			}else if(paramname=="x_CarBrand"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=brand";
			}else if(paramname=="x_RegYear"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=regyear";
			}else if(paramname=="x_SweptVolume"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=sweptvolume";
			}else if(paramname=="x_Color"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=color";
			}else if(paramname=="x_Price"){
				document.location.href="advanced-search?"+whereClause+"&delProperty=price";
			}else{
				document.location.href="advanced-search?"+whereClause;
			}
		}else{if( document.getElementById('loads')!=null){
		    document.getElementById('loads').innerHTML="<img src='/html/inc/images/loading.gif' />";
		    }
			document.location.href="advanced-search?"+paramname+"="+paramvalue+"&"+whereClause;
		}
}
function darkRelocation(paramname,paramvalue,whereClause){
	
			document.location.href="dark-advanced-search?"+paramname+"="+paramvalue+"&"+encodeURI(whereClause);
}
//更新cookie页面类型并刷新页面
function chgPagetype(cookievalue,whereClause){
	EW_addCookieByName("Bib_View_PageType",cookievalue);
	document.location.href="advanced-search?"+whereClause;
}
//更新cookie页面类型并刷新页面(模糊搜索)
function darkChgPagetype(cookievalue,whereClause){
	EW_addCookieByName("Bib_View_PageType",cookievalue);
	document.location.href="dark-advanced-search?"+whereClause;
}
//更新cookie记录数类型并刷新页面
function chgPageNum(cookievalue,whereClause){
	EW_addCookieByName("Bib_View_PageSize",cookievalue);
	document.location.href="advanced-search?"+whereClause;
}
//更新cookie记录数类型并刷新页面(模糊搜索)
function darkChgPageNum(cookievalue,whereClause){
	EW_addCookieByName("Bib_View_PageSize",cookievalue);
	document.location.href="dark-advanced-search?"+whereClause;
}

//跳到某一页
function gotoPage(whereClause) {
	var newPage = document.getElementById('jumpto').value;
	try{
		var temp = newPage + 1;
		document.location.href="advanced-search?"+whereClause+"&startIndex="+newPage;
	}catch(e){
	}
}
function gotoPageCheck(whereClause) {
	var newPage = document.getElementById('jumpto1').value;
	try{
		var temp = newPage + 1;
		document.location.href="advanced-search?"+whereClause+"&startIndex1="+newPage;
	}catch(e){
	}
}
function gotoPageDelegate(whereClause) {
	try {
		var c = 0;
		if (document.all) {
			c = window.event.keyCode;
		}
		if (c == 13) {
			gotoPage(whereClause);
			return false;
		}
	}catch (e) {
	}
	return true;
}
//跳到某一页(模糊搜索)
function darkGotoPage(whereClause) {
	var newPage = document.getElementById('jumpto').value;
	try{
		var temp = newPage + 1;
		document.location.href="dark-advanced-search?"+whereClause+"&startIndex="+newPage;
	}catch(e){
	}
}
function darkGotoPageDelegate(whereClause) {
	try {
		var c = 0;
		if (document.all) {
			c = window.event.keyCode;
		}
		if (c == 13) {
			darkGotoPage(whereClause);
			return false;
		}
	}catch (e) {
	}
	return true;
}
function chgPageNums(actions,cookievalue,whereClause){
	EW_addCookieByName("Bib_View_PageSize",cookievalue);
	document.location.href=actions+"?"+whereClause;
}

function gotoPages1(actions,whereClause) {
	var newPage = document.getElementById('jumpto1').value;
	try{
		 document.location.href=actions+"?"+whereClause+"&carStart="+newPage;
		
		
	}catch(e){
	}
}
function gotoPages2(actions,whereClause) {
	var newPage = document.getElementById('jumpto2').value;
	
	try{
		 document.location.href=actions+"?"+whereClause+"&busStart="+newPage;
		
	}catch(e){
	}
}
function gotoPages3(actions,whereClause) {
	var newPage = document.getElementById('jumpto3').value;
	
	try{
		 document.location.href=actions+"?"+whereClause+"&truckStart="+newPage;
		
	}catch(e){
	}
}

function gotoPages4(actions,whereClause) {
	var newPage = document.getElementById('jumpto4').value;
	
	try{
		 document.location.href=actions+"?"+whereClause+"&nameStart="+newPage;
		
	}catch(e){
	}
}

function gotoPages5(actions,whereClause) {
	var newPage = document.getElementById('jumpto').value;
	
	try{
		 document.location.href=actions+"?"+whereClause+"&startIndex="+newPage;
		
	}catch(e){
	}
}

function gotoPages6(actions,whereClause) {
	var newPage = document.getElementById('jumpto2').value;
	
	try{
	
		 document.location.href=actions+"?pinStart="+newPage+whereClause;
		
	}catch(e){
	}
}

function gotoPages7(actions,whereClause) {
	var newPage = document.getElementById('jumpto1').value;
	
	try{
		 document.location.href=actions+"?nameStart="+newPage+whereClause;
		
	}catch(e){
	}
}

function gotoPages8(actions,whereClause,index) {
	var newPage = document.getElementById('jumpto').value;
	
	try{
		 document.location.href=actions+"?"+index+"="+newPage+whereClause;
		
	}catch(e){
	}
}

function gotoPages9(actions,whereClause) {
	var newPage = document.getElementById('jumpto').value;
	
	try{
		 document.location.href=actions+"?"+whereClause+"&startIndex="+newPage;
		
	}catch(e){
	}
}

function gotoPages10(actions,whereClause) {
	var newPage = document.getElementById('jumpto').value;
	
	try{
		 document.location.href=actions+"?startIndex="+newPage+whereClause;
		
	}catch(e){
	}
}

function EW_updateformaction(obj,action_value, ordertype){

	obj.action = action_value + "?" + ordertype;
}

function change(imgs){
 document.images.ImgInit.src =imgs;
 document.getElementById('enlargePhotoAnchor').href=imgs;
}
//统计输入的文字个数
function textCounter(field, maxlimit) { 
		if (field.value.length > maxlimit) 
			field.value = field.value.substring(0, maxlimit); 
		else 
			document.vehicleadd.remLen.value = maxlimit - field.value.length;
}
function EW_TextCounter(remLen,field,maxlimit) {
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
	}else{
		remLen.value = maxlimit - field.value.length;
		}
}

function testFlag(){
//alert(flag);
	if(flag==false){
		return false;
		}
	document.vehicleadd.submit();
	return true;
}
function EW_checkCriticism(EW_this) {
	if (EW_this.x_name && !EW_hasValue(EW_this.x_name, "TEXT")) {
		if (!EW_onError(EW_this, EW_this.x_name, "TEXT", "请填写您的昵称")) {
			return false;
		}
	}
	if (EW_this.rand_criticism && !EW_hasValue(EW_this.rand_criticism, "TEXT")) {
		if (!EW_onError(EW_this, EW_this.rand_criticism, "TEXT", "验证码不能为空")){
			return false;
		 }
		}
	if (EW_this.rand_criticism.value.length!=4) {
		if (!EW_onError(EW_this, EW_this.rand_criticism, "TEXT", "验证码长度应该为4")) {
			return false;
		}
	}
	if (EW_this.x_content && !EW_hasValue(EW_this.x_content, "TEXT")) {
		if (!EW_onError(EW_this, EW_this.x_content, "TEXT", "评论内容不能为空")) {
			return false;
		}
	}
	return true;
}

//在线答疑
/*function EW_textCounter(field, maxlimit) { 
		if (field.value.length > maxlimit) 
			field.value = field.value.substring(0, maxlimit); 
}*/

function EW_checkAddonlineReply(EW_this){
	if (EW_this.title && !EW_hasValue(EW_this.title, "TEXT" )) {
	            if (!EW_onError(EW_this, EW_this.title, "TEXT", "请输入标题"))
	                return false;
	        }
	        
	  	if (EW_this.telephone && !EW_checkphone(EW_this.telephone.value)) {
	        if (!EW_onError(EW_this, EW_this.telephone, "TEXT", "您输入的联系电话格式不正确"))
	           return false;
	        }
	        
	if (EW_this.email && !EW_checkemail(EW_this.email.value)) {
	        if (!EW_onError(EW_this, EW_this.email, "TEXT", "您输入的Email格式不正确"))
	         return false;
	   }
	if (EW_this.content && !EW_hasValue(EW_this.content, "TEXT" )) {
	            if (!EW_onError(EW_this, EW_this.content, "TEXT", "请输入内容"))
	             return false;
	        }
      return true;
}

function  EW_checkAddCarForm(EW_this) {
	var carType=-1;
	var flag=true;
	hidDiv("er_CarBrand");
	hidDiv("er_CarSeries");
    hidDiv("er_CarSeries");
	hidDiv("er_RegYear");
	hidDiv("er_RegMonth");
	hidDiv("er_TradeProvince");
	hidDiv("er_TradeCity");
	hidDiv("er_Town");
	hidDiv("er_Mileage");
	hidDiv("er_Mileage2");
	hidDiv("er_Mileage3");
	hidDiv("er_SweptVolume");
	hidDiv("er_Price");
	hidDiv("er_Price2");
	hidDiv("er_Price3");
	hidDiv("er_Price3");
	if(EW_this.x_CarType.length!=null){
	for (var i = 0; i < EW_this.x_CarType.length; i++) {
						if (EW_this.x_CarType[i].checked) {
							carType=EW_this.x_CarType[i].value;
							continue;
						}
					}
}else{
	carType=EW_this.x_CarType.value;
	}
	 if(carType==-1){
		 if (!EW_onError(EW_this, EW_this.x_CarType, "RADIO", "请选择车辆类型")){
			 if(flag==true){
			 EW_onFocus(EW_this, EW_this.x_CarType, "RADIO");
	         flag= false;
			 }
		 }
		 }
	if (EW_this.x_CarBrand && !EW_hasValue(EW_this.x_CarBrand, "SELECT" )) {
		        showDiv("er_CarBrand");
				if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_CarBrand, "SELECT");
	                flag=false;
				}
	        }
	if (EW_this.x_CarSeries && !EW_hasValue(EW_this.x_CarSeries, "SELECT" )) {
	            showDiv("er_CarSeries");
				if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_CarSeries, "SELECT");
	                flag=false;
				}
	        }
	if (EW_this.x_RegYear && !EW_hasValue(EW_this.x_RegYear, "SELECT" )) {
				showDiv("er_RegYear");
	                if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_RegYear, "SELECT");
	                flag=false;
				}
	        }
	if (EW_this.x_RegMonth && !EW_hasValue(EW_this.x_RegMonth, "SELECT" )) {
	            showDiv("er_RegMonth");
	                if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_RegMonth, "SELECT");
	                flag=false;
				}
	        }	        
	if (EW_this.x_TradeProvince && !EW_hasValue(EW_this.x_TradeProvince, "SELECT" )) {
	            showDiv("er_TradeProvince");
	               if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_TradeProvince, "SELECT");
	                flag=false;
				}
	        }
	if (EW_this.x_TradeCity && !EW_hasValue(EW_this.x_TradeCity, "SELECT" )) {
	            showDiv("er_TradeCity");
	               if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_TradeCity, "SELECT");
	                flag=false;
				}
	        }
	if(EW_this.x_TradeCity.value==197){//如果城市为东莞
		if (EW_this.x_Town && !EW_hasValue(EW_this.x_Town, "SELECT" )) {
	            showDiv("er_Town");
	               if(flag==true){
		             EW_onFocus(EW_this, EW_this.x_Town, "SELECT");
	                flag=false;
				}
	        }
		}
	if (EW_this.x_Mileage && !EW_hasValue(EW_this.x_Mileage, "TEXT" )) {
	            showDiv("er_Mileage");
	                if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Mileage, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Mileage && !EW_checknumber(EW_this.x_Mileage.value)) {
	        showDiv("er_Mileage2");
	           if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Mileage, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)>1000) {	
	        showDiv("er_Mileage3");
	            if(flag==true){
		         EW_onFocus(EW_this, EW_this.x_Mileage, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)<0) {	
	        showDiv("er_Mileage3");
	           if(flag==true){
		         EW_onFocus(EW_this, EW_this.x_Mileage, "TEXT");
	                flag=false;
				}
	        }
    if (EW_this.x_SweptVolume && !EW_hasValue(EW_this.x_SweptVolume, "SELECT" )) {
	            showDiv("er_SweptVolume");
	               if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_SweptVolume, "SELECT");
	                flag=false;
				}
	        }
	if (EW_this.x_Price && !EW_hasValue(EW_this.x_Price, "TEXT" )) {
	            showDiv("er_Price");
	                if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Price, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Price && !EW_checknumber(EW_this.x_Price.value)) {
	        showDiv("er_Price2");
	           if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Price, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)>1000) {
	        showDiv("er_Price3");
	            if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Price, "TEXT");
	                flag=false;
				}
	        }
	if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)<=0.1) {
	        showDiv("er_Price3");
	        if(flag==true){
		        EW_onFocus(EW_this, EW_this.x_Price, "TEXT");
	                flag=false;
				}
	        }
    
    /*
    Ajax_Estimate('EstimateAction.do',EW_this);
    alert(flag);
    return flag;
    */
    
    //var f = Ajax_Estimate('EstimateAction.do',EW_this);
    //alert(f);
   // EW_this.x_Percent.value=percent;
    setTimeout("testFlag()",1000);
    /*
    if(f==true){
    //alert(flag);
    	if(flag==false){
    		//alert();
        	return false;
		}
	}
	*/
	if(flag==true){
		document.getElementById('step1').style.display='none';
		document.getElementById('step2').style.display='';
		//hidDiv('step1');
		//showDiv('step2');
		}
	return flag;
}



function  EW_checkBusAddForm(EW_this) {
if (EW_this.x_BusBrand && !EW_hasValue(EW_this.x_BusBrand, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_BusBrand, "SELECT", "请选择车辆品牌"))
                return false; 
        }
if (EW_this.x_BusSeries && !EW_hasValue(EW_this.x_BusSeries, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_BusSeries, "SELECT", "请选择车辆所属车系"))
                return false; 
        }
if (EW_this.x_RegYear && !EW_hasValue(EW_this.x_RegYear, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_RegYear, "SELECT", "请选择上牌时间"))
                return false; 
        }
if (EW_this.x_TradeProvince && !EW_hasValue(EW_this.x_TradeProvince, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TradeProvince, "SELECT", "请选择交易城市"))
                return false; 
        }
if (EW_this.x_TradeCity && !EW_hasValue(EW_this.x_TradeCity, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TradeCity, "SELECT", "请选择交易城市"))
                return false; 
        }
if (EW_this.x_Mileage && !EW_hasValue(EW_this.x_Mileage, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "请输入车辆的行驶里程"))
                return false; 
        }
if (EW_this.x_Mileage && !EW_checknumber(EW_this.x_Mileage.value)) {
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为数值格式"))
            return false; 
        }
if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)>1000) {	
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为合理数值"))
            return false; 
        }
if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)<0) {	
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为合理数值"))
            return false; 
        }
if (EW_this.x_Mileage && !EW_hasValue(EW_this.x_Horsepower, "TEXT" )) {
        if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "请输入车辆的功率"))
            return false; 
        }
if (EW_this.x_Horsepower && !EW_checknumber(EW_this.x_Horsepower.value)) {
        if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "您输入的车辆功率必须为数值格式"))
            return false; 
        }
if (EW_this.x_Horsepower && parseFloat(EW_this.x_Horsepower.value)>1000) {	
        if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "您输入的车辆功率必须为合理数值"))
            return false; 
        }
if (EW_this.x_Torque && !EW_hasValue(EW_this.x_Torque, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "请输入车辆的扭矩"))
                return false; 
        }
if (EW_this.x_Torque && !EW_checknumber(EW_this.x_Torque.value)) {
        if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "您输入的扭矩必须为数值格式"))
            return false; 
        }
if (EW_this.x_Torque && parseFloat(EW_this.x_Torque.value)>100000) {	
        if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "您输入的扭矩必须为合理数值"))
            return false; 
        }
if (EW_this.x_Price && !EW_hasValue(EW_this.x_Price, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "请输入车辆的价格"))
                return false; 
        }
if (EW_this.x_Price && !EW_checknumber(EW_this.x_Price.value)) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为数值格式"))
            return false; 
        }
if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)>1000) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为合理数值"))
            return false; 
        }
if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)<=0.1) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为合理数值"))
            return false; 
        }
if (EW_this.x_ContactPerson && !EW_hasValue(EW_this.x_ContactPerson, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_ContactPerson, "TEXT", "请输入联系人姓名"))
                return false; 
        }
if (EW_this.x_Telephone1 && !EW_hasValue(EW_this.x_Telephone1, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Telephone1, "TEXT", "请输入联系电话1"))
                return false; 
        }
if (EW_this.x_Telephone1 && !EW_checkphone(EW_this.x_Telephone1.value)) {
        if (!EW_onError(EW_this, EW_this.x_Telephone1, "TEXT", "您输入的联系电话1格式不正确"))
            return false; 
        }		
if (EW_this.x_Telephone2 && EW_hasValue(EW_this.x_Telephone2, "TEXT" )) {
	if (EW_this.x_Telephone2 && !EW_checkphone(EW_this.x_Telephone2.value)) {
        if (!EW_onError(EW_this, EW_this.x_Telephone2, "TEXT", "您输入的联系电话2格式不正确"))
            return false;
        }
}		
if (EW_this.x_Email && !EW_checkemail(EW_this.x_Email.value)) {
        if (!EW_onError(EW_this, EW_this.x_Email, "TEXT", "您输入的Email格式不正确"))
            return false; 
        }
EW_this.submit();
return true;
}
function  EW_checkTruckAddForm(EW_this) {
if (EW_this.x_TruckBrand && !EW_hasValue(EW_this.x_TruckBrand, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TruckBrand, "SELECT", "请选择车辆品牌"))
                return false; 
        }
if (EW_this.x_TruckSeries && !EW_hasValue(EW_this.x_TruckSeries, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TruckSeries, "SELECT", "请选择车辆所属车系"))
                return false; 
        }
if (EW_this.x_RegYear && !EW_hasValue(EW_this.x_RegYear, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_RegYear, "SELECT", "请选择上牌时间"))
                return false; 
        }
if (EW_this.x_TradeProvince && !EW_hasValue(EW_this.x_TradeProvince, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TradeProvince, "SELECT", "请选择交易城市"))
                return false; 
        }
if (EW_this.x_TradeCity && !EW_hasValue(EW_this.x_TradeCity, "SELECT" )) {
            if (!EW_onError(EW_this, EW_this.x_TradeCity, "SELECT", "请选择交易城市"))
                return false; 
        }
if (EW_this.x_Mileage && !EW_hasValue(EW_this.x_Mileage, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "请输入车辆的行驶里程"))
                return false; 
        }
if (EW_this.x_Mileage && !EW_checknumber(EW_this.x_Mileage.value)) {
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为数值格式"))
            return false; 
        }
if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)>1000) {	
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为合理数值"))
            return false; 
        }
if (EW_this.x_Mileage && parseFloat(EW_this.x_Mileage.value)<=0) {
        if (!EW_onError(EW_this, EW_this.x_Mileage, "TEXT", "您输入的行驶里程必须为合理数值"))
            return false; 
        }
if (EW_this.x_Horsepower && !EW_hasValue(EW_this.x_Horsepower, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "请输入车辆的功率"))
                return false; 
        }
if (EW_this.x_Horsepower && !EW_checknumber(EW_this.x_Horsepower.value)) {
        if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "您输入的车辆功率必须为数值格式"))
            return false; 
        }
if (EW_this.x_Horsepower && parseFloat(EW_this.x_Horsepower.value)>10000) {	
        if (!EW_onError(EW_this, EW_this.x_Horsepower, "TEXT", "您输入的车辆功率必须为合理数值"))
            return false; 
        }
if (EW_this.x_Torque && !EW_hasValue(EW_this.x_Torque, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "请输入车辆的扭矩"))
                return false; 
        }
if (EW_this.x_Torque && !EW_checknumber(EW_this.x_Torque.value)) {
        if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "您输入的扭矩必须为数值格式"))
            return false; 
        }
if (EW_this.x_Torque && parseFloat(EW_this.x_Torque.value)>100000) {	
        if (!EW_onError(EW_this, EW_this.x_Torque, "TEXT", "您输入的扭矩必须为合理数值"))
            return false; 
        }
if (EW_this.x_OilExertion && !EW_hasValue(EW_this.x_OilExertion, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_OilExertion, "TEXT", "请输入车辆的油耗"))
                return false; 
        }
if (EW_this.x_OilExertion && !EW_checknumber(EW_this.x_OilExertion.value)) {
        if (!EW_onError(EW_this, EW_this.x_OilExertion, "TEXT", "您输入的油耗必须为数值格式"))
            return false; 
        }
if (EW_this.x_OilExertion && parseFloat(EW_this.x_OilExertion.value)>100000) {	
        if (!EW_onError(EW_this, EW_this.x_OilExertion, "TEXT", "您输入的油耗必须为合理数值"))
            return false; 
        }
if (EW_this.x_Price && !EW_hasValue(EW_this.x_Price, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "请输入车辆的价格"))
                return false; 
        }
if (EW_this.x_Price && !EW_checknumber(EW_this.x_Price.value)) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为数值格式"))
            return false; 
        }
if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)>1000) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为合理数值"))
            return false; 
        }
if (EW_this.x_Price && parseFloat(EW_this.x_Price.value)<=0.1) {
        if (!EW_onError(EW_this, EW_this.x_Price, "TEXT", "您输入的价格必须为合理数值"))
            return false; 
        }
if (EW_this.x_ContactPerson && !EW_hasValue(EW_this.x_ContactPerson, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_ContactPerson, "TEXT", "请输入联系人姓名"))
                return false; 
        }
if (EW_this.x_Telephone1 && !EW_hasValue(EW_this.x_Telephone1, "TEXT" )) {
            if (!EW_onError(EW_this, EW_this.x_Telephone1, "TEXT", "请输入联系电话1"))
                return false; 
        }
if (EW_this.x_Telephone1 && !EW_checkphone(EW_this.x_Telephone1.value)) {
        if (!EW_onError(EW_this, EW_this.x_Telephone1, "TEXT", "您输入的联系电话1格式不正确"))
            return false; 
        }		
if (EW_this.x_Telephone2 && EW_hasValue(EW_this.x_Telephone2, "TEXT" )) {
	if (EW_this.x_Telephone2 && !EW_checkphone(EW_this.x_Telephone2.value)) {
        if (!EW_onError(EW_this, EW_this.x_Telephone2, "TEXT", "您输入的联系电话2格式不正确"))
            return false;
        }
}		
if (EW_this.x_Email && !EW_checkemail(EW_this.x_Email.value)) {
        if (!EW_onError(EW_this, EW_this.x_Email, "TEXT", "您输入的Email格式不正确"))
            return false; 
        }
EW_this.submit();
return true;
}

function deletePark(parkstr,other)
{
	if(confirm('确实要删除吗?'))location='del-park?key='+parkstr+'&'+other;
}

function openwins(url,name,tele,addr) {
  
  var para3 =encodeURI(url+"userName="+name+"&tele="+tele+"&address="+addr)
    window.open(para3, "tips"); 
	
}

function check(objict1,name1,id1,objict2,name2,id2,objict3,name3,id3,objict4,name4,id4,objict5,name5,objict51,name51,id5,objict6,name6,objict61,name61,id6,objict7,name7,objict71,name71,id7,objict8,name8,id8,objict9,name9,id9,objict10,name10,id10,objict11,name11,id11,objict12,name12,id12){

  if(name2=="0"||name2==""){
     
      id2.innerHTML="请选择一个车辆类型";
    
    
  }else{
       id2.innerHTML="";
       }
  if(name1=="0"||name1==""){
  
      id1.innerHTML="请选择一个车辆产地";
     
     
  }else{
       id1.innerHTML="";
       }
  if(name3=="0"||name3==""){
  
      id3.innerHTML="请选择一个品牌";
      
      
  }else{
       id3.innerHTML="";
       }
  if(name4=="0"||name4==""){
  
      id4.innerHTML="请选择一个系列";
      
     
  }else{
       id4.innerHTML="";
       }
       
   if(name5==""){
  
      id5.innerHTML="里程范围不能为空";
      
     }else
  if(name51==""){
  
      id5.innerHTML="里程范围不能为空";
     
     
  }else
  if(name5!=""&&name51!=""){
   
     if(isNaN(name5)){
     
      id5.innerHTML="必需是数字";
      
     
    
      }else
      if(isNaN(name51)){
     
      id5.innerHTML="必需是数字";
      
     
    
      }else
      if(parseFloat(name51)<=parseFloat(name5)){
      
        id5.innerHTML="后面的里程要大于前面的里程";
       
      }
      else{
       id5.innerHTML="";
       }
  }
  if(name6==""){
  
      id6.innerHTML="价格范围不能为空";
      
     
  }else
  if(name61==""){
  
      id6.innerHTML="价格范围不能为空";
      
     
  }else
  if(name6!=""&&name61!=""){
   if(isNaN(name6)){
      
      id6.innerHTML="必需是数字";
      
      
      }else
      if(isNaN(name61)){
      
      id6.innerHTML="必需是数字";
     
     
      }else
        if(parseFloat(name61)<=parseFloat(name6)){
       
        id6.innerHTML="后面的价格要大于前面的价格";
       
       
      }
      else{
       id6.innerHTML="";
       }
  }
  if(name7=="0"||name7==""){
  
      id7.innerHTML="请选择一个交易省份";
      
      
      }else
  if(name71=="0"||name71==""){
  
      id7.innerHTML="请选择一个交易城市";
     
     
  }else{
       id7.innerHTML="";
       }
       
    if(name71!="0"&&name71!=""&&name71=="197"){
      if(name12=="0"||name12==""){	
        id12.innerHTML="请选择一个交易地区";
      }else{
       id12.innerHTML="";
       }
     
  }
           
 
   if(name8.length>300){
       id8.innerHTML="您输入的汉字请不要超过300个字，目前还可以输入 300 个字。";
    }else{
       id8.innerHTML="";
    }
    
     if(name9==""){
   
      id9.innerHTML="用户名不能为空";
     
     
  }else if(name9.length>43){
         id9.innerHTML="用户名长度必需小于43";
   } else{
       id9.innerHTML="";
       }
       
   if(name10==""){
  
      id10.innerHTML="电话不能为空";
      
  }
      
  if(name10!=""){
   if(isNaN(name10)){
      
      id10.innerHTML="电话必需是数字";
     
      }else if(name10.length<7){
         id10.innerHTML="电话长度必需大于6";
      }else if(name10.length>43){
         id10.innerHTML="电话长度必需小于43";
      } else{
       id10.innerHTML="";
       }
  }
  if(name11.length>99){
      id11.innerHTML="地址长度必需小于99";
  }
       
   if(name2=="0"||name2==""){
      objict1.focus();
      return false;
   }else if(name1=="0"||name1==""){
       objict2.focus();
      return false;
   } else if(name3=="0"||name3==""){
       objict3.focus();
      return false;
   } else if(name4=="0"||name4==""){
       objict4.focus();
      return false;
   } else if(name5==""){
       objict5.focus();
      return false;
   } else if(name51==""){
      
      objict51.focus();
      return false;
  }else if(isNaN(name5)){
      objict5.focus();
      return false;
   }
   else if(isNaN(name51)){
      objict51.focus();
      return false;
   } else if(parseFloat(name51)<=parseFloat(name5)){
      objict51.focus();
      return false;
   } else if(name6==""){
      objict6.focus();
      return false;
   }else if(name61==""){
      objict61.focus();
      return false;
   }else if(isNaN(name6)){
      objict6.focus();
      return false;
   } else if(isNaN(name61)){
      objict61.focus();
      return false;
   } else if(parseFloat(name61)<=parseFloat(name6)){
      objict61.focus();
      return false;
   }
   else if(name7=="0"||name7==""){
      objict7.focus();
      return false;
   } else if(name71=="0"||name71==""){
      objict71.focus();
      return false;
   }  else if(name71!="0"&&name71!=""&&name71=="197"){
   	    if(name12=="0"||name12==""){
           objict12.focus();
           return false;
   	    }
         
   }                                    
    if(name8.length>300){ 
        objict8.focus();
      return false;                                                                             
    }
    
  
  
  if(name9==""){
      objict9.focus();
      return false;
   }else if(name9.length>43){
      objict9.focus();
      return false;
   }else if(name10==""){
      objict10.focus();
      return false;
   }else if(isNaN(name10)){
      objict10.focus();
      return false;
   }else if(name10.length<7){
      objict10.focus();
      return false;
   }else if(name10.length>43){
      objict10.focus();
      return false;
   }else if(name11.length>99){
      objict11.focus();
      return false;
   }  
  
  return true;

}

function checksr(objict3,name3,objict1,name1,id1,objict4,name4,objict2,name2,id2){

if(name3!=""){
  if(isNaN(name3)){
     
      id1.innerHTML="必需是数字";
      objict3.focus();
      return false;
    
      }
       if(name1==""){
        id1.innerHTML="后面的行程必需不为空";
        objict1.focus();
        return false;
      }
      else{
       id1.innerHTML="";
       }
}
if(name1!=""){
   
     if(isNaN(name1)){
     
      id1.innerHTML="必需是数字";
      objict1.focus();
      return false;
    
      }
      else{
       id1.innerHTML="";
       }
  }
  if(parseFloat(name1)<=parseFloat(name3)){
      id1.innerHTML="后面的行程要大于前面的行程";
      objict3.focus();
      return false;
  
  }
  if(name4!=""){
   if(isNaN(name4)){
      
      id2.innerHTML="必需是数字";
      objict4.focus();
      return false;
      }
       if(name2==""){
        id2.innerHTML="后面的价格必需不为空";
        objict1.focus();
        return false;
      }
      else{
       id2.innerHTML="";
       }
  }
  if(name2!=""){
   if(isNaN(name2)){
      
      id2.innerHTML="必需是数字";
      objict2.focus();
      return false;
      }else{
       id2.innerHTML="";
       }
  }
  if(parseFloat(name2)<=parseFloat(name4)){
      id2.innerHTML="后面的价格要大于前面的价格";
      objict4.focus();
      return false;
  
  }
  return true;

}

function checkd(objict1,name1,id1,objict2,name2,id2,objict3,name3,id3){
 
   if(name1==""){
   
      id1.innerHTML="用户名不能为空";
     
     
  }else if(name1.length>43){
         id1.innerHTML="用户名长度必需小于43";
   } else{
       id1.innerHTML="";
       }
       
   if(name2==""){
  
      id2.innerHTML="电话不能为空";
      
  }
      
  if(name2!=""){
   if(isNaN(name2)){
      
      id2.innerHTML="电话必需是数字";
     
      }else if(name2.length<7){
         id2.innerHTML="电话长度必需大于6";
      }else if(name2.length>43){
         id2.innerHTML="电话长度必需小于43";
      } else{
       id2.innerHTML="";
       }
  }
  if(name3.length>99){
      id3.innerHTML="地址长度必需小于99";
  }
  
  if(name1==""){
      objict1.focus();
      return false;
   }else if(name1.length>43){
      objict1.focus();
      return false;
   }else if(name2==""){
      objict2.focus();
      return false;
   }else if(isNaN(name2)){
      objict2.focus();
      return false;
   }else if(name2.length<7){
      objict2.focus();
      return false;
   }else if(name2.length>43){
      objict2.focus();
      return false;
   }else if(name3.length>99){
      objict3.focus();
      return false;
   }
  
  return true;
   
}
  function hidDiv(divName)
    {
	  var divId = document.getElementById(divName);
	   if(divId!=null)
	  divId.style.display = 'none';
    }
    function showDiv(divName)
    {
       var divId = document.getElementById(divName);
       if(divId!=null)
       divId.style.display = '';
	  /* var a = divId.getElementsByTagName('*');
	   for(i=0;i<a.length;i++){
			a[i].onmouseout = function(e){

				if (e)
					e.stopPropagation();
				else
					window.event.cancelBubble = true;
			}
	   }
	   */
    }
    
     //翻页 
   function darkpage(pageQuery,startIndex){
    var newPageQuery=encodeURI(pageQuery);
    document.location.href="dark-advanced-search?"+newPageQuery+"&startIndex="+startIndex;
  }
    //热门搜索
  // function hotSearch(userInputQuery){
  // 	 document.location.href="dark-used-advanced-search.htm?userInputQuery="+encodeURIComponent(userInputQuery);
  // }
    //相关搜索
    
    function  relationSearch(relation){
    	document.location.href="dark-advanced-search?userInputQuery="+encodeURIComponent(relation);
    }
    
    //验证车辆
    function nTabsSearch(tabObj,obj,whereClause){
	document.location.href="dark-advanced-search?"+whereClause;
}
    function redirto(actions,flag){
       var province = document.getElementById('province').value;
       var city = document.getElementById('TradeCity').value;
       var market = document.getElementById('market').value;
       
       if(flag=="1"){
          document.location.href=actions+"&province="+province; 
       }else if(flag=="2"){
          document.location.href=actions+"&province="+province+"&city="+city; 
       }else if(flag=="3"){
          document.location.href=actions+"&province="+province+"&city="+city+"&market="+market;
       }
       
    }

 function changNum(flag){
  if(flag=="1"){
   document.getElementById('displays').innerHTML = document.getElementById('allNum1').innerHTML;
  }else if(flag=="2"){
    document.getElementById('displays').innerHTML = document.getElementById('allNum2').innerHTML;
  }
  }
  
  function commendCar(url,count,whereClause,id,edit){
  	if(count>=7&edit=='add'){
  		alert("你的推荐车辆数已经超过系统所充许的总数!")
  		return;
  	}else{
  		document.location.href=url+"?flag=list&carId="+id+"&edit="+edit+whereClause;
  	}
  }