﻿
var xmlHttp;

function createXMLHttpRequest(){
   if(window.ActiveXObject){
       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
   }else {
       xmlHttp = new XMLHttpRequest();
   }
}

function selectCity() {
	var provinceId = document.getElementById("province").value;
	if (provinceId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/citySelect.action?areaId="+provinceId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = cityCallback;
    xmlHttp.send(null);
}

function selectCitySearch() {
	var provinceId = document.getElementById("provinceSearch").value;
	if (provinceId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/citySelect.action?areaId="+provinceId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = cityCallbackSearch;
    xmlHttp.send(null);
}

function cityCallbackSearch() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_citySearch").innerHTML = xmlHttp.responseText;
        }
    }
}

function cityCallback() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_city").innerHTML = xmlHttp.responseText;
        }
    }
}

function selectCity2() {
	var provinceId = document.getElementById("province2").value;
	if (provinceId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/citySelect2.action?areaId="+provinceId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = cityCallback2;
    xmlHttp.send(null);
}

function cityCallback2() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_city2").innerHTML = xmlHttp.responseText;
        }
    }
}

function selectCity4() {
	var provinceId = document.getElementById("province2").value;
	if (provinceId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/citySelect4.action?areaId="+provinceId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = cityCallback4;
    xmlHttp.send(null);
}

function cityCallback4() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_city2").innerHTML = xmlHttp.responseText;
        }
    }
}

function selectCity3() {
	var provinceId = document.getElementById("province3").value;
	if (provinceId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/citySelect3.action?areaId="+provinceId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = cityCallback3;
    xmlHttp.send(null);
}

function cityCallback3() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_city3").innerHTML = xmlHttp.responseText;
        }
    }
}

function selectRegion() {
	var cityId = document.getElementById("cityId").value;
	if (cityId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/regionSelect.action?areaId="+cityId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = regionCallback;
    xmlHttp.send(null);
}

function regionCallback() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_region").innerHTML = xmlHttp.responseText;
        }
    }
}

function selectRegion2() {
	var cityId = document.getElementById("cityId2").value;
	if (cityId == "") 
	{
		return false;
	}
    createXMLHttpRequest();
    var url = "/regionSelect.action?areaId="+cityId;
    xmlHttp.open("GET",url,true);
    xmlHttp.onreadystatechange = regionCallback2;
    xmlHttp.send(null);
}

function regionCallback2() {
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200 ) {
			document.getElementById("select_region2").innerHTML = xmlHttp.responseText;
        }
    }
}
