
var AjaxControlManager=new AjaxControlManagerClass();function AjaxControlManagerClass()
{var maximumFindsToShow=4;var MapSearchItemIdPrefix="FindMapSearchItem";var BusinessSearchItemIdPrefix="FindBusinessSearchItem";var BusinessSearchLocationIdPrefix="FindBusinessSearchLocation";var PersonSearchItemIdPrefix="FindPersonSearchItem";var PersonSearchItemIdPrefix="FindPersonSearchLocation";var DirectionSearchToIdPrefix="DirectionSearchToItem";var DirectionSearchFromIdPrefix="DirectionSearchFromItem";var pannelOpen=false;var findDisplayed=false;this.openLeftNavPane=function(index){var behavior=this.getLeftNavBehaviour();if(behavior){var pane=behavior._panes[index];if(pane){pane.header.className="visiblePane accordionHeaderSelected accordionWidth";pane.content.className="visiblePane";}
behavior.set_SelectedIndex(index);var leftNavProxyPanel=document.getElementById('leftNavProxyPanel');if(leftNavProxyPanel)
leftNavProxyPanel.className="hidden";}
pannelOpen=true;}
this.OpenAccordionPane=function(behaviour,index){if(index==-1)
return;if(behaviour){behaviour.set_SelectedIndex(index);document.getElementById('header'+index).className='nestedAccordionHeaderSelected';}}
this.LeftNavAccordionHeaderClicked=function(index){pannelOpen=pannelOpen?false:true;this.OpenCloseLeftNavAccordion();return;}
this.OpenCloseLeftNavAccordion=function(){if(!pannelOpen){YPSearchManager.ClearFind();this.findDisplayed(false);}
else{if(!findDisplayed)
mapManager.PerformSelectedSearch();this.findDisplayed(true);}
return;}
this.findDisplayed=function(displayed){findDisplayed=displayed;}
this.getLeftNavBehaviour=function()
{var behavior=$find('leftNavAccordion_AccordionExtender');return behavior;}
this.getBusinessDirectionFindAccordion=function(){var behavior=$find(accordionBusinessDirectionFindAccordionId+"_AccordionExtender");return behavior;}
this.addPaneToBusinessDirectionFind=function(title,contentDivIdPrefix,to,from,sbn){var behavior=this.getBusinessDirectionFindAccordion();var root=behavior.get_element();var header;var paneContent;hideUnwantedPane(behavior,maximumFindsToShow);var paneCount=behavior.get_Count();var parentDiv=document.getElementById(accordionBusinessDirectionFindAccordionId);header=document.createElement("div");parentDiv.appendChild(header);header.id="header"+paneCount;this.setBusinessDirectionFindHeader(paneCount,title,contentDivIdPrefix,to,from,sbn);paneContent=document.createElement("div");parentDiv.appendChild(paneContent);paneContent.id="content"+paneCount;paneContent.setAttribute("style","overflow-x:hidden;");paneContent.setAttribute("style","overflow-y:scroll;");paneContent.setAttribute("style","border-bottom:none;");this.setBusinessDirectionFindContent(paneCount,contentDivIdPrefix);behavior.addPane(header,paneContent);ClientCache.Save('last_pane_num',paneCount);ClientCache.Save('selected_pane_num',paneCount);return paneCount;}
this.setBusinessDirectionFindHeader=function(paneCount,title,contentDivIdPrefix,to,from,sbn){var header=document.getElementById('header'+paneCount);if(contentDivIdPrefix=='yp_DrivingDirections'){header.onclick=new Function("AjaxControlManager.BusinessDirectionFindHeaderClicked('"+paneCount+"',\""+from+"\",\""+to+"\")");header.innerHTML=title+"<input  type='hidden' id='"+DirectionSearchToIdPrefix+paneCount+"' value='"+to+"'/>"+"<input  type='hidden' id='"+DirectionSearchFromIdPrefix+paneCount+"' value='"+from+"'/>";}
else if(contentDivIdPrefix=='yp_FindOnMap'){header.onclick=new Function("AjaxControlManager.BusinessDirectionFindHeaderClicked('"+paneCount+"')");header.innerHTML=title+"<input type='hidden' id='"+MapSearchItemIdPrefix+paneCount+"' value='"+to+"'/>";}
else if(contentDivIdPrefix=='yp_FindBusiness'){header.onclick=new Function("AjaxControlManager.BusinessDirectionFindHeaderClicked('"+paneCount+"',\""+from+"\",\""+to+"\",\""+sbn+"\")");header.innerHTML=to+' '+resourceNear+' '+from+"<input type='hidden' id='"+BusinessSearchItemIdPrefix+paneCount+"' value='"+to+"'/><input type='hidden' id='"+BusinessSearchLocationIdPrefix+paneCount+"' value='"+from+"'/>";}
else{header.onclick=new Function("AjaxControlManager.BusinessDirectionFindHeaderClicked('"+paneCount+"',\""+from+"\",\""+to+"\")");header.innerHTML=decodeURI(to)+' '+resourceNear+' '+decodeURI(from)+"<input type='hidden' id='"+BusinessSearchItemIdPrefix+paneCount+"' value='"+decodeURI(to)+"'/><input type='hidden' id='"+BusinessSearchLocationIdPrefix+paneCount+"' value='"+decodeURI(from)+"'/>";}
header.setAttribute("class","nestedAccordionHeader");header.setAttribute("className","nestedAccordionHeader");}
this.setBusinessDirectionFindContent=function(paneCount,contentDivIdPrefix){var paneContent=document.getElementById('content'+paneCount);if(contentDivIdPrefix=='yp_FindBusiness'||contentDivIdPrefix=='yp_FindPerson')
paneContent.innerHTML="<div style='width:93%; height:auto;overflow-y:auto;overflow-x:hidden;'><div id='fab_summary"+paneCount+"' class='yp_resultsummary'><div>"+resourceElementSearching+"...</div></div><div id='fab_goto_top"+paneCount+"' class='yp_gotopage'></div><div id='fab_full"+paneCount+"' class='resultPageDiv'><table id='fab_table"+paneCount+"' style='width:100%'></table></div><div id='fab_goto"+paneCount+"' class='yp_gotopage'></div></div>";else
paneContent.innerHTML="";var innerDiv=document.createElement("div");innerDiv.id=contentDivIdPrefix+paneCount;paneContent.appendChild(innerDiv);paneContent.setAttribute("class","nestedAccordionContent");paneContent.setAttribute("className","nestedAccordionContent");}
this.getNextPaneNumber=function(){var behavior=this.getBusinessDirectionFindAccordion();if(behavior==null)
return(0);return(behavior.get_Count());}
this.BusinessDirectionFindHeaderClicked=function(paneIndex,first,second,sbn)
{YPSearchManager.ClearFind();if(ClientCache.Retrieve('selected_pane_num')!=paneIndex){if(sbn==true)document.getElementById('cbBusOnly').checked=true;ClientCache.Save('selected_pane_num',paneIndex);mapManager.EmulateSelectedPaneFind(paneIndex,first,second,sbn);}else{ClientCache.Save('selected_pane_num',-1);}}
function hideUnwantedPane(behavior,toKeep)
{for(var i=0;i<=behavior.get_Count()-toKeep;i++)
{var pane=behavior._panes[i];if(pane){pane.header.className="hiddenPane";pane.content.className="hiddenPane";}}
ClientCache.Save('firstPaneNumber',(((behavior.get_Count()-toKeep+1)<0?0:(behavior.get_Count()-toKeep+1))));}
this.removePaneFromLeftNav=function(index)
{var behavior=this.getLeftNavBehaviour();var root=behavior.get_element();if(index==undefined)
{index=behavior._panes.length-1;}
if(index>=5)
{var pane=behavior._panes[index];if(pane)
{var animation=pane.animation;if(animation)
{if(animation.get_isPlaying())
{animation.stop();}
if(animation._ended)
{animation.remove_ended(animation._ended);animation._ended=null;}
animation.dispose();animation._length=null;animation._fade=null;animation._pane=null;animation._opening=null;animation._behavior=null;pane.animation=null;}
if(pane.header)
{pane.header._index=null;$removeHandler(pane.header,"click",behavior._headerClickHandler);pane.header=null;}
if(pane.content)
{pane.content._original=null;pane.content=null;}
behavior._panes.splice(index,1);delete pane;}
var parentDiv=document.getElementById("leftNavAccordion");for(var x=index*2+2;x>=index*2+1;x--)
{parentDiv.removeChild(parentDiv.childNodes[x]);}}}}