var xmlHttp

function citychange()
{
	id=document.form1.state.value;
	
	//alert(id);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputcity.php"
url=url+"?stateid="+id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 


function showloc()
{
	city=document.searchform.city.value;
	str=document.searchform.location.value;
	if(document.searchform.location.value=='')
	{
	document.getElementById("tablediv").style.display="none";
	document.getElementById("a").innerHTML=" ";
	}	
	else
	{
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
  		{
  			alert ("Browser does not support HTTP Request")
  			return
  		} 
	
		var url="outputloc.php"
		url=url+"?strloc="+str
		url=url+"&city="+city
		url=url+"&sid="+Math.random()
		xmlHttp.onreadystatechange=stateC
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)		
		document.getElementById("tablediv").style.display="block";
	}
}

function addloc(a)
{
	document.searchform.location.value=document.getElementById(a).innerHTML;	
	document.getElementById("tablediv").style.display="none";	
}

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

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

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 citychange1()
{
	id=document.form1.state.value;
	
	//alert(id);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputcity1.php"
url=url+"?stateid="+id
url=url+"&sid="+Math.random()
//alert(url);
xmlHttp.onreadystatechange=stateCity
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateCity() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		document.getElementById("ajcitya").innerHTML=xmlHttp.responseText
		
		
		
 	} 
}
	
// This Function plced in Filter.php

/*function ajaxfilter()
{
	id=document.filterform.filterproperty.value;
	ptype=document.filterform.hidptype.value;
	//alert(ptype);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputfilter.php"
url=url+"?property="+id+"&ptype="+ptype
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=statefilter 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
*/
function ajaxfilter()
{
	
	id=document.form1.filterproperty.value;
	ptype=document.form1.hidswhat.value;
	//alert(id);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputfilter.php"
url=url+"?property="+id+"&ptype="+ptype
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=statefilter 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

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



function changecity()
{
	id=document.addproject.state.value;
	
	//alert(id);
	xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputcity.php"
url=url+"?stateid="+id
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 

/////////////////////////////////////////////////////////////////////

function checkemail(){
	
	var str=document.form1.email.value;
	
		xmlHttp=GetXmlHttpObject()

	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	
var url="outputemail.php"
url=url+"?email="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=emailResult 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
	
}

function emailResult() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 	{ 
 		var str=xmlHttp.responseText;
		document.getElementById("emailstatus").innerHTML=xmlHttp.responseText;
		if(str.length==91)
		document.form1.email.focus();
		
 	} 
}
