var xmlHttp
function GetXmlHttpObject(handler)
{var objXmlHttp=null
if(navigator.userAgent.indexOf("MSIE")>=0)
{var strName="Msxml2.XMLHTTP"
if(navigator.appVersion.indexOf("MSIE 5.5")>=0)
{strName="Microsoft.XMLHTTP"}
try
{objXmlHttp=new ActiveXObject(strName)
objXmlHttp.onreadystatechange=handler
return objXmlHttp}
catch(e)
{return}}
if(navigator.userAgent.indexOf("Mozilla")>=0||navigator.userAgent.indexOf("Opera")>=0)
{objXmlHttp=new XMLHttpRequest()
objXmlHttp.onload=handler
objXmlHttp.onerror=handler
return objXmlHttp}}
function showHint(str)
{if(str.length>2||(!isNaN(String(str).substr(1,1))&&str.length>1))
{var url="/ajax/getareas.asp?sid="+ Math.random()+"&q="+ str
xmlHttp=GetXmlHttpObject(stateChanged)
setProgress(100);xmlHttp.open("GET",url,true)
xmlHttp.send(null)}
else
{document.getElementById("txtHint").innerHTML=""}}
function stateChanged()
{clearTimeout(timerID);if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{document.getElementById("txtHint").innerHTML=xmlHttp.responseText
document.getElementById("progressBar").innerHTML=""}
else
{document.getElementById("progressBar").innerHTML="Searching..."}}
function setProgress(theProgress)
{document.getElementById("progressBar").innerHTML=theProgress+"%";theProgress=theProgress-1;if(theProgress<1)
{clearTimeout(timerID);}
else
{timerID=setTimeout("setProgress("+theProgress+")",1);}}
function showNameHint(str)
{if(str.length>2||(!isNaN(str)&&str.length>0))
{var url="/ajax/getrestaurants.asp?sid="+ Math.random()+"&q="+ str
xmlHttp=GetXmlHttpObject(stateNameChanged)
setNameProgress(100);xmlHttp.open("GET",url,true)
xmlHttp.send(null)}
else
{document.getElementById("txtNameHint").innerHTML=""}}
function stateNameChanged()
{clearTimeout(timerID);if(xmlHttp.readyState==4||xmlHttp.readyState=="complete")
{document.getElementById("txtNameHint").innerHTML=xmlHttp.responseText
document.getElementById("progressNameBar").innerHTML=""}
else
{document.getElementById("progressNameBar").innerHTML="Searching..."}}
function setNameProgress(theProgress)
{document.getElementById("progressNameBar").innerHTML=theProgress+"%";theProgress=theProgress-1;if(theProgress<1)
{clearTimeout(timerID);}
else
{timerID=setTimeout("setNameProgress("+theProgress+")",1);}}
function getName(searchTerm){if(searchTerm==''||searchTerm=='%'||searchTerm=='Enter the name...'){document.namesearch.Rest_Name.value='Enter the name...';return false;}else{document.namesearch.action='/search/dosearch.asp';}}
function getArea(searchTerm){if(searchTerm==''||searchTerm=='%'||searchTerm=='Enter the location...'){document.areasearch.Rest_Postal.value='Enter the location...';return false;}else{document.areasearch.action='/search/dosearch.asp';}}
function resetField(whichName){if(whichName.value=='Enter the name...'||whichName.value=='Enter the location...'){whichName.value='';}}
