var http_request1 = false;
function send_city_request(url,method) {
	http_request1 = false;
	if(window.XMLHttpRequest) {
		http_request1 = new XMLHttpRequest();
		if (http_request1.overrideMimeType) {
			http_request1.overrideMimeType('text/xml');
		}
	} else if (window.ActiveXObject) {
		try {
			http_request1 = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request1 = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}
	if (!http_request1) {
		return false;
	}
	http_request1.open("GET", url, false);
	http_request1.send(null);
	var result = http_request1.status;
	if(result==200)
    {
		if(method==1){
			var responseText = http_request1.responseText;
		    responseText = trim(responseText);
			var optGroup = responseText.split("|");
			addOptionGroup1("province",optGroup[0],optGroup[1]);
		}
		if(method==2){
			var responseText = http_request1.responseText;
			responseText = trim(responseText);
			//alert(responseText);
			var optGroup = responseText.split("|");
			addOptionGroup1("city",optGroup[0],optGroup[1]);
		}
		if(method==3)
		{
			var responseText = http_request1.responseText;
			responseText = trim(responseText);
			//alert(responseText);
			var optGroup = responseText.split("|");
			addOptionGroup1("county",optGroup[0],optGroup[1]);
		} 
  }
    http_request1 = null;
}

function loadCity() {
	send_city_request("http://www.yellowpage.com.cn/web-inf/lib/core/apprun/yellowpages/yellowpages_city.php?type=city&id="+document.getElementById("province").value,2);
}
function addOption1(objSelectNow,txt,val)
{
	var objOption = document.createElement("OPTION");
	objOption.text= txt;
	objOption.value=val;
	objSelectNow.options.add(objOption);
}
function addOptionGroup1(selectId,value,name)
{
	var value = value.split(",");
	var name = name.split(",");
	var objSelect = document.getElementsByTagName("SELECT");
	var objSelectNow = objSelect[selectId];
	objSelectNow.length = 1;
	/// 成组添加Options
	for (i=0; i<value.length; i++)
	{
		addOption1(objSelectNow, name[i], value[i]);
	}
}