var myAjax = Ajax.getTransport();
var CPCTSelect = {
	POnChange: function(){
		clearOptions("txtcity_select");
		var select_index = $("province_select").selectedIndex;
		var provinceId = $("province_select").options[select_index].value;
		default_city = 0;
		if (provinceId==0)
		{
			if($("txtcity_select") != undefined)
			{
				$("txtcity_select").options.length=1;
			}
			else
			{
				return false;
			}
		}
		else
		{
			initCity(provinceId);
		}
	}
	
}
function initCity(provinceId){
	try{
		var url = "getCity.asp?provinceId=" + escape(provinceId);
		myAjax.open("GET", url, true);
		myAjax.onreadystatechange = initCityOk;
		myAjax.send(null);
		Ajax.activeRequestCount++;
	}catch(exception){}	
}

function initCityOk(){
	if (myAjax.readyState == 4) {
		var response = unescape(myAjax.responseText);
		
		try{
			clearOptions("txtcity_select");
			var arr = response.split(",");
			var arrValue = new Array(), arrText = new Array(), arrTemp = new Array();
			for(i=0, arrLen = arr.length; i < arrLen; i++){
				arrTemp = arr[i].split("-");
				arrValue[i] = arrTemp[0];
				arrText[i] = arrTemp[1];
			}
			
			addOptions("txtcity_select", arrValue, arrText);
			setSelected("txtcity_select", default_city);
		}catch(exception){}
		Ajax.activeRequestCount--;
	}
}
