var xmlHttp

function getresults()
{ 
	xmlHttp=GetXmlHttpObject()
	
	if (xmlHttp==null)
 	{
 		alert ("Browser does not support HTTP Request")
 		return
 	}
	var url="scripts/getresults.php"
	
	var myfname = document.getElementById("fname").value
	var mylname = document.getElementById("lname").value
	var mystate = document.getElementById("state").value
	
	url=url+"?fname="+myfname+"&lname="+mylname+"&state="+mystate+"&sid="+Math.random()
	
//	alert(url);
	
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

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

function showhide(myid)
{
//	alert(myid);
	
	if( document.getElementById(myid).style.display=='none' )
	{
		document.getElementById(myid).style.display = '';
		
		var address = document.getElementById("a"+myid).value;
		
		var map = null;
    	var geocoder = null;
		
       	map = new GMap2(document.getElementById("m"+myid));
       	map.setCenter(new GLatLng(37.4419, -122.1419), 13);
       	geocoder = new GClientGeocoder();

		if (geocoder) 
		{
        	geocoder.getLatLng(address, 
				function(point) 
				{
            		if (!point) 
					{
              			alert(address + " not found");
            		} 
					else 
					{
              			map.setCenter(point, 13);
              			var marker = new GMarker(point);
              			map.addOverlay(marker);
              			marker.openInfoWindowHtml(address);
            		}
          		}
			 );
		 }
 	}
	else
	{
   		document.getElementById(myid).style.display = 'none';
 	}	 
	
//	alert("no alert")
}


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 showRegForm(myurl)
{
	var mywin = window.open (myurl, "mywindow","menubar=1, resizable=1, width=350, height=275" );
	mywin.moveTo(screen.availWidth/2-(350/2),screen.availHeight/2-(275/2));

}
