	
	citySelect = document.getElementById("CityID");
	districtSelect = document.getElementById("DistrictID");
	
	
	citySelect.onchange = updateDistricts;
	var http = null;
	//updateDistricts();
	
	function updateDistricts() {
		if (window.XMLHttpRequest) {
   			http = new XMLHttpRequest();
		} else if (window.ActiveXObject) {
   			http = new ActiveXObject("Microsoft.XMLHTTP");
		}
		http.overrideMimeType('text/xml');
		var file = "districts.php?CityID=" + citySelect.options[citySelect.selectedIndex].value;
		if (http != null) {
   			http.open("GET", file, true);
   			http.onreadystatechange = updateComboBox;
   			http.send(null);
		}
	}
	
	function updateComboBox()
	{
		if (http.readyState == 4) {
		
			if(http.responseText == ""){
				districtSelect.disabled = true;
			} else {
				districtSelect.disabled = false;
         		districtSelect.innerHTML = http.responseText;
        	}
        }
	}
