////级联select地区

var nu; //省号
var vu; //省名
var cu; //城市号
var cv; //城市名
var city_code;
var cityObj;
var country_code;
var countryObj;
//根据省显示市
function getCityByProCode(pro_code,code,jqObj){
	if(pro_code!=""&&pro_code!=0){
		city_code = code;
		cityObj = jqObj;
		getdwrTestStates.getDwrByStateId(pro_code,cityReturn);
	}else{
		hideCityAndCountry();
	}
}

//根据城市显示区
function getCountryByCityCode(city_code,code,jqObj){
	if(city_code!=""&&city_code!=0){
		country_code = code;
		countryObj = jqObj;
		getdwrTestStates.getDwrByCityId(city_code,countyReturn);
	}else{
		hideCountry();
	}
}

//隐藏县区
function hideCountry(){
	document.getElementById("showCounty").style.display='none';
}
//隐藏城市
function hideCityAndCountry(){
	document.getElementById("showCity").style.display='none';
	document.getElementById("showCounty").style.display='none';
}

function getCity(obj){
	 nu=obj.value;
	 vu=obj.options[obj.selectedIndex].text;	
	if(nu!=0){			
		getdwrTestStates.getDwrByStateId(nu,cityReturn);
		
	}else{
		hideCityAndCountry();
	}

}

function getCounty(obj){
	 cu=obj.value;
	 cv=obj.options[obj.selectedIndex].text;
	if(cu!=0){			
		getdwrTestStates.getDwrByCityId(cu,countyReturn);
	}else{
		hideCountry();
	}

}

//回调函数
 function cityReturn(data){ 			
		if(data!=null){
			document.getElementById("showCity").style.display='block';					
			var obj_City = document.getElementById("sel_city");			
			DWRUtil.removeAllOptions(obj_City);	
			DWRUtil.addOptions(obj_City,{'0':'请选择'});
			DWRUtil.addOptions(obj_City,data,'regionId','regionName');  
			if(city_code!=undefined){
				cityObj.val(city_code);
			}
		}			
         
}
//回调函数
function countyReturn(data){
	if(data!=null&&data!=""){			
		document.getElementById("showCounty").style.display='block';					
		var obj_County= document.getElementById("sel_county");		
		DWRUtil.removeAllOptions(obj_County);	
		DWRUtil.addOptions(obj_County,{'0':'请选择'});
		DWRUtil.addOptions(obj_County,data,'regionId','regionName');  
		if(country_code!=undefined){
			countryObj.val(country_code);
		}
	}else{
		var obj_County= document.getElementById("sel_county");		
		DWRUtil.removeAllOptions(obj_County);
		document.getElementById("showCounty").style.display='none';
	}

}




