var ajaxTimerId=0;var myAjaxRequest;Ajax.Request.prototype.abort=function()
{this.transport.onreadystatechange=Prototype.emptyFunction;this.transport.abort();Ajax.activeRequestCount--;};function searchAToZ()
{var dropdown=document.getElementById("AToZSelection");if(document.getElementById("atozsearchquery").value.length>2)
{dropdown.length=0;dropdown.size=1;dropdown.options[dropdown.options.length]=new Option("Searching....",'');dropdown.style.display="";myAjaxRequest=new Ajax.Request('/dundeecity/azentryfuzzysearch.php',{method:'get',parameters:$('atozsearchquery').serialize(true),requestHeaders:{Accept:'application/json'},onComplete:function(transport)
{var json=transport.responseText.evalJSON(true);if(json!==null)
{dropdown.length=0;dropdown.size=10;for(var x=0;x<json.title.length;x++)
{dropdown.options[dropdown.options.length]=new Option(json.title[x],json.link[x]);}
dropdown.style.display="";}
else
{dropdown.length=0;dropdown.size=1;dropdown.options[dropdown.options.length]=new Option("No Results Found",'');dropdown.style.display="";}}});}
else
{dropdown.length=0;dropdown.style.display="none";}}
function callAjaxSearch()
{if(Ajax.activeRequestCount<0)
{Ajax.activeRequestCount=0;}
if(Ajax.activeRequestCount>0)
{myAjaxRequest.abort();}
clearTimeout(ajaxTimerId);ajaxTimerId=setTimeout(searchAToZ,500);}
function loadLink()
{document.location.href=$F('AToZSelection');}