// JavaScript Document	
function getState(countryid) {		
	
	var strURL="findStateajax.php?st=1&countryid="+countryid;	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('statediv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		
		req.open("GET", strURL, true);
		req.send(null);
	}		
}
function getCity(countryid,regionid) {		
	var strURL="findStateCityLoc.php?st=2&countryid="+countryid+"&regionid="+regionid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('citydiv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}

function getLocation(cityid) {		
	
	var strURL="findStateCityLoc.php?st=3&cityid="+cityid;	
	var req = GetXmlHttpObject();	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('loc_div').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}		
}

function getCities(countryid) {		
	var strURL="findStateCityLoc.php?st=4&countryid="+countryid;
	var req = GetXmlHttpObject();	
	if (req) {		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('citydiv').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}	
		//alert(strURL);
		req.open("GET", strURL, true);
		req.send(null);
	}			
}
