var xmlHttp;
var bPreloaded;

function showStates_gmap(iStateID, bPreload)
{
	document.getElementById("CountryID").disabled	= true;

	var url = "ajaxRetrieveStateList.asp?iStateID=" + iStateID + "&bGoogleMap=TRUE";

	xmlHttp_gmap=GetXmlHttpObject()

	if (xmlHttp_gmap==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}

	if ( iStateID.length > 0 ) {
		document.getElementById("ajaxStateList").style.display				= "none";
		document.getElementById("ajaxStateListLoadingGif").style.display	= "inline";
	}

	xmlHttp_gmap.onreadystatechange=stateChanged_gmap 
	xmlHttp_gmap.open("GET",url,true)
	xmlHttp_gmap.send(null)
}


function showStates_gmap2(iStateID, bPreload)
{
	document.getElementById("CountryID").disabled	= true;

	var url = "ajaxRetrieveStateListBackend.asp?iStateID=" + iStateID + "&bGoogleMap=TRUE";

	xmlHttp_gmap=GetXmlHttpObject()

	if (xmlHttp_gmap==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	}

	if ( iStateID.length > 0 ) {
		document.getElementById("ajaxStateList").style.display				= "none";
		document.getElementById("ajaxStateListLoadingGif").style.display	= "inline";
	}

	xmlHttp_gmap.onreadystatechange=stateChanged_gmap 
	xmlHttp_gmap.open("GET",url,true)
	xmlHttp_gmap.send(null)
}


function stateChanged_gmap() 
{ 
	if (xmlHttp_gmap.readyState==4 || xmlHttp_gmap.readyState=="complete")
	{ 
		document.getElementById("ajaxStateList").innerHTML						= xmlHttp_gmap.responseText;
		document.getElementById("ajaxStateList").style.display				= "inline";
		document.getElementById("ajaxStateListLoadingGif").style.display	= "none";

		document.getElementById("CountryID").disabled			= false;

		if ( document.getElementById("CountryID").value != "" ) {
			document.getElementById("StateID").focus();
		}
	} 
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null

	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}

	return objXMLHttp
}