var xmlHttp

function showState(str)
{
	if(str.length < 5)
	{
		alert("Enter 5 Digits Zip Code");
		document.form1.txtZipCode.focus();
		return false;
	}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
	alert ("Browser does not support HTTP Request")
 	return
} 
 
var url="getstate.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged() 
{ 
 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 	
 	document.getElementById('cmbState').style.display="none";
	 var ajaxDisplay = document.getElementById('myCom');
	 //alert(xmlHttp.responseText);
	ajaxDisplay.innerHTML = xmlHttp.responseText;

	document.getElementById('total').innerHTML="";
	if(document.getElementById("mystate")!=null)	
	document.getElementById('total').innerHTML="&nbsp;&nbsp;&nbsp;"+(eval(document.getElementById("mystate").length))+" communities found!";
	if(document.getElementById("mystate1")!=null)	
	document.getElementById('total').innerHTML="&nbsp;&nbsp;&nbsp; This 5 digit zip code &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;was not found!";
 } 
}


function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}

function goCommunity(obj)
{
	document.form1.hdnuser.value=obj[obj.selectedIndex].value;
	//alert(document.form1.hdnuser.value);
	document.form1.submit();
	/*if(obj[obj.selectedIndex].value!="")
	{
		var id=obj[obj.selectedIndex].value;
		window.location="community.php?at=ci&commId="+id;
	}*/
	
	
}

function goCommunity2(obj)
{
	if(obj[obj.selectedIndex].value!="")
	{
		var id=obj[obj.selectedIndex].value;
		window.location="welcome.php?at=ci&commId="+id;
	}
}