var xmlHttp

function GetXmlHttpObject(){ 
	var objXMLHttp=null
	if (window.XMLHttpRequest){
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject){
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}

//============== Home Page ================

function GetLocality(county) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="show_localities.php"
	url=url+"?id="+county
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=GetLocality_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetLocality_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("Locality_display").innerHTML=xmlHttp.responseText 
	} 
}

function GetCounty1(County1,name) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="get_localities.php"
	url=url+"?cid="+County1
	url=url+"&name="+name
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=GetCounty1_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetCounty1_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("ShowLocalities1").innerHTML=xmlHttp.responseText 
	} 
}

function GetCounty2(County2,name) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="get_localities.php"
	url=url+"?cid="+County2
	url=url+"&name="+name
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=GetCounty2_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetCounty2_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("ShowLocalities2").innerHTML=xmlHttp.responseText 
	} 
}

function GetCounty3(County3,name) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="get_localities.php"
	url=url+"?cid="+County3
	url=url+"&name="+name
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=GetCounty3_Change
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetCounty3_Change(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("ShowLocalities3").innerHTML=xmlHttp.responseText 
	} 
}

//========  Image box  ========//

function GetImageBox(BoxType) { 

	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url="get_box.php"
	url=url+"?type="+BoxType
	url=url+"&ram_id="+Math.random()	
	xmlHttp.onreadystatechange=GetBox
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function GetBox(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ 		
		document.getElementById("ImageBox").innerHTML=xmlHttp.responseText 
	} 
}


