$OM.loadInfo({300:"Suggest"});$OM.loadClass({"Suggest":function()
{var th=this;this.dContainer=null;this.dQuery=null;this.dBody=null;this.dResult=null;this.dFocusedLink=null;this.bIsDisabled=false;this.bIsShowed=false;this.sQuery='';this.aData={};this.constructor=function(oOm)
{var sQuery=byId('search_query').value,dInput=byId('search_query_body').innerHTML;byId('search_query_body').innerHTML='';byId('search_query_body').innerHTML=dInput.replace('id="search_query"','autocomplete="off" id="search_query"');byId('search_query').value=sQuery;this.dContainer=byId('search_block');this.dQuery=byId('search_query');this.dQuery.autocomplete='off';if(this.dContainer&&this.dQuery)
{this.dResult=$(this.dBody=this.render('body')).appendTo(this.dContainer).set({"click":this.eResultClick,"mouseover":this.eResultMover}).first(2).fetch(1);$(this.dQuery).set({"keyup":this.eQueryKeyup,"keydown":this.eQueryKeydown});$($_D).set("click",this.eDocClick);$_W['google']={"ac":{"Suggest_apply":this.eSuggestLoaded}};}
this.dQuery.focus();};this.eSuggestLoaded=function(aRes,sQuery,aData)
{aRes=[];for(var i=1;i<aData.length;i+=2)
{if(aData[i])
{aRes[aRes.length]=aData[i];}}
th.aData[sQuery]=aRes;th.suggestSet();};this.eDocClick=function()
{_classSet(th.dBody,'dn');th.bIsShowed=false;};this.eQueryKeydown=function(e)
{if(!th.bIsShowed)return;if(40==e.keyCode||38==e.keyCode)
{var bIsUp=(38==e.keyCode);if(th.dFocusedLink)
{_classUnset(th.dFocusedLink.firstChild,'sgst_focus');}
if(bIsUp)
{th.dFocusedLink=(th.dFocusedLink)?th.dFocusedLink.previousSibling:th.dResult.lastChild;}
else
{th.dFocusedLink=(th.dFocusedLink)?th.dFocusedLink.nextSibling:th.dResult.firstChild;}
if(!th.dFocusedLink)
{th.dFocusedLink=(bIsUp)?th.dResult.lastChild:th.dResult.firstChild;}
_classSet(th.dFocusedLink.firstChild,'sgst_focus');th.dQuery.value=th.sQuery=th.dFocusedLink.firstChild.innerHTML;return{"stop":1};}
else if(27==e.keyCode||9==e.keyCode)
{_classSet(th.dBody,'dn');th.bIsShowed=false;}};this.eQueryKeyup=function(e)
{if(th.bIsDisabled)return;if(e.target.value.trim()!=th.sQuery)
{if(th.tSuggestGet)clearTimeout(th.tSuggestGet);th.tSuggestGet=null;th.sQuery=e.target.value.trim();if(e.target.value&&!th.aData[th.sQuery])
{th.tSuggestGet=setTimeout(th.tGetSuggest,150);}
else
{th.suggestSet();}}};this.tSuggestGet=null;this.tGetSuggest=function()
{if(th.aData[th.sQuery])
{th.suggestSet();}
else
{$Loader.include('http://suggestqueries.google.com/complete/search?js=true&qu='+th.sQuery);}};this.suggestSet=function()
{var aRes=this.aData[this.sQuery]||[],dNode=$(this.dResult).clear();for(var i=0;i<aRes.length;i++)
{dNode.append(this.render('result',aRes[i]));}
if(i)
{_classUnset(this.dBody,'dn');this.bIsShowed=true;}
else
{_classSet(this.dBody,'dn');this.bIsShowed=false;}};this.eResultClick=function(e)
{if(_classHas(e.target,'sgst_lnk'))
{th.dQuery.value=e.target.innerHTML;th.dQuery.form.submit();_classSet(th.dBody,'dn');}
else if(_classHas(e.target.parentNode,'menu_ar'))
{_classSet(th.dBody,'dn');th.bIsDisabled=true;}
th.dQuery.focus();return{"stop":1};};this.eResultMover=function(e)
{var dNode=_parent(e.target,'p','div');if(dNode&&dNode!=th.dFocusedLink)
{if(th.dFocusedLink)
{_classUnset(th.dFocusedLink.firstChild,'sgst_focus');}
th.dFocusedLink=dNode;_classSet(th.dFocusedLink.firstChild,'sgst_focus');}};},"Suggest_gui":function()
{var th=this;this._PATTERNS_={"body":[["div",{"id":'suggest_outer',"className":'dn'},[["div",{"className":'cr_br'},[["div",{"id":'suggest',"className":'cr_bl'}]]],["div",{"id":'suggest_close',"className":'menu_ar'},[["img",{"src":'img/b_x.gif',"alt":'[x]'}]]]]]],"result":[["p",0,[["a",{"href":'javascript:void(0)',"className":'sgst_lnk'}]]],function(dNode,sData){dNode.firstChild.innerHTML=sData;}]};}});$Loader.set(function(){$OM.process({"ID":300})});