var yp={DFLT_AJAX_OPTS:{method:"get"},loadIcon:null,pagins:[],currPagin:null,sbid:null,pageType:null,inpDefTxt:null,smartBox:null,rating:null,recLocsDiv:null,filterDivs:new Array(),menus:[],snsUrl:null,signInAnchorForm:null,snsLogoutUrl:null,dbgmsg:function(txt,lvl){var lvls=["debug","info","warn","error"];
if(window.console){if(window.console.firebug){if(!lvl){lvl=0;
}eval("console."+lvls[lvl]+"('"+txt+"')");
}else{window.console.log(txt);
}}return txt;
},init:function(){var t;
if((t=location.pathname.match(/[0,1]{1}-[0-9]{4,}/))!==null){if(t.length>0){this.sbid=t[0].substr(2);
this.pageType=t[0].substr(0,1);
}}var autoCompDivs=["query_autocomplete","area_autocomplete","ft_query_autocomplete","ft_area_autocomplete"];
$("query","area","ft_query","ft_area").each(function(el,i){if(el===null){return ;
}if(el.id.indexOf("query")>-1){new yp.inpDefTxt(el,initialSearchInputValue,el.id==="query");
}else{new yp.inpDefTxt(el,initialNearInputValue,false);
el.smartBox=new yp.smartBox(el,autoCompDivs[i],"/yellowpages/yp/areasb",{paramName:"q"});
}});
new yp.recLocsDiv("recLocBut","area","ft_recLocsDiv");
if($("ft_area")){new yp.recLocsDiv("ft_recLocBut","ft_area","recLocsDiv");
}var cg_directions=$("from_input");
if(cg_directions){cg_directions.focus();
}var usrRate;
if(usrRate=$("userRating")){new yp.rating(usrRate,"star-rating");
}if(local.template==="ypdetails"||local.template==="freedetails"){var div=$("nearbypopup");
var link=$("nearby");
if(div!==null&&link!==null){Event.observe(link,"click",this.whatsNearbyPopup.bindAsEventListener(this));
Event.observe(document,"click",function(e){if((Event.element(e||event).descendantOf(div)||Event.element(e||event)===div)&&Event.element(e||event).nodeName.toLowerCase()!="a"){Event.stop(e);
return ;
}if(div.visible()){this.whatsNearbyPopup(false);
}if(typeof hideS2C==="function"&&$("s2cFrame")!==null){if($("s2cFrame").style.visibility==="visible"){hideS2C("s2cFrame");
}}}.bind(this));
}}else{if(local.template==="listings"){$$("p.description").each(function(p){var a;
if((a=p.getElementsBySelector("span.more-link a")).length>0){Event.observe(a[0],"click",function(e){var el=Event.element(e||event);
el.up().hide();
el.up().next().show();
});
}if((a=p.getElementsBySelector("a.less-link")).length>0){Event.observe(a[0],"click",function(e){var el=Event.element(e||event);
el.up().hide();
el.up().previous().show();
});
}});
}}Event.observe(window,"resize",function(){yp.menus.invoke("position");
var div=$("nearbypopup"),link=$("nearby");
if(div!==null&&link!==null){if(div.visible()){div.style.left=((link.cumulativeOffset()[0])+20)+"px";
div.style.top=((link.cumulativeOffset()[1]+link.offsetHeight)+5)+"px";
}}}.bind(this));
},cmn:{getCityName:function(){var l=location.pathname;
l=l.substr(l.indexOf("local/")+6);
return l.substring(0,((l.indexOf("/")>-1)?l.indexOf("/"):l.length));
},getText:function(node){var txt="";
if(!node.nodeType){return ;
}if(node.nodeType==3){return(node.nodeValue.strip()!="")?node.nodeValue:"";
}else{if(node.childNodes.length>0){for(var i=0;
i<node.childNodes.length;
i++){txt+=this.getText(node.childNodes[i]);
}}}return(this.getText.caller!=this.getText)?txt.strip():txt;
},removeChildren:function(node){if(node==null){return ;
}while(node.childNodes.length>0){node.removeChild(node.firstChild);
}},ce:function(en,eid,ecl){var e=document.createElement(en);
if(eid!=null){e.id=eid;
}if(ecl!=null){e.className=ecl;
}return e;
},apTxt:function(ele,txt){return ele.appendChild(document.createTextNode(txt));
},oneTimeObserve:function(ele,actions,handler){var handlerOb=function(e){handler(e);
for(j=0;
j<actions.length;
j++){Event.stopObserving(e.target,actions[j],handler);
}};
for(i=0;
i<actions.length;
i++){Event.observe(ele,actions[i],handlerOb);
}}},snsSignIn:function(url,urlRedirect){var u;
if(url){u=url;
}else{u=this.snsUrl;
}if(u){if(urlRedirect){location.href=u+escape(escape(urlRedirect)).replace(/\//g,"%252F");
}else{location.href=u+escape(escape(location.href)).replace(/\//g,"%252F");
}}else{alert(i18n.yp_errorSignInLink);
}},snsSignOut:function(){if(this.snsLogoutUrl){location.href=this.snsLogoutUrl+escape(escape(location.href)).replace(/\//g,"%252F");
}else{alert(i18n.yp_errorSignOutLink);
}},clickThruLogging:function(loggingParamStr){var logging_url="/clickthrough";
new Ajax.Request(logging_url+loggingParamStr+"&ajx=1");
},logJSError:function(errormsg){var url="/jserrorlog";
new Ajax.Request(url+"?errormsg="+escape(errormsg)+"&ajx=1");
},filterby:function(divid,url){if(this.filterDivs.indexOf(divid)==-1){this.filterDivs.push(divid);
new Ajax.Updater(divid,url);
}yp.toggleFilterByDiv(divid);
},toggleFilterByDiv:function(divid){var divids=["excity","exzip","exatoz"];
for(i=0;
i<3;
i++){var el=$(divids[i]);
if(divid==divids[i]){if(el.style.display=="block"){el.style.display="none";
}else{el.style.display="block";
}}else{el.style.display="none";
}}},send2cell:{sendBusinessInfo:function(name,number,alink){s2c_subject=name;
if(typeof (alink)==="undefined"){alink="s2clink";
}var msg="";
if(number&&number!=""){number=": "+number;
}if(msg.length>110){msg=name.substr(0,110-(number.length+6))+"... "+number;
}else{msg=name+number;
}s2c_message=msg;
calls2cpopup();
return ;
}},browser:{ie:(document.all)?true:false,safari:(/WebKit/i.test(navigator.userAgent))?true:false,opera:(window.opera)?true:false,ie6:(navigator.userAgent.match("MSIE [5-6]{1}")!==null)},setDefaultLocation:function(id){if($(id)===null){return ;
}if($(id).value==initialNearInputValue||$(id).value.replace(/[^a-zA-Z0-9]/g,"")==""){yp.defaultLocationError(0,id,null);
return ;
}var ids=["def_loc","ft_def_loc"];
var el;
var url="/locationchecker?ajx=1&where="+escape($(id).value);
var opt={method:"get",asynchronous:false,onSuccess:function(t){var res=null;
try{res=eval("("+t.responseText+")");
if(res.suggestions!=null){yp.defaultLocationError(1,id,res);
}else{yp.updateDefaultLocation(res,id);
}}catch(e){yp.defaultLocationError(2,id);
}},on404:function(t){yp.defaultLocationError(3,id);
},onFailure:function(t){yp.defaultLocationError(4,id);
},onException:function(ajx,e){yp.dbgmsg("XMLHttpRequest error: "+e.message);
}};
new Ajax.Request(url,opt);
},defaultLocationError:function(errorNo,inpId,response){var input=$(inpId);
var outerdiv=$("loc_mngr_div");
var div=$("loc_mngr_cntnt");
yp.cmn.removeChildren(div);
var p=div.appendChild(yp.cmn.ce("p"));
var msg=i18n.yp_errorSetDefLoc;
if(errorNo==0){msg=i18n.yp_errorSetDefLoc0;
}yp.cmn.apTxt(p,msg);
outerdiv.style.left=((input.cumulativeOffset()[0]))+"px";
outerdiv.style.top=((input.cumulativeOffset()[1]+input.offsetHeight)+2)+"px";
if(errorNo==1){yp.showDefaultAlternatives(div,response,inpId);
}outerdiv.show();
setTimeout('yp.hideMsgDiv("loc_mngr_div")',10000);
},showDefaultAlternatives:function(sBox,response,inpId){this.inpId=inpId;
this.suggestResp=response;
var title="<p>"+i18n.yp_errorSetDefAlter+"</p>";
title+="<p class='loc'>"+$(inpId).value+"</p>";
title+="<p>"+i18n.yp_errorSetDefAlter+"</p>";
var str=title+"<div id='defLocAlts'><ol>",r;
for(var i=0;
i<response.suggestions.length;
i++){if(r=response.suggestions[i]){str+="<li class='defLocSugg'>";
str+=r.city;
str+=", ";
str+=r.state;
str+="</li>";
}}str+="</ol></div>";
sBox.update(str);
$("defLocAlts").getElementsBySelector("li.defLocSugg").each(function(el,i){el.num=i;
Event.observe(el,"click",function(e){var el=Event.element(e||event);
$(yp.inpId).value=yp.cmn.getText(el);
$("loc_mngr_div").hide();
var newResult={};
newResult.outcome=yp.suggestResp.suggestions[el.num];
yp.updateDefaultLocation(newResult,yp.inpId);
});
}.bind(this));
},updateDefaultLocation:function(res,id){if(!res.outcome.isok){yp.defaultLocationError();
return ;
}var input=$(id);
var zipPattern=/\d{5}/;
var addressFound=res.outcome.city+", "+res.outcome.state;
if(res.outcome.address&&res.outcome.address!=""){addressFound=res.outcome.address+", "+addressFound;
}if(res.outcome.zip&&res.outcome.zip!=""&&zipPattern.test(input.value)){addressFound+=" "+res.outcome.zip;
}else{res.outcome.zip="";
}locmngr.dfltloc.setDfltLoc(res.outcome.address,res.outcome.city,res.outcome.state,res.outcome.zip,res.outcome.longval,res.outcome.latval,res.outcome.dma);
var outerdiv=$("loc_mngr_div");
var div=$("loc_mngr_cntnt");
yp.cmn.removeChildren(div);
var p=div.appendChild(yp.cmn.ce("p"));
yp.cmn.apTxt(p,i18n.yp_setDefOk);
p=div.appendChild(yp.cmn.ce("p",null,"loc"));
yp.cmn.apTxt(p,addressFound);
p=div.appendChild(yp.cmn.ce("p"));
yp.cmn.apTxt(p,i18n.yp_setDefOk2);
outerdiv.style.left=((input.cumulativeOffset()[0]))+"px";
outerdiv.style.top=((input.cumulativeOffset()[1]+input.offsetHeight)+2)+"px";
outerdiv.show();
setTimeout('yp.hideMsgDiv("loc_mngr_div")',10000);
var el=$("area");
if(el){el.value=addressFound;
}el=$("ft_area");
if(el){el.value=addressFound;
}el=$("def_loc");
if(el){el.innerHTML=i18n.yp_changeDefLoc;
}el=$("ft_def_loc");
if(el){el.innerHTML=i18n.yp_changeDefLoc;
}},isValidPhone:function(phoneNumberInput){var othervalue=$(phoneNumberInput).value;
if(othervalue){var pat=/\"|-|\s|\+|\(|\)|\./g;
othervalue=othervalue.replace(pat,"");
if(othervalue!=""&&othervalue.replace(/\d+/,"")==""){return(othervalue.length==10||(othervalue.length==11&&othervalue[0]=="1"));
}}return false;
},testValidLocation:function(id,errorDiv){var errorMsg=i18n.yp_validLocInvalid;
var validLocation=false;
if($(id).value==initialNearInputValue||$(id).value.replace(/[^a-zA-Z0-9]/g,"")==""){errorMsg=i18n.yp_validLocEmpty;
}else{if($(id).value==lastTestedLocation){$(errorDiv).show();
var handler=function(e){yp.hideMsgDiv(errorDiv);
Event.stopObserving(e.target,"onkeypress",handler);
};
Event.observe($(id),"onkeypress",handler);
return false;
}else{validLocation=true;
}}if(!validLocation){if(errorDiv!=null){yp.printInputErrorMessage(id,errorDiv,errorMsg);
}return false;
}else{lastTestedLocation=null;
}return true;
},printInputErrorMessage:function(inputId,errorDiv,errorMsg){var input=$(inputId);
var outerdiv=$(errorDiv);
var div=$(errorDiv+"_msg");
yp.cmn.removeChildren(div);
var p=div.appendChild(yp.cmn.ce("p"));
yp.cmn.apTxt(p,errorMsg);
outerdiv.style.left=((input.cumulativeOffset()[0]))+"px";
outerdiv.style.top=((input.cumulativeOffset()[1]+input.offsetHeight)+2)+"px";
outerdiv.show();
var locationSBox=$(inputId).smartBox;
if(typeof (locationSBox)!="undefined"){locationSBox.breakAndHide();
locationSBox.hideMenu();
}var handler=function(e){yp.hideMsgDiv(errorDiv);
};
var actions=["keypress","click","submit"];
yp.cmn.oneTimeObserve(input,actions,handler);
lastTestedLocation=""+input.value;
$(inputId).focus();
},addFormInput:function(form,type,name,value){var form=$(form);
var newInput;
newInput=yp.cmn.ce("input",name,"");
newInput.type=type;
newInput.name=name;
newInput.value=value;
form.appendChild(newInput);
return newInput;
},hideMsgDiv:function(theDiv){$(theDiv).hide();
},whatsNearbyPopup:function(e){if(e!==false){e=e||event;
Event.stop(e);
}var div=$("nearbypopup");
var link=$("nearby");
if(div.visible()){div.hide();
}else{div.style.left=((link.cumulativeOffset()[0])+20)+"px";
div.style.top=((link.cumulativeOffset()[1]+link.offsetHeight)+5)+"px";
div.show();
}},catSearch:function(category){$("invocationType").value="localCatPick.search";
if($("area").value!=""&&$("area").value!=initialNearInputValue){$("query").value=category;
$("query").form.submit();
return false;
}return true;
},popSearch:function(srchText){yp.validatedSearch(srchText,"localYPHotSearch.search");
},catValidatedSearch:function(category){yp.validatedSearch(category,"localCatPick.search");
return false;
},validatedSearch:function(query,searchType,areaInput,errorDiv){if($("query")===null){return false;
}if(areaInput==null){input="area";
}if(errorDiv==null){errorDiv="query-error";
}$("query").value=query;
if(yp.testValidLocation(document.getElementById(input),errorDiv)){$("invocationType").value=searchType;
$("query").form.submit();
return true;
}else{$("area").focus();
}return false;
},isValidReviewText:function(text){var pat=/<.*>/;
var OK=!pat.test(text);
return OK;
},checkCommentForm:function(formId){var d=document.forms[formId];
if(d.comments.value.strip()===""){alert(i18n.yp_commentEmpty);
return false;
}else{if(!yp.isValidReviewText(d.comments.value)){alert(i18n.yp_commentBadChars);
return false;
}else{var cke=document.cookie.split("; ");
var ckeIdx=[];
for(var i=0;
i<cke.length;
i++){var tmpCke=cke[i].split("="),val="";
for(var j=1;
j<tmpCke.length;
j++){val+="="+tmpCke[j];
}ckeIdx[tmpCke[0]]=val.substr(1);
}if(ckeIdx.commentWait){alert(i18n.yp_commentTooFast);
return false;
}return true;
}}},setCommentCookie:function(){var cDomain="aol.com";
var cookieName="commentWait";
var cookieVersion="1.0";
var seconds=10;
var exp=new Date();
exp=new Date(exp.getTime()+(1000*seconds));
document.cookie=cookieName+"="+cookieVersion+"; expires="+exp.toGMTString()+"; path=/; domain="+cDomain;
return true;
},signInToComment:function(id){yp.signInAnchorForm=id;
},signInToReview:function(){yp.signInAnchorForm=null;
},reviewsSignIn:function(snsURL){var newUrl=location.href;
newUrl=newUrl.replace(/#.*/,"").replace(/(&?)(formActive|cPage|divActive|divId|reviewUri|commentok|formActive|review_title|review_text|Submit|star-rating)=.*?(&|$)/g,"$3").replace(/\s+$/,"");
if(yp.signInAnchorForm){if(newUrl.indexOf("?")==-1){newUrl+="?";
}else{if(newUrl[newUrl.length-1]!="&"){newUrl+="&";
}}newUrl+="formActive="+yp.signInAnchorForm+"";
newUrl+="#"+yp.signInAnchorForm;
}else{newUrl+="#add_reviews";
}yp.snsSignIn(snsURL,newUrl);
},switchShowingDiv:function(showingId,newId,anchorit){if($(showingId)){$(showingId).hide();
}yp.toggleDiv(newId,anchorit);
},commentLink:function(id){if($(id)&&$(id).visible()){$(id).hide();
return false;
}else{return true;
}},showDiv:function(id,anchorit){if($(id)){$(id).show();
if(anchorit&&$(id).visible()){window.location.hash=id;
}}},toggleDiv:function(id,anchorit){if($(id)){$(id).toggle();
if(anchorit&&$(id).visible()){window.location.hash=id;
}}},hideDiv:function(id){if($(id)){$(id).hide();
}},goAndFocus:function(id){if($(id)){window.location.hash=id;
$(id).focus();
}},checkRatingForm:function(){var d=document.forms.SubmitReviews;
var correctForm=true;
if(((d["star-rating"].value.strip()!=""&&d["star-rating"].value.strip()!="0")&&d.review_title.value.strip()===""&&d.review_text.value.strip()==="")||((d["star-rating"].value.strip()!=""&&d["star-rating"].value.strip()!="0")&&d.review_title.value.strip()!=""&&d.review_text.value.strip()!="")){correctForm=true;
}else{correctForm=false;
}if(correctForm){if(d.review_text.value.strip()!=""&&!yp.isValidReviewText(d.review_text.value)){alert(i18n.yp_reviewBadChars);
return false;
}return true;
}else{alert(i18n.yp_reviewAnyBad);
return false;
}},validateSearchInput:function(queryId,areaId,errorDivId){return yp.isValidPhone(queryId)||yp.testValidLocation(document.getElementById(areaId),errorDivId);
}};
function popUp(link,title,width,height,menu,scroll){link=link.replace("#","%23");
if(menu==1){menu="yes";
}else{menu="no";
}if(scroll==1){scroll="yes";
}else{scroll="no";
}window.open(link,title,"width="+width+",height="+height+",menubar="+menu+",scrollbars="+scroll+",directories=no,location=no,status=no,toolbar=no,resizable=yes");
}yp.inpDefTxt=Class.create({initialize:function(ele,defTxt,defaultInput){this.defColor="#aaa";
this.normColor="#000";
this.ele=$(ele);
this.defTxt=defTxt;
this.defaultInput=defaultInput||false;
this.firstTime=true;
Event.observe(this.ele,"blur",this.setText.bindAsEventListener(this));
Event.observe(this.ele,"focus",this.clearText.bindAsEventListener(this));
Event.observe(this.ele,"keydown",this.clearText.bindAsEventListener(this));
Event.observe(this.ele,"click",this.clearText.bindAsEventListener(this));
this.setText();
if(this.defaultInput&&location.hash==""){this.ele.focus();
}},setText:function(e){if(this.ele.value==""||(this.setText.caller==this.initialize&&this.ele.getAttribute("value")=="")){this.ele.value=this.defTxt;
}if(this.ele.value==this.defTxt){this.ele.style.color=this.defColor;
}},clearText:function(e){e=e||event;
if(e.type.indexOf("focus")>-1&&this.firstTime&&this.defaultInput){this.firstTime=false;
return ;
}if(this.ele.value==this.defTxt){this.ele.value="";
this.ele.style.color=this.normColor;
}}});
yp.smartBox=Class.create({initialize:function(ele,outDiv,url,options){yp.menus.push(this);
this.options=options||{};
this.url=url;
this.ele=$(ele);
this.outDiv=$(outDiv);
this.entry=null;
this.entryCheckInt=null;
this.lastQuery=null;
this.listOpen=false;
this.optHighlighted=null;
this.somethingHighlighted=false;
this.formSubmitted=false;
this.mouseOverMenu=false;
this.breakOperation=false;
this.asking=false;
Event.observe(this.ele,"keyup",this.keyPressTimer.bindAsEventListener(this));
Event.observe(this.ele,"keydown",this.keyPressCheck.bindAsEventListener(this));
Event.observe(this.outDiv,"click",function(e){e=e||event;
e.cancelBubble=true;
if(e.stopPropagation){e.stopPropagation();
}}.bindAsEventListener(this));
Event.observe(document,"click",this.hideMenu.bindAsEventListener(this));
},initDomStuff:function(){this.position();
Event.observe(this.ele.form,"submit",function(e){if(this.listOpen){Event.stop(e);
}else{this.formSubmitted=true;
}}.bindAsEventListener(this));
},position:function(){this.outDiv.style.top=((this.ele.cumulativeOffset()[1]+this.ele.offsetHeight)+(yp.browser.ie?1:0))+"px";
this.outDiv.style.left=((this.ele.cumulativeOffset()[0])+(yp.browser.ie?1:0))+"px";
this.outDiv.style.width=((this.ele.offsetWidth-16)+(yp.browser.ie6?16:0))+"px";
},getDataFromInput:function(){if(((this.lastQuery==this.entry&&this.outDiv.visible())&&this.entry!="")||this.entry==""||this.formSubmitted){return ;
}this.lastQuery=this.entry;
this.entryCheckInt=null;
new Ajax.Updater(this.outDiv,this.url,{parameters:eval('({"'+(this.options.paramName||"value")+'":"'+this.entry+'","ajx":1})'),onSuccess:function(){window.setTimeout(this.showMenu.bind(this),100);
}.bind(this),method:"get"});
},keyPressCheck:function(e){e=e||event;
if(this.listOpen){var ps=null,ns=null,t;
if(this.optHighlighted!==null){ps=this.optHighlighted.previous();
ns=this.optHighlighted.next();
}switch(e.keyCode){case Event.KEY_DOWN:Event.stop(e);
if(ns!=null&&ns.nodeName.toLowerCase()=="li"){this.highlightOption({target:ns,srcElement:ns,typ:"",dummy:true});
}else{if((t=this.outDiv.getElementsBySelector("li:first-child")).length>0){this.highlightOption({target:t[0],srcElement:t[0],typ:"",dummy:true});
}}break;
case Event.KEY_UP:Event.stop(e);
if(ps!=null&&ps.nodeName.toLowerCase()=="li"){this.highlightOption({target:ps,srcElement:ps,type:"",dummy:true});
}else{if((t=this.outDiv.getElementsBySelector("li:last-child")).length>0){this.highlightOption({target:t[0],srcElement:t[0],typ:"",dummy:true});
}}break;
case Event.KEY_RETURN:if(this.somethingHighlighted){this.selectOption({target:this.optHighlighted,srcElement:this.optHighlighted,dummy:true});
Event.stop(e);
}else{if(this.ele.id.indexOf("query")>-1){var id="area",el;
if(this.ele.id.indexOf("ft_")>-1){id="ft_"+id;
}if(el=$(id)){el.focus();
el.select();
}Event.stop(e);
}else{if(this.ele.id.indexOf("area")>-1){this.hideMenu();
}}}break;
case Event.KEY_ESC:Event.stop(e);
this.hideMenu();
break;
}}},keyPressTimer:function(e){e=e||event;
if(!(e.keyCode==Event.KEY_RETURN||e.keyCode==Event.KEY_DOWN||e.keyCode==Event.KEY_UP)){window.clearTimeout(this.entryCheckInt);
this.entry=Event.element(e).value.replace(/\"/g,'\\"');
if(this.entry.length==0){this.hideMenu();
}else{this.hilghtMatches();
this.asking=true;
this.entryCheckInt=window.setTimeout(function(){if(this.entry==this.ele.value){this.getDataFromInput();
}}.bind(this),300);
}}},hilghtMatches:function(){if(navigator.userAgent.indexOf("WebKit")>-1&&navigator.userAgent.match("Version/[3-9]{1}")==null){return ;
}var lis=this.outDiv.getElementsBySelector("li");
if(this.entry.length<1||lis.length==0){return ;
}var re=new RegExp(this.entry,"ig");
for(var i=0;
i<lis.length;
i++){lis[i].update(yp.cmn.getText(lis[i]).replace(re,'<span class="hl">$&</span>'));
}},breakAndHide:function(){if(this.asking){this.breakOperation=true;
}},showMenu:function(){yp.menus.invoke("hideMenu");
var lis=$A(this.outDiv.getElementsByTagName("li"));
this.asking=false;
if(lis.length>0&&!this.breakOperation){this.outDiv.show();
this.position();
this.outDiv.scrollTop=0;
this.somethingHighlighted=false;
lis.each(function(li){Event.observe(li,"mouseover",this.highlightOption.bindAsEventListener(this));
Event.observe(li,"click",this.selectOption.bindAsEventListener(this));
}.bind(this));
this.listOpen=true;
this.hilghtMatches();
var dv=document.viewport;
if(this.outDiv.scrollIntoView&&(dv.getHeight()+dv.getScrollOffsets().top<this.outDiv.offsetTop+this.outDiv.offsetHeight)){this.outDiv.scrollIntoView(false);
}}else{this.breakOperation=false;
this.outDiv.hide();
return ;
}},hideMenu:function(e){if(this.hideMenu.caller==this.selectOption&&this.mouseOverMenu){return ;
}this.outDiv.hide();
this.optHighlighted=null;
this.listOpen=false;
},highlightOption:function(e){var t,el;
e=e||event;
if((t=this.outDiv.getElementsBySelector("li.selected")).length>0){t[0].removeClassName("selected");
}(el=Event.findElement(e,"li")).addClassName("selected");
this.optHighlighted=Event.element(e);
this.somethingHighlighted=true;
if(e.dummy==true){el=Event.element(e);
if(el.positionedOffset()[1]>(this.outDiv.offsetHeight+this.outDiv.scrollTop-el.offsetHeight)){this.outDiv.scrollTop=el.positionedOffset()[1]-this.outDiv.offsetHeight+22;
}else{if(el.positionedOffset()[1]<this.outDiv.scrollTop){this.outDiv.scrollTop=el.positionedOffset()[1];
}}}},selectOption:function(e){var t;
e=e||event;
if(!e.dummy){e.cancelBubble=true;
if(e.stopPropagation){e.stopPropagation();
}}this.ele.value=Event.findElement(e,"li").innerHTML.stripTags().replace(/&amp;/g,"&");
this.hideMenu();
this.ele.focus();
this.ele.select();
}});
yp.recLocsDiv=Class.create({initialize:function(but,input,outDiv){yp.menus.push(this);
this.ele=$(input);
this.but=$(but);
this.outDiv=$(outDiv);
this.menuOpen=false;
Event.observe(this.but,"click",this.clickBut.bindAsEventListener(this));
Event.observe(this.outDiv,"click",function(e){e=e||event;
e.cancelBubble=true;
if(e.stopPropagation){e.stopPropagation();
}}.bindAsEventListener(this));
Event.observe(document,"click",this.hideMenu.bindAsEventListener(this));
var lis=$A(this.outDiv.getElementsByTagName("li"));
lis.each(function(li){Event.observe(li,"mouseover",this.highlightOption.bindAsEventListener(this));
Event.observe(li,"click",this.selectOption.bindAsEventListener(this));
}.bind(this));
},hideMenu:function(){this.outDiv.hide();
this.menuOpen=false;
},showMenu:function(){yp.menus.invoke("hideMenu");
this.outDiv.show();
this.position();
this.menuOpen=true;
var dv=document.viewport;
if(this.outDiv.scrollIntoView&&(dv.getHeight()+dv.getScrollOffsets().top<this.outDiv.offsetTop+this.outDiv.offsetHeight)){this.outDiv.scrollIntoView(false);
}},clickBut:function(e){e=e||event;
Event.stop(e);
if(this.menuOpen){this.hideMenu();
}else{this.showMenu();
}},position:function(){this.outDiv.style.left=(this.ele.cumulativeOffset()[0])+"px";
this.outDiv.style.top=(this.ele.cumulativeOffset()[1]+this.ele.offsetHeight)+"px";
this.outDiv.style.width=(this.ele.offsetWidth+14)+"px";
},highlightOption:function(e){var t;
e=e||event;
if((t=this.outDiv.getElementsBySelector("li.selected")).length>0){t[0].removeClassName("selected");
}Event.element(e).addClassName("selected");
this.optHighlighted=Event.element(e);
},selectOption:function(e){var t;
e=e||event;
e.cancelBubble=true;
if(e.stopPropagation){e.stopPropagation();
}this.ele.value=Event.element(e).innerHTML.stripTags();
this.hideMenu();
this.ele.focus();
this.ele.select();
}});
yp.rating=Class.create({initialize:function(ul,formEleId){this.originalRating=0;
this.currRating=0;
if((this.ul=$(ul))===null){throw"no UL found";
}if((this.formEleId=$(formEleId))===null){throw"hidden form field not found";
}(this.as=this.ul.getElementsBySelector("a")).each(function(a){Event.observe(a,"mouseover",this.overStar.bindAsEventListener(this));
Event.observe(a,"mouseout",function(e){var targetEle;
if(e){targetEle=e.relatedTarget;
}else{targetEle=event.toElement;
}if(targetEle!==null&&targetEle.descendantOf("userRating")){Event.stop(e||event);
}}.bind(this));
Event.observe(a,"click",this.clickStar.bindAsEventListener(this));
}.bind(this));
if(this.formEleId.value!=""){var num=parseInt(this.formEleId.value);
this.currRating=num;
this.originalRating=num;
this.showStars(num,true);
}Event.observe(this.ul,"mouseout",function(){this.showStars(0);
}.bindAsEventListener(this));
Event.observe(this.formEleId.form,"reset",this.formReset.bindAsEventListener(this));
},formReset:function(e){this.formEleId.value=this.originalRating;
this.currRating=this.originalRating;
this.showStars(this.currRating);
},overStar:function(e){e=e||event;
if(e.type.indexOf("over")>-1){this.showStars(this.getNum(Event.element(e)),false);
}else{this.showStars(0);
}},clickStar:function(e){e=e||event;
var num=this.getNum(Event.element(e));
this.showStars(num,true);
this.currRating=num;
this.formEleId.value=num;
Event.element(e).blur();
},getNum:function(a){return parseInt(a.firstChild.nodeValue.replace(/^\s*|\s*$/g,""));
},showStars:function(num,full){if(num==0){num=this.currRating;
full=true;
}this.as.each(function(a){var currNum=this.getNum(a);
if(currNum>num||(currNum<=num&&!a.hasClassName(full?"full":"half"))){a.className="";
}if(currNum<=num){a.addClassName(full?"full":"half");
}}.bind(this));
}});
document.observe("dom:loaded",function(){yp.init();
});
function promo(name){if(typeof (s)!="undefined"){s.tl(true,"o",name);
}var now=new Date();
var later=now.getTime()+150;
while(true){now=new Date();
if(now.getTime()>later){return ;
}}}function helperTextOnFocus(inputObj,helperText,maxLength){inputObj.style.color="#000";
if(inputObj.value==helperText){inputObj.value="";
}if(maxLength){inputObj.setAttribute("maxLength",maxLength);
}}function helperTextOnBlurOnChange(inputObj,helperText,maxLength,printVisibility){if(inputObj.value==""){if(maxLength){inputObj.setAttribute("maxLength",helperText.length);
}inputObj.style.color="#666";
inputObj.value=helperText;
}else{if(maxLength){inputObj.setAttribute("maxLength",maxLength);
}inputObj.style.color="#000";
}}function aolwebsearchsubmit(){var inp=$("aolinput");
if(!inp){return ;
}var q=inp.value;
var url="http://search.aol.com/aol/search?query="+q+"&invocationType=hdmapquest";
location.href=url;
}