function callCounty(obj)
{
	var sid=obj.value;

	var url = "locations/processor3.php?sid="+escape(sid);
	//alert(url);
	var isWorking=false;
	
	var newOpt = new Option('Select a County', 0);
	var theSel = document.getElementById('county');
	theSel.length = 0;
	var selLength = theSel.length;
	theSel.options[selLength] = newOpt;	
	theSel.disabled=true;
	
	var newOpt = new Option('Select a City', 0);
	var theSel = document.getElementById('city');
	theSel.length = 0;
	var selLength = theSel.length;
	theSel.options[selLength] = newOpt;	
	theSel.disabled=true;
	
	if(!isWorking && http)
	{
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponse;
		isWorking = true;
		http.send(null);
	}
}
function callCity(obj)
{
	var cid=obj.value;
	var url = "locations/processor.php?cid="+escape(cid);
	//alert(url);
	var isWorking=false;
	if(!isWorking && http)
	{
		http.open("GET", url, true);
		http.onreadystatechange = handleHttpResponse;
		isWorking = true;
		http.send(null);
	}
}


<!-- start ajax -->
var http = getHTTPObject(); 
function getHTTPObject()
{
	var ro;
	var browser = navigator.appName;
	if(browser == "Microsoft Internet Explorer")
	{
		ro = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		ro = new XMLHttpRequest();
	}
	return ro;
}
function handleHttpResponse()
{
	if (http.readyState == 4)
	{
		if (http.responseText.indexOf('invalid') == -1) 
		{
			var xmlDocument = http.responseXML;
			var topic = new Array();
			topic=xmlDocument.getElementsByTagName("topic");
			topicValue=topic.item(0).firstChild.nodeValue;
			
			if(topicValue=="getcounty")
			{
				var county = new Array();
				var countyVal = new Array();
				var city = new Array();
				var cityVal = new Array();
								
				county=xmlDocument.getElementsByTagName("county");
				countyVal=xmlDocument.getElementsByTagName("countyVal");
				city=xmlDocument.getElementsByTagName("city");
				cityVal=xmlDocument.getElementsByTagName("cityVal");
				
				var newOpt = new Option('All County', -1);
				//alert('sss');
				var theSel = document.getElementById('county');
				theSel.length = 0;
				var selLength = theSel.length;
				theSel.options[selLength] = newOpt;
				theSel.disabled=false;
				for(var i=0;i<county.length;i++)
				{
					countyValue=county.item(i).firstChild.nodeValue;
					countyValValue=countyVal.item(i).firstChild.nodeValue;
					theText = countyValue;
					theValue = countyValValue;
					var newOpt = new Option(theText, theValue);
					var theSel = document.getElementById('county');
					var selLength = theSel.length;
					theSel.options[selLength] = newOpt;
				}
				
					
				
				// ================== < city > ============================
				
				var newOpt = new Option('Select a City', -1);
				var theSel = document.getElementById('city');
				theSel.length = 0;
				var selLength = theSel.length;
				theSel.options[selLength] = newOpt;
				theSel.disabled=false;
				//alert(city.length);
				
				for(var i=0;i<city.length;i++)
				{
					cityValue=city.item(i).firstChild.nodeValue;
					cityValValue=cityVal.item(i).firstChild.nodeValue;
					theText = cityValue;
					theValue = cityValValue;
					var newOpt = new Option(theText, theValue);
					var theSel = document.getElementById('city');
					var selLength = theSel.length;
					theSel.options[selLength] = newOpt;
				}
				
				// ================== </ city > ===========================
				
			}
			else if(topicValue=="getcity")
			{
				var city = new Array();
				var cityVal = new Array();
				city=xmlDocument.getElementsByTagName("city");
				cityVal=xmlDocument.getElementsByTagName("cityVal");
				var newOpt = new Option('Select a City', 0);
				var theSel = document.getElementById('city');
				theSel.length = 0;
				var selLength = theSel.length;
				theSel.options[selLength] = newOpt;
				theSel.disabled=false;
				for(var i=0;i<city.length;i++)
				{
					cityValue=city.item(i).firstChild.nodeValue;
					cityValValue=cityVal.item(i).firstChild.nodeValue;
					theText = cityValue;
					theValue = cityValValue;
					var newOpt = new Option(theText, theValue);
					var theSel = document.getElementById('city');
					var selLength = theSel.length;
					theSel.options[selLength] = newOpt;
				}
			}
		}
	}
}

