function GetCity(ProvinceID) {

    document.body.style.cursor='wait';

    var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
    var sURL = "GetCity.asp?ProvinceID=" + ProvinceID;
    oXMLHTTP.open( "POST", sURL, false );
    oXMLHTTP.send();
   
    if (oXMLHTTP.responseText == "-")
    {  
       document.getElementById("cmbCity").value='';
       document.getElementById("cmbCity").label='';
	}
	else
	{
        var myString = oXMLHTTP.responseText;
        var mySplitResult = myString.split(",");
		var myBranch = document.getElementById("cmbBranch");
		var myBranchLength = myBranch.length
		for (iBranch = 0; iBranch <= myBranchLength; iBranch++)
			myBranch.remove(0);

		var myCity = document.getElementById("cmbCity");
		var myCityLength = myCity.length
		for (iCity = 0; iCity <= myCityLength; iCity++)
			myCity.remove(0);
		
		for (idx = 0; idx <= (mySplitResult.length) - 2; idx++)
		{
			var myOption = document.createElement('option');
			if (idx == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if (idx % 2 == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if ((idx == 0) || (idx % 2 == 0))
			try
			{
				myCity.add(myOption, null);
			}
			catch(ex)
			{
				myCity.add(myOption);
			}			
		}
    }

	document.body.style.cursor='auto';
}

function GetBranch(CityID) {
  
    document.body.style.cursor='wait';

    var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
    var sURL = "GetBranch.asp?ProvinceID=" + document.getElementById("cmbProvince").value + "&CityID=" + CityID;
    oXMLHTTP.open( "POST", sURL, false );
    oXMLHTTP.send();
   
    if (oXMLHTTP.responseText == "-")
    {  
       document.getElementById("cmbBranch").value='';
       document.getElementById("cmbBranch").label='';
	}
	else
	{
        var myString = oXMLHTTP.responseText;
        var mySplitResult = myString.split(",");

		var myBranch = document.getElementById("cmbBranch");
		var myBranchLength = myBranch.length
		for (iBranch = 0; iBranch <= myBranchLength; iBranch++)
			myBranch.remove(0);
		
		for (idx = 0; idx <= (mySplitResult.length) - 2; idx++)
		{
			var myOption = document.createElement('option');
			if (idx == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if (idx % 2 == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if ((idx == 0) || (idx % 2 == 0))
			try
			{
				myBranch.add(myOption, null);
			}
			catch(ex)
			{
				myBranch.add(myOption);
			}			
		}
    }

	document.body.style.cursor='auto';
}

function GetCityBirth(ProvinceID) {
  
    document.body.style.cursor='wait';

    var oXMLHTTP = new ActiveXObject( "Microsoft.XMLHTTP" );
    var sURL = "GetCity.asp?ProvinceID=" + ProvinceID;
    oXMLHTTP.open( "POST", sURL, false );
    oXMLHTTP.send();
   
    if (oXMLHTTP.responseText == "-")
    {  
       document.getElementById("cmbCityBirth").value='';
       document.getElementById("cmbCityBirth").label='';
	}
	else
	{
        var myString = oXMLHTTP.responseText;
        var mySplitResult = myString.split(",");

		var myCity = document.getElementById("cmbCityBirth");
		var myCityLength = myCity.length
		for (iCity = 0; iCity <= myCityLength; iCity++)
			myCity.remove(0);
		
		for (idx = 0; idx <= (mySplitResult.length) - 2; idx++)
		{
			var myOption = document.createElement('option');
			if (idx == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if (idx % 2 == 0)
			{
				myOption.value = mySplitResult[idx];
				myOption.text = unescape(mySplitResult[idx + 1]);
			}
			if ((idx == 0) || (idx % 2 == 0))
			try
			{
				myCity.add(myOption, null);
			}
			catch(ex)
			{
				myCity.add(myOption);
			}			
		}
    }

	document.body.style.cursor='auto';
}

