function MapManager(){var mapElement=null;this.MapElement=null;var VEtoken=null;var isCategorySearch=null;var wayPointLetters=new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");var mapStyleList=new Array(null,VEMapStyle.Road,VEMapStyle.Aerial,VEMapStyle.Hybrid);var SelectedMapId=null;var SelectedMapInfo={mapID:SelectedMapId,Latitude:null,Longitude:null,ZoomLevel:null,MapStyle:null};var mapSearchAttachedPZ=false;this.MapSearchAttachedPZ=mapSearchAttachedPZ;var mapSearchReAttachablePZ=false;this.GetWayPointLetter=function(index){return wayPointLetters[index]};this.GetIsCategorySearch=function(){return isCategorySearch};this.SetCategorySearch=function(value){isCategorySearch=value};this.SetSelectedMap=function(value){SelectedMapInfo=value};this.GetSelectedMap=function(){return SelectedMapInfo};this.SetSelectedMapId=function(value){SelectedMapId=value};this.GetSelectedMapId=function(){return SelectedMapId};this.GetMapStyle=function(mapStyleInt){return mapStyleList[mapStyleInt]};this.GetMapStyleIndex=function(mapStyle){var ctr="";for(var i=0;i<mapStyleList.length;i++){if(mapStyleList[i]==mapStyle){return i}}return ctr};this.keyDownOnMap=function(e){var keyIsBirdsEyeShortcut=(e.keyCode==66||e.keyCode==79);return keyIsBirdsEyeShortcut};var map=null;this.Map=map;this.GetPrintMap=function(mapDivElement){map=new VEMap(mapDivElement);this.Map=map;map.LoadMap();map.HideDashboard();map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers)};this.PrepareForMapPointGeocoding=function(address){var postalCode=address.match(/([a-z])(\d)([a-z])\s?(\d[a-z]\d)?/i);var firstFSALetter="";var FSA="";if(postalCode!=null){firstFSALetter=postalCode[1];FSA=(postalCode[1]!=undefined?postalCode[1]:"")+(postalCode[2]!=undefined?postalCode[2]:"")+(postalCode[3]!=undefined?postalCode[3]:"");if(address==postalCode[0]){return(postalCode[1]+postalCode[2]+postalCode[3]+" "+postalCode[4])}else{address=address.replace(postalCode[0],"")}}address=address.replace(/^[uUsS]\d+[\-\s]+(\d)/,"$1");address=address.replace(/^\d+\s*\-\s*(\d+)[\s,]/,"$1 ");address=address.replace(/\b(unite?|u|bureau|suite|app(artement)?|apartment|apt)\s*\d+[a-z]*(\s*&\s*\d+[a-z]*)?/i," ");address=address.replace(/\b\d+(st|nd|rd|th)?\s*(fl|floor)\b/i," ");address=address.replace(/\bfirst floor\b/i,"");address=address.replace(/\b\d+\s*(er?|i[èe]me?|eme)\s[eé]tage\b/i,"");address=address.replace(/\bE(st)?\b/i,"East");address=address.replace(/\bS(ud)?\b/i,"South");address=address.replace(/\b(Ouest|O|W)\b/i,"West");address=address.replace(/\bN(ord)?\b/i,"North");address=address.replace(/\b(po|p\.o\.) box [a-z0-9]+/gi,"");address=address.replace(/^box [a-z0-9]+/i,"");address=address.replace(/\b(stn|station) (main|[a-z])\b/i,"");address=address.replace(/\b(at)\b/i,"and");return(address+FSA)};this.GetMapWidthHeight=function(){var myWidth=0;var myHeight=(browserManager.BrowserName=="msie"?(0-1):(browserManager.BrowserName=="safari"?(0-7):0));if(typeof(window.innerWidth)=="number"){myWidth+=window.innerWidth;myHeight+=window.innerHeight}else{if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth+=document.documentElement.clientWidth;myHeight+=document.documentElement.clientHeight}else{if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth+=document.body.clientWidth;myHeight+=document.body.clientHeight}}}var mapHeight=parseInt(myHeight-100);mapHeight=mapHeight<200?200:mapHeight;var mapWidth=myWidth;if($("yp_DrivingDirections0").style.display=="block"){var maxWidth=736}else{var maxWidth=964}if(isMerchantPage==true){if(isBranchSearch==true){maxWidth=642;mapHeight=360;document.getElementById("ErrHeaderTxt").style.display="none"}else{if(isMPMapExpanded==true){mapHeight=450;if($("yp_DrivingDirections0").style.display=="block"){var maxWidth=735;$("mapBorder").addClassName("ypMerchtMapExpandedStyle");$("navcontrol").addClassName("ypMerchtMapNavcontrolDDFix")}else{if($("navcontrol")!=undefined){$("navcontrol").removeClassName("ypMerchtMapNavcontrolDDFix")}maxWidth=978}$("mapBorder").removeClassName("ypMerchtMapCollapsedStyle")}else{mapHeight=247;mapWidth=324;$("mapBorder").addClassName("ypMerchtMapCollapsedStyle");$("mapBorder").removeClassName("ypMerchtMapExpandedStyle");if($("navcontrol")!=undefined){$("navcontrol").removeClassName("ypMerchtMapNavcontrolDDFix")}}}}mapWidth=mapWidth>maxWidth?maxWidth:mapWidth;if(isMerchantPage==true){$("BackgroundPanel").setStyle({height:mapHeight+"px",width:"964px",left:"7px",top:"6px"})}if(isDoubleHeader==true&&isMerchantPage==false){mapHeight=600;cobrandHeaderHeight=$("cobrandHeader").getHeight();mapHeight=mapHeight-cobrandHeaderHeight;mapHeight=mapHeight<450?450:mapHeight}var widthHeight=new Array();widthHeight.push(mapWidth);widthHeight.push(mapHeight);return widthHeight};this.GetMap=function(mapDivElement,centerLatitude,centerLongitude,zoom,token){mapElement=mapDivElement;this.MapElement=document.getElementById(mapElement);this.VEtoken=token;var myWidthHeight=this.GetMapWidthHeight();document.getElementById(mapElement).style.width=myWidthHeight[0]+"px";document.getElementById(mapElement).style.height=myWidthHeight[1]+"px";map=new VEMap(mapDivElement);this.Map=map;paneNumber=-1;map.LoadMap(new VELatLong(centerLatitude,centerLongitude),zoom);map.HideDashboard();map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers);AddNavControl();AddMaplevelAlertMessageControl();map.ClearInfoBoxStyles();map.AttachEvent("onresize",this.OnMapResize);map.AttachEvent("onclick",MouseHandler);map.AttachEvent("onstartpan",HideCurrentEro);map.AttachEvent("onstartzoom",HideCurrentEro);map.AttachEvent("onendpan",ShowCurrentEro);map.AttachEvent("onendpan",this.updateClientCacheCenter);map.AttachEvent("onendzoom",this.updateClientCacheZoom);map.AttachEvent("onchangemapstyle",this.updateClientCacheStyle);map.AttachEvent("onchangemapstyle",this.detachPZSearchCheck);map.AttachEvent("onobliqueenter",OnObliqueEnterHandler);map.AttachEvent("onobliqueleave",OnObliqueLeaveHandler);map.AttachEvent("onmouseover",this.mouseoverCB);map.AttachEvent("onmouseout",this.mouseoutCB);window.onresize=this.MapResize;if(browserManager.BrowserName!="msie"){MapControl.Features.ScaleBarKilometers=true}browserManager.GetWindowHeight()};function AddMyControl(){var control;if(control==null){control=document.createElement("div");control.id="myControl";control.style.top="100px";control.style.right="100px";control.style.width="100px";control.style.border="2px solid black";control.style.background="White";control.innerHTML="my control";mapManager.Map.AddControl(control)}}function mapSearch(mapEvent){var lastLat=ClientCache.Retrieve("Latitude");var lastLong=ClientCache.Retrieve("Longitude");var lastZoomSearch=ClientCache.Retrieve("zoomSearch");var curZoomLevel=mapManager.Map.GetZoomLevel();if(debug){console.log("In mm.mapSearch: lastZoomSearch: %s curZoomLevel: %s",lastZoomSearch,curZoomLevel)}var curLat=mapManager.Map.GetCenter().Latitude;var curLong=mapManager.Map.GetCenter().Longitude;if(debug){console.log("==== mapSearch triggered by ===",mapEvent)}var threshold=0.03;var latDiff=Math.abs(lastLat-curLat);var lonDiff=Math.abs(lastLong-curLong);if(debug){console.log("In mm.mapSearch: lastVsCur lat: %f %f lon %f %f. [Diff latDiff: %f lonDiff: %f]",lastLat,curLat,lastLong,curLong,latDiff,lonDiff)}if((latDiff<threshold)&&(lonDiff<threshold)&&(curZoomLevel>=lastZoomSearch)){if(debug){console.log("In mm.mapSearch: Prevented onendpan/onendzoom from triggering another search.  curZoomLevel: %s >= lastZoomSearch: %s so skip running search",curZoomLevel,lastZoomSearch)}return false}if(debug){console.log("**** !!!! Starting another search... !!!!")}mapManager.NewFindBusiness()}this.detachPZSearchCheck=function(e){if(e.mapStyle=="o"||e.mapStyle=="b"){if(debug){console.log("In mm.detachPZSearchCheck:  Connected: %s.",mapSearchAttachedPZ)}if(mapSearchAttachedPZ){if(debug){console.log("In mm.detachPZSearchCheck:  Connected: %s.  Going to disconnect.",mapSearchAttachedPZ)}mapManager.Map.DetachEvent("onendpan",mapSearch);mapManager.Map.DetachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=false;mapSearchReAttachablePZ=true}}else{if(mapSearchReAttachablePZ){if(debug){console.log("In mm.detachPZSearchCheck:  Connected: %s.  Going to connect. mapSearchReAttachablePZ: %s",mapSearchAttachedPZ,mapSearchReAttachablePZ)}mapManager.Map.AttachEvent("onendpan",mapSearch);mapManager.Map.AttachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=true;mapSearchReAttachablePZ=false}}};this.AttachPanZoomEventMapSearch=function(){map.AttachEvent("onendpan",mapSearch);map.AttachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=true};function OnObliqueEnterHandler(){if(map.IsBirdseyeAvailable()){if(debug){console.log("OnObliqueEnterHandler: map.IsBirdseyeAvailable() is true")}$YP("#a_birdseye").parent().removeClass("ypgNavDisabled")}}function OnObliqueLeaveHandler(){if(!map.IsBirdseyeAvailable()){if(debug){console.log("OnObliqueLeaveHandler: map.IsBirdseyeAvailable() is false")}$YP("#a_birdseye").parent().addClass("ypgNavDisabled")}}function AddMaplevelAlertMessageControl(){var div_zoom_alert=document.getElementById("div_maplevel_alert_message");map.AddControl(div_zoom_alert)}function AddTrafficAlertMessageControl(){var div_traffic_alert=document.getElementById("div_traffic_alert_message");map.AddControl(div_traffic_alert)}function AddTrafficBrandingControl(){var div_traffic_branding=document.getElementById("div_traffic_branding");map.AddControl(div_traffic_branding)}this.validateFindInput=function(clientCacheId,value,fieldId){var returnValue=value;if(returnValue==undefined||returnValue==null){returnValue=ClientCache.Retrieve(clientCacheId);if(returnValue==undefined||returnValue==null){returnValue=document.getElementById(fieldId).value}}ClientCache.Save(clientCacheId,returnValue);if(debug){console.log("mm.validateFindInput: clientCacheId:%s, returnValue:%s",clientCacheId,returnValue)}document.getElementById("ErrHeaderTxt").style.visibility=returnValue.trim()==""?"visible":"hidden";document.getElementById(fieldId).style.border=returnValue.trim()==""?"1px solid red":"1px solid white";returnValue=returnValue.trim()==""?null:returnValue;document.getElementById(fieldId).value=returnValue;return returnValue};this.PerformSelectedSearch=function(selectedPane,newPane){paneNumber=selectedPane==null?ClientCache.Retrieve("selected_pane_num"):selectedPane;if(paneNumber!=-1){this.Find((newPane==null?false:newPane),ClientCache.Retrieve("lastSearch"))}};this.Find=function(newFind,searchType,first,second){var validatedInputs=this.PrepareForFindLookup(newFind,searchType,first,second);this.FindLookup(validatedInputs[0],validatedInputs[1]);ClientCache.Save("lastSearchFailed","false")};this.NewFindLookup=function(txtFind){txtFind=(txtFind==undefined?document.getElementById("txtFind").value:txtFind);TopNav("FindMap");this.Find(true,"fm",txtFind)};this.PrepareForNewFindLookup=function(txtFind){TopNav("FindMap");this.PrepareForFindLookup(true,"fm",txtFind)};this.NewFindBusiness=function(latLongMode,SkipHistory,keyword,location){HideCurrentEro(null);if(debug){console.log("In NewFindBusiness: Input ARGS: latLongMode:%s, SkipHistory:%s, keyword:%s, location:%s ",latLongMode,SkipHistory,keyword,location)}if($("yp_DrivingDirections0").style.display=="block"){$("yp_DrivingDirections0").setStyle({display:"none"});this.OnMapResize(null);this.MapResize()}if(debug){console.log("In mm.NewFindBusiness:  Connected: %s.",mapSearchAttachedPZ)}if(mapSearchAttachedPZ){if(debug){console.log("In mm.NewFindBusiness:  Connected: %s.  Going to disconnect.",mapSearchAttachedPZ)}mapManager.Map.DetachEvent("onendpan",mapSearch);mapManager.Map.DetachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=false}var skipGeoCode=false;location=(location==undefined?document.getElementById("txtBusLocation").value:location);keyword=(keyword==undefined?document.getElementById("txtBusName").value:keyword);if(location==undefined||location==null||location==""){location=this.Map.GetCenter().Latitude+","+this.Map.GetCenter().Longitude;if(debug){console.log("In NewFindBusiness: location is empty.  Getting map center lat/lon location: %s.  Current map style: ",location,map.GetMapStyle())}skipGeoCode=true}ClientCache.Save("pane_"+paneNumber+"_LocationInput",location);ClientCache.Save("pane_"+paneNumber+"_NameInput",keyword);if(debug){console.log("In NewFindBusiness: Saved what:[%s] where:[%s] into paneNumber: %d",keyword,location,paneNumber)}ClientCache.Save("pane_"+paneNumber+"_inputTypeToValidate","BusLoc");if(skipGeoCode){var placeArray=mapManager.LatLongToPlaceArray(location,"");mapManager.FindInputValidatorCallback(null,null,placeArray)}else{this.YPFind(this.PrepareForMapPointGeocoding(location),mapManager.YPFindInputValidatorCallback)}};this.YPFind=function(location,callback){var qString="?where="+location;var request=new AjaxRequest("/ajax/location.html"+qString,callback);request.Execute()};this.PrepareForNewFindBusiness=function(location,keyword){this.PrepareForFindLookup(true,"bus",location,keyword)};this.NewFindPerson=function(latLongMode,SkipHistory,keyword,location){location=(location==undefined?document.getElementById("txtPersonLocation").value:location);keyword=(keyword==undefined?document.getElementById("txtPersonName").value:keyword);if(location==undefined||location==null||location==""){location=this.Map.GetCenter().Latitude+","+this.Map.GetCenter().Longitude}TopNav("FindPerson");ClientCache.Save("pane_"+paneNumber+"_LocationInput",location);ClientCache.Save("pane_"+paneNumber+"_NameInput",keyword);ClientCache.Save("pane_"+paneNumber+"_inputTypeToValidate","PerLoc");map.Find(null,this.PrepareForMapPointGeocoding(location),null,null,null,null,null,null,false,false,mapManager.FindInputValidatorCallback)};this.PrepareForNewFindPerson=function(location,keyword){TopNav("FindBusiness");this.PrepareForFindLookup(true,"per",location,keyword)};this.GetNewDirections=function(origin,destination){if(mapSearchAttachedPZ){mapManager.Map.DetachEvent("onendpan",mapSearch);mapManager.Map.DetachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=false}origin=(origin==undefined?document.getElementById("txtFrom").value:origin);destination=(destination==undefined?document.getElementById("txtTo").value:destination);if(origin==undefined||origin==null||origin==""){origin=this.Map.GetCenter().Latitude+","+this.Map.GetCenter().Longitude}else{if(destination==undefined||destination==null||destination==""){destination=this.Map.GetCenter().Latitude+","+this.Map.GetCenter().Longitude}}ClientCache.Save("pane_"+paneNumber+"_FromInput",origin);ClientCache.Save("pane_"+paneNumber+"_ToInput",destination);ClientCache.Save("pane_"+paneNumber+"_inputTypeToValidate","From");map.Find(null,this.PrepareForMapPointGeocoding(origin),null,null,null,null,null,null,false,false,mapManager.FindInputValidatorCallback)};this.PrepareForGetNewDirections=function(origin,destination){TopNav("DrivingDirections");this.PrepareForFindLookup(true,"dd",origin,destination)};this.AddWaypoint=function(location){var numWaypoints=(ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints"));location=((location==undefined)?document.getElementById("txtWaypoint"+paneNumber).value:location);numWaypoints=(numWaypoints==undefined?0:numWaypoints);ClientCache.Save("pane_"+paneNumber+"_WaypointInput"+numWaypoints,location);ClientCache.Save("pane_"+paneNumber+"_NumWaypoints",numWaypoints);ClientCache.Save("pane_"+paneNumber+"_inputTypeToValidate","Waypoint");map.Find(null,this.PrepareForMapPointGeocoding(location),null,null,null,null,null,null,false,false,mapManager.FindInputValidatorCallback)};this.FindInputValidatorCallback=function(shapeLayer,findResultArray,placeArray){if(placeArray==null){mapManager.onFailedSearch()}else{var validatedInputType=ClientCache.Retrieve("pane_"+paneNumber+"_inputTypeToValidate");if(validatedInputType=="Waypoint"){ClientCache.Save("pane_"+paneNumber+"_NumWaypoints",ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints")+1);mapManager.Find(false,"dd")}else{if(validatedInputType=="From"){ClientCache.Save("pane_"+paneNumber+"_inputTypeToValidate","To");mapManager.Map.Find(null,mapManager.PrepareForMapPointGeocoding(ClientCache.Retrieve("pane_"+paneNumber+"_ToInput")),null,null,null,null,null,null,false,false,mapManager.FindInputValidatorCallback)}else{if(validatedInputType=="To"){mapManager.Find(true,"dd",ClientCache.Retrieve("pane_"+paneNumber+"_FromInput"),ClientCache.Retrieve("pane_"+paneNumber+"_ToInput"))}else{if(validatedInputType=="PerLoc"){mapManager.Find(true,"per",ClientCache.Retrieve("pane_"+paneNumber+"_LocationInput"),ClientCache.Retrieve("pane_"+paneNumber+"_NameInput"))}else{if(validatedInputType=="BusLoc"){if(debug){console.log("In mm.FindInputValidatorCallback: placeArray[0].Name -> [%s]",placeArray[0].Name)}mapManager.Find(true,"bus",ClientCache.Retrieve("pane_"+paneNumber+"_LocationInput"),ClientCache.Retrieve("pane_"+paneNumber+"_NameInput"))}}}}}}};this.ProcessLocation=function(rText){try{g_locationResult=eval("("+rText+")");if(g_locationResult!=undefined&&g_locationResult[0].location!=null){var locationResult=g_locationResult[0];var locationName=locationResult.street+", "+locationResult.city+", "+locationResult.province+", "+locationResult.postalCode;var placeArray=mapManager.LatLongToPlaceArray(locationResult.location.latitude+","+locationResult.location.longitude,mapManager.PrepareForMapPointGeocoding(locationName))}}catch(e){if(debug){console.log("Catch Block: ProcessLocation: %s",e.message)}}return placeArray};this.YPFindInputValidatorCallback=function(rText){var placeArray=mapManager.ProcessLocation(rText);mapManager.FindInputValidatorCallback(null,null,placeArray)};this.PrepareForFindLookup=function(newFind,searchType,first,second){newFind=(ClientCache.Retrieve("lastSearchFailed")=="true"?false:newFind);paneNumber=(paneNumber==5?paneNumber++:0);var nextPaneNumber=paneNumber;if(debug){console.log("In PrepareForFindLookup: paneNumber:",paneNumber," nextPaneNumber:",nextPaneNumber)}var lastSearchType=ClientCache.Retrieve("lastSearch");ClientCache.Save("lastSearch",searchType);var validatedFirst="";var validatedSecond="";if(searchType=="fm"){validatedFirst=this.validateFindInput("pane_"+nextPaneNumber+"_FindInput",first,"txtFind");validatedSecond=null}else{if(searchType=="dd"){validatedFirst=this.validateFindInput("pane_"+nextPaneNumber+"_FromInput",first,"txtFrom");validatedSecond=this.validateFindInput("pane_"+nextPaneNumber+"_ToInput",second,"txtTo");if(ClientCache.Retrieve("pane_"+nextPaneNumber+"_NumWaypoints")==undefined){ClientCache.Save("pane_"+nextPaneNumber+"_NumWaypoints",0)}}else{if(document.getElementById("txtBusLocation").value!=""){ClientCache.Save("pane_"+nextPaneNumber+"_EnteredLocationInput",document.getElementById("txtBusLocation").value)}$("siWhat").value=second;$("siWhere").value=ClientCache.Retrieve("pane_"+nextPaneNumber+"_EnteredLocationInput");validatedFirst=this.validateFindInput("pane_"+nextPaneNumber+"_LocationInput",first,searchType=="bus"?"txtBusLocation":"txtPersonLocation");validatedSecond=this.validateFindInput("pane_"+nextPaneNumber+"_NameInput",second,searchType=="bus"?"txtBusName":"txtPersonName")}}var divIdPrefix="";var paneTitle="";if(searchType=="fm"){divIdPrefix="yp_FindOnMap";paneTitle=validatedFirst}else{if(searchType=="dd"){divIdPrefix="yp_DrivingDirections";paneTitle=resourceFrom+": "+(validatedFirst.indexOf("@")!=-1?validatedFirst.split("@")[0]:validatedFirst)+" "+resourceTo+": "+(validatedSecond.indexOf("@")!=-1?validatedSecond.split("@")[0]:validatedSecond)}else{if(searchType=="bus"){divIdPrefix="yp_FindBusiness";paneTitle=""}else{divIdPrefix="yp_FindPerson";paneTitle=""}}}if(newFind){if(ClientCache.Retrieve("lastSearchFailed")=="false"){if(lastSearchType=="dd"){var previousNumWaypoints=ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints");if(previousNumWaypoints>0){ClientCache.Save("pane_"+paneNumber+"_Waypoint"+previousNumWaypoints,undefined)}else{ClientCache.Save("pane_"+paneNumber+"_From",undefined);ClientCache.Save("pane_"+paneNumber+"_To",undefined)}}}}else{if(ClientCache.Retrieve("lastSearchFailed")=="true"){if(lastSearchType=="dd"){var previousNumWaypoints=ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints");if(previousNumWaypoints>0){ClientCache.Save("pane_"+paneNumber+"_Waypoint"+previousNumWaypoints,undefined)}else{ClientCache.Save("pane_"+paneNumber+"_From",undefined);ClientCache.Save("pane_"+paneNumber+"_To",undefined)}}else{if(lastSearchType=="fm"){ClientCache.Save("pane_"+paneNumber+"_Find",undefined)}}}}ClientCache.Save("pane_"+paneNumber+"_type",searchType);if(searchType=="fm"){findOnMap=document.getElementById(divIdPrefix+paneNumber);findOnMap.innerHTML="";AmbiguityDiv=document.createElement("div");findOnMap.appendChild(AmbiguityDiv);findOnMapFindAmbiguity=document.createElement("div");AmbiguityDiv.appendChild(findOnMapFindAmbiguity);findOnMapResultDiv=document.createElement("div");findOnMapResultDiv.id="firstResultDiv"+paneNumber;findOnMapResultDiv.style.overflow="hidden";findOnMap.appendChild(findOnMapResultDiv);findOnMapResultDiv.innerHTML='<div class="DefaultLocation"><img style="margin-top: 15px; margin-left: 15px;" src="Images/dartblue.gif"/><span class="Arial12" style="margin-left: 6px;">'+validatedFirst+"</span></div>"}else{if(searchType=="dd"){var paneContentDiv=document.getElementById(divIdPrefix+paneNumber);paneContentDiv.innerHTML="";var ambiguityDiv=document.createElement("div");ambiguityDiv.id="outerAmbiguityDiv"+paneNumber;paneContentDiv.appendChild(ambiguityDiv);var innerAmbiguityDiv=document.createElement("div");innerAmbiguityDiv.id="firstAmbiguityDiv"+paneNumber;innerAmbiguityDiv.style.display="none";ambiguityDiv.appendChild(innerAmbiguityDiv);var innerAmbiguityDiv=document.createElement("div");innerAmbiguityDiv.id="secondAmbiguityDiv"+paneNumber;innerAmbiguityDiv.style.display="none";ambiguityDiv.appendChild(innerAmbiguityDiv);var resultDiv=document.createElement("div");resultDiv.id="firstResultDiv"+paneNumber;resultDiv.style.overflow="auto";$("yp_DrivingDirections"+paneNumber).style.display="block";this.OnMapResize(null);this.MapResize();paneContentDiv.appendChild(resultDiv);resultDiv=document.createElement("div");resultDiv.id="secondResultDiv"+paneNumber;paneContentDiv.appendChild(resultDiv);resultDiv=document.createElement("div");resultDiv.id="thirdResultDiv"+paneNumber;disclaimer="<div style='margin-left:15px; overflow:auto; font-size: 10px; height:65px;'>"+resourceDDDisclaimer+"</div>";greyLine="<div class='grey_line_div' style='top:0px;margin-top:5px;margin-bottom:5px;' id='grey_line_div'></div>";printDDLink="<div id='printDDLink'></div>";resultDiv.innerHTML=disclaimer+greyLine+printDDLink;paneContentDiv.appendChild(resultDiv)}}var validatedInputs=new Array();validatedInputs.push(validatedFirst);validatedInputs.push(validatedSecond);return validatedInputs};this.FindLookup=function(txtFrom,txtTo){mapManager.clearRoute();mapManager.ClearSearchRelatedShapes();var searchType=ClientCache.Retrieve("pane_"+paneNumber+"_type");ClientCache.Save("selected_pane_num",paneNumber);var searchInput=txtFrom;waypointsArray=new Array();ShowLoading();mapManager.FindOnMap(true,searchInput)};this.FindOnMap=function(searchCanada,searchInput){if(debug){console.log("In mm.FindOnMap: paneNumber: %s, searchInput: %s",paneNumber,searchInput)}if(searchInput==undefined){mapManager.onFailedSearch();return}var latLongLocation=false;if(this.IsLatLong(searchInput)){latLongLocation=true}if(searchInput.indexOf("@")!=-1){mapManager.FindCallback(null,null,this.LatLongToPlaceArray(searchInput.split("@")[1],this.PrepareForMapPointGeocoding(searchInput.split("@")[0])))}else{if(latLongLocation){mapManager.FindCallback(null,null,this.LatLongToPlaceArray(searchInput))}else{if(YPSearchManager.isGNBForListingPopup==true&&YPSearchManager.ranGNBOnce==true){YPSearchManager.isGNBForListingPopup=false;YPSearchManager.ranGNBOnce=false;YPSearchManager.g_GNBSelectedData=new Object;if(debug){console.log("In mm.FindOnMap: reset isGNBForListingPopup and ranGNBOnce to false. No need to show selected pin of proximity search anymore")}}else{if(YPSearchManager.isGNBForListingPopup==true){YPSearchManager.ranGNBOnce=true;if(debug){console.log("In mm.FindOnMap: setting ranGNBOnce to true so next time through this method with a non lat/lon where search ... it will reset isGNBForListingPopup back to false")}}}if(debug){console.log("In mm.FindOnMap: paneNumber: %s, ccr_type: %s",paneNumber,ClientCache.Retrieve("pane_"+paneNumber+"_type"))}if(ClientCache.Retrieve("pane_"+paneNumber+"_type")=="per"||ClientCache.Retrieve("pane_"+paneNumber+"_type")=="bus"){if(debug){console.log("In mm.FindOnMap: run map.Find with callback FindBusPerCallback")}this.YPFind(this.PrepareForMapPointGeocoding(searchInput),mapManager.YPFindBusPerCallback)}else{if(debug){console.log("In mm.FindOnMap: run map.Find with callback of either FindInCanadaCallback or FindCallback [searchCanada:%s]",searchCanada)}if(searchCanada){map.Find(null,this.PrepareForMapPointGeocoding(searchInput)+", Canada",null,null,null,null,null,null,false,false,mapManager.FindInCanadaCallback)}else{map.Find(null,this.PrepareForMapPointGeocoding(searchInput),null,null,null,null,null,null,false,false,mapManager.FindCallback)}}}}};this.FindInCanadaCallback=function(shapeLayer,findResultArray,placeArray){var numWaypoints=ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints");var searchType=ClientCache.Retrieve("pane_"+paneNumber+"_type");if(placeArray!=null&&placeArray[0].Name!="Canada"){if(searchType=="fm"){mapManager.DisambiguateFindResults(placeArray,"FindInput","Find");HideLoading();mapManager.ReadWaypointsArray(searchType)}else{if(searchType=="dd"){if(debug){console.log("In FindInCanadaCallback: waypointsArray.length: ",waypointsArray.length)}if(waypointsArray.length==0){mapManager.DisambiguateFindResults(placeArray,"FromInput","From");mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_ToInput"));return}else{if(waypointsArray.length==1){mapManager.DisambiguateFindResults(placeArray,"ToInput","To");if((waypointsArray.length-2)<numWaypoints){mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_WaypointInput"+(waypointsArray.length-2)));return}mapManager.ReadWaypointsArray(searchType);return}else{mapManager.DisambiguateFindResults(placeArray,"WaypointInput"+(waypointsArray.length-2),"Waypoint"+(waypointsArray.length-1));if((waypointsArray.length-2)<numWaypoints){mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_WaypointInput"+(waypointsArray.length-2)));return}mapManager.ReadWaypointsArray(searchType);return}}}else{mapManager.FindBusPerCallback(shapeLayer,findResultArray,placeArray)}}return}else{var searchInput;if(searchType=="fm"){searchInput=ClientCache.Retrieve("pane_"+paneNumber+"_FindInput");mapManager.FindOnMap(false,searchInput);HideLoading()}else{if(searchType=="dd"){if(waypointsArray.length==0){searchInput=ClientCache.Retrieve("pane_"+paneNumber+"_FromInput")}else{if(waypointsArray.length==1){searchInput=ClientCache.Retrieve("pane_"+paneNumber+"_ToInput")}else{if((waypointsArray.length-2)<numWaypoints){searchInput=ClientCache.Retrieve("pane_"+paneNumber+"_WaypointInput"+(waypointsArray.length-2))}}}mapManager.FindOnMap(false,searchInput);HideLoading()}else{searchInput=ClientCache.Retrieve("pane_"+paneNumber+"_NameInput");mapManager.FindOnMap(false,searchInput)}}}};this.onFailedSearch=function(inputType,invalidInputFieldID){ClientCache.Save("lastSearchFailed","true");var searchInputField=document.getElementById(invalidInputFieldID);document.getElementById("ErrHeaderTxt").style.visibility="visible";if(searchInputField!=undefined){document.getElementById(invalidInputFieldID).style.border="1px solid red"}var searchInput=searchInputField!=undefined?searchInputField.value:ClientCache.Retrieve("pane_"+paneNumber+"_"+inputType+"Input");search=inputType+searchInput;if(searchInput!=""&&(inputType!=null||invalidInputFieldID!=null)){YPSearchManager.HBXSearch("map",0,null,search)}HideLoading();if(searchInput==undefined){var error="";var divIdPrefix="";switch(ClientCache.Retrieve("lastSearch")){case"fm":error=resourceErrorFOM;divIdPrefix="yp_FindOnMap";break;case"bus":error=resourceErrorFAB;divIdPrefix="yp_DrivingDirections";break;case"per":error=resourceErrorFAB;divIdPrefix="yp_FindBusiness";break;case"dd":error=resourceErrorGDD;divIdPrefix="yp_FindPerson";break}document.getElementById("ErrHeaderTxt").innerHTML=error;document.getElementById("ErrHeaderTxt").style.display="block"}return};this.FindCallback=function(shapeLayer,findResultArray,placeArray){var numWaypoints=ClientCache.Retrieve("pane_"+paneNumber+"_NumWaypoints");var searchType=ClientCache.Retrieve("pane_"+paneNumber+"_type");if(placeArray==null){mapManager.onFailedSearch("Find","txtFind");return}else{if(searchType=="fm"){mapManager.DisambiguateFindResults(placeArray,"FindInput","Find");mapManager.ReadWaypointsArray(searchType)}else{if(searchType=="dd"){if(debug){console.log("In FindCallback: waypointsArray.length: ",waypointsArray.length)}if(waypointsArray.length==0){mapManager.DisambiguateFindResults(placeArray,"FromInput","From");mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_ToInput"))}else{if(waypointsArray.length==1){mapManager.DisambiguateFindResults(placeArray,"ToInput","To");if((waypointsArray.length-2)<numWaypoints){mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_WaypointInput"+(waypointsArray.length-2)));return}mapManager.ReadWaypointsArray(ClientCache.Retrieve("pane_"+paneNumber+"_type"));return}else{mapManager.DisambiguateFindResults(placeArray,"WaypointInput"+(waypointsArray.length-2),"Waypoint"+(waypointsArray.length)-1);if((waypointsArray.length-2)<numWaypoints){mapManager.FindOnMap(true,ClientCache.Retrieve("pane_"+paneNumber+"_WaypointInput"+(waypointsArray.length-2)));return}mapManager.ReadWaypointsArray(ClientCache.Retrieve("pane_"+paneNumber+"_type"));return}}}else{mapManager.FindBusPerCallback(shapeLayer,findResultArray,placeArray)}}}};this.DisambiguateFindResults=function(placeArray,searchInputId,searchId){var search=ClientCache.Retrieve("pane_"+paneNumber+"_"+searchId);if(search!=undefined){waypointsArray.push(search)}else{var disambiguationText=mapManager.getDisambiguationText(searchId,placeArray,ClientCache.Retrieve("pane_"+paneNumber+"_"+searchInputId));if(searchId=="Find"){findOnMapFindAmbiguity.innerHTML=disambiguationText;mapManager.resizeLeftDD()}else{if(disambiguationText!=""){if(searchId=="From"){document.getElementById("firstAmbiguityDiv"+paneNumber).style.display="block";document.getElementById("firstAmbiguityDiv"+paneNumber).innerHTML=disambiguationText}else{if(searchId=="To"){document.getElementById("secondAmbiguityDiv"+paneNumber).style.display="block";document.getElementById("secondAmbiguityDiv"+paneNumber).innerHTML=disambiguationText}else{var innerAmbiguityDiv=document.createElement("div");innerAmbiguityDiv.id="Waypoint"+(waypointsArray.length-2)+"AmbiguityDiv"+paneNumber;innerAmbiguityDiv.innerHTML=disambiguationText;document.getElementById("outerAmbiguityDiv"+paneNumber).appendChild(innerAmbiguityDiv)}}}}}};this.EmulateSelectedPaneFind=function(paneClicked,first,second,sbn){HideLoading();FindNearbyClick(true);paneNumber=paneClicked;switch(ClientCache.Retrieve("pane_"+paneClicked+"_type")){case"fm":TopNav("FindMap");findOnMap=document.getElementById("yp_FindOnMap"+paneClicked);AmbiguityDiv=findOnMap.childNodes[0];findOnMapResultDiv=findOnMap.childNodes[1];first=ClientCache.Retrieve("pane_"+paneClicked+"_FindInput");second=null;center=this.Map.GetCenter();zoomLevel=this.Map.GetZoomLevel();this.Map.SetCenterAndZoom(center,zoomLevel);this.Map.SetCenterAndZoom(center,5);this.Map.SetCenterAndZoom(center,zoomLevel);break;case"bus":TopNav("FindBusiness");paneNumber=paneClicked;break;case"per":TopNav("FindPerson");paneNumber=paneClicked;break;case"dd":TopNav("DrivingDirections");drivingDirections=document.getElementById("yp_DrivingDirections"+paneNumber);AmbiguityDiv=drivingDirections.childNodes[0];drivingDirectionsFromAmbiguity=AmbiguityDiv.childNodes[0];drivingDirectionsToAmbiguity=AmbiguityDiv.childNodes[1];drivingDirectionResultDiv=drivingDirections.childNodes[1];drivingDirectionDistanceDiv=drivingDirections.childNodes[2];HideLoading();break}AjaxControlManager.openLeftNavPane(5);this.FindLookup(first,second)};this.ClearFind=function(){this.clearRoute();this.ClearSearchRelatedShapes();document.getElementById("txtBusLocation").value=""};this.CategorySearch=function(){document.getElementById("txtBusName").value=document.getElementById("txtCategorySearch").value;var center=mapManager.Map.GetCenter();document.getElementById("txtBusLocation").value=(Math.round(center.Latitude*100)/100)+", "+(Math.round(center.Longitude*100)/100);TopNav("FindBusiness");this.SetCategorySearch(true);this.NewFindBusiness(true)};this.FindBusPerCallback=function(shapeLayer,findResultArray,placeArray){if(placeArray){if(placeArray.length>0){YPSearchManager.Search(ClientCache.Retrieve("lastSearch"),false,placeArray)}}else{YPSearchManager.Search(ClientCache.Retrieve("lastSearch"))}findBusinessResultsPaneNumber=-1};this.YPFindBusPerCallback=function(rText){var placeArray=mapManager.ProcessLocation(rText);mapManager.FindBusPerCallback(null,null,placeArray)};this.clearRoute=function(){var map=mapManager.Map;var shapeLayerCount=map.GetShapeLayerCount();map.DeleteRoute();for(var i=0;i<shapeLayerCount;i++){var shapeLayer=map.GetShapeLayerByIndex(i);if(shapeLayer==null){break}var shapeCount=shapeLayer.GetShapeCount();for(var j=0;j<shapeCount;j++){var shape=shapeLayer.GetShapeByIndex(j);var icon=shape.GetCustomIcon();if(!(typeof icon=="string")){break}else{if(icon.search("A_Icon.gif")>0){map.DeleteShapeLayer(shapeLayer);break}}}}};this.SwitchDirections=function(){var txtFrom=document.getElementById("txtFrom").value;document.getElementById("txtFrom").value=document.getElementById("txtTo").value;document.getElementById("txtTo").value=txtFrom};this.getDisambiguationText=function(id,placeArray,input){var name;var postal;var lat;var lon;var display="block";var ambiguationText="";var index=0;var ambiguityArray=new Array;var ambiguityTextArray=new Array;for(var i=0;i<placeArray.length;i++){ambiguityArray[i]=new Array;name=placeArray[i].Name;if(name.match((/([a-zA-Z][0-9][a-zA-Z])(\s*[0-9][a-zA-Z][0-9])?/))||name.match(/,\s(AB|BC|MB|NB|NL|NS|NT|NU|ON|PE|QC|SK|YT)/)){index=placeArray[i].MatchConfidence<placeArray[index].MatchConfidence?i:index}ambiguityTextArray.push(name+";new VELatLong("+placeArray[i].LatLong.Latitude+","+placeArray[i].LatLong.Longitude+")','"+id+"');\">"+name)}if(ambiguityArray.length>1){ambiguationText+="<span class='DisambiguationText'>"+resourceYourSearchOf+" </span><span class='DisambiguationLocation'>"+input+"</span>";if(ambiguityArray.length>3){display="none";ambiguationText+=" "+resourceReturnedMultiple+' <a id="'+id+'AmbiguationExpand" style="cursor:pointer" onclick="mapManager.changeDisplay(\''+id+paneNumber+"AmbiguationTable');\">+</a>"}else{ambiguationText+="<span class='DisambiguationText'> "+resourceReturnedMultiple+":</span>"}ambiguationText+="<table id='"+id+paneNumber+"AmbiguationTable' style='display:"+display+"'><tr><td><div class='handicon locationunderlined' onclick=\"mapManager.disambiguateWaypoint('"+placeArray[index].Name+"','"+ambiguityTextArray.join("</div><div class='handicon locationunderlined' onclick=\"mapManager.disambiguateWaypoint('"+placeArray[index].Name+"','")+"</div></td></tr></table>";ambiguationText+="<div class='lines'></div>"}var defaultLocation=placeArray[index].Name+";new VELatLong("+placeArray[index].LatLong.Latitude+","+placeArray[index].LatLong.Longitude+")";waypointsArray.push(defaultLocation);ClientCache.Save("pane_"+paneNumber+"_"+id,defaultLocation);if(debug){console.log("mm.getDisambiguationText(): ",placeArray[index].Name)}return ambiguationText};this.disambiguateWaypoint=function(toRemoveName,toAdd,id){var waypoint;var waypointName;var index=0;for(var i=0;i<waypointsArray.length;i++){waypoint=waypointsArray[i].split(";");waypointName=waypoint[0];if(waypointName==toRemoveName){waypointsArray[i]=toAdd;index=i;break}}if(ClientCache.Retrieve("pane_"+paneNumber+"_type")=="dd"){AmbiguityDiv=document.getElementById("outerAmbiguityDiv"+paneNumber)}var ambiguationDivs=AmbiguityDiv.childNodes;ambiguationDivs[index].innerHTML="";ambiguationDivs[index].style.display="none";if(toRemoveName!=toAdd){ClientCache.Save("pane_"+paneNumber+"_"+id,waypointsArray[index]);if(waypointsArray.length>1){this.ReadWaypointsArray("dd")}else{ClientCache.Save("lastSearchFailed","true");this.PrepareForFindLookup(false,"fm",this.extractPlaceValues(false,0),null);ClientCache.Save("lastSearchFailed","false");mapManager.ClearSearchRelatedShapes();this.ReadWaypointsArray("fm");ClientCache.Save("selected_pane_num",paneNumber)}}};this.ClearSearchRelatedShapes=function(){if(debug){console.log("In ClearSearchRelatedShapes()")}if(debug){var map=mapManager.Map;var shapeLayerCount=map.GetShapeLayerCount();console.log("In ClearSearchRelatedShapes: shapeLayerCount:%d",shapeLayerCount);for(var i=0;i<shapeLayerCount;i++){var shapeLayer=map.GetShapeLayerByIndex(i);if(shapeLayer==null){break}var shapeCount=shapeLayer.GetShapeCount();if(debug){console.log("In ClearSearchRelatedShapes: shapeLayer:%d has %d shapes",i,shapeCount)}}}mapManager.Map.DeleteAllShapes();if(debug){console.log("In ClearSearchRelatedShapes: Just ran mapManager.Map.DeleteAllShapes()")}var map=mapManager.Map;var shapeLayerCount=map.GetShapeLayerCount();if(debug){console.log("In ClearSearchRelatedShapes: shapeLayerCount:%d",shapeLayerCount)}for(var i=0;i<shapeLayerCount;i++){var shapeLayer=map.GetShapeLayerByIndex(i);if(shapeLayer==null){break}var shapeCount=shapeLayer.GetShapeCount();if(debug){console.log("In ClearSearchRelatedShapes: shapeLayer:%d has %d shapes",i,shapeCount)}if(shapeCount==0){map.DeleteShapeLayer(shapeLayer);if(debug){console.log("In ClearSearchRelatedShapes: Deleting shapeLayer:%d because it has %d shapes",i,shapeCount)}}}var shapeLayerCount=map.GetShapeLayerCount();if(debug){console.log("In ClearSearchRelatedShapes: shapeLayerCount:%d",shapeLayerCount)}};this.ReadWaypointsArray=function(type){ShowLoading();var waypointsLLArray=new Array();for(var i=0;i<waypointsArray.length;i++){waypointsLLArray.push(eval(this.extractPlaceValues(true,i)))}if(type=="dd"){var options=new VERouteOptions();options.RouteColor=new VEColor(0,73,134,0.5);options.RouteWeight=6;options.RouteCallback=this.onGotRoute;options.ShowDisambiguation=false;options.ShowErrorMessages=false;options.DistanceUnit=VERouteDistanceUnit.Kilometer;map.GetDirections(waypointsLLArray,options);var query=YPSearchManager.CreateSearchQuery("route",null,null,null,ClientCache.Retrieve("pane_"+paneNumber+"_FromInput"),ClientCache.Retrieve("pane_"+paneNumber+"_ToInput"));YPSearchManager.PersistQuery(query,"route");var origin=ClientCache.Retrieve("pane_"+paneNumber+"_FromInput");var destination=ClientCache.Retrieve("pane_"+paneNumber+"_ToInput");ClientCache.Save("origin",origin);ClientCache.Save("destination",destination);ClientCache.Save("lastSearch","dd")}else{waypoint=waypointsArray[0].split(";");var waypointName=waypoint[0];var waypointVELatLon=waypoint[1].split("(");var waypointLatLon=waypointVELatLon[1].split(",");var waypointLat=waypointLatLon[0];var waypointLon=waypointLatLon[1].substring(0,waypointLatLon[1].length-1);YPSearchManager.includePlaces(this.LatLongToPlaceArray(waypointLat+","+waypointLon,waypoint[0]));this.findOnMap(0,waypointName,waypointLat,waypointLon);var query=YPSearchManager.CreateSearchQuery("map",null,waypointName,new VELatLong(waypointLat,waypointLon),null,null);YPSearchManager.PersistQuery(query,"map");POIManager.RefreshPOIs();var location=document.getElementById("txtFind").value;ClientCache.Save("location",location);ClientCache.Save("lastSearch","fm");YPSearchManager.HBXSearch("map",1,null,location)}};this.extractPlaceValues=function(getLatLong,index){var itemArray=waypointsArray[index].split(";");if(getLatLong){return itemArray[1]}else{return itemArray[0]}};this.changeDisplay=function(id){var element=document.getElementById(id);var display=element.style.display;if(display=="block"){element.style.display="none"}else{element.style.display="block"}};this.findOnMap=function(index,location,latitude,longitude){ShowLoading();var divHeight="170px";var topMargin="8px";var dartImg="dartblue.gif";var description='<div style="height: '+divHeight+";margin-top:"+topMargin+';"><div class="popupTop"><div class="popupTopLeft"><div style="display:block; margin-top:5px; margin-bottom:5px;"><img src="Images/dartblue.gif"></img></div><div style="font-weight: bold; font: 12px/14px Arial;"><strong>'+location+'</strong></div></div><div class="popupTopRight"><div id="AL_ACTION_'+index+'" class="popupActionArea" style="top:10px;"><div id="AL_EMPTY_'+index+'" style="height:130px; width:100px;"></div><div id="AL_TO_'+index+'" style="height:130px; display:none; margin-left:5px;"><div class="popupHeader"><strong>'+resourceDD+':</strong></div><br/><div><img src="Images/tohereicon.gif">'+resourceToHere+':</img></div><input type="text" id="l_toAddress'+index+'" style="width:158px;" onkeydown="ExecuteFindFromInput(\'l_imgTo'+(index)+'\', event);"/><br/><div class="popupLink" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+index+", 'FROM');\">"+resourceFromHere+'<img src="images/fromhereicon.gif"></div><div><img id="l_imgTo'+index+'" src="'+images+'GetDD.gif" class="popupLink" style="left:100px; float: right;" onclick="YPSearchManager.GDDForLocationPopup(\'TO\');" /></div></div><div id="AL_FROM_'+index+'" style="height:130px; display:none; margin-left:5px;"><div class="popupHeader"><strong>'+resourceDD+': </strong></div><br/><div><img src="Images/fromhereicon.gif">'+resourceFromHere+':</img></div><input type="text" id="l_fromAddress'+index+'" style="width:158px;" onkeydown="ExecuteFindFromInput(\'l_imgFrom'+(index)+'\', event);"/><br/><div class="popupLink" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+(index)+", 'TO');\">"+resourceToHere+'<img src="images/tohereicon.gif"></div><div><img id="l_imgFrom'+(index)+'" src="'+images+'GetDD.gif" class="popupLink" style="left:100px; float: right;" onclick="YPSearchManager.GDDForLocationPopup(\'FROM\');"/></div></div><div id="AL_NEAR_'+index+'" style="height:130px;display:none;"><div class="popupHeader"><strong>'+resourceWhatsNearby+': </strong></div><br/><div class="popupSubheader">'+resourceSearchForCategory+':<br/></div><input type="text" id="l_nearby'+index+'" style="width:158px;" onkeydown="ExecuteFindFromInput(\'l_imgNear'+(index)+'\', event);"/><br/><div style="float:left; width:110px">'+resourceWhatsNearbyExample+'</div><div><img id="l_imgNear'+(index)+'" src="'+images+'GetDD.gif" class="popupLink" style="margin-top:11px; left:100px; float: right;" onclick="YPSearchManager.GNBForLocationPopup();"/></div></div><div id="AL_MAP_'+index+'" style="height:130px;display:none;"><div id="AL_MAP_SAVE_'+index+'" style="display:none"><div style="float:left;"><div class="popupHeader" style="width:110px"><strong>'+resourceSaveToAMap+': </strong></div><br /><div style="width:110px">'+resourceSaveToAMapPrompt+'</div></div><div><img src="Images/'+dartImg+'" class="popupLink" style="margin-right:10px; margin-top:10px; float: right; border: 1px solid black;" /></div><div style="margin-top:10px;"><select id="mapSelect" style="width:158px;""></select><br/></div><div><img id="l_imgAdd'+(index)+'" src="'+images+'doneButton.gif" class="popupLink" style="left:100px; float: right;" onclick="YPSearchManager.SaveLocationToCustomMap();"/></div></div><div id="AL_MAP_WARN_'+index+'" style="float:left;display:none"><div class="popupHeader" style="width:110px"><strong>'+resourceSaveToAMap+': </strong></div><br /><div style="width:180px">'+resourceLoginNeeded+'</div></div></div></div></div></div><div class="popupBottom"><table><tr><td><table><td><img src="images/drivingicon.gif" align="left" style="margin-right:3px;margin-left:3px"></img></td><td>'+resourceDD.toUpperCase()+'<div></div><span class="popupLink popupDrivingFunctionTo" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+(index)+', \'TO\');"><img src="images/tohereicon.gif"><span>'+resourceToHere.toUpperCase()+'</span></img></span><span> | </span><span class="popupLink popupDrivingFunctionFrom" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+(index)+', \'FROM\');"><img src="images/fromhereicon.gif"><span>'+resourceFromHere.toUpperCase()+'</span></img></span></td><td style="width:60px;margin-right:3px;"><span class="popupLink" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+(index)+', \'NEAR\');"><img src="images/nearbyicon.gif" align="left" style="margin-right:3px"></img><span class="popupLink">'+resourceWhatsNearby.toUpperCase()+'</div></span></td><td style="margin-right:3px; width:70px;"><span class="popupLink" onclick="YPSearchManager.ShowActionDiv(\'AL_\', '+(index)+', \'MAP\');"><img src="images/savemapicon.gif" align="left" style="margin-right:3px;margin-left:3px"></img>'+resourceAddToAMap.toUpperCase()+"</span></td></tr></table></div></div>";description="(S)"+description;var shape=new VEShape(VEShapeType.Pushpin,new VELatLong(latitude,longitude));shape.SetTitle("");shape.SetDescription("fom||"+index);shape.SetCustomIcon("<div class='pin_blue'></div>");map.AddShape(shape);InfoBoxManager.StoreDescription("fom",index,description);this.ZoomToLocation(location,latitude,longitude);HideLoading()};this.ZoomToLocation=function(name,latitude,longitude){var numSpaces=name.match(/\s/g);var zoomFactor=numSpaces!=null?numSpaces.length:0;var latLon=new VELatLong(latitude,longitude);map.SetCenterAndZoom(latLon,12+zoomFactor)};this.onGotRoute=function(route){if(route.RouteLegs.length==0){document.getElementById("ErrHeaderTxt").innerHTML=resourceDDGenerateError;document.getElementById("ErrHeaderTxt").style.visibility="visible";document.getElementById("txtFrom").style.border="1px solid red";document.getElementById("txtTo").style.border="1px solid red";HideLoading();YPSearchManager.HBXSearch("directions",0,null,"From "+document.getElementById("txtFrom").value+" To "+document.getElementById("txtTo").value);return}document.getElementById("ErrHeaderTxt").style.visibility="hidden";ShowLoading();mapManager.ClearSearchRelatedShapes();var legs=route.RouteLegs;var numTurns=0;var leg=null;var shape=null;var wayPointCount=0;var legsArray=new Array;var prevPrevLatLons=legs[0].Itinerary.Items[0].LatLong;var prevLatLons=legs[0].Itinerary.Items[0].LatLong;var curLatLons=legs[0].Itinerary.Items[0].LatLong;var nextLatLons=legs[0].Itinerary.Items[0].LatLong;var nextNextLatLons=legs[0].Itinerary.Items[1].LatLong;var prevShape=new VEShape(VEShapeType.Pushpin,prevLatLons);var curShape;var nextShape=new VEShape(VEShapeType.Pushpin,nextLatLons);var shapeIds=new Array();var prevPrevText="";var prevText="";var curText=legs[0].Itinerary.Items[0].Text;var nextText=legs[0].Itinerary.Items[0].Text;var prevStep=resourceStart;var curStep=resourceStart;var nextStep="";var prevDist="";var curDist=legs[0].Itinerary.Items[0].Distance;var nextDist=legs[0].Itinerary.Items[0].Distance;var totalDist=0;var prevTime="";var curTime=legs[0].Itinerary.Items[0].Time;var nextTime=legs[0].Itinerary.Items[0].Time;var totalTime=0;for(var i=0;i<legs.length;i++){leg=legs[i];curLatLons=nextLatLons;curShape=nextShape;nextLatLons=nextNextLatLons;nextShape=new VEShape(VEShapeType.Pushpin,nextLatLons);nextText=leg.Itinerary.Items[1].Text;nextStep=resourceStep+" "+(numTurns+1);nextDist=leg.Itinerary.Items[1].Distance;nextTime=leg.Itinerary.Items[1].Time;if(leg.Itinerary.Items.length>=3){nextNextLatLons=leg.Itinerary.Items[2].LatLong}else{if(leg.Itinerary.Items.length==2){if(i<legs.length-1){nextNextLatLons=legs[i+1].Itinerary.Items[0].LatLong}else{nextStep=resourceFinalDestination}}else{if(i==(legs.length-1)){nextStep=resourceFinalDestination}else{nextText=legs[i+1].Itinerary.Items[0].Text;nextStep=resourceStep+" &#"+(i+66)+";";nextNextLatLons=legs[i+1].Itinerary.Items[1].LatLong}}}var latLons=curLatLons+","+prevLatLons;var shapeCustomIconImage="Images/GreyIcons/"+iconArray[incrementWayPointCount(i)]+".gif";var shapeDescriptionTitle=prevText;var shapeDescriptionItems=new Array();var shapeDescriptionCurrentItemTopRow="<tr class='DDEroTextCurrentSeperator DDEroTextSeperatorCurrentTop DDEroTextCurrent'><td></td><td></td><td class='popupLink DDEroUpArrow' onclick='mapManager.ShowInfoBoxp;'></td></tr>";var wayPointLinks=new Array();var waypointType="(DDI)";shapeDescriptionItems.push("<tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextPrevious'><td class='DDEroTextStepNum'>"+prevStep+"</td><td class='DDEroTextStepText'>"+prevText+"</td><td class='waypointDescriptionDistance'>"+mapManager.getDistTime(prevDist,prevTime)+"</td></tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr>");wayPointLinks.push(prevLatLons+","+prevPrevLatLons+","+curLatLons+");'>prev");if(i==0){shapeCustomIconImage="/images/shared/map/A_Icon.gif";mapManager.extractPlaceValues(false,0);latLons=curLatLons;shapeDescriptionTitle=resourceStart;shapeDescriptionItems.pop();wayPointLinks.pop();curText=mapManager.extractPlaceValues(false,i);shapeDescriptionCurrentItemTopRow="<tr class='DDEroTextSeperator DDEroTextSeperatorCurrentTop DDEroTextCurrent'><td></td><td></td><td></td></tr>";waypointType="(DDF)"}shapeDescriptionItems.push(shapeDescriptionCurrentItemTopRow+"<tr class='DDEroTextCurrent DDEroTextStepText'><td class='DDEroTextStepNum DDEroTextStepNumSelected'>"+curStep+"</td><td class='DDEroTextStepText'>"+curText+"</td><td></td></tr><tr class='DDEroTextCurrentSeperator DDEroTextSeperatorCurrentBottom DDEroTextCurrent'><td></td><td></td><td class='popupLink DDEroDownArrow' onclick='mapManager.ShowInfoBoxn;'></td></tr>");wayPointLinks.push(curLatLons+","+prevLatLons+","+nextLatLons+");'>zoom in");shapeDescriptionItems.push("<tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextNext'><td class='DDEroTextStepNum'>"+nextStep+"</td><td class='DDEroTextStepText'>"+nextText+"</td><td class='waypointDescriptionDistance'>+"+mapManager.getDistTime(nextDist,nextTime)+"</td></tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr>");wayPointLinks.push(nextLatLons+","+prevLatLons+","+nextNextLatLons+");'>next");latLons+=","+nextLatLons;legsArray.push("<table class='directionsList' id='leg_"+i+"_title'><tr><td onclick='mapManager.CenterAndZoom("+latLons+")'><div class='drivingDirectionsWaypointIcon drivingDirectionsWaypointListIcon' style='background-image:url(\""+shapeCustomIconImage+"\")'><b></b></div></td><td style='width:10px'></td><td><div class='drivingDirectionsListDetails'>"+curText+(i!=0?"</div><div>"+mapManager.getDistTime(totalDist,totalTime):"")+"</div></td><td><a id='waypoint_"+i+"_Expand' style='cursor:pointer' onclick='mapManager.changeDisplay(\"leg_"+i+"_table\");'>+</a></td></tr></table><table style='display:block' class='directionsList' id='leg_"+i+"_table'>");shape=curShape;shape.SetDescription(waypointType+"<table id='turnpoint"+numTurns+"_table' class='DDEroText'>"+shapeDescriptionItems.join("")+"<tr style='height:14px; background:#66676a'><td></td><td></td><td></td></tr></table>");shape.SetCustomIcon("<div class='drivingDirectionsWaypointMapIcon drivingDirectionsWaypointIcon' style='background-image:url(\""+shapeCustomIconImage+"\")'></div>");map.AddShape(shape);shapeIds.push(shape.GetID());for(var k=1;k<leg.Itinerary.Items.length-1;k++){numTurns++;prevPrevLatLons=prevLatLons;prevLatLons=curLatLons;prevShape=curShape;curLatLons=nextLatLons;curShape=nextShape;nextLatLons=nextNextLatLons;nextShape=new VEShape(VEShapeType.Pushpin,nextLatLons);prevStep=curStep;curStep=nextStep;nextStep=resourceStep+" "+(numTurns+1);prevDist=curDist;curDist=nextDist;nextDist=leg.Itinerary.Items[k+1].Distance;prevTime=curTime;curTime=nextTime;nextTime=leg.Itinerary.Items[k+1].Time;prevText=curText;curText=nextText;nextText=leg.Itinerary.Items[k+1].Text;if((k+1)==(leg.Itinerary.Items.length-1)){if(i<(legs.length-1)){nextText=legs[i+1].Itinerary.Items[0].Text;nextStep=resourceStep+" &#"+(i+66)+";"}else{nextStep=resourceFinalDestination}}if(leg.Itinerary.Items.length>=k+3){nextNextLatLons=leg.Itinerary.Items[k+2].LatLong}else{if(i<legs.length-1){nextNextLatLons=legs[i+1].Itinerary.Items[1].LatLong}}shapeDescriptionItems=new Array();wayPointLinks=new Array();shapeDescriptionItems.push("<td class='DDEroTextStepNum'>"+prevStep+"</td><td class='DDEroTextStepText'>"+prevText+"</td><td class='waypointDescriptionDistance'>"+mapManager.getDistTime(prevDist,prevTime)+"</td>");shapeDescriptionItems.push("<td class='DDEroTextStepNum DDEroTextStepNumSelected'>"+curStep+"</td><td class='DDEroTextStepText'>"+curText+"</td><td></td>");shapeDescriptionItems.push("<td class='DDEroTextStepNum'>"+nextStep+"</td><td class='DDEroTextStepText'>"+nextText+"</td><td class='waypointDescriptionDistance'>+"+mapManager.getDistTime(nextDist,nextTime)+"</td>");wayPointLinks.push(prevLatLons+","+prevPrevLatLons+","+curLatLons+");'>prev");wayPointLinks.push(curLatLons+","+prevLatLons+","+nextLatLons+");'>zoom in");wayPointLinks.push(nextLatLons+","+prevLatLons+","+nextNextLatLons+");'>next");legsArray.push("<tr><td style='width:27px' onclick='mapManager.CenterAndZoom("+curLatLons+","+prevLatLons+","+nextLatLons+")'><div class='drivingDirectionsTurnIcon drivingDirectionsTurnListIcon' style='background-image:url(\"/images/shared/map/turnpointPushpin.png\")'><div class='drivingDirectionsTurnIconText'>"+numTurns+"</div></div></td><td style='width:10px'></td><td><div class='drivingDirectionsListDetails'><span>"+leg.Itinerary.Items[k].Text+"</span></div></td></tr>");shape=curShape;shape.SetDescription("(DDI)<table id='turnpoint"+numTurns+"_table' class='DDEroText'><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextPrevious'>"+shapeDescriptionItems[0]+"</tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextCurrentSeperator DDEroTextSeperatorCurrentTop DDEroTextCurrent'><td></td><td></td><td class='popupLink DDEroUpArrow' onclick='mapManager.ShowInfoBoxp;'></td></tr><tr class='DDEroTextCurrent DDEroTextStepText'>"+shapeDescriptionItems[1]+"</tr><tr class='DDEroTextCurrentSeperator DDEroTextSeperatorCurrentBottom DDEroTextCurrent'><td></td><td></td><td class='popupLink DDEroDownArrow' onclick='mapManager.ShowInfoBoxn;'></td></tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextNext'>"+shapeDescriptionItems[2]+"</tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr style='height:14px; background:#66676a'><td></td><td></td><td></td></tr></table>");shape.SetCustomIcon("<div class='drivingDirectionsTurnMapIcon drivingDirectionsTurnIcon' style='background-image:url(\"/images/shared/map/turnpointPushpin.png\")'><div class='drivingDirectionsTurnIconText'>"+numTurns+"</div></div>");map.AddShape(shape);shapeIds.push(shape.GetID())}prevPrevLatLons=prevLatLons;prevLatLons=curLatLons;prevShape=curShape;prevPrevText=prevText;prevText=curText;curText=nextText;prevStep=curStep;curStep=nextStep;curDist=nextDist;curTime=legs[0].Itinerary.Items[0].Time;totalDist+=leg.Distance;totalTime+=leg.Time;legsArray.push("</table>")}curLatLons=nextLatLons;curShape=nextShape;curText=nextText;curStep=nextStep;var shapeDescriptionItems=new Array();var wayPointLinks=new Array();shapeDescriptionItems.push("<td class='DDEroTextStepNum'>"+prevStep+"</td><td class='DDEroTextStepText'>"+prevText+"</td><td class='waypointDescriptionDistance'>"+mapManager.getDistTime(prevDist,prevTime)+"</td>");shapeDescriptionItems.push("<td class='DDEroTextStepNum DDEroTextStepNumSelected'>"+resourceFinalDestination+"</td><td class='DDEroTextStepText'>"+curText+"</td><td></td>");legsArray.push("<table class='directionsList' id='last_waypoint'><tr><td onclick='mapManager.CenterAndZoom("+curLatLons+","+prevLatLons+")'><div class='drivingDirectionsWaypointIcon drivingDirectionsWaypointListIcon' style='background-image:url(\"/images/shared/map/"+iconArray[legs.length]+".gif\")'><b></b></div></td><td style='width:10px'></td><td><div class='drivingDirectionsListDetails'>"+mapManager.extractPlaceValues(false,waypointsArray.length-1)+"</div><div>"+mapManager.getDistTime(totalDist,totalTime)+"</div></td></tr>");shape=curShape;shape.SetDescription("(DDL)<table id='turnpoint"+numTurns+"_table' class='DDEroText'><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextPrevious'>"+shapeDescriptionItems[0]+"</tr><tr class='DDEroTextSeperator'><td></td><td></td><td></td></tr><tr class='DDEroTextCurrentSeperator DDEroTextSeperatorCurrentTop DDEroTextCurrent'><td></td><td></td><td class='popupLink DDEroUpArrow' onclick='mapManager.ShowInfoBoxp;'></td></tr><tr class='DDEroTextCurrent DDEroTextStepText'>"+shapeDescriptionItems[1]+"</tr><tr class='DDEroTextSeperator DDEroTextSeperatorCurrentBottom DDEroTextCurrent'><td></td><td></td><td></td></tr><tr style='height:14px; background:#66676a'><td></td><td></td><td></td></tr></table>");shape.SetCustomIcon("<div class='drivingDirectionsWaypointMapIcon drivingDirectionsWaypointIcon' style='background-image:url(\"/images/shared/map/"+iconArray[legs.length]+".gif\")'></div>");map.AddShape(shape);shapeIds.push(shape.GetID());ClientCache.Save("pane_"+paneNumber+"_turnpointIds",shapeIds.join("|"));document.getElementById("firstResultDiv"+paneNumber).innerHTML=legsArray.join("");var fromDDInfoArray=mapManager.extractNameLatLon(0);var toDDInfoArray=mapManager.extractNameLatLon(1);if(debug){console.log("fromDDInfoArray: %s @ %s,%s",fromDDInfoArray[0],fromDDInfoArray[1],fromDDInfoArray[2])}if(debug){console.log("toDDInfoArray: %s @ %s,%s",toDDInfoArray[0],toDDInfoArray[1],toDDInfoArray[2])}$("printDDLink").innerHTML="<a target='_blank' href='/search/print/map.html?fromAddr="+fromDDInfoArray[0]+"&fromLat="+fromDDInfoArray[1]+"&fromLon="+fromDDInfoArray[2]+"&toAddr="+toDDInfoArray[0]+"&toLat="+toDDInfoArray[1]+"&toLon="+toDDInfoArray[2]+"'>"+resourcePrintDrivingDir+"</a>";mapManager.resizeLeftDD();POIManager.RefreshPOIs();HideLoading()};this.extractNameLatLon=function(index){var itemArray=waypointsArray[index].split(";");var name=itemArray[0];var latlon=itemArray[1];var returnArray=latlon.match(/\((.+)?,(.+)?\)/);returnArray.splice(0,1,name);return returnArray};this.CenterAndZoom=function(centerLat,centerLon,secondLat,secondLon,thirdLat,thirdLon){var includePredAndSuc=false;var latLon=new VELatLong(centerLat,centerLon);map.SetCenterAndZoom(latLon,15);if(includePredAndSuc){if(!(typeof secondLat=="undefined")){latLon=new VELatLong(secondLat,secondLon);map.IncludePointInView(latLon)}if(!(typeof thirdLat=="undefined")){latLon=new VELatLong(thirdLat,thirdLon);map.IncludePointInView(latLon)}if(map.GetZoomLevel()<18){map.SetCenterAndZoom(latLon,15)}}};this.ShowInfoBox=function(shapeID){nextEro=new PushpinERO(shapeID,map);nextEro.Show()};this.getDistTime=function(dist,time){var dist=Math.round(dist*10)/10+" km";var time="("+Math.round(time/60)+" min)";return dist+"<div>"+time+"</div>"};function incrementWayPointCount(wayPointCount){if(wayPointCount==25){return wayPointCount}else{return wayPointCount+1}}this.toggleAddLocation=function(index){var addLocationElement=document.getElementById("addDestinationPanel"+index);var addLocationArrow=document.getElementById("addLocationArrow"+index);if(addLocationElement.style.display=="none"){addLocationElement.style.display="block";addLocationArrow.src="Images/downarrow.gif"}else{addLocationElement.style.display="none";addLocationArrow.src="Images/rightarrow.gif"}};this.MapResize=function(){if(debug){console.log("MapResize")}MapControl.Features.ScaleBarKilometers=true;OldMapCenter=map.GetCenter();OldMapZoomLevel=map.GetZoomLevel();if(onPanEnd==false){onPanEnd=true}var toggledMapSearchAttachedPZ=false;if(debug){console.log("In mm.MapResize:  Connected: %s. toggledMapSearchAttachedPZ: %s",mapSearchAttachedPZ,toggledMapSearchAttachedPZ)}if(mapSearchAttachedPZ){if(debug){console.log("In mm.MapResize:  Connected: %s.  Going to disconnect. toggledMapSearchAttachedPZ: %s",mapSearchAttachedPZ,toggledMapSearchAttachedPZ)}mapManager.Map.DetachEvent("onendpan",mapSearch);mapManager.Map.DetachEvent("onendzoom",mapSearch);toggledMapSearchAttachedPZ=true;mapSearchAttachedPZ=false}var mapWidthHeight=mapManager.GetMapWidthHeight();var mapWidth=mapWidthHeight[0];var mapHeight=mapWidthHeight[1]-(browserManager.BrowserName=="msie"?(0-6):0);map.Resize(parseInt(mapWidth),mapHeight);map.SetCenterAndZoom(OldMapCenter,OldMapZoomLevel);if(toggledMapSearchAttachedPZ){if(isMerchantPage==false){if(debug){console.log("In mm.MapResize:  Connected: %s.  Going to connect. toggledMapSearchAttachedPZ: %s",mapSearchAttachedPZ,toggledMapSearchAttachedPZ)}mapManager.Map.AttachEvent("onendpan",mapSearch);mapManager.Map.AttachEvent("onendzoom",mapSearch);mapSearchAttachedPZ=true}else{if(debug){console.log("In mm.MapResize:  Connected: %s.  Skipping the reconnect because this is Merchant Page. toggledMapSearchAttachedPZ: %s",mapSearchAttachedPZ,toggledMapSearchAttachedPZ)}}}browserManager.GetWindowHeight()};this.OnMapResize=function(e){if(debug){console.log("OnMapResize: "+e)}setTimeout(function(){onPanEnd=false;if(isMerchantPage==true){if(YPSearchManager.g_FullMPSelectedData!=null&&YPSearchManager.g_FullMPSelectedData.listing!=undefined){var currentListing=YPSearchManager.g_FullMPSelectedData;map.SetCenter(new VELatLong(currentListing.listing.address.location.latitude,currentListing.listing.address.location.longitude))}if($YP("#yp_DrivingDirections0").css("display")=="block"){$YP("#weatherContainer").hide()}}if($YP("#yp_DrivingDirections0").css("display")=="block"){mapManager.resizeLeftDD()}},300)};this.resizeLeftDD=function(){var mapOffsetHeight=$(mapElement).offsetHeight;if(debug){console.log("resizeLeftDD: %f",mapOffsetHeight)}$("yp_DrivingDirections0").style.height=mapOffsetHeight+"px"};this.resizeLeftDiv=function(){if(paneNumber!=-1){var numPanes=AjaxControlManager.getNextPaneNumber();var headerHeightSum=(browserManager.BrowserName=="msie"?39:(browserManager.BrowserName=="safari"?17:10));for(var i=0;i<numPanes;i++){headerHeightSum+=document.getElementById("header"+i).offsetHeight}if(numPanes==1&&browserManager.BrowserName=="msie"){headerHeightSum+=15}if(ClientCache.Retrieve("pane_"+paneNumber+"_type")=="per"||ClientCache.Retrieve("pane_"+paneNumber+"_type")=="bus"){document.getElementById("content"+paneNumber).style.height=document.getElementById(mapElement).offsetHeight-15-(browserManager.BrowserName=="msie"?118:(browserManager.BrowserName=="safari"?157:65))-headerHeightSum+(document.getElementById("PanelWhatsNearby").style.display=="none"?0:67)+"px"}else{if(ClientCache.Retrieve("pane_"+paneNumber+"_type")=="dd"){document.getElementById("content"+paneNumber).style.height=document.getElementById(mapElement).offsetHeight+7-headerHeightSum-(document.getElementById("PanelWhatsNearby").style.display=="none"?(browserManager.BrowserName=="msie"?120:80):0)+"px";document.getElementById("yp_DrivingDirections"+paneNumber).style.width="93%"}else{document.getElementById("yp_FindOnMap"+paneNumber).style.height=document.getElementById(mapElement).offsetHeight+5+(browserManager.BrowserName=="msie"?38:(browserManager.BrowserName=="safari"?16:8))-headerHeightSum-(document.getElementById("PanelWhatsNearby").style.display=="none"?80:0)+"px";document.getElementById("firstResultDiv"+paneNumber).style.width="100%";document.getElementById("firstResultDiv"+paneNumber).style.overflow="hidden"}}}};this.updateClientCacheCenter=function(e){var center=map.GetCenter();ClientCache.Save("center",center.Latitude+"|"+center.Longitude)};this.updateClientCacheZoom=function(e){var center=map.GetCenter();ClientCache.Save("center",center.Latitude+"|"+center.Longitude);ClientCache.Save("zoom",map.GetZoomLevel())};this.updateClusterOnOff=function(e){var curZoom=map.GetZoomLevel();if(debug){console.log("updateClusterOnOff: zoom:%d ",curZoom)}if(curZoom>=clusterOnOffZoomThreshold){clusterManager.ClusterOff(100)}else{clusterManager.ClusterOn(100)}};this.updateClientCacheStyle=function(e){ClientCache.Save("style",map.GetMapStyle())};this.GetTrafficToronto=function(){map.SetCenterAndZoom(new VELatLong(43.673334930320145,-79.420166015625),11);ToggleTraffic();if(document.getElementById("PanelWhatsNearby").style.display=="none"){FindNearbyShow();ShowTrafficTab()}};this.IsLatLong=function(input){var result=false;if(/^[-]?[\d]{1,3}[\.]?[\d]*[,][\s]?[-]?[\d]{1,3}[\.]?[\d]*$/.test(input)){var coords=input.replace(/[\s]/g,"").split(",");if(coords.length==2){var lat=coords[0];var lon=coords[1];if(lat>=-90&&lat<=90&&lon>=-180&&lon<=180){result=true}}}return result};this.LatLongToPlaceArray=function(input,placeName){var latLong=null;var result=null;if(typeof(input)=="string"){var coords=input.replace(/[\s]/g,"").split(",");latLong=new VELatLong(coords[0],coords[1])}else{if(typeof(input)=="object"){latLong=input}}if(latLong!=null){if(placeName==null){result=new Array(new VEPlace(latLong.toString(),latLong,null,0,0,1))}else{result=new Array(new VEPlace(placeName,latLong,null,0,0,1))}}return result};this.mouseoverCB=function(e){if(e.elementID!=null&&map.GetShapeByID(e.elementID)!=null){var shape=map.GetShapeByID(e.elementID);if(shape._customIcon!=undefined){var curCustomIconClass=shape._customIcon.match(/class=(["'])?([\w\s]*)\1/)[2];if(curCustomIconClass.match(/^clusterPin|drivingDirectionsTurnMapIcon|drivingDirectionsWaypointMapIcon/i)!=null){return true}else{return false}}}else{return false}};this.mouseoutCB=function(e){if(e.elementID!=null&&map.GetShapeByID(e.elementID)!=null){var shape=map.GetShapeByID(e.elementID);if(shape._customIcon!=undefined){var curCustomIconClass=shape._customIcon.match(/class=(["'])?([\w\s]*)\1/)[2];if(curCustomIconClass.match(/^pin_wf|pin_v_wf|pin_nonad|pin_v_nonad/i)!=null){return true}else{return false}}}else{return false}}}if(/(?:Gecko\/|AppleWebKit\/|Opera\/|KHTML)/.test(navigator.userAgent)){Msn.Drawing.Graphic.CreateGraphic=function(f,b){return new Msn.Drawing.SVGGraphic(f,b)}};
