var xmlHttp;
function notallowed(event,strname,strcity)
{
    // Compatibilité IE / Firefox
    if(!event && window.event) {
        event = window.event;
    }
    // IE
    if(event.keyCode == 13) {
        event.returnValue = false;
        event.cancelBubble = true;
		showQuery(strname,strcity,1);
    }
    // DOM
    if(event.which == 13) {
        event.preventDefault();
        event.stopPropagation();
		showQuery(strname,strcity,1);
    }
}
 
 
 function showPopularCategory(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="getPopCategory.php"
	url=url+"?popCat="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged1
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showQuery(sQuery,sCity,sPage)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="getQuery.php"
	url=url+"?Query="+sQuery
	url=url+"&City="+sCity
	url=url+"&page="+sPage
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function showCategory(str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="getCategory.php"
	url=url+"?SiteID="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged1
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function showBusiness(sId,str,spage)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="getBusiness.php"
	url=url+"?catID="+sId
	url=url+"&CatName="+str
	url=url+"&page="+spage
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChanged1 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("TextHint").innerHTML=xmlHttp.responseText ;
	} 
} 
function stateChanged1() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById("category_results_div").innerHTML=xmlHttp.responseText ;
	} 
} 

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

