if(typeof TomTom==="undefined"){TomTom={}}TomTom.Controls={};TomTom.Config={Map:{ServerRenderer:true,AnimatedZoomPan:true,TiledCanvas:true,Bounds:{minLat:20037508.3427892,minLon:-20037508.3427892,maxLat:-20037508.3427892,maxLon:20037508.3427892},Center:{lat:6867999.335859477,lon:544458.0860867497,zoom:0},Resolutions:[39135.758482010155,19567.879241005077,9783.939620502539,4891.969810251269,2445.9849051256347,1222.9924525628173,611.4962262814087,305.74811314070433,152.87405657035217,76.43702828517608,38.21851414258804,19.10925707129402,9.55462853564701,4.777314267823505,2.3886571339117526,1.1943285669558763]},debug:("false"=="true"?true:false),Services:{location:(typeof LocationService=="object"?LocationService:null)},Layers:{basic:"http://wms01.routes.tomtom.com/lbs/wms,http://wms02.routes.tomtom.com/lbs/wms,http://wms03.routes.tomtom.com/lbs/wms,http://wms04.routes.tomtom.com/lbs/wms",canvas:"http://wms01.routes.tomtom.com/lbs/wms,http://wms02.routes.tomtom.com/lbs/wms,http://wms03.routes.tomtom.com/lbs/wms,http://wms04.routes.tomtom.com/lbs/wms",getCanvas:function(){return this.canvas.split(",")},getBasic:function(){return this.basic.split(",")}},GeocodeTolerance:0.88,GeocodeBias:[0,0,0.02,0.04,0.06,0.1,0.14,0.19,0.25,0.32,0.39,0.47,0.56,0.66,0.77,0.88],apikey:"55849048-cbd2-4bfc-a7b4-83acbebecf3d",REST:{baseUrl:"/lbs/services".replace(/\/$/,"")},ajaxTimeout:"30000",staticDir:"/t".replace(/\/$/,""),lbsStaticDir:"/lbs".replace(/\/$/,"")+"/",lbsInternalHost:"http://172.18.136.24",findFriendUrl:"/services/flag/location",adServerUrl:"/t/assetmngr".replace(/\/\//g,"/").replace(/http:\//,"http://"),oasisKey:"9256e829-73f3-4eba-aa51-0a614e56fef5",oasisUrl:"http://addto.tomtom.com/api/home/v2/",wbrpHome:"/t",wbrpContextRoot:"/t",getWbrpAbsoluteUrl:function(){return TomTom.Config.lbsInternalHost+TomTom.Config.wbrpContextRoot},UntiledTrafficLayer:"false",UntiledRouteLayer:"false",pathToEmptyTile:"/lbs/wms/empty.gif",personalNavigatorUrl:"/t/personalnavigator",tomtomDomain:"tomtom.com",defaultTripAdvisorDeparture:"now_with_traffic",tomtomLocales:{en:"1",en_UK:"1",fr:"2",de:"3",en_US:"4",nl:"5",es:"6",it:"7",en_AU:"8",de_AT:"11",nl_BE:"12",fr_BE:"13",de_LU:"15",fr_CH:"19",de_CH:"20",en_CA:"22",en_IE:"25",en_ZA:"south-africa",da:"14",sv:"18",no:"16",fi:"24",cs:"10",hu:"31",pl:"9",pt:"17",tr:"26",af:"28"},tomtomLidSydneyLocale:[{id:"1",lang:"en_UK"},{id:"2",lang:"fr"},{id:"3",lang:"de"},{id:"4",lang:"en_US"},{id:"5",lang:"nl"},{id:"6",lang:"es"},{id:"7",lang:"it"},{id:"14",lang:"da"},{id:"18",lang:"sv"},{id:"16",lang:"no"},{id:"24",lang:"fi"},{id:"10",lang:"cs"},{id:"31",lang:"hu"},{id:"9",lang:"pl"},{id:"17",lang:"pt"},{id:"26",lang:"tr"},{id:"28",lang:"af"}],localeValidated:function(B){var A="af,cs,de,en,es,fr,hu,it,nl,pl,pt,tr";A=A.toLowerCase();if(A.indexOf(B.toLowerCase())==-1){return false}else{return true}},tomtomLanguageId2SydneyLocale:function(C){for(var B=0;B<this.tomtomLidSydneyLocale.length;B++){var A=this.tomtomLidSydneyLocale[B];if(A.id==C){return A.lang}}return"en"},Icons:{home:"homeIcon"},mapTileBuffer:"1",viewportMaxDimensions:"1600,1200",getViewportMaxDimensions:function(){var A=this.viewportMaxDimensions.split(",");if(A.length==2){return new Array(parseInt(A[0],10),parseInt(A[1],10))}else{return[]}},bodyMinDimensions:"1150,560",getBodyMinDimensions:function(){return this.getDimensionsAsArray(this.bodyMinDimensions)},getDimensionsAsArray:function(A){var B=A.split(",");if(B.length==2){return new Array(parseInt(B[0],10),parseInt(B[1],10))}else{return[]}},Traffic:{incidentsMinZoomLevel:parseInt("5",10),updateInterval:parseInt("120",10)},Video:{baseDir:"http://download.tomtom.com/open/liveshow.tomtom.com/",fileName:"videoplayer?video_file=introduction_"},GetViewportDescCauses:{MAP_CHANGE:1,TRAFFIC_AGE_POLL:2},UnitTests:{runFlag:"0"},unitTypes:{KM:0,MI:1}};TomTom.LazyLoad=function(){var A,A={load:function(B){new Ajax.Request(TomTom.Config.staticDir+"/js/tomtom/lib/"+B,{method:"get",evalJS:false,evalJSON:false,onSuccess:function(C){var D=document.createElement("script");document.getElementsByTagName("head")[0].appendChild(D);D.text=C.responseText}})}};return A}();TomTom.CookieManager={wbrpLocaleCookie:"wbrplocale",tomtomLocaleCookie:"tt_locale",defaultCookieName:"WBRPPrefs",defaultDelimeter:"&",homeField:"tt_home",uiField:"ui",preferredUnitsField:"pu",defaultPath:"/",prefsPath:TomTom.Config.wbrpContextRoot,defaultExpiry:30,set:function(C,D,B,E){var A="";if(!B){B=this.defaultExpiry}if(!E){E=this.defaultPath}var F=new Date();F.setTime(F.getTime()+(86400000*parseFloat(B)));A="; expires="+F.toGMTString()+"; path="+(E.length>0?E:this.defaultPath);return(document.cookie=escape(C)+"="+escape(D||"")+A)},get:function(A){var B=document.cookie.match(new RegExp("(^|;)\\s*"+escape(A)+"=([^;\\s]*)"));return(B?unescape(B[2]):null)},getField:function(C,G,B){if(B==null){B=this.defaultDelimeter}var E=this.get(C);if(E!=null){var A=E.split(B);for(var D=0;D<A.length;D++){var F=A[D].split("=");if(F[0]==G){if(F.length>1){return F[1]}else{return""}}}}return null},setField:function(B,I,C,F,E){if(E==null){E=this.defaultDelimeter}if(F==null){F=this.defaultExpiry}var D=this.get(B);var J=false;if(D!=null){var H=D.split(E);for(var G=0;G<H.length;G++){var A=H[G].split("=");if(A[0]==I){H[G]=A[0]+"="+C;J=true}}if(!J){H[H.length]=I+"="+C}this.set(B,H.join(E),F,this.prefsPath)}else{this.set(B,I+"="+C,F,this.prefsPath)}return this.get(B)},removeField:function(C,G){var E=this.get(C);var B=[];if(E!=null){var A=E.split(this.defaultDelimeter);for(var D=0;D<A.length;D++){var F=A[D].split("=");if(F[0]!=G){B.push(F[0]+"="+F[1])}}}this.set(C,B.join(this.defaultDelimeter),this.defaultExpiry,this.prefsPath)},erase:function(A){var B=Cookie.get(A)||true;Cookie.set(A,"",-1);return B},accept:function(){if(typeof navigator.cookieEnabled=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")==="1")},hasHomeSet:function(){var A=this.getField(this.defaultCookieName,this.homeField);if(A){return A}return false},addLocation:function(A){TomTom.LocationsCookie.addLocation(A)},loadLocations:function(){TomTom.LocationsCookie.loadLocations()},getSavedLocations:function(){return TomTom.LocationsCookie.getSavedLocations()},clearLocations:function(){TomTom.LocationsCookie.clearLocations()}};TomTom.LocationsCookie=function(){var H,I="locs",G=";",E="^",D=[],B=20,A=function(){var L=[];for(var K=D.length-1;K>=0;K--){L[K]=D[K].join(E)}var J=L.join(G);TomTom.CookieManager.setField(TomTom.CookieManager.defaultCookieName,I,J)},C=function(K){var J=D,M=J.length-1,N=Number.MAX_VALUE;for(var O=J.length-1;O>=0;O--){var L=J[O];if(L[H.LOC_ADDR_IDX]==K){return{alreadyExistsIndex:O}}if(O>4&&L[H.LOC_AGE_IDX]!=0){var P=L[H.LOC_COUNT_IDX]/L[H.LOC_AGE_IDX];if(P<N){M=O;N=P}}}return{alreadyExistsIndex:null,lowestRatioIndex:M}},F=function(){D.sort(function(K,J){return J[0]-K[0]})},H={LOC_COUNT_IDX:0,LOC_ADDR_IDX:1,LOC_AGE_IDX:2,LOC_POI_CATEGORY_IDX:3,clearLocations:function(){TomTom.CookieManager.removeField(TomTom.CookieManager.defaultCookieName,I);D=[]},loadLocations:function(){D=[];var J=TomTom.CookieManager.getField(TomTom.CookieManager.defaultCookieName,I);if(J!=""&&J!=null){var L=J.split(G);for(var K=L.length-1;K>=0;K--){D[K]=L[K].split(E);D[K][this.LOC_AGE_IDX]=parseInt(D[K][this.LOC_AGE_IDX],10)+1}}F();A()},addLocation:function(N){var J=N.formattedAddress,L=N.poiCategory,O=C(J),M=O.alreadyExistsIndex;if(M!=null){D[M][this.LOC_COUNT_IDX]=parseInt(D[M][this.LOC_COUNT_IDX],10)+1;D[M][this.LOC_AGE_IDX]=0}else{var K=D.length;if(K<B){D[K]=[1,J,0,L]}else{D[O.lowestRatioIndex]=[1,J,0,L]}}F();A()},getSavedLocations:function(){return D}};return H}();TomTom.MessageBus=function(){return{startTime:0,finishTime:0,channels:[],wbrpState:null,initialize:function(){},unsubscribe:function(H,E){var C=this.channels.length;for(var D=0;D<H.length;D++){for(var B=0;B<C;B++){var G=this.channels[B];if(G.topic==H[D]){var F=G.modules.length;for(var A=0;A<F;A++){if(E==G.modules[A]){G.modules.splice(A,1);break}}}}}},subscribe:function(F,D){var B=this.channels.length;for(var C=0;C<F.length;C++){for(var A=0;A<B;A++){var E=this.channels[A];if(E.topic==F[C]){if(E.modules.indexOf(D)==-1){E.modules.push(D)}break}}if(A==B){var E=new Object();E.topic=F[C];E.modules=new Array();E.modules.push(D);this.channels.push(E)}}},publish:function(C,F){var B=this.channels.length;for(var D=0;D<B;D++){if(this.channels[D].topic==C){C=C.split("__")[0];var E=this.channels[D].modules.length;for(var A=0;A<E;A++){this.channels[D].modules[A].notified(C,F)}break}}}}}();TomTom.RouteSummary=Class.create();TomTom.RouteSummary.empty=function(){return new TomTom.RouteSummary()};TomTom.RouteSummary.prototype={empty:function(){return this.departureDay==""},departureDay:"",departureTime:"",arrivalDay:"",arrivalTime:"",initialize:function(A,B){if(!A||!B){return }this.calculateTripAdvisorSummary(B.departureMoment,A.departureOverviewDay,A.arrivalOverviewDay,A.departureOverviewTime,A.arrivalOverviewTime)},calculateTripAdvisorSummary:function(C,B,E,D,A){if(C=="no_specific"){this.departureDay="";this.departureTime="";this.arrivalDay="";this.arrivalTime=""}else{this.departureDay=B;this.departureTime=D;this.arrivalDay=E;this.arrivalTime=A}}};if(typeof TomTom==="undefined"){TomTom={}}TomTom.ClientState=function(){var M,L=TomTom.MessageBus,R=TomTom.CookieManager,P="zoom",E="center",W="ui",Q="bbox",V="leave",O="traffic",K="test",N="name",Y=2,I=4,D=8,J=function(a){if(a!=null){M.action=M.ACTION_PLANROUTE;R.addLocation(a);return a}return null},Z=function(a){if(!a){TomTom.Map.setResolutions(TomTom.Config.Map.Resolutions.slice(0,M.map.getZoom()+1))}else{TomTom.Map.setResolutions(TomTom.Config.Map.Resolutions)}M.zoomInEnabled=a},S=function(a){TomTom.History.add(M.serialize(),a)},H=function(){R.setField(R.defaultCookieName,R.uiField,G())},U=function(){var a=R.getField(R.defaultCookieName,R.uiField);return T(a)},A=function(a){return a!=null?"@"+a.latitude+","+a.longitude:""},C=function(b){var a=b.formattedAddress;if(a.indexOf("@")!=-1){a=a.substring(0,a.indexOf("@")-1)}return encodeURIComponent(encodeURIComponent(a+A(b.coordinate)+"@"+b.poiCategory))+"/"},G=function(){var a=0;if(M.action==M.ACTION_FINDLOCATION){a+=D}return a},T=function(a){var b=false;b=b||M.contextMenu!=(a&I);M.contextMenu=(a&I);M.findlocationPin=(a&D);return b},X=function(a){M.tripAdvisorInfo=TomTom.TripAdvisorInfo.deserialize(a)},B=function(b){var c=decodeURIComponent(decodeURIComponent(b));if(!c||c.trim()==""){return null}var e=c.split("@"),l=e[0],h=l;if(e[1]){var f=e[1].split(",");if(f.length>1){var m=f[0],a=f[1],g=TomTom.Utils.forwardMercator(parseFloat(a),parseFloat(m))}}var k=g?g.lon:null,j=g?g.lat:null,n=g?{latitude:m,longitude:a,mercX:k,mercY:j}:null,d=null;if(h&&h.length>1){d=h.substr(h.length-2,2)}return{inputString:l,formattedAddress:h,coordinate:n,country:d,poiCategory:e[2]?e[2]:-1}},F=function(b){var a=b,c=a.indexOf("@");if(c>=0){a=a.substring(0,c)}return a};M={ACTION_HOMESET:"homeset",ACTION_PLANROUTE:"planroute",ACTION_FINDLOCATION:"findlocation",ACTION_FINDFRIEND:"findfriend",TAB_PLANROUTE:"planroute",TAB_FINDLOCATION:"findlocation",map:null,ttMap:null,locale:"en",panelTab:null,traffic:null,action:null,departure:null,destination:null,foundLocation:null,mapName:null,home:null,friend:null,zoom:null,center:null,bbox:null,panbackjustclicked:false,country:null,tripAdvisorInfo:null,contextMenu:false,findlocationPin:false,tripAdvisorSummary:TomTom.RouteSummary.empty(),i18nTexts:[{id:"close_text.content",evtid:"close_text",text:"Close"},{id:"film_locale.content",evtid:"film_locale",text:"en"}],testing:false,zoomInEnabled:true,preferredUnitTypes:{KM:0,MI:1},initLoadState:false,initialize:function(a){this.tripAdvisorInfo=TomTom.TripAdvisorInfo.createDefault();if(a==true){return }L.subscribe(["homeset","destinationFilled","departureFilled","mapchanged","setlocale","tabchanged","findlocationgeocode","trafficstatechanged","tripadvisorrequestparamsprepared","i18nupdated","settitle","routeplanned","getViewportDescOk"],this);var b=window.location.toString().replace("#/","");var c=b.toQueryParams();this.panelTab=$("location_content").getStyle("display")=="block"?this.TAB_FINDLOCATION:this.TAB_PLANROUTE;this.testing=c[K]?c[K]:false},getVideoLanguage:function(){return TomTom.Utils.getText(this.i18nTexts,"film_locale")},minimiseTrafficDelays:function(){return Boolean(this.tripAdvisorInfo.minimiseDelays)},getPreferredUnits:function(a){var b=R.getField(R.defaultCookieName,R.preferredUnitsField);return b?parseInt(b):TomTom.CountryList.isImperialCountry(a)?TomTom.Config.unitTypes.MI:TomTom.Config.unitTypes.KM},setPreferredUnits:function(a){R.setField(R.defaultCookieName,R.preferredUnitsField,a)},notified:function(c,d){switch(c){case"setlocale":this.locale=d;break;case"tabchanged":this.panelTab=d;break;case"findlocationgeocode":this.foundLocation=d.location;R.addLocation(this.foundLocation);this.action=this.ACTION_FINDLOCATION;this.bbox=this.map.getExtent().toBBOX();this.zoom=this.map.getZoom();var b=this.foundLocation.formattedAddress;L.publish("settitle",b);var e={altResults:d.altResults,formattedAddress:b,docTitle:b};S(e);break;case"routeplanned":this.action=this.ACTION_PLANROUTE;var e={docTitle:d.title};S(e);break;case"mapchanged":var a=this.map.getCenter();if(!a){break}this.center=a.lon+","+a.lat;this.zoom=this.map.getZoom();this.bbox=this.map.getExtent().toBBOX();break;case"homeset":this.home=d;this.action=this.ACTION_HOMESET;break;case"departureFilled":this.departure=J(d);break;case"destinationFilled":this.destination=J(d);break;case"trafficstatechanged":H();break;case"tripadvisorrequestparamsprepared":H();break;case"i18nupdated":TomTom.Utils.updateTexts(this.i18nTexts,d);break;case"settitle":document.title="TomTom Route Planner - "+d;break;case"getViewportDescOk":this.mapName=d.maps;Z(d.canZoomIn);break;default:break}},retrieveState:function(){if(this.action==null){L.publish("mapstatechanged",true);S({})}L.publish("maploaded")},serialize:function(a,h){var c={};var d=true;if(!a){a=this}else{a.locale=this.locale}var f=G();var b="";if(a.action==this.ACTION_PLANROUTE){this.foundLocation=null;d=false;b+="/route/";if(this.departure){b+=C(this.departure)}else{b+="/"}if(this.destination){b+=C(this.destination)}else{b+="/"}var g=a.tripAdvisorInfo.serialize(h).toQueryParams();c[V]=g.leave;if(g.traffic){c[O]=g.traffic}}else{b+="/map/";if(a.action==this.ACTION_FINDLOCATION){d=false;if(this.foundLocation){b+=C(this.foundLocation)}}else{if(a.action==this.ACTION_HOMESET){}}}if(this.foundLocation){c[E]=this.foundLocation.coordinate.latitude+","+this.foundLocation.coordinate.longitude}else{if(a.center){var j=OpenLayers.LonLat.fromString(a.center);var e=TomTom.Utils.inverseMercator(j.lon,j.lat);c[E]=e.lat+","+e.lon}}if(a.zoom){c[P]=a.zoom}if(f>0){c[W]=f}if($H(c).size()>0){d=false}if(!d){b+="?"+$H(c).toQueryString()}else{b="/"}return b},serializeWithBBox:function(){var a=this.serialize(null,true);var b={};b[Q]=this.bbox;return a+"&"+$H(b).toQueryString()},deserialize:function(a){return this.deserializeURL(a)},deserializeURL:function(f){var g=false;var c=window.location.toString().replace("#/","");var e=c.toQueryParams();var q=c.replace(window.location.protocol+"//"+window.location.host+TomTom.Config.wbrpContextRoot+"/","");var p=q.indexOf("?");if(p>=0){q=q.substr(0,p)}if(q.startsWith("http:")){return false}if(e[E]){var a=decodeURIComponent(e[E]);var k=a.split(",");var n=TomTom.Utils.forwardMercator(parseFloat(k[1]),parseFloat(k[0]));this.center=n.lon+","+n.lat;g=true}if(e[P]){this.zoom=parseInt(e[P]);g=true}if(e[Q]){this.bbox=e[Q];g=true}if(e[W]){g=true;var j=e[W];T(j)}if(q.startsWith("print/")){q=q.replace("print/","")}var b=q.split("/");var d=b[0];if(d=="map"){g=true;if(b.length>1&&b[1].trim().length>0){this.action=this.ACTION_FINDLOCATION;this.panelTab=this.TAB_FINDLOCATION;this.foundLocation=B(b[1])}else{var m=R.hasHomeSet();if(m){var l=m.evalJSON();var h=this.getViewport();if(l.coordinate.mercY==h.coordinate.mercY&&l.coordinate.mercX==h.coordinate.mercX){this.action=this.ACTION_HOMESET;this.home=this.getViewport()}}}}else{if(d=="route"){g=true;this.action=this.ACTION_PLANROUTE;this.panelTab=this.TAB_PLANROUTE;this.departure=B(b.length>1?b[1]:"");this.destination=B(b.length>2?b[2]:"");X(c);if(this.tripAdvisorInfo!=null){L.publish("restoretripadvisorstate",this.tripAdvisorInfo)}}}if(g){L.publish("clearlocationmarker");L.publish("statechanged",f);L.publish("disablePanback")}return false},getViewport:function(){if(!this.center){return null}var a=OpenLayers.LonLat.fromString(this.center);var b={mercX:a.lon,mercY:a.lat};return{zoom:this.zoom,coordinate:b}},parseLocale:function(){var a=this.locale;if(a&&a.length>2){a=a.substr(0,2)}return a},isAllowedToThisZoom:function(a){return(this.zoomInEnabled||a<=this.map.getZoom())},isAllowedToZoomIn:function(){return this.zoomInEnabled},setTTMap:function(a){this.ttMap=a},getTTMap:function(){return this.ttMap}};L.wbrpState=M;return M}();TomTom.VideoOverlay=Class.create();TomTom.VideoOverlay.prototype={yPos:0,xPos:0,lang:null,htmlString:null,initialize:function(){var B=document.getElementsByTagName("body")[0];var A=document.createElement("div");A.id="overlay";B.appendChild(A);TomTom.MessageBus.subscribe(["startdemovideo","startmanhattan","stopdemovideo","stopmanhattan"],this)},activateVideo:function(){this.content="video_panel";if(Prototype.Browser.IE){this.hideSelects("hidden")}this.displayLightbox("block");this.showMovie()},activateManhattan:function(A){this.content="manhattan_panel";if(Prototype.Browser.IE){this.hideSelects("hidden")}this.displayLightbox("block");this.showManhattan(A)},hideSelects:function(A){selects=document.getElementsByTagName("select");for(i=0;i<selects.length;i++){selects[i].style.visibility=A}},getScroll:function(){if(self.pageYOffset){this.yPos=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.yPos=document.documentElement.scrollTop}else{if(document.body){this.yPos=document.body.scrollTop}}}},setScroll:function(A,B){window.scrollTo(A,B)},displayLightbox:function(A){$("overlay").style.display=A;$(this.content).style.display=A},closeVideoOverlay:function(){this.content="video_panel";if(Prototype.Browser.IE){this.setScroll(0,this.yPos);this.hideSelects("visible")}this.displayLightbox("none");document.getElementById("video_panel").innerHTML=this.htmlString+"</div>"},closeManhattanOverlay:function(){this.content="manhattan_panel";if(Prototype.Browser.IE){this.setScroll(0,this.yPos);this.hideSelects("visible")}this.displayLightbox("none");document.getElementById("manhattan_panel").innerHTML=this.htmlString+"</div>"},showMovie:function(E){E=TomTom.MessageBus.wbrpState.getVideoLanguage();var D=TomTom.Config.Video.baseDir;if(D.substring(D.length-1,D.length)!="/"){D+="/"}var B=TomTom.Config.Video.fileName+E+".flv";var A=this.AC_FL_DynRunContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0","style","margin-top:-33px","width","480","height","310","src",D+B,"quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","align","l","play","true","loop","true","scale","showall","wmode","transparent","devicefont","false","id","movie","bgcolor","#ffffff","name","movie","menu","true","allowFullScreen","true","allowScriptAccess","always","movie",D+B,"salign","tl","base",D);this.htmlString=document.getElementById("video_panel").innerHTML.toString();var C=this.htmlString.indexOf("</div>");if(C==-1){C=this.htmlString.indexOf("</DIV>")}this.htmlString=this.htmlString.substring(0,C);document.getElementById("video_panel").innerHTML=this.htmlString+A+"</div>"},showManhattan:function(I){var D=TomTom.MessageBus.wbrpState.map.layers;var B=0;for(var C=0;C<D.length;C++){if(D[C].isBaseLayer==true){B=C;break}}var J=TomTom.MessageBus.wbrpState.map.layers[B];var M=TomTom.MessageBus.wbrpState.zoom;var K=new OpenLayers.Pixel(parseFloat(I.split(",")[0]),parseFloat(I.split(",")[1]));var E=J.getLonLatFromViewPortPx(K);var L=J.getTileBounds(K);var H="tile_bbox="+L.left+","+L.bottom+","+L.right+","+L.top;H+="&center="+E.lon+","+E.lat+"&zoom="+M;var A="flex/bin-debug/";var G="Manhattan";var F=this.AC_FL_DynRunContent("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0","width","510","height","458","src",A+G,"quality","high","pluginspage","http://www.macromedia.com/go/getflashplayer","align","l","play","true","loop","true","scale","showall","wmode","transparent","devicefont","false","id","movie","bgcolor","#ffffff","name","movie","menu","true","allowFullScreen","true","allowScriptAccess","always","movie",A+G,"FlashVars",H,"salign","tl","base",A);this.htmlString=document.getElementById("manhattan_panel").innerHTML.toString();var B=this.htmlString.indexOf("</div>");if(B==-1){B=this.htmlString.indexOf("</DIV>")}this.htmlString=this.htmlString.substring(0,B);document.getElementById("manhattan_panel").innerHTML=this.htmlString+F+"</div>"},AC_DynGenerateobj:function(F,E,A){var D="";var B=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;if(Prototype.Browser.IE&&B&&!Prototype.Browser.Opera){D+="<object ";for(var C in F){D+=C+'="'+F[C]+'" '}D+=">";for(var C in E){D+='<param name="'+C+'" value="'+E[C]+'" /> '}D+="</object>"}else{D+="<embed ";for(var C in A){D+=C+'="'+A[C]+'" '}D+="> </embed>"}return D},AC_FL_DynRunContent:function(){var B=this.AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");var A=this.AC_DynGenerateobj(B.objAttrs,B.params,B.embedAttrs);return A},AC_AddExtension:function(B,A){if(B.indexOf("?")!=-1){return B.replace(/\?/,A+"?")}else{return B+A}},AC_GetArgs:function(B,E,G,D,H){var A=new Object();A.embedAttrs=new Object();A.params=new Object();A.objAttrs=new Object();for(var C=0;C<B.length;C=C+2){var F=B[C].toLowerCase();switch(F){case"classid":break;case"pluginspage":A.embedAttrs[B[C]]=B[C+1];break;case"src":case"movie":B[C+1]=this.AC_AddExtension(B[C+1],E);A.embedAttrs.src=B[C+1];A.params[G]=B[C+1];break;case"onafterupdate":case"onbeforeupdate":case"onblur":case"oncellchange":case"onclick":case"ondblclick":case"ondrag":case"ondragend":case"ondragenter":case"ondragleave":case"ondragover":case"ondrop":case"onfinish":case"onfocus":case"onhelp":case"onmousedown":case"onmouseup":case"onmouseover":case"onmousemove":case"onmouseout":case"onkeypress":case"onkeydown":case"onkeyup":case"onload":case"onlosecapture":case"onpropertychange":case"onreadystatechange":case"onrowsdelete":case"onrowenter":case"onrowexit":case"onrowsinserted":case"onstart":case"onscroll":case"onbeforeeditfocus":case"onactivate":case"onbeforedeactivate":case"ondeactivate":case"type":case"codebase":case"id":A.objAttrs[B[C]]=B[C+1];break;case"width":case"height":case"align":case"vspace":case"hspace":case"class":case"title":case"accesskey":case"name":case"tabindex":A.embedAttrs[B[C]]=A.objAttrs[B[C]]=B[C+1];break;default:A.embedAttrs[B[C]]=A.params[B[C]]=B[C+1]}}A.objAttrs.classid=D;if(H){A.embedAttrs.type=H}return A},notified:function(A,B){switch(A){case"startdemovideo":this.activateVideo();break;case"startmanhattan":this.activateManhattan(B);break;case"stopdemovideo":this.closeVideoOverlay();break;case"stopmanhattan":this.closeManhattanOverlay();break;default:break}}};function hideDivs(){}function showDivs(){}
/*
 * Version: 1.0 Alpha-1 
 * Build Date: 13-Nov-2007
 * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
 * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/. 
 * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
 */
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};Date.getMonthNumberFromName=function(B){var E=Date.CultureInfo.monthNames,A=Date.CultureInfo.abbreviatedMonthNames,D=B.toLowerCase();for(var C=0;C<E.length;C++){if(E[C].toLowerCase()==D||A[C].toLowerCase()==D){return C}}return -1};Date.getDayNumberFromName=function(B){var F=Date.CultureInfo.dayNames,A=Date.CultureInfo.abbreviatedDayNames,E=Date.CultureInfo.shortestDayNames,D=B.toLowerCase();for(var C=0;C<F.length;C++){if(F[C].toLowerCase()==D||A[C].toLowerCase()==D){return C}}return -1};Date.isLeapYear=function(A){return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.getDaysInMonth=function(A,B){return[31,(Date.isLeapYear(A)?29:28),31,30,31,30,31,31,30,31,30,31][B]};Date.getTimezoneOffset=function(A,B){return(B||false)?Date.CultureInfo.abbreviatedTimeZoneDST[A.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[A.toUpperCase()]};Date.getTimezoneAbbreviation=function(B,D){var C=(D||false)?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,A;for(A in C){if(C[A]===B){return A}}return null};Date.prototype.clone=function(){return new Date(this.getTime())};Date.prototype.compareTo=function(A){if(isNaN(this)){throw new Error(this)}if(A instanceof Date&&!isNaN(A)){return(this>A)?1:(this<A)?-1:0}else{throw new TypeError(A)}};Date.prototype.equals=function(A){return(this.compareTo(A)===0)};Date.prototype.between=function(C,A){var B=this.getTime();return B>=C.getTime()&&B<=A.getTime()};Date.prototype.addMilliseconds=function(A){this.setMilliseconds(this.getMilliseconds()+A);return this};Date.prototype.addSeconds=function(A){return this.addMilliseconds(A*1000)};Date.prototype.addMinutes=function(A){return this.addMilliseconds(A*60000)};Date.prototype.addHours=function(A){return this.addMilliseconds(A*3600000)};Date.prototype.addDays=function(A){return this.addMilliseconds(A*86400000)};Date.prototype.addWeeks=function(A){return this.addMilliseconds(A*604800000)};Date.prototype.addMonths=function(A){var B=this.getDate();this.setDate(1);this.setMonth(this.getMonth()+A);this.setDate(Math.min(B,this.getDaysInMonth()));return this};Date.prototype.addYears=function(A){return this.addMonths(A*12)};Date.prototype.add=function(B){if(typeof B=="number"){this._orient=B;return this}var A=B;if(A.millisecond||A.milliseconds){this.addMilliseconds(A.millisecond||A.milliseconds)}if(A.second||A.seconds){this.addSeconds(A.second||A.seconds)}if(A.minute||A.minutes){this.addMinutes(A.minute||A.minutes)}if(A.hour||A.hours){this.addHours(A.hour||A.hours)}if(A.month||A.months){this.addMonths(A.month||A.months)}if(A.year||A.years){this.addYears(A.year||A.years)}if(A.day||A.days){this.addDays(A.day||A.days)}return this};Date._validate=function(D,C,A,B){if(typeof D!="number"){throw new TypeError(D+" is not a Number.")}else{if(D<C||D>A){throw new RangeError(D+" is not a valid value for "+B+".")}}return true};Date.validateMillisecond=function(A){return Date._validate(A,0,999,"milliseconds")};Date.validateSecond=function(A){return Date._validate(A,0,59,"seconds")};Date.validateMinute=function(A){return Date._validate(A,0,59,"minutes")};Date.validateHour=function(A){return Date._validate(A,0,23,"hours")};Date.validateDay=function(C,A,B){return Date._validate(C,1,Date.getDaysInMonth(A,B),"days")};Date.validateMonth=function(A){return Date._validate(A,0,11,"months")};Date.validateYear=function(A){return Date._validate(A,1,9999,"seconds")};Date.prototype.set=function(B){var A=B;if(!A.millisecond&&A.millisecond!==0){A.millisecond=-1}if(!A.second&&A.second!==0){A.second=-1}if(!A.minute&&A.minute!==0){A.minute=-1}if(!A.hour&&A.hour!==0){A.hour=-1}if(!A.day&&A.day!==0){A.day=-1}if(!A.month&&A.month!==0){A.month=-1}if(!A.year&&A.year!==0){A.year=-1}if(A.millisecond!=-1&&Date.validateMillisecond(A.millisecond)){this.addMilliseconds(A.millisecond-this.getMilliseconds())}if(A.second!=-1&&Date.validateSecond(A.second)){this.addSeconds(A.second-this.getSeconds())}if(A.minute!=-1&&Date.validateMinute(A.minute)){this.addMinutes(A.minute-this.getMinutes())}if(A.hour!=-1&&Date.validateHour(A.hour)){this.addHours(A.hour-this.getHours())}if(A.month!==-1&&Date.validateMonth(A.month)){this.addMonths(A.month-this.getMonth())}if(A.year!=-1&&Date.validateYear(A.year)){this.addYears(A.year-this.getFullYear())}if(A.day!=-1&&Date.validateDay(A.day,this.getFullYear(),this.getMonth())){this.addDays(A.day-this.getDate())}if(A.timezone){this.setTimezone(A.timezone)}if(A.timezoneOffset){this.setTimezoneOffset(A.timezoneOffset)}return this};Date.prototype.clearTime=function(){this.setHours(0);this.setMinutes(0);this.setSeconds(0);this.setMilliseconds(0);return this};Date.prototype.isLeapYear=function(){var A=this.getFullYear();return(((A%4===0)&&(A%100!==0))||(A%400===0))};Date.prototype.isWeekday=function(){return !(this.is().sat()||this.is().sun())};Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())};Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})};Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})};Date.prototype.moveToDayOfWeek=function(A,B){var C=(A-this.getDay()+7*(B||+1))%7;return this.addDays((C===0)?C+=7*(B||+1):C)};Date.prototype.moveToMonth=function(C,A){var B=(C-this.getMonth()+12*(A||+1))%12;return this.addMonths((B===0)?B+=12*(A||+1):B)};Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000)};Date.prototype.getWeekOfYear=function(A){var G=this.getFullYear(),C=this.getMonth(),E=this.getDate();var I=A||Date.CultureInfo.firstDayOfWeek;var D=7+1-new Date(G,0,1).getDay();if(D==8){D=1}var B=((Date.UTC(G,C,E,0,0,0)-Date.UTC(G,0,1,0,0,0))/86400000)+1;var H=Math.floor((B-D+7)/7);if(H===I){G--;var F=7+1-new Date(G,0,1).getDay();if(F==2||F==8){H=53}else{H=52}}return H};Date.prototype.isDST=function(){console.log("isDST");return this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"};Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())};Date.prototype.setTimezoneOffset=function(B){var A=this.getTimezoneOffset(),C=Number(B)*-6/10;this.addMinutes(C-A);return this};Date.prototype.setTimezone=function(A){return this.setTimezoneOffset(Date.getTimezoneOffset(A))};Date.prototype.getUTCOffset=function(){var B=this.getTimezoneOffset()*-10/6,A;if(B<0){A=(B-10000).toString();return A[0]+A.substr(2)}else{A=(B+10000).toString();return"+"+A.substr(1)}};Date.prototype.getDayName=function(A){return A?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]};Date.prototype.getMonthName=function(A){return A?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]};Date.prototype._toString=Date.prototype.toString;Date.prototype.toString=function(C){var A=this;var B=function B(D){return(D.toString().length==1)?"0"+D:D};return C?C.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(D){switch(D){case"hh":return B(A.getHours()<13?A.getHours():(A.getHours()-12));case"h":return A.getHours()<13?A.getHours():(A.getHours()-12);case"HH":return B(A.getHours());case"H":return A.getHours();case"mm":return B(A.getMinutes());case"m":return A.getMinutes();case"ss":return B(A.getSeconds());case"s":return A.getSeconds();case"yyyy":return A.getFullYear();case"yy":return A.getFullYear().toString().substring(2,4);case"dddd":return A.getDayName();case"ddd":return A.getDayName(true);case"dd":return B(A.getDate());case"d":return A.getDate().toString();case"MMMM":return A.getMonthName();case"MMM":return A.getMonthName(true);case"MM":return B((A.getMonth()+1));case"M":return A.getMonth()+1;case"t":return A.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return A.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return""}}):this._toString()};Date.now=function(){return new Date()};Date.today=function(){return Date.now().clearTime()};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var A={};A[this._dateElement]=this;return Date.now().add(A)};Number.prototype.ago=function(){var A={};A[this._dateElement]=this*-1;return Date.now().add(A)};(function(){var G=Date.prototype,A=Number.prototype;var M=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),L=("january february march april may june july august september october november december").split(/\s/),K=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),J;var I=function(N){return function(){if(this._is){this._is=false;return this.getDay()==N}return this.moveToDayOfWeek(N,this._orient)}};for(var F=0;F<M.length;F++){G[M[F]]=G[M[F].substring(0,3)]=I(F)}var H=function(N){return function(){if(this._is){this._is=false;return this.getMonth()===N}return this.moveToMonth(N,this._orient)}};for(var D=0;D<L.length;D++){G[L[D]]=G[L[D].substring(0,3)]=H(D)}var E=function(N){return function(){if(N.substring(N.length-1)!="s"){N+="s"}return this["add"+N](this._orient)}};var B=function(N){return function(){this._dateElement=N;return this}};for(var C=0;C<K.length;C++){J=K[C].toLowerCase();G[J]=G[J+"s"]=E(K[C]);A[J]=A[J+"s"]=B(J)}}());Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")};Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)};Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)};Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)};Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)};Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};(function(){Date.Parsing={Exception:function(I){this.message="Parse error at '"+I.substring(0,10)+" ...'"}};var A=Date.Parsing;var C=A.Operators={rtoken:function(I){return function(J){var K=J.match(I);if(K){return([K[0],J.substring(K[0].length)])}else{throw new A.Exception(J)}}},token:function(I){return function(J){return C.rtoken(new RegExp("^s*"+J+"s*"))(J)}},stoken:function(I){return C.rtoken(new RegExp("^"+I))},until:function(I){return function(J){var K=[],M=null;while(J.length){try{M=I.call(this,J)}catch(L){K.push(M[0]);J=M[1];continue}break}return[K,J]}},many:function(I){return function(J){var M=[],K=null;while(J.length){try{K=I.call(this,J)}catch(L){return[M,J]}M.push(K[0]);J=K[1]}return[M,J]}},optional:function(I){return function(J){var K=null;try{K=I.call(this,J)}catch(L){return[null,J]}return[K[0],K[1]]}},not:function(I){return function(J){try{I.call(this,J)}catch(K){return[null,J]}throw new A.Exception(J)}},ignore:function(I){return I?function(J){var K=null;K=I.call(this,J);return[null,K[1]]}:null},product:function(){var J=arguments[0],K=Array.prototype.slice.call(arguments,1),L=[];for(var I=0;I<J.length;I++){L.push(C.each(J[I],K))}return L},cache:function(K){var I={},J=null;return function(L){try{J=I[L]=(I[L]||K.call(this,L))}catch(M){J=I[L]=M}if(J instanceof A.Exception){throw J}else{return J}}},any:function(){var I=arguments;return function(K){var L=null;for(var J=0;J<I.length;J++){if(I[J]==null){continue}try{L=(I[J].call(this,K))}catch(M){L=null}if(L){return L}}throw new A.Exception(K)}},each:function(){var I=arguments;return function(K){var N=[],L=null;for(var J=0;J<I.length;J++){if(I[J]==null){continue}try{L=(I[J].call(this,K))}catch(M){throw new A.Exception(K)}N.push(L[0]);K=L[1]}return[N,K]}},all:function(){var J=arguments,I=I;return I.each(I.optional(J))},sequence:function(I,J,K){J=J||C.rtoken(/^\s*/);K=K||null;if(I.length==1){return I[0]}return function(O){var P=null,Q=null;var S=[];for(var N=0;N<I.length;N++){try{P=I[N].call(this,O)}catch(R){break}S.push(P[0]);try{Q=J.call(this,P[1])}catch(M){Q=null;break}O=Q[1]}if(!P){throw new A.Exception(O)}if(Q){throw new A.Exception(Q[1])}if(K){try{P=K.call(this,P[1])}catch(L){throw new A.Exception(P[1])}}return[S,(P?P[1]:O)]}},between:function(J,K,I){I=I||J;var L=C.each(C.ignore(J),K,C.ignore(I));return function(M){var N=L.call(this,M);return[[N[0][0],r[0][2]],N[1]]}},list:function(I,J,K){J=J||C.rtoken(/^\s*/);K=K||null;return(I instanceof Array?C.each(C.product(I.slice(0,-1),C.ignore(J)),I.slice(-1),C.ignore(K)):C.each(C.many(C.each(I,C.ignore(J))),px,C.ignore(K)))},set:function(I,J,K){J=J||C.rtoken(/^\s*/);K=K||null;return function(X){var L=null,N=null,M=null,O=null,P=[[],X],W=false;for(var R=0;R<I.length;R++){M=null;N=null;L=null;W=(I.length==1);try{L=I[R].call(this,X)}catch(U){continue}O=[[L[0]],L[1]];if(L[1].length>0&&!W){try{M=J.call(this,L[1])}catch(V){W=true}}else{W=true}if(!W&&M[1].length===0){W=true}if(!W){var S=[];for(var Q=0;Q<I.length;Q++){if(R!=Q){S.push(I[Q])}}N=C.set(S,J).call(this,M[1]);if(N[0].length>0){O[0]=O[0].concat(N[0]);O[1]=N[1]}}if(O[1].length<P[1].length){P=O}if(P[1].length===0){break}}if(P[0].length===0){return P}if(K){try{M=K.call(this,P[1])}catch(T){throw new A.Exception(P[1])}P[1]=M[1]}return P}},forward:function(I,J){return function(K){return I[J].call(this,K)}},replace:function(J,I){return function(K){var L=J.call(this,K);return[I,L[1]]}},process:function(J,I){return function(K){var L=J.call(this,K);return[I.call(this,L[0]),L[1]]}},min:function(I,J){return function(K){var L=J.call(this,K);if(L[0].length<I){throw new A.Exception(K)}return L}}};var H=function(I){return function(){var J=null,M=[];if(arguments.length>1){J=Array.prototype.slice.call(arguments)}else{if(arguments[0] instanceof Array){J=arguments[0]}}if(J){for(var L=0,K=J.shift();L<K.length;L++){J.unshift(K[L]);M.push(I.apply(null,J));J.shift();return M}}else{return I.apply(null,arguments)}}};var G="optional not ignore cache".split(/\s/);for(var D=0;D<G.length;D++){C[G[D]]=H(C[G[D]])}var F=function(I){return function(){if(arguments[0] instanceof Array){return I.apply(null,arguments[0])}else{return I.apply(null,arguments)}}};var E="each any all".split(/\s/);for(var B=0;B<E.length;B++){C[E[B]]=F(C[E[B]])}}());(function(){var F=function(J){var K=[];for(var I=0;I<J.length;I++){if(J[I] instanceof Array){K=K.concat(F(J[I]))}else{if(J[I]){K.push(J[I])}}}return K};Date.Grammar={};Date.Translator={hour:function(I){return function(){this.hour=Number(I)}},minute:function(I){return function(){this.minute=Number(I)}},second:function(I){return function(){this.second=Number(I)}},meridian:function(I){return function(){this.meridian=I.slice(0,1).toLowerCase()}},timezone:function(I){return function(){var J=I.replace(/[^\d\+\-]/g,"");if(J.length){this.timezoneOffset=Number(J)}else{this.timezone=I.toLowerCase()}}},day:function(I){var J=I[0];return function(){this.day=Number(J.match(/\d+/)[0])}},month:function(I){return function(){this.month=((I.length==3)?Date.getMonthNumberFromName(I):(Number(I)-1))}},year:function(I){return function(){var J=Number(I);this.year=((I.length>2)?J:(J+(((J+2000)<Date.CultureInfo.twoDigitYearMax)?2000:1900)))}},rday:function(I){return function(){switch(I){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0;this.now=true;break}}},finishExact:function(I){I=(I instanceof Array)?I:[I];var J=new Date();this.year=J.getFullYear();this.month=J.getMonth();this.day=1;this.hour=0;this.minute=0;this.second=0;for(var K=0;K<I.length;K++){if(I[K]){I[K].call(this)}}this.hour=(this.meridian=="p"&&this.hour<13)?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month)){throw new RangeError(this.day+" is not a valid value for days.")}var L=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);if(this.timezone){L.set({timezone:this.timezone})}else{if(this.timezoneOffset){L.set({timezoneOffset:this.timezoneOffset})}}return L},finish:function(I){I=(I instanceof Array)?F(I):[I];if(I.length===0){return null}for(var M=0;M<I.length;M++){if(typeof I[M]=="function"){I[M].call(this)}}if(this.now){return new Date()}var J=Date.today();var P=null;var N=!!(this.days!=null||this.orient||this.operator);if(N){var O,L,K;K=((this.orient=="past"||this.operator=="subtract")?-1:1);if(this.weekday){this.unit="day";O=(Date.getDayNumberFromName(this.weekday)-J.getDay());L=7;this.days=O?((O+(K*L))%L):(K*L)}if(this.month){this.unit="month";O=(this.month-J.getMonth());L=12;this.months=O?((O+(K*L))%L):(K*L);this.month=null}if(!this.unit){this.unit="day"}if(this[this.unit+"s"]==null||this.operator!=null){if(!this.value){this.value=1}if(this.unit=="week"){this.unit="day";this.value=this.value*7}this[this.unit+"s"]=this.value*K}return J.add(this)}else{if(this.meridian&&this.hour){this.hour=(this.hour<13&&this.meridian=="p")?this.hour+12:this.hour}if(this.weekday&&!this.day){this.day=(J.addDays((Date.getDayNumberFromName(this.weekday)-J.getDay()))).getDate()}if(this.month&&!this.day){this.day=1}return J.set(this)}}};var B=Date.Parsing.Operators,E=Date.Grammar,D=Date.Translator,H;E.datePartDelimiter=B.rtoken(/^([\s\-\.\,\/\x27]+)/);E.timePartDelimiter=B.stoken(":");E.whiteSpace=B.rtoken(/^\s*/);E.generalDelimiter=B.rtoken(/^(([\s\,]|at|on)+)/);var A={};E.ctoken=function(M){var L=A[M];if(!L){var N=Date.CultureInfo.regexPatterns;var K=M.split(/\s+/),J=[];for(var I=0;I<K.length;I++){J.push(B.replace(B.rtoken(N[K[I]]),K[I]))}L=A[M]=B.any.apply(null,J)}return L};E.ctoken2=function(I){return B.rtoken(Date.CultureInfo.regexPatterns[I])};E.h=B.cache(B.process(B.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),D.hour));E.hh=B.cache(B.process(B.rtoken(/^(0[0-9]|1[0-2])/),D.hour));E.H=B.cache(B.process(B.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),D.hour));E.HH=B.cache(B.process(B.rtoken(/^([0-1][0-9]|2[0-3])/),D.hour));E.m=B.cache(B.process(B.rtoken(/^([0-5][0-9]|[0-9])/),D.minute));E.mm=B.cache(B.process(B.rtoken(/^[0-5][0-9]/),D.minute));E.s=B.cache(B.process(B.rtoken(/^([0-5][0-9]|[0-9])/),D.second));E.ss=B.cache(B.process(B.rtoken(/^[0-5][0-9]/),D.second));E.hms=B.cache(B.sequence([E.H,E.mm,E.ss],E.timePartDelimiter));E.t=B.cache(B.process(E.ctoken2("shortMeridian"),D.meridian));E.tt=B.cache(B.process(E.ctoken2("longMeridian"),D.meridian));E.z=B.cache(B.process(B.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),D.timezone));E.zz=B.cache(B.process(B.rtoken(/^(\+|\-)\s*\d\d\d\d/),D.timezone));E.zzz=B.cache(B.process(E.ctoken2("timezone"),D.timezone));E.timeSuffix=B.each(B.ignore(E.whiteSpace),B.set([E.tt,E.zzz]));E.time=B.each(B.optional(B.ignore(B.stoken("T"))),E.hms,E.timeSuffix);E.d=B.cache(B.process(B.each(B.rtoken(/^([0-2]\d|3[0-1]|\d)/),B.optional(E.ctoken2("ordinalSuffix"))),D.day));E.dd=B.cache(B.process(B.each(B.rtoken(/^([0-2]\d|3[0-1])/),B.optional(E.ctoken2("ordinalSuffix"))),D.day));E.ddd=E.dddd=B.cache(B.process(E.ctoken("sun mon tue wed thu fri sat"),function(I){return function(){this.weekday=I}}));E.M=B.cache(B.process(B.rtoken(/^(1[0-2]|0\d|\d)/),D.month));E.MM=B.cache(B.process(B.rtoken(/^(1[0-2]|0\d)/),D.month));E.MMM=E.MMMM=B.cache(B.process(E.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),D.month));E.y=B.cache(B.process(B.rtoken(/^(\d\d?)/),D.year));E.yy=B.cache(B.process(B.rtoken(/^(\d\d)/),D.year));E.yyy=B.cache(B.process(B.rtoken(/^(\d\d?\d?\d?)/),D.year));E.yyyy=B.cache(B.process(B.rtoken(/^(\d\d\d\d)/),D.year));H=function(){return B.each(B.any.apply(null,arguments),B.not(E.ctoken2("timeContext")))};E.day=H(E.d,E.dd);E.month=H(E.M,E.MMM);E.year=H(E.yyyy,E.yy);E.orientation=B.process(E.ctoken("past future"),function(I){return function(){this.orient=I}});E.operator=B.process(E.ctoken("add subtract"),function(I){return function(){this.operator=I}});E.rday=B.process(E.ctoken("yesterday tomorrow today now"),D.rday);E.unit=B.process(E.ctoken("minute hour day week month year"),function(I){return function(){this.unit=I}});E.value=B.process(B.rtoken(/^\d\d?(st|nd|rd|th)?/),function(I){return function(){this.value=I.replace(/\D/g,"")}});E.expression=B.set([E.rday,E.operator,E.value,E.unit,E.orientation,E.ddd,E.MMM]);H=function(){return B.set(arguments,E.datePartDelimiter)};E.mdy=H(E.ddd,E.month,E.day,E.year);E.ymd=H(E.ddd,E.year,E.month,E.day);E.dmy=H(E.ddd,E.day,E.month,E.year);E.date=function(I){return((E[Date.CultureInfo.dateElementOrder]||E.mdy).call(this,I))};E.format=B.process(B.many(B.any(B.process(B.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(I){if(E[I]){return E[I]}else{throw Date.Parsing.Exception(I)}}),B.process(B.rtoken(/^[^dMyhHmstz]+/),function(I){return B.ignore(B.stoken(I))}))),function(I){return B.process(B.each.apply(null,I),D.finishExact)});var G={};var C=function(I){return G[I]=(G[I]||E.format(I)[0])};E.formats=function(J){if(J instanceof Array){var K=[];for(var I=0;I<J.length;I++){K.push(C(J[I]))}return B.any.apply(null,K)}else{return C(J)}};E._formats=E.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]);E._start=B.process(B.set([E.date,E.time,E.expression],E.generalDelimiter,E.whiteSpace),D.finish);E.start=function(I){try{var J=E._formats.call({},I);if(J[1].length===0){return J}}catch(K){}return E._start.call({},I)}}());Date._parse=Date.parse;Date.parse=function(A){var B=null;if(!A){return null}try{B=Date.Grammar.start.call({},A)}catch(C){return null}return((B[1].length===0)?B[0]:null)};Date.getParseFunction=function(B){var A=Date.Grammar.formats(B);return function(C){var D=null;try{D=A.call({},C)}catch(E){return null}return((D[1].length===0)?D[0]:null)}};Date.parseExact=function(A,B){return Date.getParseFunction(B)(A)};TomTom.FormatHelper=function(){var A,F={AM_PM:"hh:mm tt",TWENTY_FOUR:"HH:mm"},G=function(I,J){var H=I.clone();if(E(I,J)){if(I.getHours()<12){H.setHours(I.getHours()+12);if(E(H,J)){H=J.clone()}}else{H=J.clone()}}return H},E=function(H,I){return H.getHours()<I.getHours()||(H.getHours()==I.getHours()&&H.getMinutes()<I.getMinutes())},D=function(O){var H=O.split(/[\D]+/g),P=O.toUpperCase().split(/[^A-Z]+/g),M=0,I=0,J=[];for(var L=0;L<H.length;L++){var Q=Number(H[L]);if(H[L]!=""&&Q!=null){J.push(H[L]*1)}}H=J;if((H.length==1)&&(String(H[0]).length<5)){if(String(H[0]).length>2){var K=String(H[0]).substr(String(H[0]).length-2,2);I=Number(K);M=Number(String(H[0]).substr(0,String(H[0]).length-K.length))}else{I=0;M=H[0]}}else{if(H.length==2){I=H[1];M=H[0]}else{return null}}if((M<12)&&(C(P)==A.PM.toUpperCase())){M=M+12}if((M==12)&&(C(P)==A.AM.toUpperCase())){M=0}if((M>23)||(I>59)){return null}var N=new Date().clone();N.setMinutes(I);N.setHours(M);return N},C=function(H){var I="";for(var J=0;J<H.length;J++){if((H[J]==A.PM.toUpperCase())||(H[J]==A.AM.toUpperCase())){I=H[J]}}return I},B=function(H){if(H==A.TWELVE){return F.AM_PM}else{return F.TWENTY_FOUR}};A={TWELVE:"12",TWENTY_FOUR:"24",AM:"am",PM:"pm",formatTime:function(J,L){if(!J){return null}else{var H=J.getHours(),K=J.getMinutes(),I="";if(L==this.TWELVE){if(H>12){H-=12;I=" "+this.PM}else{if(H==12){I=" "+this.PM}else{if(H==0){H=12;I=" "+this.AM}else{I=" "+this.AM}}}}if(H<10){H="0"+H}if(K<10){K="0"+K}return H+":"+K+I}},timeForLaterToday:function(){var I=new Date().addMinutes(45).toString("HH:mm"),K=I.split(":"),H=parseInt(K[0]),J=parseInt(K[1]);if(H==0&&J<45){H=23;J=59}else{H=H+1;J=0}return new Date(1976,0,6,H,J,0)},parseTimeForLaterToday:function(I){var H=this.timeForLaterToday();return this.formatTime(H,I)},parseTimeForToday:function(K,J,I){if(!I){I=new Date()}K=K.trim();var H=this.timeString2Date(K,J);if(H==null){H=D(K,J);if(H==null){H=I.clone()}else{H=G(H,I)}}else{H=G(H,I)}return this.formatTime(H,J)},parseTimeForAnyDay:function(K,J,I){if(!I){I=new Date()}K=K.trim();var H=this.timeString2Date(K,J);if(H==null){H=this.parseTime(K,J);if(H==null){H=I.clone()}}return this.formatTime(H,J)},formatDistance:function(I,J,L){var P,M,N=TomTom.Config.unitTypes;if(J==N.KM){if(I<1){P="0&nbsp;";M="m"}if(I<100){P=I+"&nbsp;";M="m"}var H=I/1000;if(I<100000){P=H.toFixed(1)+"&nbsp;";M="km"}else{P=H.toFixed(0)+"&nbsp;";M="km"}}else{var O=I*3.2808399;if(O<1){P="0&nbsp;";M="feet"}if(O<528){P=O.toFixed(0)+"&nbsp;";M="feet"}var K=I/1609.344;if(K>=100){P=K.toFixed(0)+"&nbsp;";M="mi"}else{P=K.toFixed(1)+"&nbsp;";M="mi"}}if(L){if(L.unitsHTML){M=L.unitsHTML.replace(/{units}/,M)}if(L.distanceHTML&&!isNaN(I)){P=L.distanceHTML.replace(/{distance}/,P)}}return P+M},formatTimeAmount:function(J){var H=Math.floor(J/60);var I=Math.round(J-(60*H));if(I==60){I=0;H=H+1}if(H==0){return I+"&nbsp;min."}else{if(I<10){I="0"+I}return H+":"+I+"&nbsp;hrs"}},formatTrafficDelay:function(I){var H=I<30?0:Math.round(I/30)*0.5;return H+"&nbsp;min."},timeString2Date:function(M,N){if(Date.parseExact(M,B(N))==null){return null}var H;var L;var I=M.substring(0,2);H=parseInt(I,10);L=parseInt(M.substring(3,5),10);if(N==this.TWELVE){var K=M.substring(6,8);if(K.toLowerCase()==this.AM){if(H==12){H=0}}else{if(H<12){H+=12}}}var J=new Date();J.setHours(H);J.setMinutes(L);return J},formatTimeString:function(H,I){if(H==""){return""}return this.formatTime(this.timeString2Date(H,this.TWENTY_FOUR),I)},calculateDate:function(H,J){var I;if(H=="today"||H=="tomorrow"){I=Date.parse(H)}else{I=Date.parse("next "+H)}if(!J){return I}I.set({hour:J.getHours(),minute:J.getMinutes()});return I}};return A}();TomTom.AnimatedZoomPan={MAX_TILE_SIZE:Math.pow(2,15),animatedPanningIntervalID:null,map:null,currentTimeout:null,animatedPan:function(B,A,C){if(!C){C=this.map}this.move(B,A,C)},move:function(H,G,V){var C=V.getViewPortPxFromLonLat(V.getCenter());var U=C.add(H,G);if(!U.equals(C)){TomTom.MessageBus.publish("panmapstart");var E=V.getLonLatFromViewPortPx(U);var F=U;if(!V.center&&!V.isValidLonLat(E)){E=V.maxExtent.getCenterLonLat();F=V.getViewPortPxFromLonLat(E)}var N=V.getViewPortPxFromLonLat(V.layerContainerOrigin);var Q=N.x-F.x;var A=parseInt(V.layerContainerDiv.style.left);var D=Q-A;var S=0;var P=V.baseLayer.resolutions[V.getZoom()];var K=V.calculateBounds(E,P);if(V.restrictedExtent.containsBounds(K)){var M=N.y-F.y;var L=parseInt(V.layerContainerDiv.style.top);S=M-L}else{var I=V.getCenter();E=new OpenLayers.LonLat(E.lon,I.lat);F=V.getViewPortPxFromLonLat(E)}var J=3;var R=3;var T=3;var O=false;var B=V.size;if((Math.abs(D)>B.w*1.5)||(Math.abs(S)>B.h*1.5)||(Math.abs(D)<5&&Math.abs(S)<5)){V.layerContainerDiv.style.left=(N.x-F.x)+"px";V.layerContainerDiv.style.top=(N.y-F.y)+"px";TomTom.MessageBus.publish("animatedpanend")}else{new PeriodicalExecuter((function(W){if(J>=50){R=R-T;if(R<=0){R=3}T=T-1}else{R=R+T;T=T+2}J=J+R;if(J>100){J=100;O=true}else{if(Prototype.Browser.IE){V.layerContainerDiv.style.left=(A+D*J/100)+"px";V.layerContainerDiv.style.top=(L+S*J/100)+"px"}else{V.moveTo(E,V.getZoom(),{dragging:true,noEvent:true})}}if(O||(D==0&&S==0)){V.setCenter(E);TomTom.MessageBus.publish("animatedpanend");W.stop()}}).bind(V),0.01)}}else{TomTom.MessageBus.publish("animatedpanend")}},animatedZoom:function(B,A){if(!B){B=this.map}var A=B.getZoom()+A;if(A>=0&&A<B.resolutions.length){this.zoomTo(A,B)}},animatedZoomIn:function(A){this.animatedZoom(A,1)},animatedZoomOut:function(A){this.animatedZoom(A,-1)},zoomToCenter:function(B,A,C){if(!C){C=this.map}clearTimeout(this.currentTimeout);this.currentTimeout=setTimeout(function(){if(A>=0&&A<C.resolutions.length){if(Math.abs(A-C.getZoom())==1){this.zoomTo(A,C,B)}else{this.clearCloneLayer(C);TomTom.MessageBus.publish("setcenter",TomTom.Map.SetCenterData.fromLonLat(B.lon,B.lat,A))}}else{var F=C.getViewPortPxFromLonLat(B);var G=C.getViewPortPxFromLonLat(C.getCenter());var E=F.x-G.x;var D=F.y-G.y;this.animatedPan(E,D)}}.bind(this),250)},getCenterTile:function(C){var B=C.getCenter();var E=C.baseLayer;var A=E.grid;if(A){var D=A.length;for(var F=0;F<D;F++){var I=A[F].length;for(var H=0;H<I;H++){var G=A[F][H].bounds;if(G.containsLonLat(B,true)){E.centerRow=F;E.centerCol=H;return A[F][H]}}}}return false},scaleTileTo:function(I,K,B){var A=B.getPixelFromLonLat(B.getCenter());var J=K.w;var E=K.h;if(I){if((J<this.MAX_TILE_SIZE)&&(E<this.MAX_TILE_SIZE)){var D=B.layerContainerDiv.style;var L=I.position;var N=I.size;var O=L.x+parseInt(D.left);var C=J/N.w*(A.x-O);C=Math.round(C);var F=A.x-C-parseInt(D.left);var M=L.y+parseInt(D.top);var G=E/N.h*(A.y-M);G=Math.round(G);var H=A.y-G-parseInt(D.top);this.setTilePositionAndSize(I,H,F,J,E)}}},intervalZoom:function(){this.index++;this.newTileSize.w=this.map.baseLayer.tileSize.w+this.increasedDelta;this.newTileSize.h=this.map.baseLayer.tileSize.h+this.increasedDelta;this.increasedDelta=this.increasedDelta+this.delta;this.centerTile.position.x=this.centerTile.position.x+this.xdelta;this.centerTile.position.y=this.centerTile.position.y+this.ydelta;this.animatedModule.scaleTileTo(this.centerTile,this.newTileSize,this.map);this.animatedModule.scaleTilesOfGrid(this.centerTile,this.newTileSize,this.map);if(this.index==5){for(var C=0,A=this.map.layers.length;C<A;C++){var B=this.map.layers[C];if(B.name!="traffictiles"){if(!B.isBaseLayer){B.div.style.display="block"}}}this.animatedModule.cloneBaseLayerDiv(this.map);window.clearInterval(this.animatedModule.animatedPanningIntervalID);this.animatedModule.animatedPanningIntervalID=null;if(this.lonlat!=null){var D={mercY:this.lonlat.lat,mercX:this.lonlat.lon}}else{var D={mercY:null,mercX:null}}TomTom.MessageBus.publish("setcenter",new TomTom.Map.SetCenterData.fromCoordinate(D,this.zoom,{forceZoom:true}))}},zoomTo:function(N,B,F){for(var E=B.layers.length-1;E>=0;E--){var G=B.layers[E];if(!G.isBaseLayer){G.div.style.display="none"}}TomTom.MessageBus.publish("cancelmarkerrendering");if(this.animatedPanningIntervalID){window.clearInterval(this.animatedPanningIntervalID);this.animatedPanningIntervalID=null}var K={};var L;var I=B.baseLayer.tileSize;if(B.zoom>N){K.w=I.w/2;K.h=I.h/2;L=-K.w/5}else{if(B.zoom<N){K.w=I.w*2;K.h=I.h*2;L=I.w/5}}var J=0;var M=0;if(F){var D=B.getPixelFromLonLat(F);var A=B.getPixelFromLonLat(B.getCenter());J=(A.x-D.x)/5;M=(A.y-D.y)/5}else{F=this.map.getCenter()}var H=this.getCenterTile(B);if(!H){this.map.setCenter(F,N)}else{var C={map:B,delta:L,newTileSize:K,centerTile:H,animatedModule:this,zoom:N,increasedDelta:L,xdelta:J,ydelta:M,lonlat:F,index:0};this.animatedPanningIntervalID=window.setInterval(this.intervalZoom.bindAsEventListener(C),2)}},scaleTilesOfGrid:function(F,M,A){var K=M.w;var C=M.h;if((K<this.MAX_TILE_SIZE)&&(C<this.MAX_TILE_SIZE)){var Q=A.getExtent();var L=A.baseLayer;var E=L.grid;var B=E.length;for(var J=0;J<B;J++){var P=E[J].length;for(var O=0;O<P;O++){var H=E[J][O];if(H.imgDiv){if(Q.containsBounds(H.bounds,true,false)){var I=J-L.centerRow;var N=O-L.centerCol;var D=parseInt(F.frame?F.frame.style.left:F.imgDiv.style.left)+N*K;var G=parseInt(F.frame?F.frame.style.top:F.imgDiv.style.top)+I*C;this.setTilePositionAndSize(H,G,D,K,C)}}}}}},setTilePositionAndSize:function(C,E,D,B,A){if(C.frame){C.frame.style.top=Math.round(E)+"px";C.frame.style.left=Math.round(D)+"px";C.frame.style.width=Math.round(B)+"px";C.frame.style.height=Math.round(A)+"px"}else{C.imgDiv.style.top=Math.round(E)+"px";C.imgDiv.style.left=Math.round(D)+"px"}C.imgDiv.style.width=Math.round(B)+"px";C.imgDiv.style.height=Math.round(A)+"px"},clearCloneLayer:function(A){if(!A){A=this.map}if(A&&A.baseLayerDivClone){A.layerContainerDiv.removeChild(A.baseLayerDivClone);if(Prototype.Browser.IE){A.baseLayerDivClone.outerHTML=""}A.baseLayerDivClone=null}},cloneBaseLayerDiv:function(A){if(A.div.id=="map"){this.clearCloneLayer(A);A.baseLayerDivClone=A.baseLayer.div.cloneNode(true);A.baseLayerDivClone.id=A.baseLayer.div.id+"_clone";A.layerContainerDiv.appendChild(A.baseLayerDivClone);A.baseLayerDivClone.style.zIndex--;if(A.layerContainerDiv.style.left!=""){A.baseLayerDivClone.style.left=A.layerContainerDiv.style.left}if(A.layerContainerDiv.style.top!=""){A.baseLayerDivClone.style.top=A.layerContainerDiv.style.top}}},panTo:function(C){var D=this.map;var F=D.getViewPortPxFromLonLat(C);var E=D.getViewPortPxFromLonLat(D.getCenter());var B=F.x-E.x;var A=F.y-E.y;this.animatedPan(B,A,D)}};TomTom.Controls.OverviewMap=OpenLayers.Class.create();TomTom.Controls.OverviewMap.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{id:"OverviewMap",element:null,ovmap:null,size:new OpenLayers.Size(143,100),layers:null,minRatio:16,maxRatio:16,mapOptions:null,shown:true,i18nTexts:[{id:"show_overview_map_message.content",text:""},{id:"hide_overview_map_message.content",text:""}],initialize:function(A){this.layers=[];OpenLayers.Control.prototype.initialize.apply(this,[A]);TomTom.MessageBus.subscribe(["i18nupdated"],this)},notified:function(A,B){switch(A){case"i18nupdated":this.updateText(B);break;default:break}},getText:function(A){return TomTom.Utils.getText(this.i18nTexts,A)},updateText:function(A){TomTom.Utils.updateTexts(this.i18nTexts,A)},destroy:function(){if(!this.mapDiv){return }this.mapDiv.removeChild(this.extentRectangle);this.extentRectangle=null;this.rectEvents.destroy();this.rectEvents=null;this.ovmap.destroy();this.ovmap=null;this.element.removeChild(this.mapDiv);this.mapDiv=null;this.mapDivEvents.destroy();this.mapDivEvents=null;this.div.removeChild(this.element);this.element=null;this.elementEvents.destroy();this.elementEvents=null;if(this.maximizeDiv){OpenLayers.Event.stopObservingElement(this.maximizeDiv);this.maximizeDiv=null}if(this.minimizeDiv){OpenLayers.Event.stopObservingElement(this.minimizeDiv);this.minimizeDiv=null}this.map.events.unregister("moveend",this,this.update);this.map.events.unregister("changebaselayer",this,this.baseLayerDraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);if(!(this.layers.leoverviewMapExtentRectanglength>0)){if(this.map.baseLayer){var B=this.map.baseLayer.clone();this.layers=[B]}else{this.map.events.register("changebaselayer",this,this.baseLayerDraw);return this.div}}this.element=document.createElement("div");this.element.className="overviewMapElement";this.div.className="overviewMapContainer";this.minimizeDiv=document.createElement("div");this.minimizeDiv.id="ovMinimize";this.minimizeDiv.className="overviewMapMinimize";this.minimizeDiv.style.display="block";OpenLayers.Event.observe(this.minimizeDiv,"click",this.minimizeControl.bindAsEventListener(this));OpenLayers.Event.observe(this.minimizeDiv,"dblclick",function(D){OpenLayers.Event.stop(D)});OpenLayers.Event.observe(this.minimizeDiv,"mouseover",function(E){$("ovMinimize").setStyle({backgroundPosition:"4px -15px"});var D={};D.delay=1200;D.text=this.getText("hide_overview_map_message.content");D.position=new OpenLayers.Pixel(E.clientX-135,E.clientY-35);D.id="hide_ov";TomTom.MessageBus.publish("popup",D)}.bind(this));OpenLayers.Event.observe(this.minimizeDiv,"mouseout",function(D){$("ovMinimize").setStyle({backgroundPosition:"4px 5px"});TomTom.MessageBus.publish("clearpopup")});this.maximizeDiv=document.createElement("div");this.maximizeDiv.id="ovMaximize";this.maximizeDiv.className="overviewMapMaximize";this.maximizeDiv.style.display="none";OpenLayers.Event.observe(this.maximizeDiv,"click",this.maximizeControl.bindAsEventListener(this));OpenLayers.Event.observe(this.maximizeDiv,"dblclick",function(D){OpenLayers.Event.stop(D)});OpenLayers.Event.observe(this.maximizeDiv,"mouseover",function(E){$("ovMaximize").setStyle({backgroundPosition:"4px -56px"});var D={};D.delay=1200;D.text=this.getText("show_overview_map_message.content");D.position=new OpenLayers.Pixel(E.clientX-135,E.clientY-35);D.id="show_ov";TomTom.MessageBus.publish("popup",D)}.bind(this));OpenLayers.Event.observe(this.maximizeDiv,"mouseout",function(D){$("ovMaximize").setStyle({backgroundPosition:"4px -34px"});TomTom.MessageBus.publish("clearpopup")});var C=document.createElement("div");C.className="overviewMapHeaderBg";C.appendChild(this.minimizeDiv);C.appendChild(this.maximizeDiv);this.div.appendChild(C);var A=document.createElement("div");A.className="overviewMapHeaderSpacer";this.div.appendChild(A);this.mapDiv=document.createElement("div");this.mapDiv.style.width=this.size.w+"px";this.mapDiv.style.height=this.size.h+"px";this.mapDiv.style.position="relative";this.mapDiv.style.overflow="hidden";this.mapDiv.id=OpenLayers.Util.createUniqueID("overviewMap");this.extentRectangle=document.createElement("div");this.extentRectangle.id="extentRectangle";this.extentRectangle.style.position="absolute";this.extentRectangle.style.zIndex=1000;this.extentRectangle.style.overflow="hidden";this.extentRectangle.style.backgroundImage="url("+OpenLayers.Util.getImagesLocation()+"blank.gif)";this.extentRectangle.className="overviewMapExtentRectangle";this.mapDiv.appendChild(this.extentRectangle);this.element.appendChild(this.mapDiv);this.map.events.register("moveend",this,this.update);this.elementEvents=new OpenLayers.Events(this,this.element,null,true,{includeXY:true});this.elementEvents.register("mousedown",this,function(D){OpenLayers.Event.stop(D)});this.elementEvents.register("click",this,function(D){OpenLayers.Event.stop(D)});this.elementEvents.register("dblclick",this,function(D){OpenLayers.Event.stop(D)});this.rectEvents=new OpenLayers.Events(this,this.extentRectangle,null,true,{includeXY:true});this.rectEvents.register("mousedown",this,this.rectMouseDown);this.rectEvents.register("click",this,function(D){OpenLayers.Event.stop(D)});this.rectEvents.register("dblclick",this,this.rectDblClick);this.mapDivEvents=new OpenLayers.Events(this,this.mapDiv,null,true,{includeXY:true});this.mapDivEvents.register("click",this,this.mapDivClick);this.div.appendChild(this.element);if(this.map.getExtent()){this.update()}return this.div},baseLayerDraw:function(){this.draw();this.map.events.unregister("changebaselayer",this,this.baseLayerDraw)},rectMouseDown:function(A){if(!OpenLayers.Event.isLeftClick(A)){return }if(!Prototype.Browser.WebKit){this.windowEvents=new OpenLayers.Events(this,window,null,true,{includeXY:true});this.windowEvents.register("mousemove",this,this.rectMouseMove);this.windowEvents.register("mouseup",this,this.rectMouseUp)}this.map.events.register("mousemove",this,this.rectMouseMove);this.map.events.register("mouseup",this,this.rectMouseUp);this.rectDragStart=A.xy.clone();this.rectDragStart.x=this.extentRectangle.getWidth()/2;this.rectDragStart.y=this.extentRectangle.getHeight()/2;this.map.div.style.cursor="url("+TomTom.Config.staticDir+"/images/grabbing.cur), -moz-grabbing";this.extentRectangle.style.cursor="url("+TomTom.Config.staticDir+"/images/grabbing.cur),-moz-grabbing";this.performedRectDrag=false;OpenLayers.Event.stop(A)},rectMouseMove:function(I){if(this.rectDragStart!=null){var A=this.getRectPxBounds();var E=Math.abs(A.getHeight());var C=A.getWidth();var H=OpenLayers.Util.pagePosition(this.mapDiv);var D=I.clientY-H[1]-this.rectDragStart.y;var B=I.clientX-H[0]-this.rectDragStart.x;var F=Math.max(0,D);F=Math.min(F,this.ovmap.size.h-this.hComp-E);var G=Math.max(0,B);G=Math.min(G,this.ovmap.size.w-this.wComp-C);this.setRectPxBounds(new OpenLayers.Bounds(G,F+E,G+C,F));if(D<0){this.ovmap.pan(0,-3)}if(D>this.ovmap.size.h-this.hComp-E){this.ovmap.pan(0,3)}if(B<0){this.ovmap.pan(-3,0)}if(B>this.ovmap.size.w-this.wComp-C){this.ovmap.pan(3,0)}this.performedRectDrag=true;OpenLayers.Event.stop(I)}},rectMouseOut:function(A){if(this.rectDragStart){if(A.currentTarget==window){this.rectMouseUp(A)}}},rectMouseUp:function(A){if(!OpenLayers.Event.isLeftClick(A)){return }if(this.performedRectDrag&&this.rectDragStart){this.updateMapToRect();OpenLayers.Event.stop(A)}this.map.div.style.cursor="";this.extentRectangle.style.cursor="url("+TomTom.Config.staticDir+"/images/grab.cur), -moz-grab";this.map.events.unregister("mousemove",this);this.map.events.unregister("mouseup",this);if(this.windowEvents){this.windowEvents.unregister("mousemove",this,this.rectMouseMove);this.windowEvents.unregister("mouseup",this,this.rectMouseUp);this.windowEvents=null}document.onselectstart=null;this.rectDragStart=null;this.rectDragOut=null},rectDblClick:function(A){this.performedRectDrag=false;OpenLayers.Event.stop(A);this.updateOverview()},mapDivClick:function(J){var C=this.getRectPxBounds();var B=C.getCenterPixel();var F=J.xy.x-B.x;var E=J.xy.y-B.y;var H=C.top;var D=C.left;var K=Math.abs(C.getHeight());var A=C.getWidth();var G=Math.max(0,(H+E));G=Math.min(G,this.ovmap.size.h-K);var I=Math.max(0,(D+F));I=Math.min(I,this.ovmap.size.w-A);this.setRectPxBounds(new OpenLayers.Bounds(I,G+K,I+A,G));this.updateMapToRect();OpenLayers.Event.stop(J)},maximizeControl:function(A){this.showToggle(false);this.updateOverview();TomTom.MessageBus.publish("slide",this.buildRequest(this.element,this.size.h,null));if(A!=null){OpenLayers.Event.stop(A)}},buildRequest:function(B,A,D){var C={};C.element=B;C.height=A;C.callback=D;return C},minimizeControl:function(A){TomTom.MessageBus.publish("slide",this.buildRequest(this.element,false,function(){this.showToggle(true)}.bind(this)));if(A!=null){OpenLayers.Event.stop(A)}},showToggle:function(A){this.shown=!A;if(A){this.element.hide()}else{this.element.show()}this.maximizeDiv.style.display=A?"block":"none";this.minimizeDiv.style.display=A?"none":"block"},update:function(){if(this.ovmap==null){this.createMap()}this.updateOverview();this.updateRectToMap()},isSuitableOverview:function(){var B=this.map.getExtent();var A=this.map.maxExtent;var C=new OpenLayers.Bounds(Math.max(B.left,A.left),Math.max(B.bottom,A.bottom),Math.min(B.right,A.right),Math.min(B.top,A.top));var D=this.ovmap.getResolution()/this.map.getResolution();return((D>=this.minRatio)&&(D<=this.maxRatio)&&(this.ovmap.getExtent().containsBounds(C)))},updateOverview:function(){var A=this.map.getZoom()-1;if(this.shown){if(A==-1){$("extentRectangle").style.border="0px";A=0}else{$("extentRectangle").style.border="2px solid orange"}this.ovmap.setCenter(this.map.center,A)}this.updateRectToMap()},createMap:function(){var A=OpenLayers.Util.extend({controls:[],maxResolution:"auto"},this.mapOptions);this.ovmap=new OpenLayers.Map(this.mapDiv.id,A);this.ovmap.size=this.size;this.ovmap.addLayers(this.layers);this.wComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-left-width"),10)+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-right-width"),10);this.wComp=(this.wComp)?this.wComp:2;this.hComp=parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-top-width"),10)+parseInt(OpenLayers.Element.getStyle(this.extentRectangle,"border-bottom-width"),10);this.hComp=(this.hComp)?this.hComp:2},updateRectToMap:function(){var A=this.getRectBoundsFromMapBounds(this.map.calculateBounds());if(A){this.setRectPxBounds(A)}},updateMapToRect:function(){var B=this.getRectPxBounds();var A=this.getMapBoundsFromRectBounds(B);this.map.setCenter(A.getCenterLonLat(),this.map.zoom)},getRectPxBounds:function(){var D=parseInt(this.extentRectangle.style.top,10);var C=parseInt(this.extentRectangle.style.left,10);var A=parseInt(this.extentRectangle.style.height,10);var B=parseInt(this.extentRectangle.style.width,10);return new OpenLayers.Bounds(C,D+A,C+B,D)},setRectPxBounds:function(C){var E=Math.max(C.top,0);var D=Math.max(C.left,0);var A=Math.min(C.top+Math.abs(C.getHeight()),this.ovmap.size.h-this.hComp);var B=Math.min(C.left+C.getWidth(),this.ovmap.size.w-this.wComp);this.extentRectangle.style.top=parseInt(E,10)+"px";this.extentRectangle.style.left=parseInt(D,10)+"px";this.extentRectangle.style.height=parseInt(Math.max(A-E,0),10)+"px";this.extentRectangle.style.width=parseInt(Math.max(B-D,0),10)+"px"},getRectBoundsFromMapBounds:function(D){var A=new OpenLayers.LonLat(D.left,D.bottom);var F=new OpenLayers.LonLat(D.right,D.top);var C=this.getOverviewPxFromLonLat(A);var B=this.getOverviewPxFromLonLat(F);var E=null;if(C&&B){E=new OpenLayers.Bounds(C.x,C.y,B.x,B.y)}return E},getMapBoundsFromRectBounds:function(D){var C=new OpenLayers.Pixel(D.left,D.bottom);var B=new OpenLayers.Pixel(D.right,D.top);var A=this.getLonLatFromOverviewPx(C);var E=this.getLonLatFromOverviewPx(B);return new OpenLayers.Bounds(A.lon,A.lat,E.lon,E.lat)},getLonLatFromOverviewPx:function(F){var C=this.ovmap.size;var B=this.ovmap.getResolution();var A=this.ovmap.getExtent().getCenterLonLat();var E=F.x-(C.w/2);var D=F.y-(C.h/2);return new OpenLayers.LonLat(A.lon+E*B,A.lat-D*B)},getOverviewPxFromLonLat:function(D){var B=this.ovmap.getResolution();var C=this.ovmap.getExtent();var A=null;if(C){A=new OpenLayers.Pixel(Math.round(1/B*(D.lon-C.left)),Math.round(1/B*(C.top-D.lat)))}return A},CLASS_NAME:"TomTom.Controls.OverviewMap"});TomTom.Controls.ScaleWidget=OpenLayers.Class.create();TomTom.Controls.ScaleWidget.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{id:"ScaleWidget",scaleDiv:null,toolbar_div:$("toolbar"),header_div:$("header"),footer_div:$("footer"),size:new OpenLayers.Size(100,50),layers:null,mapOptions:null,shown:true,maxPixelsForImage:150,copyrightPrefix:"Map Data ",popupRequest:{},copyrights:null,currentCopyrightIDs:null,copyrightLogos:null,initialize:function(A){this.layers=[];this.popupRequest.delay=0;this.allowedNumbers=this.initializeAllowedNumbers();OpenLayers.Control.prototype.initialize.apply(this,[A]);TomTom.MessageBus.subscribe(["copyrightReceived"],this)},initializeAllowedNumbers:function(){var A=[1,2,5];var F=1;var E=0;var D=new Array();var C=0;for(var B=0;B<3&&E<10000000;C++){E=A[B]*F;D[C]=E;if(B==2){B=0;F*=10}else{B++}}return D},destroy:function(){if(!this.scaleDiv){return }this.map.events.unregister("moveend",this,this.update);this.scaleDiv.removeChild(this.scaleFLabel);this.scaleFLabel=null;this.scaleFImgOuter.removeChild(this.scaleFImg);this.scaleFImg=null;this.scaleDiv.removeChild(this.scaleMLabel);this.scaleMLabel=null;this.scaleMImgOuter.removeChild(this.scaleMImg);this.scaleMImg=null;this.scaleDiv.removeChild(this.scaleMImgOuter);this.scaleMImgOuter=null;this.scaleDiv.removeChild(this.scaleFImgOuter);this.scaleFImgOuter=null;this.scaleDiv=null;OpenLayers.Control.prototype.destroy.apply(this,arguments)},draw:function(){OpenLayers.Control.prototype.draw.apply(this,arguments);this.scaleDiv=document.createElement("div");this.scaleDiv.className="scaleWidget";this.scaleDiv.style.width=270+"px";this.scaleDiv.style.height=this.size.h+"px";this.scaleDiv.style.position="absolute";this.scaleDiv.style.bottom="5px";this.scaleDiv.style.right="150px";this.scaleDiv.style.overflow="hidden";this.scaleDiv.id=OpenLayers.Util.createUniqueID("ScaleWidget");this.scaleMImgOuter=document.createElement("div");this.scaleMImgOuter.className="scaleImgOuterDiv";this.scaleMImgOuter.style.top="6px";this.scaleMImg=document.createElement("img");this.scaleMImg.className="scaleImg";this.scaleMImgOuter.appendChild(this.scaleMImg);this.scaleMImg.src=TomTom.Config.staticDir+"/images/scalebar.png";this.scaleDiv.appendChild(this.scaleMImgOuter);this.scaleMLabel=document.createElement("div");this.scaleMLabel.id="scaleMLabel";this.scaleMLabel.className="scaleLabel";this.scaleMLabel.style.top="4px";this.scaleMLabel.style.right="4px";this.scaleDiv.appendChild(this.scaleMLabel);TomTom.Utils.createShadowDivs(this.scaleMLabel,this.scaleDiv,"scaleLabelShadow");this.scaleFImgOuter=document.createElement("div");this.scaleFImgOuter.className="scaleImgOuterDiv";this.scaleFImgOuter.style.top="21px";this.scaleFImg=document.createElement("img");this.scaleFImg.className="scaleImg";this.scaleFImgOuter.appendChild(this.scaleFImg);this.scaleFImg.src=TomTom.Config.staticDir+"/images/scalebar.png";this.scaleDiv.appendChild(this.scaleFImgOuter);this.scaleFLabel=document.createElement("div");this.scaleFLabel.id="scaleFLabel";this.scaleFLabel.className="scaleLabel";this.scaleFLabel.style.top="19px";this.scaleFLabel.style.right="4px";this.scaleDiv.appendChild(this.scaleFLabel);TomTom.Utils.createShadowDivs(this.scaleFLabel,this.scaleDiv,"scaleLabelShadow");this.copyrightLabel=document.createElement("div");this.copyrightLabel.id="copyrightLabel";this.copyrightLabel.className="scaleLabel";this.copyrightLabel.style.top="35px";this.copyrightLabel.style.right="2px";this.scaleDiv.appendChild(this.copyrightLabel);TomTom.Utils.createShadowDivs(this.copyrightLabel,this.scaleDiv,"scaleLabelShadow");this.map.events.register("moveend",this,this.update);if(this.map.getExtent()){this.update()}return this.scaleDiv},update:function(){var C=this.mercatorLatitudeToRadians(this.map.getCenter().lat);var B=1/Math.cos(C);var D=this.map.getResolution()/B;var J=this.getBestFittingLabel(D);var F=(J/D);var E="m";if(J>1000){J/=1000;J=Math.ceil(J);E="km"}var I=D*3.2808;var H=this.getBestFittingLabel(I);var G=(H/I);var A="ft";if(H>5286){H/=5286;H=this.getBestFittingLabel(I/5286);G=(H*5286/I);A="mi"}this.scaleMImg.style.width=Math.round(F)+"px";this.scaleMLabel.style.right=Math.round(F)+37+"px";this.scaleMLabel.innerHTML=J+" "+E;TomTom.Utils.modifyShadowsStyle(this.scaleMLabel,"right",Math.round(F)+37+"px");TomTom.Utils.modifyShadowsContent(this.scaleMLabel,J+" "+E);this.scaleFImg.style.width=Math.round(G)+"px";this.scaleFLabel.style.right=Math.round(G)+37+"px";this.scaleFLabel.innerHTML=H+" "+A;TomTom.Utils.modifyShadowsStyle(this.scaleFLabel,"right",Math.round(G)+37+"px");TomTom.Utils.modifyShadowsContent(this.scaleFLabel,H+" "+A);this.copyrightLabel.style.right="30px";TomTom.Utils.modifyShadowsStyle(this.copyrightLabel,"right","30px")},getBestFittingLabel:function(C){var A;for(var B=this.allowedNumbers.length;B>=0;B--){if((C*this.maxPixelsForImage)>this.allowedNumbers[B]){A=this.allowedNumbers[B];break}}return A},mercatorLatitudeToRadians:function(B){circumference=this.map.getMaxExtent().top*2;var A=circumference/(2*Math.PI);var C=(Math.PI/2)-(2*Math.atan(Math.exp(-1*B/A)));return C},buildCopyrightBalloon:function(K){var B=0;try{B=K.target.id}catch(F){B=K.srcElement.getAttribute("id")}try{var E=parseInt(B.substring(20,B.length))}catch(F){return false}if(B){var G=K.target?K.target:K.srcElement;var A=G.cumulativeOffset();var J={x:A.left,y:A.top+10};this.copyrightLabel.blur();var H='<div id="copyrightDiv" class="copyrightDiv">';if(this.copyrightLogos[E]){H+='<div id="copyrightLogo" class="copyrightLogo"><img width="75" height="75" src="'+this.copyrightLogos[E].src+'"/></div>'}H+=this.copyrights[E].desc;this.popupRequest=TomTom.Utils.createInfoBalloon({x:0,y:0},this.copyrights[E].label,H,"contextmenu");var D="<div id='temp_node' style='position:absolute;left:50px;top:20px;z-index:99999;display:none'>"+this.popupRequest.text+"</div>";$("map").insert(D);var C=0;var I=new PeriodicalExecuter(function(L){if($("temp_node")!=null){C=$("temp_node").getHeight();$("temp_node").remove();this.popupRequest=TomTom.Utils.createInfoBalloon(J,this.copyrights[E].label,H,"contextmenu",C);this.popupRequest.id="copyrightDetails";TomTom.MessageBus.publish("popup",this.popupRequest);L.stop()}}.bind(this),0.1);setTimeout(function(){I.stop()},10000)}},setCopyrights:function(A){this.copyrights=A;this.buildCopyrightWidget();this.preloadCopyrightLogos()},preloadCopyrightLogos:function(){this.copyrightLogos=new Array();var B=null;var A=0;for(var D in this.copyrights){if(this.copyrights[D].logo){B=new Image();B.src=this.copyrights[D].logo;this.copyrightLogos[D]=B}}var C=0},buildCopyrightWidget:function(){if(this.copyrights&&this.currentCopyrightIDs){var C=this.copyrightPrefix;var A=this.currentCopyrightIDs.length;for(var B=0;B<A;B++){if(B!=A-1){C+='<span class="copyrightDetailsLink" id="copyrightDetailsLink'+this.currentCopyrightIDs[B]+'">'+this.copyrights[parseInt(this.currentCopyrightIDs[B])].label+"</span>&nbsp;,&nbsp;"}else{C+='<span  class="copyrightDetailsLink" id="copyrightDetailsLink'+this.currentCopyrightIDs[B]+'">'+this.copyrights[parseInt(this.currentCopyrightIDs[B])].label+"</span>"}}this.copyrightLabel.innerHTML=C;for(var B=0;B<A;B++){var D=$("copyrightDetailsLink"+this.currentCopyrightIDs[B]);Event.observe(D,"click",function(E){this.buildCopyrightBalloon(E)}.bindAsEventListener(this))}TomTom.Utils.modifyShadowsStyle(this.copyrightLabel,"right","30px");TomTom.Utils.modifyShadowsContent(this.copyrightLabel,this.copyrightLabel.innerHTML)}},notified:function(A,B){switch(A){case"copyrightReceived":this.currentCopyrightIDs=B.copyrightIDs;this.buildCopyrightWidget();break}},CLASS_NAME:"TomTom.Controls.ScaleWidget"});TomTom.Controls.Navigation=OpenLayers.Class.create();TomTom.Controls.Navigation.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{dragPan:null,zoomBox:null,wheelHandler:null,SCROLLDELAY:250,lastCenter:null,lastZoom:null,activate:function(){this.dragPan.activate();this.wheelHandler.activate();this.zoomBox.activate();return OpenLayers.Control.prototype.activate.apply(this,arguments)},deactivate:function(){this.zoomBox.deactivate();this.dragPan.deactivate();this.wheelHandler.deactivate();return OpenLayers.Control.prototype.deactivate.apply(this,arguments)},draw:function(){this.map.events.register("dblclick",this,this.defaultDblClick);this.dragPan=new OpenLayers.Control.DragPan({map:this.map});this.zoomBox=new OpenLayers.Control.ZoomBox({map:this.map,keyMask:OpenLayers.Handler.MOD_SHIFT});this.dragPan.draw();this.zoomBox.draw();this.wheelHandler=new OpenLayers.Handler.MouseWheel(this,{up:this.wheelUp,down:this.wheelDown});this.activate()},defaultDblClick:function(B){var A=this.map.getLonLatFromViewPortPx(B.xy);if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.zoomToCenter(A,this.map.zoom+1,this.map)}OpenLayers.Event.stop(B);return false},wheelChange:function(C,H){TomTom.MessageBus.publish("clearpopup");if(this.lastZoom==null){this.lastZoom=this.map.getZoom()}var E=parseInt(this.lastZoom,10)+parseInt(H,10);if(E<0){E=0}else{if(E>this.map.getNumZoomLevels()-1){E=this.map.getNumZoomLevels()-1}}if(E==this.lastZoom){return }var D=this.map.getSize();var B=D.w/2-C.xy.x;var A=C.xy.y-D.h/2;var F=this.map.baseLayer.resolutions[E];var G=this.map.getLonLatFromPixel(C.xy);this.lastCenter=new OpenLayers.LonLat(G.lon+B*F,G.lat+A*F);this.lastZoom=E;this.map.controls[1].moveZoomBar(E);setTimeout(function(){this.checkScrollDelay(E)}.bind(this),this.SCROLLDELAY);OpenLayers.Event.stop(C)},wheelUp:function(A){this.wheelChange(A,+1)},wheelDown:function(A){this.wheelChange(A,-1)},checkScrollDelay:function(A){if(A==this.lastZoom){this.map.controls[1].moveZoomBar(this.lastZoom);if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.zoomToCenter(this.lastCenter,this.lastZoom,this.map)}this.lastZoom=null}},CLASS_NAME:"TomTom.Controls.Navigation"});TomTom.Controls.PanZoomBar=OpenLayers.Class.create();TomTom.Controls.PanZoomBar.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{zoomStopWidth:8,zoomStopHeight:28,sliderEvents:null,divEvents:null,windowEvents:null,buttons:[{id:"pan_back",contentId:"cpan_back",tooltip:""},{id:"pan_nw",contentId:"cpan_nw",tooltip:""},{id:"pan_n",contentId:"cpan_n",tooltip:""},{id:"pan_ne",contentId:"cpan_ne",tooltip:""},{id:"pan_e",contentId:"cpan_e",tooltip:""},{id:"pan_se",contentId:"cpan_se",tooltip:""},{id:"pan_s",contentId:"cpan_s",tooltip:""},{id:"pan_sw",contentId:"cpan_sw",tooltip:""},{id:"pan_w",contentId:"cpan_w",tooltip:""},{id:"zoom_out",contentId:"czoom_out",tooltip:""},{id:"zoom_in",contentId:"czoom_in",tooltip:""},{id:"slider",contentId:"cslider",tooltip:""},{id:"zoombar",contentId:"csliderbar",tooltip:""}],tooltip:null,slider:null,startLeft:92,initialize:function(){TomTom.MessageBus.subscribe(["disablePanback","instructionclicked","i18nupdated","mapchanged","afterload","getViewportDescOk"],this);OpenLayers.Control.prototype.initialize.apply(this,arguments)},destroy:function(){this.divEvents.destroy();this.sliderEvents.destroy();this.map.events.unregister("zoomend",this,this.moveZoomBar);this.map.events.unregister("changebaselayer",this,this.redraw);OpenLayers.Control.prototype.destroy.apply(this,arguments)},setMap:function(A){OpenLayers.Control.prototype.setMap.apply(this,arguments);this.map.events.register("zoomend",this,this.moveZoomBar);this.map.events.register("changeBaseLayer",this,this.moveZoomBar)},redraw:function(){if(this.div!=null){this.div.innerHTML=""}this.draw()},draw:function(A){OpenLayers.Control.prototype.draw.apply(this,arguments);this.div.innerHTML='<div id="panzoombar">   <div id="panner">       <a id="pan_nw" href="javascript:;"></a>       <a id="pan_n" href="javascript:;"></a>       <a id="pan_ne" href="javascript:;"></a>       <a id="pan_e" href="javascript:;"></a>       <a id="pan_se" href="javascript:;"></a>       <a id="pan_s" href="javascript:;"></a>       <a id="pan_sw" href="javascript:;"></a>       <a id="pan_w" href="javascript:;"></a>       <a id="pan_back" class="disabled" href="javascript:;"></a>   </div>   <div id="zoomslider">       <a id="zoom_out" href="javascript:;"></a>       <div id="zoombar"></div>       <a id="slider" href="javascript:;"></a>       <a id="zoom_in" href="javascript:;"></a>   </div></div>';return this.div},attachEvents:function(){for(var B=0,A=this.buttons.length;B<A;B++){this.addEventsToButton($(this.buttons[B].id),this.buttons[B].contentId)}this.slider=$("slider");this.sliderEvents=new OpenLayers.Events(this,this.slider,null,true,{includeXY:true});this.sliderEvents.register("mousedown",this,this.zoomBarDown);this.sliderEvents.register("mousemove",this,this.zoomBarDrag);this.sliderEvents.register("mouseup",this,this.zoomBarUp);this.sliderEvents.register("dblclick",this,this.doNothing);this.addEventsToButton(this.slider,"cslider");this.divEvents=new OpenLayers.Events(this,$("zoombar"),null,true,{includeXY:true});this.divEvents.register("mousemove",this,this.passEventToSlider);this.divEvents.register("mouseup",this,this.passEventToSlider);this.divEvents.register("dblclick",this,this.passEventToSlider);this.divEvents.register("mousedown",this,this.divClick);this.addEventsToButton($("zoombar"),"csliderbar");this.moveZoomBar()},addEventsToButton:function(A,B){A.map=this.map;A.tooltip=B;A.parent=this;A.events=new OpenLayers.Events(this,A,null,true);A.events.register("mousedown",A,this.buttonDown);if(B!=null){A.events.register("mouseover",A,this.showPopup);A.events.register("mouseout",A,this.cancelPopup)}A.events.register("click",A,this.doNothing);A.events.register("dblclick",A,this.doNothing)},passEventToSlider:function(A){this.sliderEvents.handleBrowserEvent(A)},divClick:function(B){if(!OpenLayers.Event.isLeftClick(B)){return }var A=B.xy.x;var D=OpenLayers.Util.pagePosition(B.object)[0];var C=Math.floor((A-D)/this.zoomStopWidth);if(!TomTom.MessageBus.wbrpState.isAllowedToThisZoom(C)){return }TomTom.AnimatedZoomPan.clearCloneLayer();TomTom.MessageBus.publish("zoomTo",C);TomTom.MessageBus.publish("closedropboxes");OpenLayers.Event.stop(B)},doNothing:function(A){OpenLayers.Event.stop(A);return false},zoomBarDown:function(A){if(!OpenLayers.Event.isLeftClick(A)){return }this.mouseDragStart=A.xy.clone();this.windowEvents=new OpenLayers.Events(this,document.body,null,false);this.windowEvents.register("mousemove",this,this.passEventToSlider);this.windowEvents.register("mouseup",this,this.passEventToSlider);this.map.events.register("mousemove",this,this.passEventToSlider);this.map.events.register("mouseup",this,this.passEventToSlider);$("zoombar").offsets=null;$("zoombar").style.cursor="url("+TomTom.Config.staticDir+"/images/grabbing.cur), -moz-grabbing;";this.slider.style.cursor="url("+TomTom.Config.staticDir+"/images/grabbing.cur), -moz-grabbing;";TomTom.MessageBus.publish("closedropboxes");OpenLayers.Event.stop(A)},zoomBarDrag:function(A){if(this.mouseDragStart!=null){var F=$("zoombar");var D=OpenLayers.Util.pagePosition(F);var E=A.clientX-D[0]-4;var C=parseInt(F.getWidth())-(this.zoomStopWidth);if(E<0){this.slider.style.left=this.startLeft+"px"}else{if(E>C){this.slider.style.left=(this.map.getNumZoomLevels()-1)*this.zoomStopWidth+this.startLeft+"px"}else{var B=Math.round(E/this.zoomStopWidth);this.moveZoomBar(B)}}this.mouseDragStart=A.xy.clone();OpenLayers.Event.stop(A)}},zoomBarUp:function(A){if(!OpenLayers.Event.isLeftClick(A)){return }if(this.mouseDragStart){TomTom.Utils.updateImage(this,"mousedown",false);this.map.events.unregister("mouseup",this,this.passEventToSlider);this.map.events.unregister("mousemove",this,this.passEventToSlider);if(this.windowEvents){this.windowEvents.unregister("mousemove",this,this.passEventToSlider);this.windowEvents.unregister("mouseup",this,this.passEventToSlider);this.windowEvents=null}var B=Math.round((parseInt(this.slider.style.left)-this.startLeft)/this.zoomStopWidth);TomTom.MessageBus.publish("zoomTo",B);this.moveZoomBar();this.mouseDragStart=null;$("zoombar").style.cursor="pointer";this.slider.style.cursor="url("+TomTom.Config.staticDir+"/images/grab.cur), -moz-grab;";OpenLayers.Event.stop(A)}},moveZoomBar:function(B){if(this.slider!=null){if(isNaN(B)){B=this.map.getZoom()}else{if(B<0){B=0}else{if(B>=this.map.getNumZoomLevels()){B=this.map.getNumZoomLevels()-1}}}var A=B*this.zoomStopWidth+this.startLeft;this.slider.style.left=A+"px"}},buttonDown:function(A){if(!OpenLayers.Event.isLeftClick(A)){return }TomTom.MessageBus.publish("closedropboxes");switch(this.id){case"pan_nw":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(-250,-250,this.map)}else{this.map.pan(-250,-250)}break;case"pan_n":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(0,-250,this.map)}else{this.map.pan(0,-250)}break;case"pan_ne":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(250,-250,this.map)}else{this.map.pan(250,-250)}break;case"pan_sw":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(-250,250,this.map)}else{this.map.pan(-250,250)}break;case"pan_s":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(0,250,this.map)}else{this.map.pan(0,250)}break;case"pan_se":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(250,250,this.map)}else{this.map.pan(250,250)}break;case"pan_w":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(-250,0,this.map)}else{this.map.pan(-250,0)}break;case"pan_e":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedPan(250,0,this.map)}else{this.map.pan(250,0)}break;case"zoom_in":if(TomTom.MessageBus.wbrpState.isAllowedToZoomIn()){if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedZoomIn(this.map)}else{this.map.zoomIn()}}break;case"zoom_out":if(TomTom.Config.Map.AnimatedZoomPan){TomTom.AnimatedZoomPan.animatedZoomOut(this.map)}else{this.map.zoomOut()}break;case"zoomworld":this.map.zoomToMaxExtent();break;case"pan_back":if(TomTom.MessageBus.wbrpState!=null&&$("pan_back").className=="active"){TomTom.MessageBus.wbrpState.panbackjustclicked=true;$("pan_back").className="disabled";TomTom.MessageBus.wbrpState.deserializeURL()}break}OpenLayers.Event.stop(A)},showPopup:function(A){if(this.tooltip){if(this.tooltip=="cpan_back"&&!($("pan_back").className=="active")){return }var C=this.parent.getText(this.tooltip);var B=new Object();B.delay=400;B.text=C;B.position=new OpenLayers.Pixel(A.clientX+12,A.clientY+12);B.id=this.tooltip;TomTom.MessageBus.publish("popup",B)}OpenLayers.Event.stop(A);return false},cancelPopup:function(A){TomTom.MessageBus.publish("clearpopup");OpenLayers.Event.stop(A)},getText:function(C){var B=this.buttons.length;for(var A=0;A<B;A++){if(this.buttons[A].contentId==C){return this.buttons[A].tooltip}}return null},updateText:function(B){var E=this.buttons.length;var A=B.length;for(var D=0;D<E;D++){for(var C=0;C<A;C++){if((this.buttons[D].contentId+".content")==B[C].id){this.buttons[D].tooltip=B[C].text}}}},enableZoomIn:function(A){if(A){$("zoom_in").removeClassName("disabled");$("zoombar").removeClassName("zoomInDisabled")}else{if(!A){$("zoom_in").addClassName("disabled");$("zoombar").addClassName("zoomInDisabled")}}},notified:function(A,B){switch(A){case"i18nupdated":this.updateText(B);break;case"mapchanged":var C=TomTom.MessageBus.wbrpState;if($("pan_back")&&C.panbackjustclicked==false){$("pan_back").className="active"}C.panbackjustclicked=false;break;case"instructionclicked":$("pan_back").className="active";break;case"disablePanback":if($("pan_back")){$("pan_back").className="disabled"}break;case"afterload":this.attachEvents();break;case"getViewportDescOk":this.enableZoomIn(B.canZoomIn);break;default:break}},CLASS_NAME:"TomTom.Controls.PanZoomBar"});OpenLayers.Control.DragPan=OpenLayers.Class.create();OpenLayers.Control.DragPan.prototype=OpenLayers.Class.inherit(OpenLayers.Control,{type:OpenLayers.Control.TYPE_TOOL,panned:false,draw:function(){this.handler=new OpenLayers.Handler.Drag(this,{move:this.panMap,done:this.panMapDone})},panMap:function(G){var E=TomTom.MessageBus;if(this.handler.start.equals(this.handler.last)){E.publish("clearpopup");E.publish("panmapstart")}this.panned=true;var D=this.handler.last.x-G.x;var B=this.handler.last.y-G.y;var F=this.map.getSize();var A=new OpenLayers.Pixel(F.w/2+D,F.h/2+B);var C=this.map.getLonLatFromViewPortPx(A);this.map.cachedCenter=null;this.map.setCenter(C,null,this.handler.dragging);E.wbrpState.center=C.lon+","+C.lat;E.wbrpState.zoom=this.map.getZoom();E.wbrpState.bbox=this.map.getExtent().toBBOX()},panMapDone:function(A){if(this.panned){this.panMap(A);this.panned=false}this.map.div.style.cursor="url("+TomTom.Config.staticDir+"/images/grab.cur), -moz-grab;"},CLASS_NAME:"OpenLayers.Control.DragPan"});var hasInnerText=(document.getElementsByTagName("body")[0].innerText!=undefined)?true:false;TomTom.Init=function(){var A=TomTom.MessageBus,F=TomTom.CookieManager,E=A.wbrpState,C=function(){new TomTom.GetMapLocation()},D=function(){new TomTom.InitLbsContextRequest()},B=function(){var H="WBRPHash";var G=F.get(H);if(G!=null){G=G.replace(/"/g,"");window.location.hash="/"+G}document.cookie=H+"=;path=/;expires="+new Date(0).toGMTString()+";"};return{initialize:function(){A.subscribe(["beforeload","afterload","initLbsContextOk"],this)},notified:function(G,H){switch(G){case"beforeload":A.wbrpState.initLoadState=true;C();D();B();TomTom.Utils.registerNativeContextMenu("global-nav");break;case"afterload":F.loadLocations();E.deserializeURL();E.retrieveState();A.publish("trafficstatechanged",true);Event.observe(window,"resize",function(){A.publish("resize")});break;case"initLbsContextOk":$("lbsVersionDiv").innerHTML=H.version?H.version:"UNKNOWN";break;default:break}}}}();TomTom.Options=Class.create();TomTom.Options.prototype={SELECTED_COLOR:"#D6D6D6",initialize:function(A){this.parent=A;this.div=$(A.expandedDivId);this.divContainer=$(A.expandedDivId+"_container");this.selectedIndex=-1;this.leftShadow=$("options_shadow_l");this.rightShadow=$("options_shadow_r");TomTom.MessageBus.subscribe(["clearpopup","autocompleteclicked"],this);Event.observe(this.parent.htmlElement,"keyup",this.handleKeyup.bind(this));Event.observe(this.parent.htmlElement,"keydown",this.handleKeydown.bind(this))},handleKeyup:function(C){if(!this.isActive){return }var D=this.getKeyNum(C);var A=this.options;var B=this.selectedIndex;switch(D){case Event.KEY_DOWN:if(this.selectedIndex<A.length-1){B=B+1}break;case Event.KEY_UP:if(this.selectedIndex>=0){B=B-1}break;case Event.KEY_ESC:this.hide();return ;default:return }if(this.div&&this.div.visible()){this.scrollToSelectedOptionIndex(B)}},handleKeydown:function(A){if(!this.isActive){return }var B=this.getKeyNum(A);switch(B){case Event.KEY_TAB:this.hide();break}},getKeyNum:function(A){if(window.event){return A.keyCode}else{if(A.which){return A.which}}},scrollToSelectedOptionIndex:function(A){if(this.div!=null){var C=(this.blankOption)?A+1:A;var B=this.getLineHeight();this.div.scrollTop=C*B;if(this.selectedIndex!=-1&&this.options[this.selectedIndex]){this.options[this.selectedIndex].setStyle({backgroundColor:""})}if(A!=-1&&this.options[A]){this.options[A].setStyle({backgroundColor:this.SELECTED_COLOR})}}this.selectedIndex=A},getSelectionText:function(){if(this.selectedIndex!=-1){return hasInnerText?this.options[this.selectedIndex].innerText:this.options[this.selectedIndex].textContent}else{return null}},getLineHeight:function(){var A=this.div.firstDescendant().getHeight();if(!Prototype.Browser.IE){A++}return A},position:function(){var A=this.parent.htmlElement;var D=Position.cumulativeOffset(A);var B=D[0];if(Prototype.Browser.IE){B=A.getBoundingClientRect().left-2}var C=this.div;C.setStyle({left:B-2+"px",top:D[1]+17+"px",width:A.getWidth()+4+"px"})},positionAndShowShadows:function(){var B=this.div.getHeight()+4;var A=(this.div.getWidth())/2+5;var D=parseInt(this.div.getStyle("left"),10)-5;var C=parseInt(this.div.getStyle("top"),10)+2;this.leftShadow.setStyle({left:D+"px",top:C+"px",width:A+"px",height:B+"px"});this.rightShadow.setStyle({left:D+this.leftShadow.getWidth()+"px",top:C+"px",width:A+"px",height:B+"px"});this.leftShadow.show();this.rightShadow.show()},show:function(A){var B=this.div;B.innerHTML=A.join('<div class="line"></div>');B.show();this.position();this.positionAndShowShadows();this.options=this.div.select("a");this.isActive=true},hide:function(){if(this.div){this.div.hide();this.leftShadow.hide();this.rightShadow.hide();this.isActive=false;this.selectedIndex=-1}},notified:function(A,B){switch(A){case"clearpopup":this.hide();break;case"autocompleteclicked":if(this.isActive){this.parent.setValue(B);this.hide()}break}}};TomTom.Poi=function(){var E=TomTom.MessageBus,M=null,C=null,J=function(){H()},H=function(){M=new OpenLayers.Layer.Markers("Pois");E.publish("setlayer",{name:"pois",layer:M,index:2})},F=function(){E.publish("clearmarkers",{name:"any",layer:M})},B=function(N){C=N;F();D(C.poiCategory)},D=function(N){var O=TomTom.Config.staticDir+"/images/poiicons/map/poi-"+N+".png";new Ajax.Request(O,{method:"get",onSuccess:L,onFailure:I})},I=function(N){var O=TomTom.Config.staticDir+"/images/marker.png";A(O,51,60)},L=function(N){A(N.request.url,28,33)},A=function(P,Q,N){var O={url:P,size:new OpenLayers.Size(Q,N),offset:new OpenLayers.Pixel(-(Q/2),-(N+1)),alphaNeeded:true};E.publish("registermarker",{location:{latitude:C.coordinate.mercY,longitude:C.coordinate.mercX},icon:O,layer:"pois",name:"poiIcon",callback:G,contextMenu:false})},K=function(){var N=TomTom.MessageBus.wbrpState.map.events;N.register("zoomend",this,function(){if(TomTom.Map.getLayers().pois.div.firstChild!=null){F();D(C.poiCategory)}})},G=function(N){return TomTom.ContextMenu.locationInfoBalloon(C,C.formattedAddress,N,{type:"findlocation"})};return{initialize:function(){E.subscribe(["beforeload","clearPoiIcons","placePoiIcon"],this);K()},notified:function(N,O){switch(N){case"beforeload":J();break;case"clearPoiIcons":F();break;case"placePoiIcon":B(O);break}}}}();TomTom.Dropbox=Class.create();TomTom.Dropbox.prototype={UP_ARROW:38,DOWN_ARROW:40,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,SELECTED_COLOR:"#D6D6D6",id:null,expandedId:null,expandedDiv:null,collapsedId:null,collapsedDiv:null,collapsedSpanWidth:"",expandedDivWidth:"",expandedDivHeight:"",itemClass:"item",name:null,optionsKey:"id",blankOption:false,pageSize:10,options:function(){return[]},selectedId:null,selectedName:null,selectedIndex:0,oSelectedOption:{id:null,name:null},handleKeydown:null,scrollableContainer:null,isActive:false,isEnabled:true,iconHtml:"",initialize:function(A,I,D,C,B,G,F,E){this.editable=(C?true:false);this.name=A;this.id=A+"_dropbox";this.ARROW_ID="arrow_"+this.id;this.expandedId=this.id+"_expanded";this.expandedDiv=$(this.expandedId);this.collapsedId=this.id+"_collapsed";this.collapsedDiv=$(this.collapsedId);if(I){this.options=I}if(B){this.collapsedSpanWidth=B+"px";this.expandedDivWidth=(B+7)+"px"}if(G){this.expandedDivHeight=G+"px"}if(F){this.blankOption=F}if(isIE6){this.iconHtml="<span class=\"dropboxIcon\" style=\"width:#{width}; height:#{height};display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{src}', sizingMethod='crop');\"></span>"}else{this.iconHtml='<img class="dropboxIcon" src="#{src}" width="#{width}" height="#{height}"/>'}this.hideSelectBox=function(K){if(!this.isActive){return }K=(K)?K:window.event;var J=(K.target)?K.target:K.srcElement;if((J.className=="arrow_down")||(J.parentNode.className=="root")){return }this.deactivate();if(this.expandedDiv&&J.offsetParent&&J.offsetParent.id!=this.expandedDiv.id&&J.id!=this.expandedDiv.id){if(this.editable&&Position.within($(this.inputBox),K.clientX,K.clientY)){return }else{this.handleClose()}}}.bind(this);this.handleKeydown=function(N){if(!this.isActive){return }var O;if(window.event){O=N.keyCode}else{if(N.which){O=N.which}}var J=this.options();var L=this.selectedIndex;switch(O){case this.DOWN_ARROW:if(this.selectedIndex<J.length-1){L=L+1}break;case this.UP_ARROW:if(this.selectedIndex>0){L=L-1}else{if(this.selectedIndex==0){if(this.blankOption){L=-1}}}break;case this.PAGE_DOWN:if(this.selectedIndex+this.pageSize<J.length-1){L=L+this.pageSize}else{L=J.length-1}break;case this.PAGE_UP:if(this.selectedIndex-this.pageSize>=0){L=L-this.pageSize}else{L=0}break;case this.HOME:L=0;break;case this.END:L=J.length-1;break;case Event.KEY_RETURN:TomTom.MessageBus.publish("set"+this.id,J[this.selectedIndex]);break;case Event.KEY_TAB:return ;default:if((O>=48&&O<=57)||(O>=65&&O<=90)||(O>=97&&O<=122)){var M=null;for(var K=0;K<J.length;K++){if(J[K].name.toUpperCase().charCodeAt(0)==O){if(K<=L&&M==null){M=K}else{if(K>L){L=K;break}}}}if(M!=null&&K==J.length){L=M;break}break}}if(this.expandedDiv&&this.expandedDiv.visible()){this.scrollToSelectedOptionIndex(L)}else{TomTom.MessageBus.publish("set"+this.id,J[L])}}.bind(this);Event.observe(document,"keydown",this.handleKeydown);Event.observe(document,"mousedown",this.hideSelectBox);var H=["expand"+this.id,"close"+this.id,"set"+this.id,"opendropbox","focusdropbox","closedropboxes"];TomTom.MessageBus.subscribe(H,this);if(!E){this.redraw(true)}if(D){TomTom.MessageBus.subscribe(["set"+this.id],D)}this.item_id_prefix=A+"_option_";this.collapsedDiv.onblur=function(J){this.cleanUp()}.bind(this);Event.observe(document,"mousewheel",this.handleWheelScroll.bind(this),false);Event.observe(document,"DOMMouseScroll",this.handleWheelScroll.bind(this),false)},redraw:function(A){this.collapsedDiv.innerHTML=this.getSelectedOptionAsHtml(A);if(!this.isEnabled){return }this.collapsedDiv.firstDescendant().onfocus=function(B){this.activate();TomTom.MessageBus.publish("focusdropbox",this.id)}.bind(this);this.restoreInputBox()},activate:function(){this.isActive=true;TomTom.MessageBus.publish("clearpopup")},deactivate:function(){this.isActive=false},disable:function(){this.isEnabled=false;this.deactivate();$(this.ARROW_ID).className="arrow_disabled";$(this.collapsedId+"_root").onclick=function(){this.collapsedDiv.blur();return false}.bind(this);this.collapsedDiv.firstDescendant().style.cursor="default";this.collapsedDiv.firstDescendant().firstDescendant().style.cursor="default";$(this.collapsedId+"_value").setStyle({color:"#cccccc"});if(this.editable){this.inputBox.setStyle({color:"#cccccc",cursor:"default"});this.inputBox.disabled=true}},enable:function(){this.isEnabled=true;if(this.editable){this.inputBox.setStyle({color:"#545454",cursor:"text"});this.inputBox.disabled=false}else{this.redraw(true)}},getSelectedOptionAsHtml:function(C){var H,G,D,E;if(C){H="down";G="expand"}else{H="up";G="close"}G=G+this.id;this.oSelectedOption=this.searchForOption();var B="";var A="";if(this.collapsedSpanWidth){B='style="width:'+this.collapsedSpanWidth+'"'}if(this.oSelectedOption&&this.oSelectedOption.icon){this.oSelectedOption.src=this.oSelectedOption.icon.src;this.oSelectedOption.width=this.oSelectedOption.icon.width;this.oSelectedOption.height=this.oSelectedOption.icon.height;A=this.iconHtml}if(this.isEnabled){D="arrow_"+H;E='style= "color:#545454"'}else{D="arrow_disabled";E='style= "color:#cccccc"'}var F=new Template('<a id="'+this.collapsedId+'_root" class="root" href="#" onclick="TomTom.MessageBus.publish(\''+G+'\',null);return false;"><span class="container" '+B+'><div id="'+this.collapsedId+'_value"'+E+'class="flag">#{name}'+A+'</div><div id="'+this.ARROW_ID+'" class="'+D+'"></div></span></a>');return F.evaluate(this.oSelectedOption==null?"":this.oSelectedOption)},searchForOption:function(){var A=this.options();var C=A.length;for(var B=0;B<C;B++){if((A[B][this.optionsKey]==this.selectedId)){this.selectedIndex=B;this.selectedId=A[B][this.optionsKey];this.selectedName=A[B].name;return A[B]}}return null},searchForIndex:function(C,B){for(var A=0;A<C.length;A++){if(C[A][this.optionsKey]==B){return A}}return -1},selectOption:function(){this.collapsedDiv.blur();this.itemTemplate=new Template('<a class="'+this.itemClass+'" style="background-color:#{color};"href="#" id="'+this.item_id_prefix+'#{i}" onclick="TomTom.MessageBus.publish(\'set'+this.id+"',{id:'#{"+this.optionsKey+"}',name:'#{escapedname}'});return false;\"><span>#{name}</span></a>");this.itemWithIconTemplate=new Template('<a class="'+this.itemClass+'" style="background-color:#{color};"href="#" id="'+this.item_id_prefix+'#{i}" onclick="TomTom.MessageBus.publish(\'set'+this.id+"',{id:'#{"+this.optionsKey+"}',name:'#{escapedname}'});return false;\"><span>#{name}</span>"+this.iconHtml+"</a>");var B=[];var D=0;this.options().each(function(H){var I=new Object();I.i=D;I[this.optionsKey]=H[this.optionsKey];I.name=H.name;I.escapedname=this.escape(H.name);if(I[this.optionsKey]==this.selectedId){I.color=this.SELECTED_COLOR}else{I.color=""}if(H.icon){I.src=H.icon.src;I.width=H.icon.width;I.height=H.icon.height;B.push(this.itemWithIconTemplate.evaluate(I))}else{B.push(this.itemTemplate.evaluate(I))}D++}.bind(this));this.redraw(false);if(this.expandedDiv){this.expandedDiv.remove()}var F=document.createElement("div");F.setAttribute("id",this.expandedId);F.className="dropbox_expanded scrollable_dropbox";var G=Position.cumulativeOffset(this.collapsedDiv);var E=G[0];if(Prototype.Browser.IE){E=this.collapsedDiv.getBoundingClientRect().left-2+document.documentElement.scrollLeft}document.getElementsByTagName("body").item(0).appendChild(F);this.expandedDiv=$(this.expandedId);this.expandedDiv.setStyle({left:E+"px",top:G[1]+20+this.topOffset()+"px",width:this.expandedDivWidth,height:this.expandedDivHeight});var A="";if(this.blankOption){A='<a class="'+this.itemClass+'" href="#" id="'+this.item_id_prefix+'00" onclick="TomTom.MessageBus.publish(\'set'+this.id+'\',{id:null,name:null});return false;"><span>&nbsp;</span></a><div class="line"></div>'}this.expandedDiv.innerHTML=A+B.join('<div class="line"></div>');if(!TomTom.Utils.elementHeightFitsInPage(this.expandedId)){if(TomTom.Utils.elementHeightFitsInPageUpwards(this.expandedId)){var G=Position.cumulativeOffset(this.collapsedDiv);var C=G[1]-7-this.expandedDivHeight.substr(0,this.expandedDivHeight.length-2);this.expandedDiv.setStyle({top:C+this.topOffset()+"px"})}else{TomTom.Utils.adjustHeight(this.expandedId)}}this.collapsedDiv.style.zIndex=999999999},escape:function(A){return A.replace("'","\\'")},restoreInputBox:function(){if(this.editable){if(this.inputBox==null){this.inputBox=document.createElement("input");this.inputBox.className="dropboxInput";this.inputBox.id=this.name+"_input"}this.collapsedDiv.appendChild(this.inputBox)}},scrollToSelectedOption:function(){this.scrollToSelectedOptionIndex(this.selectedIndex)},getLineHeight:function(){var A=this.expandedDiv.firstDescendant().getHeight();if(!Prototype.Browser.IE){A++}return A},scrollToSelectedOptionIndex:function(A){if(this.expandedDiv!=null){var C=(this.blankOption)?A+1:A;var B=this.getLineHeight();this.expandedDiv.scrollTop=C*B;if($(this.name+"_option_"+this.selectedIndex)){$($(this.name+"_option_"+this.selectedIndex)).setStyle({backgroundColor:""})}if($(this.name+"_option_"+A)){$(this.name+"_option_"+A).setStyle({backgroundColor:this.SELECTED_COLOR})}}this.selectedIndex=A},handleExpandedScroll:function(A){if(this.scrollableContainer){this.scrollableContainer.onscroll=function(B){this.scrollableContainer.scrollTop=0}.bind(this)}},setOption:function(A){this.selectedId=A?A.id:null;this.selectedName=A?A.name:null;this.selectedIndex=this.searchForIndex(this.options(),this.selectedId);this.hide();this.redraw(true)},getSelectedOption:function(){return this.oSelectedOption},getSelectedId:function(){return this.selectedId},setOptions:function(A,C,B){this.options=A;if(C){this.selectedId=C.id;this.selectedName=C.name}if(B){this.optionsKey=B}this.redraw(true)},hide:function(){if(this.expandedDiv){this.expandedDiv.hide()}},resize:function(A){this.collapsedSpanWidth=A+"px";this.expandedDivWidth=(A+7)+"px";this.redraw(true)},handleExpand:function(){this.selectOption();this.scrollToSelectedOption();this.activate()},handleClose:function(){this.hide();this.redraw(true);this.cleanUp()},handleSet:function(A){this.setOption(A)},cleanUp:function(){this.collapsedDiv.style.zIndex=0},setScrollableContainer:function(A){this.scrollableContainer=A},handleWheelScroll:function(B){if(!this.isActive){return }B=(B)?B:window.event;var A=(B.target)?B.target:B.srcElement;if(A.parentNode.className=="root"){var C=Event.wheel(B);this.expandedDiv.scrollTop=this.expandedDiv.scrollTop-(C*this.getLineHeight())}else{if(A.id==this.expandedId||A.parentNode.id==this.expandedId||A.parentNode.className=="item"||A.parentNode.parentNode.className=="item"){}else{this.handleClose()}}},topOffset:function(){if(this.scrollableContainer){return -this.scrollableContainer.scrollTop}return 0},notified:function(A,B){switch(A){case"expand"+this.id:this.handleExpand();TomTom.MessageBus.publish("opendropbox",this.id);break;case"close"+this.id:this.handleClose();break;case"set"+this.id:this.handleSet(B);this.cleanUp();break;case"opendropbox":if(B!=this.id){this.deactivate();this.handleClose()}break;case"focusdropbox":if(B!=this.id){this.deactivate()}break;case"closedropboxes":if(this.expandedDiv){this.deactivate();this.handleClose()}break;default:break}}};TomTom.Inputbox=Class.create();TomTom.Inputbox.prototype={i18nTexts:[{id:"clearhistory.content",evtid:"clearHistory",text:""}],initialize:function(D,B,C){this.htmlElement=$(D);this.htmlElement.setAttribute("autocomplete","off");this.rules=C;if(isIE6){var A="<span class=\"dropboxIcon\" style=\"width:#{width}; height:#{height};display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='#{src}', sizingMethod='crop');\"></span>"}else{var A='<img class="dropboxIcon" ';A+="onerror=\"this.src='"+TomTom.Config.staticDir+"/css/blank.gif';height=0;width=0;\" ";A+=' src="#{src}" width="#{width}" height="#{height}"/>'}this.itemTemplate=new Template('<a class="item" href="#" onclick="TomTom.MessageBus.publish(\'autocompleteclicked\',\'#{name}\');return false;"><span>#{part1}</span><span style="font-weight:bold">#{part2}</span><span>#{part3}</span>'+A+"</a>");this.itemTemplateNoIcon=new Template('<a class="item" href="#" onclick="TomTom.MessageBus.publish(\'autocompleteclicked\',\'#{name}\');return false;"><span>#{part1}</span><span style="font-weight:bold">#{part2}</span><span>#{part3}</span></a>');this.expandedDivId="autocompleter";this.autocompleter=new TomTom.Options(this);this.returnKeyHandler=B.returnKey?B.returnKey:function(){};this.onChangeHandler=B.change?B.change:function(){};Event.observe(this.htmlElement,"keyup",this.onKeyUp.bind(this));TomTom.MessageBus.subscribe(["i18nupdated","clearautocomplete"],this)},onKeyUp:function(B){if(!B){B=window.event}var A;if(B.srcElement){A=B.srcElement}else{if(B.target){A=B.target}}if(A==this.htmlElement){switch(B.keyCode){case Event.KEY_RETURN:if(this.getValue()!=""){if(this.autocompleter&&this.autocompleter.div.visible()){var C=this.autocompleter.getSelectionText();if(C==this.getText("clearHistory")){this.clearAutocomplete()}else{if(C!=null){this.setValue(C)}this.autocompleter.hide()}}else{this.returnKeyHandler()}}break;case Event.KEY_DOWN:case Event.KEY_UP:case Event.KEY_ESC:case Event.KEY_TAB:break;default:if(this.getValue()!=""){this.autocomplete(B.charCode)}else{this.autocompleter.hide()}this.onChangeHandler()}}},blur:function(){this.htmlElement.blur()},focus:function(){this.enable();this.htmlElement.focus()},disable:function(){this.htmlElement.disabled=true},enable:function(){this.htmlElement.removeAttribute("disabled")},getValue:function(){return this.htmlElement.value},setValue:function(A){this.htmlElement.value=A},setOnBlur:function(A){this.htmlElement.onblur=A},validate:function(){var C=TomTom.Validate;var B=C.validate(this.getValue(),this.rules);if(B!="true"){return{valid:false,error:B}}var A=C.statusTypes;var D=C.validateLatLon(this.getValue());if(D.status==A.BAD_COORD){return{valid:false,error:"bad_coord"}}if(D.status==A.NO_HOME_SET){return{valid:false,error:"no_home_set"}}return{valid:true,validatedLL:D}},addClearOption:function(B){var A='<a class="item clearHistory" href="#" onclick="TomTom.MessageBus.publish(\'clearautocomplete\');return false;"><span>'+this.getText("clearHistory")+"</a>";B.push(A);return B},autocomplete:function(F){var H=TomTom.CookieManager.getSavedLocations();var E=[];var L=this.getValue().toLowerCase();L=escape(L);for(var O=0,Q=H.length;O<Q;O++){var I=H[O];var S=I[TomTom.LocationsCookie.LOC_ADDR_IDX];var R=escape(S.toLowerCase());if(R.startsWith(L)){var K=unescape(L);var A=unescape(R).indexOf(K);var P=K.length;var D=S.substring(0,A);var C=S.substr(A,P);var B=S.substr(A+P);var G=I[TomTom.LocationsCookie.LOC_POI_CATEGORY_IDX];if(G!=-1){var J=TomTom.Config.staticDir+"/images/poiicons/leftpanel/poi-"+G+".png";var N="16px";var M="16px";E.push(this.itemTemplate.evaluate({name:TomTom.Utils.protectString(S),part1:D,part2:C,part3:B,src:J,width:N,height:M}))}else{E.push(this.itemTemplateNoIcon.evaluate({name:TomTom.Utils.protectString(S),part1:D,part2:C,part3:B}))}}if(E.length==5){break}}if(E.length>0){E=this.addClearOption(E);this.autocompleter.show(E)}else{this.autocompleter.hide()}},clearAutocomplete:function(){TomTom.CookieManager.clearLocations();this.autocompleter.hide()},getText:function(A){return TomTom.Utils.getText(this.i18nTexts,A)},notified:function(A,B){switch(A){case"i18nupdated":TomTom.Utils.updateTexts(this.i18nTexts,B);break;case"clearautocomplete":this.clearAutocomplete();break;default:break}}};TomTom.Validate=function(){var A=function(C){if(C!=null&&C.length>0){if(C.match(/^\W+$/)){return true}}return false},B=function(C){return(C!=null&&C.length<2&&C.length>0)};return{ruleEnum:{NoInput:0,NotEnoughChars:1,JustPunctuation:2},statusTypes:{NOT_A_COORD:-1,IS_A_COORD:0,BAD_COORD:1,NO_HOME_SET:2,IS_HOME:3},validateLatLon:function(G){var C=TomTom.Utils,L=this.statusTypes;retObj={status:L.NOT_A_COORD,location:null};if(G!=null){if(G.toLowerCase()=="home"){var J=TomTom.CookieManager.hasHomeSet();if(J){var M=J.evalJSON();retObj.status=L.IS_HOME;retObj.location=M}else{retObj.status=L.NO_HOME_SET}return retObj}var H=C.LL_getLatLong(G);if(H==-1){retObj.status=L.NOT_A_COORD}else{if(H==0){retObj.status=L.BAD_COORD}else{retObj.status=L.IS_A_COORD;var K=C.LL_degrees_from_seconds(H[1][0]),D=C.LL_degrees_from_seconds(H[2][0]),F=C.forwardMercator(D,K),I={};I=new OpenLayers.LonLat(D,K);I.coordinate={};I.coordinate.latitude=K;I.coordinate.longitude=D;I.coordinate.mercX=F.lon;I.coordinate.mercY=F.lat;var E=C.formatLonLat({lon:D,lat:K});if(H[0]!=null&&H[0].length>0){E=E+" "+H[0]}I.formattedAddress=E;retObj.location=I}}}return retObj},validateGeocodeResults:function(C){if(C.length==1){return C}var L=TomTom.Config,M=C[0].score,N=C.length,D=[],G=[];for(var H=0;H<N;H++){D[H]=C[H].score/M;if(D[H]>=L.GeocodeTolerance){G.push(C[H])}else{break}}if(G.length>0){return G}else{var E,K=L.GeocodeTolerance,F=(N<5)?N-1:4,I=D[1]-D[F];if(I==0){var J=D[1];if(J>=K*K){E=1}}else{E=1-(J*I)}if(E>=L.GeocodeTolerance){return[C[0]]}else{return C}}},validateEmpty:function(C){if(C==null){return true}if(C!=null&&C.length==0){return true}return false},validate:function(E,F){for(var D=0,C=F.length;D<C;D++){switch(F[D]){case 0:if(this.validateEmpty(E)){return"noinput"}else{break}case 1:if(B(E)){return"notfound"}else{break}case 2:if(A(E)){return"notfound"}else{break}}}return"true"}}}();TomTom.Utils={SHADOW_OFFSETS:[[-2,0],[2,0],[0,-2],[0,2],[1,1],[-1,-1],[1,-1],[-1,1]],MAP:$("map"),updateImage:function(B,D,C){if(B[D]){if(B["is"+D]){if(!C){if(B.imgSrc){B.firstDescendant().src=B.imgSrc}else{B.firstDescendant().remove()}B["is"+D]=false}}else{if(C){if(B.imgSrc){B.firstDescendant().src=B[D]}else{var A=document.createElement("img");A.src=B[D];B.appendChild(A)}B["is"+D]=true}}}},inverseMercator:function(A,D){var C=(A/20037508.34)*180;var B=(D/20037508.34)*180;B=180/Math.PI*(2*Math.atan(Math.exp(B*Math.PI/180))-Math.PI/2);return new OpenLayers.LonLat(C,B)},forwardMercator:function(C,B){var A=C*20037508.34/180;var D=Math.log(Math.tan((90+B)*Math.PI/360))/(Math.PI/180);D=D*20037508.34/180;return new OpenLayers.LonLat(A,D)},roundCorners:function(B,A){A.each(function(C){var D=document.createElement("div");D.className=C;$(B).appendChild(D)})},getCloseText:function(){return this.getText(TomTom.MessageBus.wbrpState.i18nTexts,"close_text")},createLeaveCloseBalloon:function(G,F,D,B,I,H,C,E){var A="	    <div id='infoballoon_button_left_link'>   		<a onclick='javascript:TomTom.MessageBus.publish(\"balloonleavenow\");'   		class='button' href='javascript:;'>     			<span id=\"leavenow_text\">"+B+"</span>	    	</a>   	</div>	    <div id='infoballoon_button_right_link'>   		<a onclick='javascript:TomTom.MessageBus.publish(\"clearpopup\");'   		class='button' href='javascript:;' id='close_balloon_anchor'>     			<span id=\"close_text\">"+this.getCloseText()+"</span>	    	</a>   	</div>";return this.createBalloon(A,G,F,D,I,H,C,E)},createInfoBalloon:function(F,H,B,E,A,D,G){var C="	    <div id='infoballoon_button_link' class='"+G+"'>   		<a onclick='javascript:TomTom.MessageBus.publish(\"clearpopup\");'   		class='button' href='javascript:;' style='display:inline'  id='close_balloon_anchor'>     			<span id=\"close_text\">"+this.getCloseText()+"</span>	    	</a>   	</div>";return this.createBalloon(C,F,H,B,E,A,D)},createBalloon:function(B,I,H,F,K,J,D){TomTom.MessageBus.publish("closedropboxes");var C;if(K){C=" "+K}if(!D){D=this.getBalloonBody(I,J)}if(!C){C=""}var A="";if(!window.XMLHttpRequest){A='style="background-position-y:5px"'}var G="<div id='infoballoon_top' class='infoballoontop_"+D.top+"' "+A+"></div><div id='infoballoon' class='"+C+"'>	<div id='infoballoon_header'>";if(H){G+="		<table cellpadding=1><tr><td><span id='popup_title'>"+H+"</span></td></tr>		</table>"}G+="		<div id='infoballoon_body'>"+F+B+"		</div>	</div></div></div><div id='infoballoon_bottom' class='infoballoonbottom_"+D.bottom+"'></div>";var E=new Object();E.delay=0;E.text=G;E.position=I;E.bgImg=TomTom.Config.staticDir+"/images/blank.gif";return E},getBalloonBody:function(H,J){var I=TomTom.Config.Map;var D=250;var A=J?J:214;var E=28;var C=Prototype.Browser.IE?21:17;var F=this.MAP.cumulativeOffset();var G=((this.MAP.getHeight()+F.top)-H.y<A+C);var B=(this.MAP.getWidth()-H.x<D-E);if(B){H.x-=(D-E)}else{H.x-=E}if(G){H.y-=(A+C)}else{H.y+=C}return{top:(G?"noptr":(B?"ptrright":"ptrleft")),bottom:(G?(B?"ptrright":"ptrleft"):"noptr")}},createShadowDivs:function(F,C,E){for(var D=0;D<this.SHADOW_OFFSETS.length;D++){var B=this.SHADOW_OFFSETS[D][0];var A=this.SHADOW_OFFSETS[D][1];C.appendChild(this.createShadowDiv(F,B,A,E))}},createShadowDiv:function(G,B,A,E){var F=document.createElement("div");F.id=G.id+"_"+B+"_"+A;F.className=E;F.style.position="absolute";var C=G.style.bottom?"bottom":"top";var D=G.style.right?"right":"left";F.style[C]=parseInt(G.style[C])+A+"px";F.style[D]=parseInt(G.style[D])+B+"px";F.innerHTML=G.innerHTML;return F},modifyShadowsStyle:function(F,D,E){for(var C=0;C<this.SHADOW_OFFSETS.length;C++){var B=this.SHADOW_OFFSETS[C][0];var A=this.SHADOW_OFFSETS[C][1];if(D=="right"){$(F.id+"_"+B+"_"+A).style.right=parseInt(E)+B+"px"}else{$(F.id+"_"+B+"_"+A).style[D]=E}}},modifyShadowsContent:function(E,D){for(var C=0;C<this.SHADOW_OFFSETS.length;C++){var B=this.SHADOW_OFFSETS[C][0];var A=this.SHADOW_OFFSETS[C][1];$(E.id+"_"+B+"_"+A).innerHTML=D}},adjustHeight:function(B){if($(B)){var C=$(B);var E=this.elementDistanceToBottom(B);if(E<0){var D=C.getDimensions().height;var A=D+E-6;if(A<=0){A=0}C.style.height=A+"px"}else{C.style.height="auto"}}},elementHeightFitsInPage:function(A){return this.elementDistanceToBottom(A)>=0},elementHeightFitsInPageUpwards:function(A){return this.elementDistanceToTop(A)>=0},elementDistanceToBottom:function(A){var B=$(A);var D=Position.cumulativeOffset(B)[1];var C=B.getDimensions().height;var E=Element.getDimensions(document.body).height-C-D;return E},elementDistanceToTop:function(A){var B=$(A);var D=Position.cumulativeOffset(B)[1];var C=B.getDimensions().height;var E=D-C;return E},observeRightClick:function(B,A){var C={};C.theFunction=A;var D=this.handleRightClick.bind(C);if(B.addEventListener){B.addEventListener("mousedown",D,false)}else{if(B.attachEvent){B.attachEvent("onmousedown",D)}}},stopObservingRightClick:function(B,A){if(B.removeEventListener){B.removeEventListener("mousedown",this.handleRightClick,false)}else{if(B&&B.detachEvent){B.detachEvent("onmousedown",this.handleRightClick)}}},handleRightClick:function(A){if(TomTom.Utils.isRightClick(A)){this.theFunction(A)}},isRightClick:function(A){return(((A.which)&&(A.which==3))||((A.button)&&(A.button==2)))},protectString:function(A){A=A.replace(/"/g,'"');A=A.replace(/'/g,"%27");return A},LL_getLatLong:function(A){var H="";var F=new Array();var E=new Array();if(String(A).indexOf("@")!=-1){var D=String(A).split("@");H=String(D[0]).trim();A=D[1]}var B=A.match(/\(([^\)]*)\)/g,"");if(B!=null){if(B.length>0){H=String(B[0]).trim()}}A=A.replace(/\([^\)]*\)/g,"");A=A.replace(/([+-])/g," $1");A=A.replace(/([^0-9+-.])([^\s])/g,"$1 $2");var I=String(A).trim().split(",");if(I.length>2){return -1}else{if(I.length==2){F[0]=I[0];F[1]=0;E[0]=I[1];E[1]=0}else{split2=A.trim().split(/[NSEW]/ig);if(split2.length>3){return -1}else{if(split2.length==3){if(((split2[0]!="")&&(split2[2]!=""))||((split2[0]=="")&&(split2[2]==""))){return -1}if(split2[0]==""){F[0]=split2[1];E[0]=split2[2];F[1]=1;E[1]=2;if(A.trim().substring(0,1).search(/[NS]/i)==-1){F[1]=2;E[1]=1}}else{F[0]=split2[0];E[0]=split2[1];F[1]=2;E[1]=1;if(A.trim().substr((A.trim().length-1),1).search(/[NS]/i)==-1){F[1]=1;E[1]=2}}if(A.indexOf("S")>=0){F[0]="-"+F[0]}if(A.indexOf("W")>=0){E[0]="-"+E[0]}}else{if(split2.length==2){return -1}else{A=A.replace(/([0-9])[\s]+([^0-9\s])/g,"$1$2");A=A.replace(/(['`])[\s]+(['`])/g,"$1$2");var G=A.trim().split(/\s/g);if(G.length==1){return -1}F[0]=G.slice(0,Math.floor(G.length/2)).join(" ");F[1]=0;E[0]=G.slice(Math.floor(G.length/2)).join(" ");E[1]=0}}}}}if(F[0].match(/[0-9]/g)==null){return -1}if(E[0].match(/[0-9]/g)==null){return -1}if(F[0].match(/[a-z]/ig)!=null){if(F[0].match(/[a-z]/ig).length>2){return -1}else{if(F[0].match(/[a-df-mp-rtux-z]/ig)!=null){return -1}}}if(E[0].match(/[a-z]/ig)!=null){if(E[0].match(/[a-z]/ig).length>2){return -1}else{if(E[0].match(/[a-df-mp-rtux-z]/ig)!=null){return -1}}}if(A.trim().split(/[NS]/ig).length>2){return 0}if(A.trim().split(/[EW]/ig).length>2){return 0}F.push(F[0]);E.push(E[0]);F[0]=this.LL_getLatLongSeconds(F[0]);E[0]=this.LL_getLatLongSeconds(E[0]);if((F[0]>648000)||(F[0]<-648000)||(E[0]>648000)||(E[0]<-648000)){return 0}if(((F[0]>324000)||(F[0]<-324000))&&((E[0]>324000)||(E[0]<-324000))){return 0}if((F[0]>324000)||(F[0]<-324000)){if(F[2].trim().substr((F[2].trim().length-1),1).search(/[NS]/i)!=-1){return 0}F[1]=2;E[1]=1}else{if((E[0]>648000)||(E[0]<-648000)){if(E[2].trim().substr((E[2].trim().length-1),1).search(/[EW]/i)!=-1){return 0}F[1]=1;E[1]=2}}if(F[1]==0){if(String(F[2]).match(/[NS]/ig)!=null){F[1]=1;E[1]=2}else{if(String(F[2]).match(/[EW]/ig)!=null){F[1]=2;E[1]=1}else{if(String(E[2]).match(/[NS]/ig)!=null){F[1]=2;E[1]=1}else{if(String(E[2]).match(/[EW]/ig)!=null){F[1]=1;E[1]=2}else{F[1]=1;E[1]=2}}}}}var C=new Array();C.push(H);if(F[1]==1){C.push(F);C.push(E)}else{C.push(E);C.push(F)}return C},LL_getLatLongSeconds:function(C){var E=0;var F=0;var J=0;var I=C.trim();var H=I.trim();H=H.replace(/([0-9])[\s]+([^0-9\s])/g,"$1$2");H=H.replace(/(['`])[\s]+(['`])/g,"$1$2");H=H.replace(/\.([^0-9])/g,"$1");H=H.replace(/['`]['`]/g,'"_');H=H.replace(/['`]([^'`_])/g,"'_$1");H=H.replace(/["][^_]/g,'"_');H=H.replace(/[\s]+([^\s])/g,"_$1");H=H.replace(/[^'"0-9_\.]/g,"_");if(H.split("'").length>2){return 648001}if(H.split('"').length>2){return 648001}var G=H.split("_");var D=new Array();for(var B=0;B<G.length;B++){if(String(G[B]).match(/[^'"]/g)!=null){D.push(G[B])}}G=D;if(G.length>3){return 648001}for(var B=0;B<G.length;B++){var A=String(G[B]).replace(/[^0-9\.]/g,"");if(B==0){if(String(G[0]).indexOf('"')!=-1){J=A}else{if(String(G[0]).indexOf("'")!=-1){F=A}else{E=A}}}else{if(B==1){if(J>0){return 648001}if(String(G[1]).indexOf('"')!=-1){J=A}else{if(F>0){return 648001}else{F=A}}}else{if(J>0){return 648001}J=A}}}returnValue=(E*60+F*1)*60+J*1;I=I.replace(/s/ig,"-");I=I.replace(/w/ig,"-");I=I.replace(/n/ig,"");I=I.replace(/e/ig,"");if(I.indexOf("-")!=-1){returnValue*=-1}return returnValue},LL_getPartValue:function(A){return A.replace(/[^0-9\.]/g,"")},LL_degrees_from_seconds:function(A){return Math.round((A/(60*60))*1000000)/1000000},formatLonLat:function(A){A.lon=A.lon.toFixed(5);A.lat=A.lat.toFixed(5);if(A.lon>0){A.lon=A.lon+"\u00B0E"}else{A.lon=-A.lon;A.lon=A.lon+"\u00B0W"}if(A.lat>0){A.lat=A.lat+"\u00B0N"}else{A.lat=-A.lat;A.lat=A.lat+"\u00B0S"}return A.lat+", "+A.lon},round:function(C,B){var A=Math.pow(10,B);return Math.round(C*A)/A},shrinkToFit:function(A,C){A.style.fontSize="";var D=false;var B=100;while(A.getWidth()+parseInt(Element.getStyle(A,"margin-left"))>=C){D=true;B-=2;A.style.fontSize=B+"%"}return D},lz:function(C,A){A=A?A:2;var B=String(C);while(B.length<A){B="0"+B}return B},registerNativeContextMenu:function(C){var B=function(D){TomTom.MessageBus.publish("enablecontextmenu")};var A=function(D){TomTom.MessageBus.publish("disablecontextmenu")};$(C).onmouseover=B;$(C).onmouseout=A},getText:function(D,C){for(var A=D.length-1;A>=0;A--){var B=D[A];if((B.id&&B.id==C)||(B.evtid&&B.evtid==C)){return B.text}}return null},updateTexts:function(D,A){for(var C=D.length-1;C>=0;C--){for(var B=A.length-1;B>=0;B--){if(D[C].id==A[B].id){D[C].text=A[B].text;break}}}},updateElement:function(D,C,B){if(B==null){B=function(){return false}}var A=$(D);A.className=C;A.onclick=B},isTimeWithinXMinutes:function(D,A){var C=new Date();var B=new Date(C).addMinutes(A);if(D.compareTo(B)<=0&&D.compareTo(C)>=0){return true}return false},setDateToday:function(B){var A=new Date();B.set({day:A.getDate(),month:A.getMonth(),year:A.getFullYear()})},makeWBRPCoordinate:function(C,B){var A=this.forwardMercator(C,B);return{mercX:A.lon,mercY:A.lat,longitude:C,latitude:B}},switchCheckbox:function(){this.blur();if(this.hasClassName("checked")){this.removeClassName("checked")}else{this.addClassName("checked")}TomTom.MessageBus.publish("checkboxSwitched");return false}};var nativeSplit=nativeSplit||String.prototype.split;String.prototype.split=function(I,D){if(!(I instanceof RegExp)){return nativeSplit.apply(this,arguments)}if(D===undefined||+D<0){D=false}else{D=Math.floor(+D);if(!D){return[]}}var C=(I.global?"g":"")+(I.ignoreCase?"i":"")+(I.multiline?"m":""),G=new RegExp("^"+I.source+"$",C),B=[],A=0,E=0,F;if(!I.global){I=new RegExp(I.source,"g"+C)}while((!D||++E<=D)&&(F=I.exec(this))){var H=!F[0].length;if(H&&I.lastIndex>F.index){I.lastIndex=F.index}if(I.lastIndex>A){if(F.length>1){F[0].replace(G,function(){for(var J=1;J<arguments.length-2;J++){if(arguments[J]===undefined){F[J]=undefined}}})}B=B.concat(this.slice(A,F.index),(F.index===this.length?[]:F.slice(1)));A=I.lastIndex}if(H){I.lastIndex++}}return(A===this.length)?(I.test("")?B:B.concat("")):(D?B:B.concat(this.slice(A)))};Object.extend(Event,{wheel:function(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/120;if(window.opera){B=-B}}else{if(A.detail){B=-A.detail/3}}return Math.round(B)}});function isTestMode(){return window.location.toString().replace("#/","").toQueryParams()["test"]=="true"}if(isTestMode()){if(!window.console){window.console={};window.console.log=function(C){var A="v_window_console";var B=document.getElementById(A);if(!B){var B=document.createElement("div");B.id=A;B.style.position="absolute";B.style.top="0";B.style.right="0";B.style.padding="10px";B.style.backgroundColor="white";B.style.overflow="auto";B.style.height="400px";B.onclick=function(){B.innerHTML=""};document.body.appendChild(B)}messageDiv=document.createElement("div");messageDiv.innerHTML=C;B.appendChild(messageDiv);B.scrollTop=B.scrollHeight};window.console.groupCollapsed=window.console.log;window.console.groupEnd=window.console.log}}else{try{window.console=window.console||{};window.console.log=function(A){};window.console.groupCollapsed=window.console.log;window.console.groupEnd=window.console.log}catch(ex){console.log("Console already defined. Cannot override.")}}if(isTestMode()){var versionDiv=$("version");versionDiv.onclick=function(G){var I="debug_menu";var B=document.getElementById(I);if(!B){var B=document.createElement("div");B.id=I;B.style.position="absolute";var H=Position.cumulativeOffset(versionDiv);B.style.bottom="15px";B.style.left=H.left+"px";B.style.width="100%";B.style.height="150px";B.style.backgroundColor="#EE9";B.style.padding="10px";B.style.zIndex="10000";var C=document.createElement("div");C.innerHTML="Input a mercator coordinate in the format lon,lat (UTM)<br/>                 and then press ENTER <br/>                e.g. -6500145.5,-4110844.8";B.appendChild(C);var D=document.createElement("input");D.id="debug_input_coords";D.style.borderStyle="inset";D.style.borderWidth="1px";D.style.borderColor="red";D.style.width="95%";B.appendChild(D);var A=function(J){if(Event.KEY_RETURN==J.keyCode){var K=D.value.split(",",2);var M=parseFloat(K[0]);var L=parseFloat(K[1]);TomTom.MessageBus.publish("registermarker",{location:{latitude:L,longitude:M}})}};var E=function(J){TomTom.MessageBus.publish("clearmarkers",{layer:TomTom.Map.layers.marker})};var F=document.createElement("div");F.id="debug_clear_markers";F.style.width="95%";F.style.height="15px";F.style.borderStyle="outset";F.style.position="relative";F.style.top="10px";F.innerHTML="Clear pins";B.appendChild(F);document.body.appendChild(B);Event.observe("debug_input_coords","keypress",A);Event.observe("debug_clear_markers","click",E)}else{document.body.removeChild(B)}}}TomTom.CountryList=function(){var A=[["GBR"],["United Kingdom"],["UK"],["GB"],["USA"],["US"],["United States"],["United States Of America"]];return{isImperialCountry:function(C){if(C!=null){for(var B=0;B<A.length;B++){if(A[B][0].toLowerCase()==C.toLowerCase()){return true}}}return false}}}();TomTom.i18n=function(){var I,E=TomTom.MessageBus,D=TomTom.CookieManager,H=null,B=TomTom.Config.tomtomLocales,F,J=function(P,M){var L=P.split(".");var K=L[0];var N;if(L.length>1){N=L[1]}var O=null;O=$(K);if(O!=null){if(N=="content"){O.textContent=M;O.innerText=M}else{O.setAttribute(N,M)}}},C=function(){var K=$("global-nav").getElementsByTagName("a");for(var L=K.length-1;L>=0;L--){var M=K[L].href;if(!M.endsWith("?")){M+="?"}M=M.substring(0,M.indexOf("?"));M+="?Lid="+B[E.wbrpState.locale];K[L].href=M}},A=function(K){new Ajax.Request(TomTom.Config.staticDir+"/i18n/"+K,{method:"get",onSuccess:function(M){H=[];F=M.responseXML;try{if(!F.documentElement&&M.responseStream){F.load(M.responseStream)}}catch(L){F=new DOMParser().parseFromString(M.responseText,"text/xml")}if($("globalnav_services")){$("globalnav_services").style.display=(K=="tr")?"none":"block"}G()}})},G=function(){var M=F.getElementsByTagName("item");for(var N=0;N<M.length;N++){var P=M[N];var Q=P.getElementsByTagName("id")[0].firstChild.nodeValue;var O=P.getElementsByTagName("content")[0].firstChild.nodeValue;if(Q=="meta_description"){var K=document.getElementsByTagName("meta");var L=0;if(K){while(L<K.length&&K[L].name!="description"){L++}if(L<K.length){K[L].content=O}}}else{if(Q=="document_title"){if((window.location.href.indexOf("/map/")==-1)&&(window.location.href.indexOf("/route/")==-1)){document.title=O}}else{if(Q&&O){J(Q,O);H.push({id:Q,text:O})}}}}E.publish("i18nupdated",H)};I={initialize:function(){E.subscribe(["setlocale"],this)},notified:function(K,L){switch(K){case"setlocale":this.changeLanguage(L);C();break}},changeLanguage:function(K){D.set(D.wbrpLocaleCookie,K);A(K)},getDictionary:function(){return H}};return I}();TomTom.Locale=function(){var C=TomTom.MessageBus;var G=TomTom.CookieManager;var E=TomTom.Config;var B=[{id:"af",flag:"af",name:"Afrikaans",color:""},{id:"cs",flag:"cs",name:"&#268;e&#353;tina",color:""},{id:"da",flag:"da",name:"Dansk",color:""},{id:"de",flag:"de",name:"Deutsch",color:""},{id:"en",flag:"gb",name:"English",color:""},{id:"es",flag:"es",name:"Espa&ntilde;ol",color:""},{id:"fr",flag:"fr",name:"Fran&ccedil;ais",color:""},{id:"it",flag:"it",name:"Italiano",color:""},{id:"hu",flag:"hu",name:"Magyar",color:""},{id:"nl",flag:"nl",name:"Nederlands",color:""},{id:"no",flag:"no",name:"Norsk",color:""},{id:"pl",flag:"pl",name:"Polski",color:""},{id:"pt",flag:"pt",name:"Portugu&ecirc;s",color:""},{id:"fi",flag:"fi",name:"Suomi",color:""},{id:"sv",flag:"sv",name:"Svenska",color:""},{id:"tr",flag:"tr",name:"T&uuml;rk&ccedil;e",color:""}];var A=G.get(G.wbrpLocaleCookie);var F=function(){var I=TomTom.Config;var M=G.get(G.wbrpLocaleCookie);if(!M){var H=G.get(G.tomtomLocaleCookie);var L=Object.keys(I.tomtomLocales);for(var K=0;K<L.length;K++){var J=L[K];if(I.tomtomLocales[J]==H){M=J;if(M.length>2){M=M.substring(0,2)}}}}if(!M){M=D()}if(!M){M="en"}if(M.length>2){M=M.substr(0,2)}return M};var D=function(){var H="en";if(navigator.userLanguage){H=navigator.userLanguage.toLowerCase().substring(0,2)}else{if(navigator.language){H=navigator.language.toLowerCase().substring(0,2)}else{if(navigator.userAgent.indexOf("[")!=-1){var I=navigator.userAgent.indexOf("[");H=navigator.userAgent.substring(I+1,I+3).toLowerCase()}}}return H};return{initialize:function(){var H=location.search.toQueryParams().Lid;if(typeof H!="undefined"){A=E.tomtomLanguageId2SydneyLocale(H).substring(0,2)}if(!A){A=F()}dropbox=new TomTom.Dropbox("locale",function(){var I=[];for(var J=0;J<B.length;J++){if(E.localeValidated(B[J].id)){I.push(B[J])}}return(I)},this,false,150);E.localeValidated(A);C.publish("setlocale_dropbox",{id:E.localeValidated(A)?A:"en"})},notified:function(H,I){switch(H){case"setlocale_dropbox":C.publish("setlocale",dropbox.selectedId);break;default:break}}}}();TomTom.PlanRoute=function(){var AW,AY=TomTom.MessageBus,AU,G={DEPARTURE:0,VIA:1,DESTINATION:2},j=null,v=" \u00bb ",q={STANDARD:0,ALTERNATIVE:2,INCOMPLETE_ROUTE:3,ROUTE_PLANNED:4},X=q.STANDARD,Aa=null,R=null,Z=$("cancel_plan_route"),Q=null,AA=$("planRoute"),M=$("planroute_alt"),g=$("planroute_button"),AR=$("planrouteResultdestination"),AC=$("planrouteResultdeparture"),N=$("planrouteResult"),AE=$("planroute_container"),AL=$("planroute_alternatives_container"),E=$("plannedRouteControls"),AK=$("route_planner_errors"),AP=$("routeInstructions"),Ae=$("planrouteSummary"),AJ=$("show_route_summary"),Af=$("show_instructions"),p=$("clear_route_link"),AO=$("loadingRoute"),Aq=$("replanroute_button"),Al=$("standardRouteControls"),t=$("standard_tripAdvisor"),Ai=$("tripAdvisor"),A=$("departure_alt_label"),C=$("destination_alt_label"),a=null,AM=null,Aj=false,AZ=[{id:"planroute_noinput_error.content",evtid:"planroute_alt_input_noinput",text:""},{id:"departure_not_found.content",evtid:"departure_notfound",text:""},{id:"destination_not_found.content",evtid:"destination_notfound",text:""},{id:"alter_not_found.content",evtid:"planroute_alt_input_notfound",text:""},{id:"service_error_message.content",evtid:"service_error",text:""},{id:"route_destination_equals_origin.content",evtid:"dest_same_error",text:""},{id:"no_home_location_set.content",evtid:"no_home_set",text:""},{id:"no_cookie_support.content",evtid:"no_cookies",text:""},{id:"route_unable_to_find.content",evtid:"unable_plan_route",text:""},{id:"route_summary_leavefrom.content",evtid:"leavefrom",text:""},{id:"route_summary_arriveat.content",evtid:"arriveat",text:""},{id:"bad.input.coordinate.content",evtid:"bad_coord",text:""}],Ar=null,W=[TomTom.Validate.ruleEnum.NotEnoughChars,TomTom.Validate.ruleEnum.JustPunctuation],F=-1,n=false,Ac=false,P=false,Ap,Y,Ad=function(At,Ax,Aw){var As=new OpenLayers.Size(43,49);var Av=new OpenLayers.Pixel(-11,-42);var Au={url:TomTom.Config.staticDir+At,size:As,offset:Av,callback:Aw,id:Ax};if(Ax=="startIcon"||Ax=="finishIcon"){Au.alphaNeeded=true}else{Au.alphaNeeded=false}return Au},An=function(){Ap=new TomTom.RouteNode("departure",null,Aa,false,G.DEPARTURE,"departure_notfound",null,startIcon);Y=new TomTom.RouteNode("destination",null,R,false,G.DESTINATION,"destination_notfound",null,finishIcon)},f=function(){Aa.setValue("");R.setValue("")},Am=function(As){AY.publish("expandleftpanel");AA.className="routeActiveTab";$("findLocation").className="locationInactiveTab";$("location_content").hide();$("directions_content").show();AK.hide();switch(X){case q.STANDARD:case q.INCOMPLETE_ROUTE:case q.ROUTE_PLANNED:Aa.disabled=false;Aa.focus();break;case q.ALTERNATIVE:Q.focus();break}if(As!=true){AY.publish("tabchanged","planroute")}},u=function(){if(!g.visible()){g.show();Aq.hide()}V("standard_planroute_button_link","button",w.bind(this));V("reverse_route_link","button_disabled",function(){blur();return false})},w=function(){if(!TomTom.RouteResult){TomTom.LazyLoad.load("TomTom/RouteResult.js")}P=false;var Ax=AY.wbrpState;var As=TomTom.Validate;AY.publish("planrouteclick","standard");if(As.validateEmpty(Aa.getValue())&&As.validateEmpty(R.getValue())){z("planroute_alt_input_noinput");Ab();return false}var Aw=Aa.validate();if(!Aw.valid){z("departure_"+Aw.error);Ap.reset();return false}var Au=Aw.validatedLL;Aw=R.validate();if(!Aw.valid){z("destination_"+Aw.error);Y.reset();return false}var Av=Aw.validatedLL;var At=As.statusTypes;function Ay(A1,A0,Az){if(A1.status==At.IS_A_COORD||A1.status==At.IS_HOME){A1.location.poiCategory=-1;A0.location=A1.location;if(Az){if(A0.inputElement.getValue()==A0.searchString){A0.location.country=Az.country}}A0.searchString=A0.inputElement.getValue();AY.publish(A0.name+"Filled",A0.location);A0.isSet=true;if(A1.status==At.IS_HOME){AY.publish("clearhomemarker")}}}Ay(Au,Ap,Ax.departure);Ay(Av,Y,Ax.destination);if(Au.status==At.IS_A_COORD&&Av.status==At.IS_A_COORD){Ab();AW.plan();return false}if(Au.status==At.NOT_A_COORD&&Ap.toBeGeocodedStandard()){j=Ap;j.searchString=j.inputElement.getValue();Ao({mapName:AY.wbrpState.mapName})}else{if(Av.status==At.NOT_A_COORD&&Y.toBeGeocodedStandard()){AY.publish("departureFilled",Ap.location);j=Y;j.searchString=j.inputElement.getValue();Ao(AB())}else{if(Ap.isSet&&Y.isSet){AY.publish("departureFilled",Ap.location);AY.publish("destinationFilled",Y.location);if(n){n=false;Ab();AW.plan()}else{if(Aj||AM==null||Ax.tripAdvisorInfo.departureMoment=="now"||Av.status==At.IS_HOME||Au.status==At.IS_HOME){Ab();AW.plan();Aj=false}}return false}Ab();if(Ap.isSet){j=Ap;AS()}else{if(Y.isSet){j=Y;AS()}else{if(j!=null){j.reset()}}}}}return false},Ao=function(As){c();var At={location:j.searchString,module:"planRoute",nodeName:j.name};if(As){At.mapName=As.mapName}AU=new TomTom.GeocodeRequest(At);AY.publish("planroute");AY.publish("clearPoiIcons");return false},AV=function(As){clearTimeout(cancelTimeout);if(As.length==0){z(j.notFoundErrorId);return }As=TomTom.Validate.validateGeocodeResults(As);if(Ac){As=As.slice(0,1)}if(As.length==1){j.location=As.shift();j.isSet=true;if(j.type==G.DEPARTURE){j.location.type=G.DEPARTURE;AY.publish("departureFilled",j.location);if(Y.toBeGeocodedStandard()){j=Y;j.searchString=j.inputElement.getValue();Ao(AB())}else{if(Y.isSet==false){AS()}}}else{if(j.type==G.DESTINATION){j.location.type=G.DESTINATION;AY.publish("destinationFilled",j.location);if(Ap.isSet==false){AS()}}}AW.plan()}else{h();e();M.innerHTML=U(As)}},AB=function(){if(Ap&&Ap.location&&(Aa.getValue()!=R.getValue())){return{mapName:Ap.location.mapName}}return false},U=function(Au){a=Au;var Aw="<ul>";var Ay=null;var Az=TomTom.Config.staticDir+"/images/poiicons/leftpanel/";for(var At=0,As=Au.length;At<As&&At<5;At++){var Ax='<a href="#" class="altlist-link" id="alt_'+At+"\" onclick=\"TomTom.MessageBus.publish('alternativeSelected', "+At+');return false;">'+Au[At].formattedAddress+"</a>";Ay="<li>";Ay+='<div class="altlist-imgdiv">';if(Au[At].poiCategory==-1){Ay+='<img src="'+Az+'bullet.png" width="16" height="16"/>'}else{var Av=Az+"poi-"+Au[At].poiCategory+".png";if(isIE6){Ay+="<span style=\"width:16px; height:16px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Av+"', sizingMethod='crop');\"></span>"}else{Ay+='<img src="'+Av;Ay+='" onerror="this.src=\''+Az+"bullet.png';";Ay+='" width="16" height="16"/>'}}Ay+="</div>";Ay+='<div class="altlist-linkdiv">'+Ax+"</div>";Ay+="</li>";Aw+=Ay}Aw+="</ul>";return Aw},H=function(){var At=M.getElementsByTagName("a");for(var As=0;As<At.length;As++){At[As].className="disabled_link";At[As].onclick=null}},I=function(){var At=M.getElementsByTagName("a");for(var As=0;As<At.length;As++){At[As].className=null;At[As].onclick=new Function("TomTom.MessageBus.publish('alternativeSelected',"+As+");return false")}V("alt_planroute_button_link","button",Ah.bind(this))},L=function(As){H();j.location=a[As];j.searchString=j.location.formattedAddress;j.isSet=true;if(j.type==G.DEPARTURE){j.location.type=G.DEPARTURE;AY.publish("departureFilled",j.location);if(Y.toBeGeocodedStandard()){j=Y;j.searchString=j.inputElement.getValue();Ao(AB())}else{if(Y.isSet){AY.publish("destinationFilled",Y.location);AW.plan()}else{AS()}}Aa.setValue(Ap.location.formattedAddress)}else{if(j.type==G.DESTINATION){j.location.type=G.DESTINATION;AY.publish("destinationFilled",j.location);if((Ap.isSet)&&(Y.isSet)){AW.plan()}else{AS()}R.setValue(Y.location.formattedAddress)}}return false},Ah=function(){H();j.searchString=Q.getValue();j.inputElement.setValue(Q.getValue());Ao();return false},V=function(Au,At,As){TomTom.Utils.updateElement(Au,At,As)},AF=function(){Aa.blur();Aa.disable();R.disable()},h=function(){Aa.enable();R.enable();V("standard_planroute_button_link","button",w.bind(this))},AD=function(As){return TomTom.Utils.getText(AZ,As)},b=function(As){TomTom.Utils.updateTexts(AZ,As);if(AY.wbrpState.panelTab=="planroute"&&AK.visible()){AK.innerHTML=AD(Ar)}},z=function(As){AK.innerHTML=AD(As);D();Ar=As},c=function(){cancelTimeout=setTimeout(y.bind(this),2000);Ag();AF();AK.hide();Z.hide();AO.show();if(!n){Ab()}},y=function(){Z.show()},Ak=function(){if(AU!=null){AU.cancel(this)}},AT=function(){switch(X){case q.STANDARD:case q.INCOMPLETE_ROUTE:case q.ROUTE_PLANNED:h();O();break;case q.ALTERNATIVE:if((j.type==G.DESTINATION)&&(Ap.isSet==true)&&(Y.isSet==false)){j=Ap;AS()}else{e()}break;default:break}},O=function(){AX();Ag();AL.hide();AE.appendChild(AO);AO.hide();Aa.focus();X=q.STANDARD;t.show()},e=function(){AG();Ag();AL.appendChild(AO);AO.hide();AL.show();if(j.type==G.DEPARTURE){A.show();C.hide()}else{if(j.type==G.DESTINATION){A.hide();C.show()}}Q.setValue(j.searchString);I();Q.focus();X=q.ALTERNATIVE;t.hide()},D=function(){Ac=false;n=false;h();V("reverse_route_link","button_disabled",function(){blur();return false});V("clear_route_link","button_disabled",function(){blur();return false});$("route_planner_content").insertBefore(AK,$("location_content"));O();AK.style.display="block";I();AY.publish("settitle","");if($("maploading").visible()){AY.publish("mapstatechanged",true)}},Ag=function(){N.hide();$("routeTotals").hide();E.hide();AP.hide()},AG=function(){AE.hide();Al.hide();Ai.hide();t.hide()},AX=function(){AE.show();Al.show();t.appendChild(Ai);Ai.show();t.show()},AS=function(){h();if((j!=null)&&(j.location!=null)){var As=j.location;var At='<span class="name">'+As.formattedAddress+"</span>";if(j.type==G.DEPARTURE){AY.wbrpState.destination=null;var Au='<span id="route_summary_leavefrom">'+AD("leavefrom")+"</span> "+At;TomTom.RouteResult.updateSummary(AC,Au,"",-1,"instructicons/start.gif");AC.show();AR.hide();Ap.coord=As.coordinate;AY.publish("settitle",As.formattedAddress+v)}else{if(j.type==G.DESTINATION){AY.wbrpState.departure=null;var Au='<span id="route_summary_arriveat">'+AD("arriveat")+"</span> "+At;TomTom.RouteResult.updateSummary(AR,Au,"",1,"instructicons/finish.gif");AC.hide();AR.show();Y.coord=As.coordinate;AY.publish("settitle",v+As.formattedAddress)}}j.inputElement.setValue(As.formattedAddress);j.coord=As.coordinate;j.placeIcon();AY.publish("setcenter",new TomTom.Map.SetCenterData(As))}N.show();AL.hide();AO.hide();AE.appendChild(AO);$("routeTotals").hide();V("reverse_route_link","button_disabled",function(){blur();return false});V("clear_route_link","button_disabled",function(){blur();return false});AP.hide();Ae.show();E.hide();X=q.INCOMPLETE_ROUTE;AX();if(j){j.inputElement.focus()}},d=function(){AX();V("reverse_route_link","button",l.bind(this));V("clear_route_link","button",T.bind(this));if(AY.wbrpState.minimiseTrafficDelays()){g.hide();Aq.show()}Aa.focus();X=q.ROUTE_PLANNED},S=function(At){var As={};As.routeType="Quickest";As.start=At.sDeparture;As.end=At.sDestination;As.language=AY.wbrpState.locale;As.heedTraffic=At.minimiseDelays;As.includeTraffic=At.includeTraffic;As.daySelection=At.daySelection;As.timeSelection=At.timeSelection;As.iqFlag=At.iqRouteType;As.trafficModelId=F;As.geocodedLocations=[At.sDepartureLoc,At.sDestinationLoc];document.cookie="LBSID=;path=/;expires="+new Date(0).toGMTString()+";";AU=new TomTom.CalculateRouteRequest(As)},l=function(){$("reverse_route_link").blur();c();Ab();var Au=Ap.location;var At=Ap.searchString;Ap.location=Y.location;Ap.inputElement.setValue(Y.searchString);Ap.isSet=true;Y.location=Au;Y.inputElement.setValue(At);Y.isSet=true;Ap.location.type=G.DEPARTURE;AY.publish("departureFilled",Ap.location);Y.location.type=G.DESTINATION;AY.publish("destinationFilled",Y.location);var Aw=AY.wbrpState.tripAdvisorInfo;if(Aw.departureMoment=="other"){var As=new Object();As.departureMoment="other";var Av=AY.wbrpState.tripAdvisorSummary;As.departureDay=Av.arrivalDay;As.departureTime=Av.arrivalTime;AY.publish("restoretripadvisorstate",As)}AW.plan();Ap.searchString=Ap.inputElement.getValue();Y.searchString=Y.inputElement.getValue();AY.publish("routeReversedOk");Af.show();AJ.hide();AY.publish("sitestat","link.reverse");return false},T=function(){Ab();p.blur();Af.hide();AJ.hide();AP.hide();N.hide();u();V("clear_route_link","button_disabled",function(){blur();return false});Y.clear();Ap.clear();X=q.STANDARD;window.location.hash="/";TomTom.MessageBus.wbrpState.departure=null;TomTom.MessageBus.wbrpState.destination=null;TomTom.MessageBus.wbrpState.action=TomTom.MessageBus.wbrpState.ACTION_FINDLOCATION;AY.publish("sitestat","link.clear_route");return false},AI=function(As){return x(As,Ap.location,{type:"startmarker"},["starthere"])},k=function(As){return x(As,Y.location,{type:"finishmarker"},["finishhere"])},x=function(Au,At,Av,As){return TomTom.ContextMenu.locationInfoBalloon(At,At.formattedAddress,Au,Av,As)},AN=function(As){if(AY.wbrpState.panelTab==AY.wbrpState.TAB_PLANROUTE){Am()}if(AY.wbrpState.action=="planroute"){if(!As){Ac=true}AY.publish("expandleftpanel");f();Ap.isSet=false;Y.isSet=false;Am(true);O();AY.publish("clearlocationmarker");Ab();if(AY.wbrpState.departure){Ap.update(AY.wbrpState.departure);j=Ap;j.type=G.DEPARTURE}if(AY.wbrpState.destination){Y.update(AY.wbrpState.destination);j=Y;j.type=G.DESTINATION}w()}},K=function(Au){if(!TomTom.RouteResult){TomTom.LazyLoad.load("TomTom/RouteResult.js")}Ak();AY.publish("expandleftpanel");Ab();AY.publish("clearfindlocationpanel");AY.publish("clearlocationmarker");if(Au!=null){var Av=Au.target;if(Av=="departure"){j=Ap;if(Au.location.lat&&Au.source.type!="startmarker"){Ap.coord={mercY:Au.location.lat,mercX:Au.location.lon}}else{Ap.coord=Au.location.coordinate}if(Y.coord&&Au.source.type=="finishmarker"){Y.clear()}Ap.placeIcon();if(Y.isSet){Y.placeIcon()}}else{if(Av=="destination"){j=Y;if(Au.location.lat&&Au.source.type!="finishmarker"){Y.coord={mercY:Au.location.lat,mercX:Au.location.lon}}else{Y.coord=Au.location.coordinate}if(Ap.coord&&Au.source.type=="startmarker"){Ap.clear()}Y.placeIcon();if(Ap.isSet){Ap.placeIcon()}}}if(Au.location.rightClick){n=Au.location.rightClick}if(Au.source.type=="mapclick"&&AY.wbrpState.reverseGeocodeLocation){Au.location=AY.wbrpState.reverseGeocodeLocation;AY.wbrpState.reverseGeocodeLocation=null}j.location=Au.location;if(Au.titleId!=null){if($(Au.titleId).innerHTML!=Au.location.formattedAddress){Au.location.formattedAddress=$(Au.titleId).innerHTML}}var As=TomTom.Utils.LL_getLatLong(Au.location.formattedAddress);if(As==-1||As==0){var At;if(Au.location.lon){At=TomTom.Utils.inverseMercator(Au.location.lon,Au.location.lat)}else{At=TomTom.Utils.inverseMercator(Au.location.coordinate.mercX,Au.location.coordinate.mercY)}Au.location.formattedAddress+=" @"+TomTom.Utils.formatLonLat(At)}j.inputElement.setValue(unescape(Au.location.formattedAddress));j.searchString=unescape(Au.location.formattedAddress);j.isSet=true;if(Ap.isSet){AY.publish("departureFilled",Ap.location)}if(Y.isSet){AY.publish("destinationFilled",Y.location)}Am();if(((j==Y)&&(!Ap.isSet&&Ap.inputElement.getValue()!=""))||((j==Ap)&&(!Y.isSet&&Y.inputElement.getValue()!=""))){w()}else{AW.plan()}}},J=function(At){TomTom.RouteResult.show({route:At,request:AU,dep:Ap,des:Y});try{clearTimeout(cancelTimeout);h();if(At){AM=At;d()}else{O();z("unable_plan_route")}n=false;AY.publish("disablePanback");P=false;AY.publish("sitestat","plan_a_route.result")}catch(As){AH(As)}},AH=function(As){clearTimeout(cancelTimeout);h();O();if(As.errorResponse!=null&&As.errorResponse["@errorCode"]==406){z("unable_plan_route")}else{z("service_error")}AM=null},AQ=function(){clearTimeout(cancelTimeout);var As='<span id="service_error_message">'+AD("service_error")+"</span>";AK.innerHTML=As;if(j!=null){j.reset()}D()},Ab=function(){AM=null;if(TomTom.RouteResult){TomTom.RouteResult.clear()}},m=function(){P=true},B=function(){var As=AY.wbrpState.map.events;As.register("zoomend",this,function(){AY.publish("clearroutemarkers");if(Ap.isSet){Ap.placeIcon()}if(Y.isSet){Y.placeIcon()}})},AW={initialize:function(){var As=TomTom.Config;Aa=new TomTom.Inputbox("departure",{returnKey:w.bind(this),change:u.bind(this)},W);R=new TomTom.Inputbox("destination",{returnKey:w.bind(this),change:u.bind(this)},W);Q=new TomTom.Inputbox("planroute_alt_input",{returnKey:Ah.bind(this)},W);f();AA.onclick=Am.bind(this);$("standard_planroute_button_link").onclick=w.bind(this);$("standard_replan_button_link").onclick=function(){AY.wbrpState.action=AY.wbrpState.ACTION_PLANROUTE;AY.publish("planrouteclick","replan");AW.plan();AY.publish("sitestat","link.replan");return false}.bind(this);$("alt_planroute_button_link").onclick=Ah.bind(this);Z.onclick=function(){Ak();AT();j.reset();return false}.bind(this);Z.hide();$("reverse_route_link").onclick=function(){blur();return false};p.onclick=function(){blur();return false};AJ.hide();Aq.hide();Aa.setOnBlur(function(At){Ap.isSet=(Ap.inputElement.getValue()==Ap.searchString&&Ap.inputElement.getValue()!="")?true:false}.bind(this));R.setOnBlur(function(At){Y.isSet=(Y.inputElement.getValue()==Y.searchString&&Y.inputElement.getValue()!="")?true:false}.bind(this));startIcon=Ad("/images/routeplanner/icon_start.png","startIcon",AI);finishIcon=Ad("/images/routeplanner/icon_finish.png","finishIcon",k);An();TomTom.Utils.registerNativeContextMenu("departure");TomTom.Utils.registerNativeContextMenu("destination");B();if(AA.className=="routeActiveTab"){Aa.focus()}AY.subscribe(["clearroute","statechanged","tripadvisorrequestparamsprepared","geocodeOk","geocodeError","activeplanroute","alternativeSelected","findLocationPopUpLinkClicked","findlocation","i18nupdated","tripadvisorchanged","calculateRouteOk","calculateRouteError","trafficAgeReceived","routetrafficmodelexpired"],this)},getBookmark:function(){return Ac},setBookmark:function(As){Ac=As},getRightClick:function(){return n},setRightClick:function(As){n=As},getRouteTrafficModelExpired:function(){return P},getActiveNode:function(){return j},notified:function(As,Au){switch(As){case"activeplanroute":Am(Au);break;case"geocodeOk":if(Au.module=="planRoute"){AV(Au)}break;case"geocodeError":if(Au.module=="planRoute"){AQ()}break;case"alternativeSelected":if(AA.className=="routeActiveTab"){L(Au)}break;case"findLocationPopUpLinkClicked":K(Au);break;case"statechanged":AN(Au);break;case"clearroute":Ab();break;case"calculateRouteOk":if(!TomTom.RouteResult){var At=new PeriodicalExecuter(function(Av){if(false){Av.stop();J(Au)}},0.1);setTimeout(function(){At.stop();if(!TomTom.RouteResult){AH({category:"service_error"})}},TomTom.Config.ajaxTimeout)}else{J(Au)}break;case"calculateRouteError":AH(Au);AY.publish("sitestat","plan_a_route.result_error");break;case"tripadvisorrequestparamsprepared":S(Au);break;case"i18nupdated":b(Au);break;case"tripadvisorchanged":Aj=true;V("reverse_route_link","button_disabled",function(){blur();return false});u();break;case"trafficAgeReceived":F=Au.trafficModelId;break;case"routetrafficmodelexpired":m();break;default:break}},plan:function(){var Av=AY.wbrpState;TomTom.AnimatedZoomPan.clearCloneLayer();AY.publish("requesttripadvisorstate");if((Ap.isSet==false)||(Y.isSet==false)){return false}else{cancelTimeout=setTimeout(y.bind(this),2000);var As=Ap.location.coordinate.mercX+","+Ap.location.coordinate.mercY;var At=Y.location.coordinate.mercX+","+Y.location.coordinate.mercY;if(As==At){z("dest_same_error");return }c();var Au={};Au.sDeparture=As;Au.sDestination=At;Au.sDepartureLoc=Ap.location;Au.sDestinationLoc=Y.location;Au.locale=AY.wbrpState.locale;AY.publish("tripadvisorrequest",Au)}}};return AW}();TomTom.RouteNode=Class.create();TomTom.RouteNode.prototype={searchString:null,inputElement:null,isSet:false,type:null,notFoundErrorId:null,location:null,icon:null,coord:null,initialize:function(C,B,H,F,E,G,A,D){this.name=C;this.searchString=B;this.inputElement=H;this.isSet=F;this.type=E;this.notFoundErrorId=G;this.location=A;this.icon=D},toBeGeocodedStandard:function(){if(this.inputElement.getValue()!=""&&this.inputElement.getValue()!=null){if(this.inputElement.getValue().toLowerCase()=="home"){return false}if(this.inputElement.getValue()!=this.searchString||!this.location||!this.location.coordinate){this.isSet=false;this.searchString=this.inputElement.getValue();this.isBeingSet=true;this.location=null;return true}else{return false}}else{if(this.name=="departure"){TomTom.MessageBus.publish("departureFilled",null)}return false}},placeIcon:function(){var B=TomTom.MessageBus,C=this.icon,F=this.coord?this.coord:this.location.coordinate,E=C.callback,A=Object.clone(C);if(TomTom.CookieManager.hasHomeSet()){var D=TomTom.CookieManager.getField("WBRPPrefs","tt_home").evalJSON();if((parseFloat(F.mercX)==parseFloat(D.coordinate.mercX))&&(parseFloat(F.mercY)==parseFloat(D.coordinate.mercY))){B.publish("clearhomemarker")}}B.publish("registermarker",{id:C.id,location:{latitude:F.mercY,longitude:F.mercX},icon:A,name:"route",callback:C.callback})},reset:function(){this.location=null;this.isSet=false;this.searchString=""},clear:function(){this.reset();this.inputElement.setValue("");this.coord=null},update:function(A){this.location=A;this.inputElement.setValue(this.location.formattedAddress);if(this.location.coordinate){this.searchString=this.location.formattedAddress}this.isSet=true}};TomTom.RouteLayer=OpenLayers.Class(OpenLayers.Layer.WMS,{initialize:function(C,B,D,A){this.tilesBounds=A.tilesBounds;OpenLayers.Layer.WMS.prototype.initialize.apply(this,arguments)},getURL:function(A){A=this.adjustBounds(A);if(!A.intersectsBounds(this.tilesBounds)){return TomTom.Config.pathToEmptyTile}var B=this.getImageSize();return this.getFullRequestString({BBOX:this.encodeBBOX?A.toBBOX():A.toArray(),WIDTH:B.w,HEIGHT:B.h})}});TomTom.RouteResult=function(){var N,S=TomTom.MessageBus,z=TomTom.Config,K=" \u00bb ",B=[{id:"route_trafficdelay.content",evtid:"trafficdelay",text:""},{id:"time.type",evtid:"time",text:""}],G='<tr><td colspan="3"><div class="distsep" style="display:#{showdist}"><span>#{dist}</span></div></td></tr><tr id="instructionRow#{index}" ><td width="28px"><img src="'+z.staticDir+'/images/#{icon}?bid=58521)" style="padding-right:5px;display:#{imageDisplay}"/></td><td class="instructionText" ><a href="#" id="instruction_#{index}" class="rii" style="padding:0px"><span class="time">#{time}</span><span class="text">#{text}</span><span class="sign" style="display:#{showsign}">#{sign}</span><span style="display:#{showsign}">&nbsp;</span><span class="name">#{name}</span></a></td><td id="arrow#{index}" align="right" class="instructionArrow" ></td></tr>',AA=new Template(G),A='<span id="totalDistanceUnits" class="text" style="text-decoration = underline">{units}</span>',R='<span id="totalDistanceMagnitude" class="text">{distance}</span>',h={unitsHTML:A,distanceHTML:R},AJ=$("planrouteResultdestination"),AI=$("planrouteResultdeparture"),V=$("routeInstructions"),Z=$("show_route_summary"),E=$("show_instructions"),L=$("planrouteResult"),u=$("planrouteSummary"),x=$("plannedRouteControls"),AC=$("loadingRoute"),J=$("planroute_container"),AD=$("planroute_alternatives_container"),j,W,d,c,n,v,w=[],AH,U=false,Y=function(){var AP=S.wbrpState,AT=AP.tripAdvisorSummary,AW=AE(0,j),AU=c.departureOverviewMessage.replace("{0}",AW);N.updateSummary(AI,AU,AT.departureTime,-1,"instructicons/start.gif");var AX='<span id="totalDistance">'+TomTom.FormatHelper.formatDistance(c.totalDistance,v,h)+'</span> - <span class="text">'+TomTom.FormatHelper.formatTimeAmount(Math.floor(c.totalTime/60))+"</span>",AY=null,AV=null;if(n.requestParams.includeTraffic){AX+='<div id="trafficdelay" class="text">'+C("trafficdelay")+" "+TomTom.FormatHelper.formatTrafficDelay(c.totalDelay)+"</div>";AY="9px";AV="instructicons/delay_icon.png"}var AQ=-99;$("routeTotals").innerHTML='<table class="instructionTable">'+AB(AX,AQ,"",AY,null,AV)+"</table>";var AR=$("instructionRow"+AQ);w.push(Event.observe(AR,"click",D.bindAsEventListener(N,AQ)));w.push(Event.observe(AR,"mouseover",X.bindAsEventListener(N,AQ)));w.push(Event.observe(AR,"mouseout",q.bindAsEventListener(N,AQ)));var AO=AE(c.instructions.length-1,W),AS=c.arrivalOverviewMessage.replace("{0}",AO);N.updateSummary(AJ,AS,AT.arrivalTime,-(c.instructions.length),"instructicons/finish.gif")},AE=function(AP,AQ){var AO="";if(c&&c.instructions[AP].roadName){if(AQ.location.houseNumber!=null){AO=AQ.location.houseNumber+" "}AO+=c.instructions[AP].roadName}else{AO=AQ.location.formattedAddress}return'<span class="name">'+AO+"</span>"},AB=function(AW,AT,AR,AZ,AY,AV,AQ,AX,AO,AU,AS){var AP="inline";if(!AV){AV="";AP="none"}if(!AQ){AQ=""}if(!AX){AX="none"}if(!AO){AO=""}if(!AU){AU=0}if(!AS){AS="none"}if(!AZ){AZ="undefined"}return AA.evaluate({icon:AV,text:AW+" ",sign:AQ,showsign:AX,name:AO,dist:AU,showdist:AS,index:AT,time:AR,bottompadding:AZ,imageDisplay:AP})},t=function(AO){var AP=$("instruction_"+AO);w.push(Event.observe(AP,"click",AL.bindAsEventListener(N,AO)));w.push(Event.observe(AP,"mouseover",a.bindAsEventListener(N,AO)));w.push(Event.observe(AP,"mouseout",AK.bindAsEventListener(N,AO)))},AL=function(AU,AR){TomTom.AnimatedZoomPan.clearCloneLayer();S.publish("clearlocationmarker");var AT=false,AQ=true;if(AR==-99){if(c){S.publish("zoomtoextend",c.bounds);u.focus();u.blur()}return false}if(AR<0){AR=-AR;AR--;AT=true;u.focus();u.blur()}var AS={};if(!c){var AP=TomTom.PlanRoute.getActiveNode().location.coordinate;AS.longitude=AP.mercX;AS.latitude=AP.mercY;AQ=false}else{var AO=c.instructions[AR];AS=T(AO);AS.longitude=AO.coordinate.mercX;AS.latitude=AO.coordinate.mercY;AQ=(AR==0||AR==c.instructions.length-1)?false:true}var AW={index:AR,coordinate:{mercY:AS.latitude,mercX:AS.longitude},zoom:14};if(!AT&&AQ){var AV=function(AX){return TomTom.ContextMenu.locationInfoBalloon(this,formattedAddress,AX,{type:"instructionmarkerclick"})}.bind(AS);Object.extend(AW,{registermarker:{name:"location",location:AS,callback:AV}})}S.publish("instructionclicked",AW);return false},AK=function(AO,AP){$("arrow"+AP).style.backgroundPosition="0px 50%";Element.removeClassName($("instructionRow"+AP),"instructionRow")},a=function(AO,AP){$("arrow"+AP).style.backgroundPosition="-10px 50%";Element.addClassName($("instructionRow"+AP),"instructionRow")},y=function(){w.each(function(AO){AO.stopObserving()});w=[]},D=function(AO,AP){var AQ=AO.findElement();if(AQ.id=="totalDistanceUnits"){AF()}else{AL(AO,AP)}},X=function(AO,AP){var AQ=AO.findElement();if(AQ.id=="totalDistanceUnits"){AQ.addClassName("highlightedUnits")}else{a(AO,AP)}},q=function(AO,AP){var AQ=AO.findElement();if(AQ.id=="totalDistanceUnits"){AQ.removeClassName("highlightedUnits")}else{AK(AO,AP)}},AF=function(){if(c){var AP=c.instructions;var AR=V.select('[class="distsep"] span');v=(v+1)%2;var AQ=v;var AT=0;for(var AS=0,AO=AP.length;AS<AO;AS++){var AU=AP[AS].distance;AR[AS].innerHTML=TomTom.FormatHelper.formatDistance(AU-AT,AQ);AT=AU}$("totalDistanceUnits").remove();$("totalDistance").innerHTML=TomTom.FormatHelper.formatDistance(c.totalDistance,AQ,h);S.wbrpState.setPreferredUnits(AQ)}},I=function(){var AP=[];var AU,AQ=0;for(var AS=0;AS<c.instructions.length;AS++){var AO=c.instructions[AS];var AR=AO.text;var AT=AO.roadName;if(AS==0){AR=AE(AS,j);AR=c.departureOverviewMessage.replace("{0}",AR);AT="";AO.iconPath="start.gif"}else{if(AS==c.instructions.length-1){AR=AE(AS,W);AR=c.arrivalOverviewMessage.replace("{0}",AR);AT="";AO.iconPath="finish.gif"}}AQ=AO.distance-AU;AP.push(AB(AR,AS,"",null,null,"instructicons/"+AO.iconPath,AO.roadNumber,AO.roadNumber?"inline":"none",AT,TomTom.FormatHelper.formatDistance(AQ,v),(AQ>0)?"block":"none"));AU=AO.distance}V.innerHTML='<table class="instructionTable">'+AP.join("")+"</table>";for(var AS=0;AS<AP.length;AS++){t(AS)}AH=false},p=function(AO){S.publish("instructionrightclick",AO)},AM=function(AQ){var AR=new OpenLayers.Pixel(Event.pointerX(AQ),Event.pointerY(AQ));var AO=F(AQ,c.instructions);if(AO){var AP=T(AO.contents);var AS=TomTom.ContextMenu.locationInfoBalloon(AP,AP.formattedAddress,AR,{type:"instructionclick",index:AO.index});AS.id="instruction"+AO.index;S.publish("popup",AS)}},F=function(AS,AP){var AQ=$(Event.element(AS));if(!$(Event.element(AS)).hasClassName("rii")){AQ=AQ.up(".rii")}if(AQ){var AT=AQ.id;var AR=parseInt(AT.substr(AT.indexOf("_")+1));var AO=AP[AR];return{index:AR,contents:AO}}else{return false}},T=function(AO){var AP=new OpenLayers.LonLat(AO.coordinate.mercX,AO.coordinate.mercY);AP.coordinate=AO.coordinate;AP.formattedAddress=AO.roadName;AP.rightClick=true;return AP},b=function(){V.immediateDescendants().each(function(AO){AO.remove()});y();I()},Q=function(){V.toggle();E.toggle();Z.toggle();u.toggle();TomTom.Leftpanel.setBannerAdVisibility();return false},AG=function(){return C("time")},C=function(AO){return TomTom.Utils.getText(B,AO)},k=function(AO){TomTom.Utils.updateTexts(B,AO)},O=function(){S.publish("afterplanroute",c);f();var AR=c.bounds,AO;e();if(TomTom.PlanRoute.getRightClick()||TomTom.PlanRoute.getRouteTrafficModelExpired()){TomTom.PlanRoute.setRightClick(false)}else{if(TomTom.PlanRoute.getBookmark()){TomTom.PlanRoute.setBookmark(false);AO=S.wbrpState.center;var AQ=S.wbrpState.zoom;if(AQ){if(AO){var AP=OpenLayers.LonLat.fromString(AO)}else{var AP=AR.getCenterLonLat()}var AS={mercX:AP.lon,mercY:AP.lat};S.publish("setcenter",TomTom.Map.SetCenterData.fromCoordinate(AS,AQ,{forceZoom:true}))}else{if(AO){var AP=OpenLayers.LonLat.fromString(AO);var AS={mercX:AP.lon,mercY:AP.lat};S.publish("setcenter",TomTom.Map.SetCenterData.fromCoordinate(AS,null))}else{S.publish("zoomtoextend",AR)}}}else{S.publish("zoomtoextend",AR)}}S.publish("clearroutemarkers");j.coord=c.instructions.first().coordinate;j.placeIcon();W.coord=c.instructions.last().coordinate;W.placeIcon()},g=function(){var AO=c.areaTopLeft,AP=c.areaBottomRight;AO.mercX-=(AP.mercX-AO.mercX)/2;AO.mercY-=(AP.mercY-AO.mercY)/10;AP.mercY+=(AP.mercY-AO.mercY)/10;var AQ=new OpenLayers.Bounds(AO.mercX,AP.mercY,AP.mercX,AO.mercY);c.bounds=AQ.clone()},e=function(){if(!d){var AS={layers:"canvas",REQUEST:"GetMap",FORMAT:(Prototype.Browser.IE)?"image/gif":"image/png",apikey:z.apikey,ROUTEKEY:c.routeKey,instructionid:0},AV=c.areaTopLeft,AR=c.areaBottomRight,AQ=Math.min(AV.mercX,AR.mercX),AW=Math.max(AV.mercX,AR.mercX),AP=Math.min(AV.mercY,AR.mercY),AU=Math.max(AV.mercY,AR.mercY),AO={transparent:true,isBaseLayer:false,buffer:parseInt(z.mapTileBuffer),tilesBounds:new OpenLayers.Bounds(AQ,AP,AW,AU)};if(z.UntiledRouteLayer=="true"){d=new OpenLayers.Layer.WMS.Untiled("canvas",z.Layers.getCanvas(),AS,AO)}else{d=new TomTom.RouteLayer("canvas",z.Layers.getCanvas(),AS,AO)}d.url=z.Layers.getCanvas();var AT=TomTom.Map.getLayers().traffictiles?2:1;S.publish("setlayer",{name:"canvas",layer:d,index:AT});d.setOpacity("0.6")}},m=function(){var AO=l();S.publish("settitle",AO);S.publish("routeplanned",{title:AO})},l=function(){return j.location.formattedAddress+K+W.location.formattedAddress},H=function(){if(c){if(S.wbrpState.map.calculateBounds().intersectsBounds(c.bounds)){M()}else{if(d){S.publish("removelayer","canvas");d=null}}}else{if(TomTom.PlanRoute.getRouteTrafficModelExpired()){TomTom.PlanRoute.plan()}}},M=function(){if(!d){e()}},AN=function(){AC.hide();AD.hide();J.appendChild(AC);E.show();Z.hide();u.show();V.hide();$("routeTotals").show();L.show();$("planrouteResultdeparture").show();AJ.show();x.show();TomTom.Leftpanel.setBannerAdVisibility()},f=function(){var AO=TomTom.Map.getLayers().marker;S.publish("clearmarkers",{name:"startIcon",layer:AO});S.publish("clearmarkers",{name:"finishIcon",layer:AO})},P=function(){if(TomTom.PlanRoute.getRouteTrafficModelExpired()&&S.wbrpState.tripAdvisorInfo.includeTraffic){N.clear()}};N={initialize:function(){S.subscribe(["i18nupdated","mapchanged","setlocale","instructionrightclick","panmapstart","movemapstart"],this);TomTom.Utils.observeRightClick(V,p);Event.observe($("show_instructions_link"),"click",function(){Q();if(AH==false){S.publish("sitestat","plan_a_route.directions");AH=true}return false});Event.observe($("show_route_summary_link"),"click",function(){Q();return false})},show:function(AO){c=AO.route;n=AO.request;v=S.wbrpState.getPreferredUnits(AO.request.requestParams.geocodedLocations[0].country);j=AO.dep;W=AO.des;g();b();Y();m();AN();if(U==false){if(!TomTom.PlanRoute.getRouteTrafficModelExpired()){S.publish("clearlocationmarker")}O()}U=false},updateSummary:function(AP,AS,AR,AO,AQ){if(AR!=""){AR=TomTom.FormatHelper.formatTimeString(AR,AG())}AP.innerHTML='<table class="instructionTable">'+AB(AS,AO,AR,null,null,AQ)+"</table>";t(AO)},clear:function(){if(!U){c=null;f();S.publish("removelayer","canvas");d=null;$("leftPanelBannerAdManagerInResult").hide();$("leftPanelBannerAdManagerInPlanroute").show()}},notified:function(AO,AP){switch(AO){case"i18nupdated":k(AP);break;case"mapchanged":H();break;case"instructionrightclick":AM(AP);break;case"setlocale":if(c!=null){U=true;TomTom.PlanRoute.plan()}break;case"panmapstart":case"movemapstart":P();break}}};return N}();TomTom.FindLocation=function(){var P,S=TomTom.MessageBus,M={},b=null,U=$("cancel_find_location"),X=null,AA=false,AE={STANDARD:0,ALTERNATIVE:2,LOCATION_SELECTED:3},h=AE.STANDARD,B=null,A=[{id:"findlocation_noinput_error.content",evtid:"noinput",text:""},{id:"bad.input.coordinate.content",evtid:"bad_coord",text:""},{id:"no_home_location_set.content",evtid:"no_home_set",text:""},{id:"wronginput_error.content",evtid:"notfound",text:""},{id:"service_error_message.content",evtid:"service_error",text:""}],N=[TomTom.Validate.ruleEnum.NoInput,TomTom.Validate.ruleEnum.NotEnoughChars,TomTom.Validate.ruleEnum.JustPunctuation],y=TomTom.Config.staticDir,w=y+"/images/marker_small.png",R=y+"/images/homepin_small.png",z=y+"/images/poiicons/leftpanel/",H=false,AG=false,G=$("findLocationResult"),t=$("findLocationResult_street"),f=$("planRoute"),v=$("location_content"),p=$("directions_content"),Y=$("route_planner_errors"),AD=$("standard_find_button_link"),AJ=$("findLocationResultImg"),m=$("location_container"),I=$("location_controls"),c=$("location_loading"),L=$("location_alternatives_container"),a=$("location"),n=$("findLocationResultDiv"),T=$("route_planner_content"),K=$("ie6markerspan"),q=function(AN,AM,AL){TomTom.Utils.updateElement(AN,AM,AL)},W=function(){b.disable();q("standard_find_button_link","button_disabled")},AH=function(){b.enable();q("standard_find_button_link","button",d)},u=function(AQ){var AP=S.wbrpState;if(AP.panelTab==AP.TAB_FINDLOCATION){l()}if(AP.action==AP.ACTION_FINDLOCATION||AP.action==AP.ACTION_FINDFRIEND){if(!AQ){H=!AP.panbackjustclicked}if(AP.action==AP.ACTION_FINDLOCATION){var AL=AP.foundLocation;S.publish("expandleftpanel");M.formattedAddress=AL.formattedAddress;M.poiCategory=AL.poiCategory;b.setValue(!AP.panbackjustclicked?AL.formattedAddress:b.getValue());var AO=AP.getViewport();if(AO&&AQ!==null){var AM=F();var AN=AM==null?true:((AO.zoom!=AP.map.getZoomForExtent(AM))?true:false);S.publish("setcenter",new TomTom.Map.SetCenterData(AO,AO.zoom,{forceCenter:true,forceZoom:AN}));M.coordinate=AL.coordinate?AL.coordinate:AO.coordinate;if(AQ){t.innerHTML=AQ.formattedAddress?AQ.formattedAddress:"";$("location_alt").innerHTML=AQ.altResults?AC(AQ.altResults):"";S.publish("settitle",AQ.docTitle)}else{S.publish("findlocationgeocode",{location:AL,altResults:!AP.panbackjustclicked?null:X})}if(AP.findlocationPin){if(M.poiCategory==-1){AK(false)}else{S.publish("placePoiIcon",M)}}}else{d()}}}},l=function(){S.publish("clearpopup");f.className="routeInactiveTab";P.FINDLOCATION.className="locationActiveTab";v.show();p.hide();Y.hide();S.publish("expandleftpanel");b.focus();S.publish("tabchanged","findlocation");if(AG==false){S.publish("sitestat",S.wbrpState.parseLocale()+".find_a_location.index");AG=true}},d=function(){b.blur();AB();var AN=b.validate();if(AN.valid==false){x(AN.error)}else{var AM=AN.validatedLL;var AL=TomTom.Validate.statusTypes;if(AM.status==AL.IS_A_COORD||AM.status==AL.IS_HOME){if(AM.status==AL.IS_HOME){AA=true}AM.location.poiCategory=-1;k([AM.location])}else{currentRequest=new TomTom.GeocodeRequest({mapName:S.wbrpState.mapName,location:b.getValue(),module:"findLocation",nodeName:"location"})}}return false},k=function(AM){clearTimeout(cancelTimeout);S.publish("clearlocationmarker");S.publish("clearPoiIcons");if(AM.length==0){x("notfound");return }AH();AM=TomTom.Validate.validateGeocodeResults(AM);M=AM.shift();if(AM.length==0){C()}else{E();$("location_alt").innerHTML=AC(AM)}if(H){H=false;var AL=null;var AN=S.wbrpState.zoom;if(AN){S.publish("setcenter",new TomTom.Map.SetCenterData(M,AN))}else{if(!AN){if(M.height&&M.width){S.publish("zoomtoextend",F())}else{S.publish("setcenter",new TomTom.Map.SetCenterData(M))}}}}else{if(M.height&&M.width){S.publish("zoomtoextend",F())}else{S.publish("setcenter",new TomTom.Map.SetCenterData(M))}}M.isHome=AA;S.publish("findlocationgeocode",{location:M,altResults:X});if(AA){S.publish("goHome");AA=false;return }if(M.poiCategory==-1){AK(false)}else{S.publish("placePoiIcon",M)}S.publish("disablePanback");TomTom.Leftpanel.setBannerAdVisibility()},AK=function(AL){S.publish("clearPoiIcons");S.publish("registermarker",{location:{latitude:M.coordinate.mercY,longitude:M.coordinate.mercX},name:"location",callback:j.bind(this),contextMenu:AL})},J=function(){currentRequest.cancel(this);switch(h){case AE.STANDARD:case AE.ALTERNATIVE:AH();O();break;default:break}},F=function(){if(M.coordinate&&M.width&&M.height){var AR=M.coordinate.mercX;var AQ=M.coordinate.mercY;var AP=AR-M.width/2;var AO=AQ-M.height/2;var AM=AR+M.width/2;var AL=AQ+M.height/2;var AN=new OpenLayers.Bounds(AP,AO,AM,AL);return AN}else{return null}},x=function(AL){Y.innerHTML=D(AL);V();B=AL},D=function(AL){return TomTom.Utils.getText(A,AL)},g=function(AL){TomTom.Utils.updateTexts(A,AL);if(S.wbrpState.panelTab=="findlocation"&&Y.visible()){Y.innerHTML=D(B)}},j=function(AL){return TomTom.ContextMenu.locationInfoBalloon(M,M.formattedAddress,AL,{type:"findlocation"})},AC=function(AN){X=AN;var AP="<ul>";var AR=null;var AS=z;for(var AM=0,AL=AN.length;AM<AL&&AM<5;AM++){var AQ='<a class="altlist-link" id="alt_'+AM+'" href="#" onclick="TomTom.MessageBus.publish(\'alternativeSelected\', '+AM+');return false;">'+AN[AM].formattedAddress+"</a>";AR="<li>";AR+='<div class="altlist-imgdiv">';if(AN[AM].poiCategory==-1){AR+='<img src="'+AS+'bullet.png" width="16" height="16"/>'}else{var AO=AS+"poi-"+AN[AM].poiCategory+".png";if(isIE6){AR+="<span style=\"width:16px; height:16px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+AO+"', sizingMethod='crop');\"></span>"}else{AR+='<img src="'+AO;AR+='" onerror="this.src=\''+AS+"bullet.png';";AR+='" width="16" height="16"/>'}}AR+="</div>";AR+='<div class="altlist-linkdiv">'+AQ+"</div>";AR+="</li>";AP+=AR}AP+="</ul>";return AP},Z=function(){var AL=S.wbrpState.map.events;AL.register("zoomend",this,function(){if($("findLocationIcon")){S.publish("clearlocationmarker");AK(false)}})},AF=function(AL){M=X[AL];b.setValue(M.formattedAddress);S.publish("findlocationgeocode",{location:M,altResults:null});if(M.height&&M.width){S.publish("zoomtoextend",F())}else{S.publish("setcenter",new TomTom.Map.SetCenterData(M))}S.publish("clearlocationmarker");if(M.poiCategory==-1){AK(false)}else{S.publish("placePoiIcon",M)}C()},AI=function(){K.style.display="none";t.innerHTML=M.formattedAddress;if(AA){AJ.src=R;AJ.className="homeMarkerImageSmall";t.style.bottom="10px";AJ.style.display=""}else{if(M.poiCategory==-1){e()}else{var AL=z+"poi-"+M.poiCategory+".png";if(isIE6){K.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+AL+"', sizingMethod='crop')";K.style.display="inline-block";AJ.style.display="none";t.style.bottom="0px"}else{AJ.src=AL;AJ.className="poiMarkerImageSmall";t.style.bottom="4px"}}}n.show();G.show()},e=function(){AJ.src=w;AJ.className="markerImageSmall";t.style.bottom="10px";AJ.style.display=""},O=function(AM,AL){if(AL==null||AL){Y.hide()}m.show();I.show();c.hide();U.hide();n.hide();L.hide();if(AM!="load"){b.focus()}h=AE.STANDARD;TomTom.Leftpanel.setBannerAdVisibility();return false},AB=function(){cancelTimeout=setTimeout(Q,2000);W();Y.hide();c.show();G.hide();L.hide();S.publish("findlocation")},Q=function(){U.show()},E=function(){C();L.show();h=AE.ALTERNATIVE},C=function(){AI();O();n.show();h=AE.LOCATION_SELECTED},V=function(){clearTimeout(cancelTimeout);AH();T.insertBefore(Y,v);O();Y.style.display="block"};P={FINDLOCATION:$("findLocation"),initialize:function(){Event.observe(this.FINDLOCATION,"click",l);b=new TomTom.Inputbox("location",{returnKey:d},N),AD.onclick=function(){H=false;d()};U.onclick=function(){J();return false};U.hide();b.setValue("");TomTom.Utils.registerNativeContextMenu("location");S.subscribe(["activefindlocation","instructionclicked","alternativeSelected","i18nupdated","statechanged","planroute","clearfindlocationpanel","geocodeOk","geocodeError"],this);Z();Event.observe(AJ,"error",e)},notified:function(AL,AN){switch(AL){case"activefindlocation":l();break;case"geocodeOk":if(AN.module=="findLocation"){k(AN);S.publish("sitestat","find_a_location.result")}break;case"geocodeError":if(AN.module=="findLocation"){var AM='<span id="service_error_message">'+D("service_error")+"</span>";Y.innerHTML=AM;V();S.publish("sitestat","find_a_location.result_error")}break;case"alternativeSelected":if(this.FINDLOCATION.className=="locationActiveTab"){AF(AN)}break;case"i18nupdated":g(AN);break;case"statechanged":b.blur();u(AN);break;case"planroute":O("load",false);S.publish("clearlocationmarker");break;case"clearfindlocationpanel":O("load");break;case"instructionclicked":if(AN.registermarker){M=AN.registermarker.location}break}}};return P}();TomTom.Effects=function(){var E=0;var D=null;var B=null;var A=function(I,H,K,J){if(!J){J=0.75}var G=H?Math.ceil(H*(1-J)):Math.floor(parseInt(Element.getStyle(I,"height"))*J);if(G>=0){I.style.height=G+"px"}else{I.style.height="0px"}J-=J/2;if((H&&G<H)||(!H&&Math.floor(G)>0)){setTimeout(function(){A(I,H,K,J)}.bind(this),1)}else{if(K){K();TomTom.MessageBus.publish("slidedone")}}};var C=function(J){if(J.id==B){F()}else{if(B!==null){F()}B=J.id;var I=J.delay;var K=J.text;var G=J.position;var H=J.bgImg;if(E&&D==K){window.clearTimeout(E)}D=K;popupType=J.type;E=setTimeout(function(){if(H){Tip(K,BGIMG,H,BGPOSITION,"bottom center",BORDERWIDTH,0,BGCOLOR,"transparent",STICKY,true,FIX,[G.x,G.y],DELAY,0,FADEIN,150,FADEOUT,100)}else{Tip(K,FIX,[G.x,G.y],BGCOLOR,"#FFFFFF",BORDERCOLOR,"#009ed9",FONTCOLOR,"#009ed9",DELAY,0,DURATION,2000,OPACITY,85,FADEIN,150,FADEOUT,100)}},I);if(J.callback){setTimeout(function(){J.callback(J.id)},250)}}};var F=function(){if(E){window.clearTimeout(E);E=null}B=null;tt_HideInit()};return{initialize:function(){TomTom.MessageBus.subscribe(["popup","clearpopup","slide"],this)},notified:function(G,H){switch(G){case"popup":C(H);break;case"clearpopup":F();break;case"slide":A(H.element,H.height,H.callback);break;default:break}}}}();TomTom.Map=function(){var N=TomTom.MessageBus,Z=null,l=[],g,AA,h=new Array(),e=$("map"),F=$("map_canvas"),X=$("toolbar"),Q=$("header"),O=$("footer"),c=null,w=null,W=0,b=0,t={left:380,top:82,right:49,bottom:124},f="2",V=null,D=function(){["lt","rt","lb","rb"].each(function(AD){var AE=document.createElement("div");AE.className="inset_"+AD;e.appendChild(AE)});var AC=TomTom.Config.getViewportMaxDimensions();if(AC.length==2){c=AC[0];w=AC[1]}var AB=TomTom.Config.getBodyMinDimensions();if(AB.length==2){W=AB[0];bodyMinHeight=AB[1]}J(false)},v=function(){var AD=document.viewport.getDimensions();var AF=8;var AG=0;var AC=0;var AB=0;if(Q&&Q.getStyle("display")=="block"){AC=Q.getHeight()}if(X&&X.getStyle("display")=="block"){AG=X.getHeight()}if(O&&O.getStyle("display")=="block"){AB=isIE6?0:O.getHeight()}var AE=(AD.height<bodyMinHeight)?bodyMinHeight:AD.height;return(AE-(AG+AC+AB+AF))},J=function(AF){TomTom.AnimatedZoomPan.clearCloneLayer();var AC=document.viewport.getDimensions();var AE=12;var AB=v();var AD=AC.width-AE;if(AB>0){F.style.height=AB+"px";if(c&&w){e.style.height=(AB>w)?w+"px":AB+"px";e.style.width=(AD>c)?c+"px":AD+"px"}else{e.style.height=AB+"px"}}if(AF){Z.updateSize();if(isIE6){if(AC.height!=Z.winHeight){winHeight=AC.height;Z.layerContainerDiv.style.height=Z.viewPortDiv.style.height=AB+"px"}}}else{Z.size=Z.getCurrentSize()}q()},q=function(){var AB=document.viewport.getDimensions();if(AB.width<W){document.documentElement.style.width=W+"px";$("main_canvas").style.width=W+"px"}else{document.documentElement.style.width="100%";$("main_canvas").style.width="100%"}if(AB.height<bodyMinHeight){document.documentElement.style.height=bodyMinHeight+"px";$("main_canvas").style.height=bodyMinHeight+"px"}else{document.documentElement.style.height="100%";$("main_canvas").style.height="100%"}},m=function(){var AG=TomTom;var AE=AG.Controls;var AC=AG.Config.Map.Bounds;var AF=new OpenLayers.Bounds(-999999999,AC.maxLat,999999999,AC.minLat);var AH={maxExtent:new OpenLayers.Bounds(AC.minLon,AC.maxLat,AC.maxLon,AC.minLat),extentWithDelta:new OpenLayers.Bounds(-20037508.342799,-20037508.342799,20037508.342799,20037508.342799),units:"meters",resolutions:AG.Config.Map.Resolutions,projection:"EPSG:900913",restrictedExtent:AF,fallThrough:false,theme:null};var AD={minRatio:8,maxRatio:8,mapOptions:Object.clone(AH)};AD.mapOptions.resolutions=[156543.03392804062,156543.03392804062,156543.03392804062,78271.51696402031,39135.758482010155,19567.879241005077,9783.939620502539,4891.969810251269,2445.9849051256347,1222.9924525628173,611.4962262814087,305.74811314070433,152.87405657035217,76.43702828517608,38.21851414258804,19.10925707129402];AA=new AE.OverviewMap(AD);var AB={mapOptions:Object.clone(AH)};g=new AE.ScaleWidget(AB);var AI=new Object();Object.extend(AI,AH);AI.controls=[new AE.Navigation(),new AE.PanZoomBar(),new OpenLayers.Control.ArgParser(),AA,g];Z=new OpenLayers.Map("map",AI);Z.events.addEventType("zoomstart");Event.observe(Z.div,"mousedown",function(AJ){var AK=Event.element(AJ).id;if((AK.indexOf("copyrightDetailsLink")==-1)&&(AK.indexOf("LineString")==-1)){N.publish("clearpopup")}N.publish("closedropboxes")},false);N.wbrpState.map=Z;L();AG.AnimatedZoomPan.map=Z;k()},L=function(){var AB=TomTom.Config;l=new Object();var AC=AB.Layers.getBasic();l.basic=new OpenLayers.Layer.WMS("TomTom WMS",AC[0],{layers:"basic",transparent:false,request:"GetMap",format:"image/jpg",apikey:TomTom.Config.apikey,lid:C()},{wrapDateLine:true,buffer:parseInt(AB.mapTileBuffer)},{isBaseLayer:true});Z.addLayer(l.basic);n(AC);l.marker=new OpenLayers.Layer.Markers("Markers");Z.addLayer(l.marker);l.basic.events.register("loadend",this,function(){TomTom.AnimatedZoomPan.clearCloneLayer()})},n=function(AC){var AE=f;var AB=new Array();for(var AD=AC.length-1;AD>=0;AD--){AB[AD]=AC[AD]+"/"+AE}l.basic.url=AB},U=function(){return f},R=function(AC,AB){if(l[AC]){I(AC)}l[AC]=AB;Z.addLayer(AB)},d=function(AB){if(l[AB]){return true}return false},I=function(AB){if(Z&&l[AB]){Z.removeLayer(l[AB]);l[AB]=null}},z=function(AC,AD,AB){if(!Z){return }R(AC,AD);Z.setLayerIndex(AD,AB)},u=function(AC){if(!AC){return }var AH=AC.location;var AK=AC.zoom;var AI=AC.getForceZoom();var AD=AC.getUseCachedCenter();var AE=AC.getForceCenter();if(AH.coordinate){var AJ=AH.coordinate;var AG=AJ.mercY;var AB=AJ.mercX;if(AK==null){AK=(AH.street!=null||AH.postCode!=null)?13:10}if(AC.getAnimated()){TomTom.AnimatedZoomPan.zoomToCenter(new OpenLayers.LonLat(AB,AG),AK)}else{B(AG,AB,AK,AI,AD,AE)}}else{if(AH.x&&AH.y&&AK){var AF=Z.getLonLatFromPixel(AH);B(AF.lat,AF.lon,AK,AI,AD,AE)}}},B=function(AD,AF,AC,AE,AG,AB){if(AC==null){AC=0}if(AB||!K.dontZoomDontPan(AD,AF,AC,AE)){if(Y(AD,AF,AC,AE)){TomTom.AnimatedZoomPan.panTo(new OpenLayers.LonLat(AF,AD))}else{Z.setCenter(new OpenLayers.LonLat(AF,AD),AC,false,AE,AG)}}},P=function(AC,AB){E(AC);if(AB!=null){Z.zoomTo(Z.getZoom()-1)}$("maploading").hide()},E=function(AD){var AF=AD.getCenterLonLat();if(Z.baseLayer.wrapDateLine){var AB=Z.getMaxExtent();AD=AD.clone();while(AD.right<AD.left){AD.right+=AB.getWidth()}AF=AD.getCenterLonLat().wrapDateLine(AB)}TomTom.AnimatedZoomPan.clearCloneLayer();var AC=Z.calculateBounds();var AE=AC==null?true:!AC.containsBounds(AD);B(AF.lat,AF.lon,Z.getZoomForExtent(AD),AE)},k=function(){Z.events.register("moveend",Z,function(){N.publish("mapchanged")});Z.events.register("movestart",Z,function(){N.publish("movemapstart")})},y=function(){var AI=TomTom.Config;var AC=N.wbrpState;if(AC.center&&AC.zoom){Z.setCenter(OpenLayers.LonLat.fromString(AC.center),AC.zoom)}else{if(TomTom.CookieManager.hasHomeSet()){N.publish("gohome",null)}else{if(V){if(!V.version){var AG=V.coordinate.mercY;var AD=V.coordinate.mercX;var AJ=V.height;var AE=V.width;var AB=new OpenLayers.Bounds(AD-AE,AG+AJ,AD+AE,AG-AJ);P(AB)}else{var AF=TomTom.Config.Map.Center;u(TomTom.Map.SetCenterData.fromLonLat(AF.lon,AF.lat,AF.zoom))}}else{var AH=new PeriodicalExecuter(function(AL){if(V){if(!V.version){var AO=V.coordinate.mercY;var AQ=V.coordinate.mercX;var AK=V.height;var AM=V.width;var AN=new OpenLayers.Bounds(AQ-AM,AO+AK,AQ+AM,AO-AK);P(AN)}else{var AP=TomTom.Config.Map.Center;u(TomTom.Map.SetCenterData.fromLonLat(AP.lon,AP.lat,AP.zoom))}AL.stop()}},0.1);setTimeout(function(){AH.stop()},30000)}}}$("maploading").hide();N.publish("disablePanback")},A=function(AB){if(l.canvas){l.canvas.mergeNewParams({instructionid:AB})}},j=function(AE){var AF=AE.coordinate;var AC=AE.index;var AB=AE.registermarker;var AD=AE.zoom;if(K.dontZoomDontPan(AF.mercY,AF.mercX,14,false)){a(AC,AB)}else{if(Y(AF.mercY,AF.mercX,14,false)){h[h.length]=AE;u(TomTom.Map.SetCenterData.fromCoordinate(AF,AD))}else{u(TomTom.Map.SetCenterData.fromCoordinate(AF,AD));a(AC,AB)}}},T=function(){if(h.length>0){var AB=h.shift();a(AB.index,AB.registermarker)}},a=function(AB,AC){A(AB);N.publish("clearlocationmarker");if(AC){N.publish("registermarker",{name:AC.name,location:AC.location,callback:AC.callback})}},Y=function(AD,AF,AC,AE){var AB=Z.baseLayer.getTilesBounds();return p(AD,AF,AC,AE,AB)},p=function(AD,AG,AC,AF,AB){if(AC==null){AC=0}var AE=Z.getZoom();return(!AF&&AB&&AB.contains(AG,AD,false)&&Math.abs(AC-AE)<=1)},H=function(AB,AC,AH){var AF=null;if(AB==null){AB=Z.getCenter()}if(AC==null){AC=Z.getResolution()}if((AB!=null)&&(AC!=null)){var AE=Z.getSize();var AG=AE.w*AC;var AD=AE.h*AC;AF=new OpenLayers.Bounds(AB.lon-AG/2+(AH.left*AC),AB.lat-AD/2+(AH.top*AC),AB.lon+AG/2-(AH.right*AC),AB.lat+AD/2-(AH.bottom*AC))}return AF},S=function(AB){if(l.basic){l.basic.mergeNewParams({Lid:AB})}},G=function(){var AE=$("locale_dropbox_collapsed").offsetWidth;var AC=$("global-nav").getElementsByTagName("a");for(var AD=0,AB=AC.length;AD<AB;AD++){AE+=AC[AD].offsetWidth}W=AE+42;q()},C=function(){return N.wbrpState.locale},x=function(AB){Z.zoomTo(AB)},M=function(AC){if(g){g.setCopyrights(AC)}else{var AB=new PeriodicalExecuter(function(AD){if(g){g.setCopyrights(AC);AD.stop()}}.bind(this),3);setTimeout(function(){AB.stop()},30000)}};m();D();var K={initialize:function(){N.subscribe(["instructionclicked","mapstatechanged","removelayer","resize","zoomtoextend","setcenter","instructionshown","zoomtoextendadjusted","animatedpanend","setlayer","setlocale","initLbsContextOk","getMapLocationOk","getMapLocationError","zoomTo","i18nupdated"],this)},notified:function(AB,AC){switch(AB){case"resize":N.publish("clearpopup");J(true);break;case"setcenter":u(AC);$("maploading").hide();break;case"zoomtoextend":P(AC);break;case"zoomtoextendadjusted":P(AC.bounds,AC.px);break;case"removelayer":I(AC);break;case"mapstatechanged":y(AC);break;case"instructionclicked":j(AC);break;case"instructionshown":A(AC);break;case"animatedpanend":T();break;case"setlayer":z(AC.name,AC.layer,AC.index);break;case"setlocale":S(AC);break;case"i18nupdated":G();break;case"initLbsContextOk":M(AC.copyrights);break;case"initLbsContextError":break;case"getMapLocationOk":V=AC;break;case"getMapLocationError":$("maploading").hide();break;case"zoomTo":x(AC);break;default:break}},getMap:function(){return Z},getLayers:function(){return l},getOverview:function(){return AA},setTilesVersion:function(AB){if(f!=AB){f=AB;n(TomTom.Config.Layers.getBasic())}},setResolutions:function(AB){Z.resolutions=AB;if(Z.baseLayer){Z.baseLayer.numZoomLevels=AB.length}},dontZoomDontPan:function(AD,AF,AC,AE){var AB=H(Z.getCenter(),Z.getResolution(),t);return p(AD,AF,AC,AE,AB)}};return K}();TomTom.ViewportInfo=function(){var C=TomTom.MessageBus;var B=TomTom.Config.GetViewportDescCauses;var E=TomTom.Map;var D=function(G){new PeriodicalExecuter(function(H){F(B.TRAFFIC_AGE_POLL)},G)};var F=function(J){var K=TomTom.Map.getMap();var G=K.getExtent();var I=K.getZoom();var H=TomTom.Map.getOverview().map.getExtent();var L={viewport:{minX:G.left,minY:G.bottom,maxX:G.right,maxY:G.top},wmsZoom:I+2,overview:{minX:H.left,minY:H.bottom,maxX:H.right,maxY:H.top},ovWmsZoom:I-3<0?0:I-3,cause:J};new TomTom.GetViewportDescRequest(L)};var A=function(G){C.publish("trafficAgeReceived",G);if(parseInt(G.cause)==B.MAP_CHANGE){C.publish("copyrightReceived",G)}if(G.tilesVersion){E.setTilesVersion(G.tilesVersion)}};return{initialize:function(){C.subscribe(["mapchanged","startTrafficAgePolling","getViewportDescOk"],this)},notified:function(G,H){switch(G){case"mapchanged":F(B.MAP_CHANGE);break;case"getViewportDescOk":A(H);break;case"startTrafficAgePolling":D(H);break;default:break}}}}();TomTom.Map.SetCenterData=Class.create();TomTom.Map.SetCenterData.prototype={location:null,zoom:null,options:{},initialize:function(A,C,B){this.location=A;this.zoom=C;if(B){this.options=B}},getForceZoom:function(){return this.options.forceZoom},getAnimated:function(){return this.options.animated},getUseCachedCenter:function(){return this.options.useCachedCenter},getForceCenter:function(){return this.options.forceCenter},setForceZoom:function(A){this.options.forceZoom=A},setAnimated:function(A){this.options.animated=A},setUseCachedCenter:function(A){this.options.useCachedCenter=A},setForceCenter:function(A){this.options.forceCenter=A}},TomTom.Map.SetCenterData.fromLonLat=function(D,C,B,A){return new TomTom.Map.SetCenterData({coordinate:{mercY:C,mercX:D}},B,A)},TomTom.Map.SetCenterData.fromCoordinate=function(C,B,A){return new TomTom.Map.SetCenterData({coordinate:C},B,A)};TomTom.Traffic=function(){var P=TomTom.MessageBus,AP=[],f=TomTom.Config.Traffic.updateInterval,H=0,y=false,AJ=false,AM={CLUSTER:0,ERROR:1,DETAIL:2},U=[],p=TomTom.Config.Traffic.incidentsMinZoomLevel,AE=true,F=null,I=null,W=new OpenLayers.Size(20,20),q=new OpenLayers.Size(26,26),v=TomTom.Config.lbsStaticDir+"/images/traffic/traffic-",n=false,X=false,z=false,h=false,M=null,G={},AN=null,AB=null,x=null,R=false,A=[{id:"view_traffic_info_update_text.content",evtid:"info_text",text:""},{id:"view_traffic_info_update_text_unavailable.content",evtid:"info_unavailable_text",text:""},{id:"view_detailed_traffic_info_text_unavailable.content",evtid:"detailed_info_unavailable_text",text:""},{id:"traffic_ballon_default_title.content",evtid:"defaulttitle",text:""},{id:"traffic_ballon_cluster_title.content",evtid:"clusterTitle",text:""},{id:"traffic_ballon_cluster_zoom_in_1.content",evtid:"zoomIn1",text:""},{id:"traffic_ballon_cluster_zoom_in_2.content",evtid:"zoomIn2",text:""},{id:"traffic_ballon_cluster_incidents_in_area.content",evtid:"incInArea",text:""},{id:"traffic_ballon_cluster_total.content",evtid:"clusterTotal",text:""},{id:"departure_alternatives_label.content",evtid:"fromText",text:""},{id:"print.to_header.content",evtid:"toText",text:""},{id:"traffic_ballon_default_for.content",evtid:"forText",text:""},{id:"traffic_ballon_default_delay.content",evtid:"delayText",text:""},{id:"plus_title.content",evtid:"plusTitle",text:""},{id:"plus_description.content",evtid:"plusDescription",text:""},{id:"hd_title.content",evtid:"hdTitle",text:""},{id:"hd_description.content",evtid:"hdDescription",text:""},{id:"close_text.content",evtid:"closeText",text:""},{id:"more_about_plus_traffic.content",evtid:"moreAboutPlus",text:""},{id:"more_about_hd_traffic.content",evtid:"moreAboutHD",text:""},{id:"contextmenu_zoomin.content",evtid:"zoomin",text:""},{id:"traffic_zoomin.content",evtid:"traffic_zoomin",text:""},{id:"temporarily_unavailable_text.content",evtid:"temporarily_unavailable_text",text:""}],AD=function(){m();b();D();P.publish("startTrafficAgePolling",f)},b=function(){var AR=TomTom.Config;serverStubs=AR.Layers.getCanvas();var AS={layers:"traffic",request:"GetMap",format:isIE6?"image/gif":"image/png",apikey:AR.apikey};var AT={transparent:true,isBaseLayer:false,buffer:parseInt(AR.mapTileBuffer),singleTile:AR.UntiledTrafficLayer=="true"?true:false};F=new OpenLayers.Layer.WMS("traffictiles",serverStubs,AS,AT);F.url=serverStubs},m=function(){I=new OpenLayers.Layer.Markers("TrafficIcons");P.publish("setlayer",{name:"trafficicons",layer:I,index:1})},D=function(){var AR=I.map.events;AR.register("zoomstart",this,function(){Q()})},C=function(){X=false;var AR=P.wbrpState.map.baseLayer.getTilesBounds();if(n||(AR&&!AR.equals(M))){X=true}return X},L=function(AR,AS){var AT=P.wbrpState;H=AR;S();AA();if(AS==TomTom.Config.GetViewportDescCauses.TRAFFIC_AGE_POLL||C()||AT.initLoadState){k()}if(AT.initLoadState){AT.initLoadState=false}},Q=function(){n=false;var AS=P.wbrpState.zoom;var AR=I.map.getZoom();if(AR!=AS){n=true;N();F.display(false)}},T=function(AR){if(AR==null){AJ=!AJ}else{AJ=AR}},AK=function(AR){if(AJ!==AR){T(AR);k()}},k=function(){if(AJ&&y){if(AE){AG()}else{AL();e(false)}}else{if(AJ){AE?j():AL();e(false)}else{j();e(false);n=false}}M=P.wbrpState.map.baseLayer.getTilesBounds()},Y=function(){var AT=F;if(!AT.map){Object.extend(AT.params,{TM:G.trafficModelId});P.publish("setlayer",{name:"traffictiles",layer:F,index:1})}var AU=(new Date()).getTime();var AR=new Array();for(var AS=serverStubs.length-1;AS>=0;AS--){AR[AS]=serverStubs[AS]+"/"+AU}AT.url=AR;O();if(AN!=G.trafficModelId){AT.mergeNewParams({TM:G.trafficModelId})}else{var AV=n||z||R||h;AT.moveTo(AT.getExtent(),AV,true);R=false;F.div.style.display="block"}},AL=function(){AO()},O=function(){if(AJ&&y){e(AE)}},j=function(){AI();if(AJ&&AE||!AJ){N()}},e=function(AR){F.visibility=AR;F.div.style.display=AR?"block":"none";if(!AR){AN=null}},S=function(){var AR=Math.floor(H/1000/60);y=(AR>-1&&AR<=20)},AA=function(){var AR=(!AE&&H!=-1)||y;P.publish("updatetrafficinfostyle",{isOn:AJ,isEnabled:AR});Z()},Z=function(){var AR="";if(AE){var AT=Math.floor(H/1000/60);if(AT==-1){AR=""}else{if(AT>-1&&AT<=5){var AS=new Template(B("info_text"));AR=AS.evaluate({age:AT})}else{if(AT>5&&AT<=20){AR=B("info_unavailable_text")}else{AR=B("temporarily_unavailable_text")}}}}P.publish("updatetrafficinfotext",{text:AR})},AI=function(){for(var AR=U.length-1;AR>=0;AR--){U[AR].stop();U[AR]=null}U=[]},N=function(){AI();P.publish("clearmarkers",{name:"any",layer:I})},K=function(AR){AI();P.publish("filtermarkers",{markers:AR,layer:I})},d=function(){var AU=P.wbrpState.map;M=AU.baseLayer.getTilesBounds();var AT=M;var AS=AU.getLayerPxFromLonLat(new OpenLayers.LonLat(AT.left,AT.bottom));var AR=AU.getLayerPxFromLonLat(new OpenLayers.LonLat(AT.right,AT.top));var AV={extent:{minX:AT.left,minY:AT.bottom,maxX:AT.right,maxY:AT.top},zoomLevel:AU.getZoom()+2,language:P.wbrpState.locale,viewExtent:{minX:AS.x,minY:AR.y,maxX:AR.x,maxY:AS.y}};AV.trafficModelId=x?x:AB;requestedTrafficModelId=AV.trafficModelId;return{service:"getTrafficModel",requestParams:AV}},AG=function(){new TomTom.getTrafficModelRequest(d())},AH=function(AR){G=AR;Y();AC(G.trafficPois);var AS=G.trafficModelId;if(AN==null||(AS!=AN)){AN=AS}if(AS!=requestedTrafficModelId&&requestedTrafficModelId==x){J();P.publish("routetrafficmodelexpired")}},AF=function(){X=false;n=false},AC=function(AR){if(X&&!n){K(AR)}else{N()}X=false;n=false;if(AR){var AX=AR.length;var AV=AX/2;var AU=[];var AW=0;for(var AT=0;AT<AX;AT++){AU.push(AR[AT]);AW++;if(AW>=AV||AT==(AX-1)){var AS={response:AU,index:0};g(AS);AU=[];AW=0}}}else{}},g=function(AR){new PeriodicalExecuter(function(AV){if(!y){AV.stop();return }U.push(AV);var AY=AR.response[AR.index];AR.index++;if(!AY){return }var AU,AZ,AT,AX;var AS=(AY.clBL!=null);if(AS){AU=l(v+TomTom.Utils.lz(AY.iconCategory)+"_stack.gif",q);AT=AM.CLUSTER;AX={clBL:AY.clBL,clTR:AY.clTR,length:AY.length,CSz:AY.CSz,detail:AY.detail}}else{AU=l(v+TomTom.Utils.lz(AY.iconCategory)+".gif",W);AT=(AY.detail!=null)?AM.DETAIL:AM.ERROR;AX=AY.detail}var AW=(AY.id)?AY.id:"img_"+AY.position.mercX+"_"+AY.position.mercY+"_"+AY.iconCategory;P.publish("registermarker",{location:{latitude:AY.position.mercY,longitude:AY.position.mercX},type:AT,param:AX,layer:"trafficicons",icon:AU,id:AW,callback:u});if(AR.index==AR.response.length){AV.stop()}},0.001)},E=function(AU){var AX=TomTom.FormatHelper;var AV="";var AZ=null;var AR="";if(AU.from){AR=B("fromText")+"<strong> "+AU.from.escapeHTML()+"</strong> "}if(AU.to){AR+=B("toText")+" <strong> "+AU.to.escapeHTML()+"</strong><br>"}if(AU.length){var Aa=AX.formatDistance(AU.length,P.wbrpState.getPreferredUnits(AU.countryISOCode))}var AS=AU.cause?AU.cause.escapeHTML()+", ":"";var AW=AU.description?AU.description.escapeHTML()+" ":"";var AY=AS+AW;if(Aa){AY+=(B("forText")+" <strong>"+Aa+"</strong>")}if(AU.delay){var AT=AX.formatTrafficDelay(AU.delay);AY+=", "+B("delayText")+" <strong>"+AT+"</strong>"}AV=AR+AY;return AV},u=function(Ab,AY,AS,AR){var AX=TomTom.FormatHelper;var AV="";var AZ=null;if(AY==AM.DETAIL){if(AS.roadNumber){AZ=AS.roadNumber}else{AZ=B("defaulttitle")}AV=E(AS)}else{if(AY==AM.CLUSTER){var Aa=AS.CSz;var AT=AX.formatDistance(AS.length,P.wbrpState.getPreferredUnits(AS.countryISOCode));AZ=B("clusterTitle")+"&nbsp;("+Aa+")";AV=Aa+"&nbsp;"+B("incInArea")+"<br/>";if(AS.length!=0){AV+="<span id='clusterlength' style='font-size:9pt;'>"+AT+"</span>&nbsp;"+B("clusterTotal")}AV+="<br/><a href='#'onclick='TomTom.MessageBus.publish(\"zoomtoextendadjusted\", {bounds:new OpenLayers.Bounds("+AS.clBL.mercX+","+AS.clBL.mercY+","+AS.clTR.mercX+","+AS.clTR.mercY+"),px:{x:"+Ab.x+",y:"+Ab.y+'}});TomTom.MessageBus.publish("clearpopup");return false;\'>'+B("zoomIn1")+"</a>&nbsp;"+B("zoomIn2")}else{if(AY==AM.ERROR){AZ='<div id="loading_title">Error</div>';AV='<div id="loading_body">'+B("detailed_info_unavailable_text")+"</div>"}}}var AW=TomTom.Utils.createInfoBalloon({x:0,y:0},AZ,AV,"traffic");var AU="<div id='temp_node' style='position:absolute;left:50px;top:20px;z-index:99999;display:none'>"+AW.text+"</div>";$("map_canvas").insert(AU);var Ac=$("temp_node").getHeight();$("temp_node").remove();return TomTom.Utils.createInfoBalloon(Ab,AZ,AV,"traffic",parseInt(Ac))},AO=function(){if(!AE){if(TomTom.MessageBus.wbrpState.map.getCenter()){AQ()}else{var AR=new PeriodicalExecuter(function(AS){if(TomTom.MessageBus.wbrpState.map.getCenter()){AQ();AS.stop()}}.bind(this),3);setTimeout(function(){AR.stop()},30000)}}},AQ=function(){if(!AE){P.publish("clearmarkers",{layer:TomTom.Map.getLayers()["trafficicons"],name:"any"});if(AJ&&I.div.getElementsByTagName("div").length==0){var AV=P.wbrpState.map.getZoom();var AW=TomTom.Config.lbsStaticDir+"/images/traffic/traffic-";var AS=AP;for(var AT=AS.length-1;AT>=0;AT--){var AR=AS[AT];if(AR.fromZoom<=AV){var AU=l(AW+AR.feedType+".gif",W);if(AR.feedType!="PLUS"){AU.zIndex=1}P.publish("registermarker",{location:{latitude:AR.centerY,longitude:AR.centerX},type:AR.feedType,layer:"trafficicons",icon:AU,callback:t.bind(this)})}}}}},t=function(Ad,Aa){var AT=$("map").viewportOffset();var AY={x:(Ad.x-AT.left),y:Ad.y-AT.top};var AR=TomTom.Utils;var Ac,Ae,AW;var Ab="<a href='#' onclick=\"TomTom.MessageBus.publish('trafficzoomin',{x:"+AY.x+",y:"+AY.y+"});TomTom.MessageBus.publish('clearpopup');return false;\">"+B("zoomin")+"</a>";var AX=new Template(B("traffic_zoomin"));var AS=AX.evaluate({link:Ab});if(Aa=="PLUS"){Ac=B("plusTitle");Ae=B("plusDescription")+" "+AS;AW="<div><span>"+Ae+"</span>  <div id='traffic_availability'>    <ul class='left'>       <li><a target='_blank' href='http://www.tomtom.com/plus'><span>"+B("moreAboutPlus")+"</span></a></li>    </ul>  </div></div>"}else{if(Aa=="HD"){var AV="http://www.tomtom.com/services/service.php?id=2&Lid="+TomTom.Config.tomtomLocales[P.wbrpState.locale];Ac=B("hdTitle");Ae=B("hdDescription")+" "+AS;AW="<table border='0'><tr><td><span>"+Ae+'</span></td><td valign="top"><div id=\'HDImg\'><img height="65" width="65" src=\''+TomTom.Config.staticDir+"/images/HDTraffic_logo.png'/></div></td></tr><tr><td colspan='2'><div id='toolbar_menu' style='margin-left:0px;height:36px;'><div class='left'><li><a  style='color:#00AEEF;text-decoration: underline;' target='_blank' href='"+AV+"'>"+B("moreAboutHD")+"</a></li></div></td></tr></table>"}else{if(Aa=="V"){Ac=B("plusTitle");Ae=B("plusDescription")+" "+AS;AW="<table border='0'><tr><td><span>"+Ae+"</span></td><td valign=\"top\"><div id='vImg'><a href='http://www.v-trafic.com' target='_blank'><img  height=\"65\" width=\"65\" src='"+TomTom.Config.staticDir+"/images/v-trafic_logo.gif'/></a></div></td></tr><tr><td colspan='2'>  <div id='traffic_availability'>    <ul class='left'>       <li><a target='_blank' href='http://www.tomtom.com/traffic'><span>"+B("moreAboutPlus")+"</span></a></li>    </ul>  </div></td></tr></table>"}}}if(Ac&&AW&&Ae){var AZ=TomTom.Utils.createInfoBalloon({x:0,y:0},Ac,AW,"traffic");var AU="<div id='temp_node' style='position:absolute;left:50px;top:20px;z-index:99999;display:none'>"+AZ.text+"</div>";$("map_canvas").insert(AU);var Af=$("temp_node").getHeight();$("temp_node").remove();return AR.createInfoBalloon(Ad,Ac,AW,"traffic",Af)}},l=function(AS,AR){s=(AR)?AR:new OpenLayers.Size(20,20);o=new OpenLayers.Pixel(-(s.w/2),-(s.h/2));icon={size:s,url:AS,offset:o};return icon},B=function(AR){return TomTom.Utils.getText(A,AR)},w=function(AR){TomTom.Utils.updateTexts(A,AR)},c=function(AR){P.publish("setcenter",new TomTom.Map.SetCenterData(AR,p,{forceZoom:true}))},a=function(){if((!C())){if((AJ&&x!=AN)||!AJ){k()}}},J=function(){x=null},V=function(){if(AJ&&y){if(AE){var AV=TomTom.Map.getLayers()["trafficicons"];var AU=document.getElementById(AV.id);var AY=AU.childNodes;if(AY.length>0){for(var AR=0;AR<AY.length;AR++){var AW=AY[AR].id.split("_");var AT=new OpenLayers.LonLat(AW[1],AW[2]);var AX=AV.map.getLayerPxFromLonLat(AT);var AZ=AY[AR].getDimensions();var AS={x:AZ.width/2,y:AZ.height/2};AY[AR].style.top=(AX.y-AS.y).toString()+"px";AY[AR].style.left=(AX.x-AS.x).toString()+"px"}}}}};return{initialize:function(){P.subscribe(["cancelmarkerrendering","beforeload","trafficstatechanged","resize","i18nupdated","trafficzoomin","routeplanned","tripadvisorrequestparamsprepared","trafficAgeReceived","afterplanroute","initLbsContextOk","initLbsContextError","getTrafficModelOk","getTrafficModelError","statechanged"],this)},notified:function(AR,AT){AE=P.wbrpState.map&&(P.wbrpState.map.getZoom()>=p);switch(AR){case"beforeload":AD();break;case"initLbsContextOk":AP=AT.regions;AO();break;case"initLbsContextError":AP=[];break;case"trafficAgeReceived":AB=AT.trafficModelId;L(AT.trafficAge,AT.cause);break;case"getTrafficModelOk":AH(AT);break;case"getTrafficModelError":AF();break;case"trafficstatechanged":AK(AT);break;case"cancelmarkerrendering":AI();break;case"i18nupdated":k();w(AT);Z();break;case"trafficzoomin":c(AT);break;case"routeplanned":a();break;case"tripadvisorrequestparamsprepared":T(AT.includeTraffic);break;case"afterplanroute":if(AJ){x=AT.trafficModelId}R=true;if(F&&F.map){var AV=AT.bounds;var AU=AV.getCenterLonLat();var AW=F.map.getZoomForExtent(AV);var AS=TomTom.Map.dontZoomDontPan(AU.lat,AU.lon,AW,false);if(!TomTom.PlanRoute.getRightClick()&&!AS){F.div.style.display="none"}}break;case"resize":z=true;Y();V();z=false;break;case"statechanged":h=true;Y();h=false;break;default:break}},buildDetailPopupBody:function(AU){var AX=TomTom.FormatHelper,AV="",AZ=null,AR="";if(AU.from){AR=B("fromText")+"<strong> "+AU.from.escapeHTML()+"</strong> "}if(AU.to){AR+=B("toText")+" <strong> "+AU.to.escapeHTML()+"</strong><br>"}if(AU.length){var Aa=AX.formatDistance(AU.length,P.wbrpState.getPreferredUnits(AU.countryISOCode))}var AS=AU.cause?AU.cause.escapeHTML()+", ":"";var AW=AU.description?AU.description.escapeHTML()+" ":"";var AY=AS+AW;if(Aa){AY+=(B("forText")+" <strong>"+Aa+"</strong>")}if(AU.delay){var AT=AX.formatTrafficDelay(AU.delay);AY+=", "+B("delayText")+" <strong>"+AT+"</strong>"}AV=AR+AY;return AV}}}();TomTom.AdManager=function(){var C=TomTom.Config.adServerUrl,E="en",B=[{name:"lang",value:E}],D=function(){var G="?";for(var F=0;F<B.length;F++){if(F>0){G=G+"&"}G=G+B[F].name+"="+B[F].value}return G},A=function(F){var H=false;for(var G=0;G<B.length;G++){if(B[G].name==F.name){B[G].value=F.value;H=true}}if(!H){B.push(F)}};return{serveAd:function(H,F){for(var G=0;G<H.length;G++){A(H[G])}$(F).style.display="block";$(F).src=C+D()}}}();TomTom.Leftpanel=function(){var Q;var T=TomTom.MessageBus,A=[{id:"show_panel_message.content",text:""},{id:"hide_panel_message.content",text:""}],D=TomTom.AdManager,q=$("route_planner"),V=$("route_planner_content"),E=$("route_planner_slider"),y=$("map_canvas"),h=$("leftPanelBannerAdManagerInResult"),J=$("leftPanelBannerAdManagerInAltResult"),t=$("leftPanelBannerAdManagerInFindlocation"),I=$("leftPanelBannerAdManagerInPlanroute"),P=$("find_a_location"),O=$("planrouteResult"),b=$("planRoute"),m=$("plan_a_route"),K=$("planroute_container"),k=$("planrouteSummary"),U=$("routeInstructions"),c=$("location_label"),Y=$("location"),g=$("location_container"),n=$("findLocationResultDiv"),L=$("location_alternatives_container"),C=$("location_alt"),Z=$("clearroute_button"),AA=$("reverseroute_button"),AC=$("clear_route_link_text"),AB=$("route_planner_label_for_departure"),e=$("route_planner_label_for_destination"),a=$("tripAdvisor_leaving"),x=$("departure"),F=$("destination"),X=$("standard_location_labels"),z=$("route_planner_errors"),d=$("standard_planroute_labels"),W=$("avoid_traffic_label_text"),H=function(){S(T.wbrpState.locale)},S=function(AD){N(AD)},N=function(AD){$("leftPanelBannerAdFrameInFindlocation").style.display="block";D.serveAd([{name:"lang",value:AD},{name:"placement",value:"leftpanel"}],"leftPanelBannerAdFrameInFindlocation");$("leftPanelBannerAdFrameInResult").style.display="block";D.serveAd([{name:"lang",value:AD},{name:"placement",value:"leftpanel"}],"leftPanelBannerAdFrameInResult");$("leftPanelBannerAdFrameInPlanroute").style.display="block";D.serveAd([{name:"lang",value:AD},{name:"placement",value:"leftpanel"}],"leftPanelBannerAdFrameInPlanroute");$("leftPanelBannerAdFrameInAltResult").style.display="block";D.serveAd([{name:"lang",value:AD},{name:"placement",value:"leftpanel"}],"leftPanelBannerAdFrameInAltResult")},R=function(AD){if(E.className=="routePlannerSliderUp"){E.setStyle({backgroundPosition:"0px -90px"})}else{E.setStyle({backgroundPosition:"0px -30px"})}l(AD)},w=function(){if(E.className=="routePlannerSliderUp"){E.setStyle({backgroundPosition:"0px -60px"})}else{E.setStyle({backgroundPosition:"0px 0px"})}T.publish("clearpopup")},l=function(AE){var AF="";var AD=parseInt(V.getHeight())>0;var AG={};if(AD){AG.id="hide_lp";AF=B("hide_panel_message.content")}else{AG.id="show_lp";AF=B("show_panel_message.content")}AG.delay=400;AG.text=AF;if(!AE){AE=window.event}AG.position=new OpenLayers.Pixel(AE.clientX,AE.clientY);T.publish("popup",AG)},M=function(){if(V.getHeight()>0){var AD=G();if(AD>=0){V.setStyle({height:(AD)+"px"})}}},p=function(){if(AC.getWidth()>20){var AF=275-AA.getWidth()-Z.getWidth();if(AF>=0){var AE=["button_plan_trip","button_replan_trip"];for(var AD=0;AD<AE.length;AD++){$(AE[AD]).style.width=AF+"px"}}}},v=function(){var AG=0,AD=0;var AI=0;var AJ=0;var AH=22;var AE=0;var AF=11;if(b.className=="routeActiveTab"){if(K.style.display!="none"){AD=Math.max(AD,AB.getWidth());AD=Math.max(AD,e.getWidth());AD=Math.max(AD,a.getWidth());AD=Math.max(AD,W.getWidth());AD+=AF;d.setStyle({width:AD+"px"});$("tripAdvisor").setStyle({width:AD-7+"px"});AG=K.getWidth();if(Prototype.Browser.IE){if(isIE6){AE=6}else{AE=1}}AI=AG-AD-AH-AE;AJ=AI-10;if(AI>=0){x.setStyle({width:AI+4+"px"});F.setStyle({width:AI+4+"px"})}}$("tripAdvisor_container").style.left=AD+"px";T.publish("resizedropboxes",{width:AJ})}else{if(g.style.display!="none"){AG=g.getWidth();AD=c.getWidth()+AF;X.setStyle({width:AD+"px"});AI=AG-AD-AH;if(AI>=0){Y.setStyle({width:AI+"px"})}}}},j=function(AD){if(parseInt(V.getHeight())==0){V.show();T.publish("slide",f(G(),function(){q.style.height=G()+"px";E.className="routePlannerSliderUp";E.setStyle({backgroundPosition:"0px -60px"})}))}else{if(!AD){V.show();T.publish("slide",f(false,function(){q.style.height=64+"px";E.className="routePlannerSliderDown";E.setStyle({backgroundPosition:"0px 0px"})}))}}},G=function(){return y.getHeight()-71},f=function(AD,AE){return{element:V,height:AD,callback:AE}},B=function(AD){return TomTom.Utils.getText(A,AD)},u=function(AE){var AD=TomTom.Utils;AD.updateTexts(A,AE);AD.shrinkToFit(m,159);AD.shrinkToFit(P,159)};Q={initialize:function(){T.subscribe(["resize","expandleftpanel","i18nupdated"],this);Event.observe(E,"click",function(){j()});Event.observe(E,"mouseover",R);Event.observe(E,"mouseout",function(){w()})},notified:function(AD,AE){switch(AD){case"resize":M();this.setBannerAdVisibility();break;case"expandleftpanel":j(true);v();p();break;case"i18nupdated":u(AE);N(T.wbrpState.locale);v();p();break;default:break}},setBannerAdVisibility:function(){if(b.className=="routeActiveTab"){if(O.visible()){I.hide();var AN=K.getHeight(),AD=k.getHeight(),AG=U.getHeight(),AO=h.getHeight(),AM=U.visible()?AG:AD,AH=AN+AM+AO,AF=V.getHeight(),AE=AF-AN,AL=AH>AF?"relative":"absolute";O.setStyle({height:AE+"px"});h.setStyle({position:AL,bottom:"0px"});h.show()}else{I.show();h.hide()}}else{if(L.visible()){t.hide();var AK,AN=g.getHeight(),AM=n.getHeight(),AI=$("did_you_mean").getHeight(),AJ=C.getHeight(),AO=J.getHeight(),AH=AN+AM+AJ+AI+AO+35,AF=V.getHeight();if(AH>AF){AK=AJ+AI+35;L.setStyle({height:AK+"px"});J.setStyle({position:"relative",bottom:"0px"})}else{AK=AF-AN-AM-20;L.setStyle({height:AK+"px"});J.setStyle({position:"absolute",bottom:"0px"})}J.show()}else{t.show();J.hide()}}}};H();return Q}();TomTom.WebtestHooks=Class.create();TomTom.WebtestHooks.prototype={appLoaded:false,geocodeOk:false,routeReversedOk:false,lastLocation:null,findLocationDone:false,initialize:function(){var A=TomTom.MessageBus;A.subscribe(["afterload"],this);A.subscribe(["geocodeOk"],this);A.subscribe(["geocodeOk__planRoute1"],this);A.subscribe(["geocodeOk__findLocation1"],this);A.subscribe(["geocodeStructuredOk"],this);A.subscribe(["findlocationgeocode"],this);A.subscribe(["routeReversedOk"],this)},zoomTo:function(A){if(A!=null){TomTom.AnimatedZoomPan.map.zoomTo(A)}},zoomIn:function(){TomTom.AnimatedZoomPan.animatedZoomIn()},zoomOut:function(){TomTom.AnimatedZoomPan.animatedZoomOut()},panLeft:function(){TomTom.AnimatedZoomPan.animatedPan(-250,0,null)},panRight:function(){TomTom.AnimatedZoomPan.animatedPan(250,0,null)},panTop:function(){TomTom.AnimatedZoomPan.animatedPan(0,-250,null)},panBottom:function(){TomTom.AnimatedZoomPan.animatedPan(0,250,null)},getLinkToMapViewUrl:function(){return window.location.protocol+"//"+window.location.host+TomTom.MessageBus.wbrpState.serialize()},notified:function(A,B){switch(A){case"afterload":this.appLoaded=true;break;case"geocodeOk":this.geocodeOk=true;break;case"geocodeStructuredOk":this.geocodeOk=true;break;case"findlocationgeocode":this.saveLastLocation(B.location);break;case"routeReversedOk":this.routeReversedOk=true;break;default:break}},saveLastLocation:function(A){this.findLocationDone=true;this.lastLocation=new Object();if(A.coordinate){this.lastLocation.latitude=A.coordinate.latitude;this.lastLocation.longitude=A.coordinate.longitude}else{console.log(A)}},getLastLocation:function(){return this.lastLocation},resetLastLocation:function(){this.findLocationDone=false},getZoom:function(){return TomTom.Modules.modules.map.map.getZoom()},getCenter:function(){var A=TomTom.Modules.modules.map.map.getCenter();return A.lon+","+A.lat},getTimeType:function(){return TomTom.Modules.modules.tripadvisor.timeType()}};TomTom.Request=Class.create();TomTom.Request.prototype={id:null,response:null,params:{},initialize:function(B,E,A,D,C){this.id=E;this.type=C;if(D){this.params=D}this.params.apiKey=TomTom.Config.apikey;switch(C){case"json":this.jsonRequest(B,A);break;case"findFriend":break;default:break}},jsonRequest:function(B,A){TomTom.MessageBus.subscribe(["responseOk__"+this.id],B);TomTom.MessageBus.subscribe(["responseError__"+this.id],B);var C="get";A=(A.replace(/\/\//g,"/")).replace(/http:\//,"http://");A=A.substring(0,A.length-1);new Ajax.Request(A,{method:C,parameters:this.params,onSuccess:this.jsonSuccess.bind(this),onFailure:this.jsonFailure.bind(this)})},jsonSuccess:function(A){this.setResponse(A);TomTom.MessageBus.publish("responseOk__"+this.id,{id:this.id,error:null,response:this.response})},jsonFailure:function(A){this.setResponse(A);TomTom.MessageBus.publish("responseError__"+this.id,{id:this.id,error:null,response:this.response})},setResponse:function(transport){if((transport.getResponseHeader("Content-Type")=="application/json;charset=ISO-8859-1")||(this.type=="json")){this.response=eval("("+transport.responseText+")")}else{this.response=transport.responseText}}};TomTom.DwrRequest=Class.create({initialize:function(A){this.service=A.service;this.requestParams=A.requestParams?A.requestParams:{};this.requestParams.apiKey=TomTom.Config.apikey;this.responseParams=A.responseParams;this.cancelled=false;if(TomTom.Config.Services.location){TomTom.Config.Services.location[this.service](this.requestParams,{callback:this.callback.bind(this),errorHandler:this.errorHandler.bind(this),warningHandler:this.errorHandler.bind(this),timeout:TomTom.Config.ajaxTimeout})}},callback:function(A){if(!this.cancelled){if(!A){throw this.service+" Empty"}if(this.responseParams){Object.extend(A,this.responseParams)}TomTom.MessageBus.publish(this.service+"Ok",A)}},errorHandler:function(A,B){if(!this.cancelled){if(this.responseParams){Object.extend(B,this.responseParams)}TomTom.MessageBus.publish(this.service+"Error",B)}},cancel:function(){this.cancelled=true}});TomTom.DwrRequest.Geocode=Class.create(TomTom.DwrRequest,{initialize:function($super,B){var A=this.prepareGeocodingReference(B.reference,B.bias);var C={};C.service="geocode";C.requestParams={address:this.cleanText(B.location),latitudeBias:A.latitude,longitudeBias:A.longitude,bias:A.bias,language:TomTom.MessageBus.wbrpState.locale};C.responseParams={module:B.module};$super(C)},prepareGeocodingReference:function(C,D){var B={};if(!C){var A=TomTom.MessageBus.wbrpState.getViewport();if(A){C=TomTom.MessageBus.wbrpState.getViewport().coordinate}}if(!C){return{latitude:0,longitude:0,bias:0}}if(C.longitude&&C.latitude){B=C}else{B=TomTom.Utils.inverseMercator(C.mercX,C.mercY);B.longitude=B.lon;B.latitude=B.lat}var E=TomTom.MessageBus.wbrpState.zoom;B.bias=D&&C?D:(E&&E>=0&&E<16?TomTom.Config.GeocodeBias[E]:0);return B},cleanText:function(B){var A=B.replace(/ $/,"");A=A.replace(/,$/,"");A=A.replace(/;$/,"");A=A.replace(/:$/,"");A=A.replace(/"$/,"");A=A.replace(/^ /,"");A=A.replace(/^,/,"");A=A.replace(/^;/,"");A=A.replace(/^:/,"");A=A.replace(/^"/,"");A=A.replace("/[^a-z,A-Z,0-9]$//","");return A}});TomTom.RestRequest=Class.create({headTag:document.getElementsByTagName("head")[0],initialize:function(C){this.service=C.service;var B=C.options?C.options:"";var A="/json/"+TomTom.Config.apikey+";language="+TomTom.MessageBus.wbrpState.locale+B;new Ajax.Request(TomTom.Config.REST.baseUrl+"/"+C.query+A,{method:"GET",onSuccess:this.callback.bind(this),onFailure:this.errorHandler.bind(this)});this.timedout=false;this.cancelled=false;this.timedOutTimer=setTimeout(this.timedoutHandler.bind(this),TomTom.Config.ajaxTimeout)},callback:function(A){A=A.responseJSON;if(!this.cancelled&&!this.timedout){clearTimeout(this.timedOutTimer);if(A.errorResponse){this.errorHandler(A.errorResponse)}else{var B=this.reformatResponse(A);if(this.responseParams){Object.extend(B,this.responseParams)}TomTom.MessageBus.publish(this.service+"Ok",B)}}},errorHandler:function(A){A=A.responseJSON!=null?A.responseJSON:{};if(!this.cancelled){clearTimeout(this.timedOutTimer);if(this.responseParams){Object.extend(A,this.responseParams)}TomTom.MessageBus.publish(this.service+"Error",A)}},timedoutHandler:function(){this.timedout=true;this.errorHandler({responseJSON:{"@errorCode":"","@description":"Request timed out."}});clearTimeout(this.timedOutTimer)},cancel:function(){this.cancelled=true;clearTimeout(this.timedOutTimer)}});TomTom.GeocodeRequest=Class.create(TomTom.RestRequest,{initialize:function($super,C){var B="";if(C.mapName){B+=";mapName="+C.mapName}var A={service:"geocode",query:"geocode/1/query/"+C.location,options:B};$super(A);this.responseParams={module:C.module}},getBiasPoint:function(D){var B=null;if(!D){var A=TomTom.MessageBus.wbrpState.getViewport();if(A){D=A.coordinate}}if(!D){return B}if(D.longitude){B=D.longitude+","+D.latitude}else{var C=TomTom.Utils.inverseMercator(D.mercX,D.mercY);B=C.lon+","+C.lat}return B},getBbox:function(){return TomTom.MessageBus.wbrpState.bbox},reformatResponse:function(C){var F=[];if(C.geoResponse){var E=parseInt(C.geoResponse["@count"],10);if(E>0){F=C.geoResponse.geoResult;if(E==1){var B=F;F=[];F[0]=B}for(var D=0,A=F.length;D<A&&D<=5;D++){F[D].coordinate=TomTom.Utils.makeWBRPCoordinate(F[D].longitude,F[D].latitude);F[D].poiCategory=F[D].type=="poi"?F[D].category:-1;F[D].height=F[D].heightMeters;F[D].width=F[D].widthMeters;F[D].postCode=F[D].postcode}}}return F}});TomTom.ReverseGeocodeRequest=Class.create(TomTom.RestRequest,{initialize:function($super,B){var A={service:"reverseGeocode",query:"geocode/1/reverse/"+B.coord};$super(A)},reformatResponse:function(A){var B={};if(A.reverseGeoResponse){B=A.reverseGeoResponse.reverseGeoResult;B.coordinate=TomTom.Utils.makeWBRPCoordinate(B.longitude,B.latitude);B.countryCode=B.countryISO3?B.countryISO3:null}return B}});TomTom.CalculateRouteRequest=Class.create(TomTom.RestRequest,{initialize:function($super,D){this.requestParams=D;var B="";B+=";avoidTraffic="+D.heedTraffic;B+=";includeTraffic="+D.includeTraffic;B+=";day="+this.getDay(D.daySelection);B+=";time="+this.getTime(D.timeSelection);B+=";iqRoutes="+this.getIQ(D.iqFlag);B+=";trafficModelId="+D.trafficModelId;var C=this.getPoints(D.geocodedLocations);var A={service:"calculateRoute",query:"route/1/"+C+"/"+D.routeType,options:B};$super(A)},getDay:function(A){var B={"-1":"today","-2":"tomorrow","0":"monday","1":"tuesday","2":"wednesday","3":"thursday","4":"friday","5":"saturday","6":"sunday"};return B[A+""]},getTime:function(B){var A=TomTom.TripAdvisorConstants.timeTypeCodes;if(B==A.RIGHT_NOW){return"now"}else{if(B==A.ANY_TIME){return"anytime"}else{return B}}},getIQ:function(A){var B=TomTom.TripAdvisorConstants.routeIQType;if(A==B.NONE){return 0}else{if(A==B.WEEKDAY||A==B.WEEKEND){return 1}else{if(A==B.VERSION2){return 2}}}},getPoints:function(B){var D=[];for(var C=0,A=B.length;C<A;C++){var E=B[C].coordinate;D[C]=E.latitude+","+E.longitude}return D.join(":")},reformatResponse:function(A){var H={};if(A.route){H=A.route;var F=H.summary;H.routeKey=F.routeKey;var G=F.departureOverview;H.departureOverviewDay=G.day;H.departureOverviewTime=G.time;H.departureOverviewMessage=G.message;var D=F.arrivalOverview;H.arrivalOverviewDay=D.day;H.arrivalOverviewTime=D.time;H.arrivalOverviewMessage=D.message;H.totalDistance=F.totalDistanceMeters;H.totalDelay=F.totalDelaySeconds;H.totalTime=F.totalTimeSeconds;H.trafficModelId=F.trafficModelId;var I=TomTom.Utils.makeWBRPCoordinate.bind(TomTom.Utils);H.areaBottomRight=I(F.bbox.topRight.longitude,F.bbox.bottomLeft.latitude);H.areaTopLeft=I(F.bbox.bottomLeft.longitude,F.bbox.topRight.latitude);var B=H.instructions.instruction;for(var C=0,E=B.length;C<E;C++){B[C].coordinate=I(B[C].point.longitude,B[C].point.latitude);B[C].distance=B[C].distanceMeters}H.instructions=B}return H}});TomTom.InitLbsContextRequest=Class.create(TomTom.RestRequest,{initialize:function($super,B){var A={service:"initLbsContext",query:"wbrp/1/initialize"};$super(A)},reformatResponse:function(J){var C={};var B="\u0040";var F=B+"version";C.version=J.initializeResponse[F];C.copyrights=[];for(var D=0,G=J.initializeResponse.copyright.length;D<G;D++){var H=J.initializeResponse.copyright[D];var I={};I.desc=H.description;var K=B+"id";I.id=H[K];I.label=H.label;I.logo=H.logo;C.copyrights[I.id]=I}C.regions=[];for(var D=0,G=J.initializeResponse.trafficRegion.length;D<G;D++){var E=J.initializeResponse.trafficRegion[D];var A={};A.fromZoom=E.fromZoom;A.feedType=E.feedType;A.centerY=E.point.latitude;A.centerX=E.point.longitude;A.areaName=E.areaName;C.regions.push(A)}return(C)}});TomTom.GetViewportDescRequest=Class.create(TomTom.RestRequest,{cause:"",initialize:function($super,B){this.cause=B.cause;var A={service:"getViewportDesc",query:"wbrp/1/viewportDesc"+this.genParameterString(B)};$super(A)},genParameterString:function(D){var B="";var A=D.viewport;var C=D.overview;B="/"+A.minY+","+A.minX+","+A.maxY+","+A.maxX;B+="/"+D.wmsZoom;B+="/"+C.minY+","+C.minX+","+C.maxY+","+C.maxX;B+="/"+D.ovWmsZoom;B+="/true";return(B)},reformatResponse:function(C){var D={};var B=C.viewpResp;if(B.copyrightIds.toString()){var E=B.copyrightIds.toString();var A=E.split(" ");D.copyrightIDs=A}else{D.copyrightIDs=""}D.canZoomIn=B.canZoomIn;D.tilesVersion=B.tilesVersion.toString();D.trafficAge=parseInt(B.trafficState["@trafficAge"]);D.trafficModelId=B.trafficState["@trafficModelId"];D.maps=B["@maps"];D.cause=this.cause;return(D)}});TomTom.GetMapLocation=Class.create(TomTom.RestRequest,{initialize:function($super,B){var A={service:"getMapLocation",query:"wbrp/1/mapLocation"};$super(A)},reformatResponse:function(A){var C={};if(A.mapLocationResponse.mapLocation){var B=A.mapLocationResponse.mapLocation;var D={};D.latitude=parseFloat(B.center.latitude);D.longitude=parseFloat(B.center.longitude);mcoord=TomTom.Utils.forwardMercator(D.longitude,D.latitude);D.mercX=parseFloat(mcoord.lon);D.mercY=parseFloat(mcoord.lat);C.coordinate=D;C.height=parseFloat(B["@height"]);C.width=parseFloat(B["@width"])}else{C.version=A.mapLocationResponse["@version"]}return(C)}});TomTom.getTrafficModelRequest=Class.create(TomTom.RestRequest,{initialize:function($super,A){var B={service:"getTrafficModel",query:"traffic/tm/"+this.genParameterString(A.requestParams)};$super(B)},genParameterString:function(D){var B=D.extent;var C=D.viewExtent;var A=D.trafficModelId;return(B.minY+","+B.minX+","+B.maxY+","+B.maxX+"/"+D.zoomLevel+"/"+C.minY+","+C.minX+","+C.maxY+","+C.maxX+"/"+A)},reformatResponse:function(D){var B=D.tm;var N=[];var C=B.poi;if(C){if(typeof C.length=="undefined"){N[0]=C}else{N=C}}for(var H=0,J=N.length;H<J;H++){var L=N[H];var A={};A.position={mercX:L.p.x,mercY:L.p.y};A.iconCategory=L.ic;A.CSz=L.cs;if(L.cs>0){A.clBL={mercX:L.cbl.x,mercY:L.cbl.y};A.clTR={mercX:L.ctr.x,mercY:L.ctr.y};A.length=L.l}var I={};I.cause=L.c;I.countryISOCode=L.cc;I.delay=L.dl;I.description=L.d;I.from=L.f;I.to=L.t;I.length=L.l;I.roadNumber=L.r;I.type=L.ty;A.detail=I;var K=L.s;if(K&&K["@width"]!=-1){A.shape={width:K["@width"],points:[]};var F=K.sp.split(";");for(var G=0,E=F.length;G<E;G++){var M=F[G].split(",");A.shape.points[G]={x:M[0],y:M[1]}}}N[H]=A}return{trafficModelId:B["@id"],trafficPois:N}}});TomTom.TripAdvisorConstants={dayCodes:{today:-1,tomorrow:-2,monday:0,tuesday:1,wednesday:2,thursday:3,friday:4,saturday:5,sunday:6,no_specific:0},routeIQType:{NONE:"IQ_NONE",WEEKDAY:"IQ_WEEKDAY",WEEKEND:"IQ_WEEKEND",VERSION2:"IQ_VERSION2"},timeTypeCodes:{RIGHT_NOW:-2,ANY_TIME:-1}};TomTom.TripAdvisorInfo=Class.create();TomTom.TripAdvisorInfo.deserialize=function(E){var D=E.toQueryParams();var I=D.leave;var B=D.traffic;var G=false;if(B){G=(B=="true")}var F=null;if(I){var A=I.split("@");if(A.length>0){switch(A[0]){case"now_without_traffic":F=this.createNow(false);break;case"now_with_traffic":F=this.createNow(true);break;case"now":F=this.createNow(G);break;case"anytime":F=this.createAnyTime();break;default:if(A.length>1){if(A[0]=="today"){var H=TomTom.FormatHelper;var C=H.timeString2Date(A[1],H.TWENTY_FOUR);F=this.createToday(C,G)}else{F=this.createSpecificDayTime(A[0],A[1])}}break}}}if(!F){F=this.createDefault()}return F};TomTom.TripAdvisorInfo.createDefault=function(){var A=TomTom.Config.defaultTripAdvisorDeparture;var B=null;switch(A){case"now_with_traffic":B=this.createNow(true);break;case"now_without_traffic":B=this.createNow(false);break;case"today":B=new TomTom.TripAdvisorInfo("today",Date.today().getDayName().toLowerCase(),TomTom.FormatHelper.timeForLaterToday(),false);break;case"tomorrow":B=new TomTom.TripAdvisorInfo("tomorrow",Date.tomorrow().getDayName().toLowerCase(),new Date(1976,0,6,12,0,0),false);break;case"other":B=new TomTom.TripAdvisorInfo("other",Date.today().getDayName().toLowerCase(),new Date(),false);break;default:B=this.createNow(true);break}return B};TomTom.TripAdvisorInfo.createNow=function(A){return new TomTom.TripAdvisorInfo("now","today",new Date(),A)};TomTom.TripAdvisorInfo.createToday=function(B,A){TomTom.Utils.setDateToday(B);return new TomTom.TripAdvisorInfo("today","today",B,A)};TomTom.TripAdvisorInfo.createAnyTime=function(){return new TomTom.TripAdvisorInfo("no_specific",Date.today().getDayName().toLowerCase(),new Date(),false)};TomTom.TripAdvisorInfo.createSpecificDayTime=function(C,B){var A=TomTom.FormatHelper;return new TomTom.TripAdvisorInfo("other",C,A.calculateDate(C,A.timeString2Date(B,A.TWENTY_FOUR)),false)};TomTom.TripAdvisorInfo.prototype={departureMoment:"no_specific",departureDay:"tuesday",departureTime:"08:00",iqRouteType:"IQ_WEEKDAY",daySelection:-1,timeSelection:-1,minimiseDelays:false,includeTraffic:false,initialize:function(B,A,E,F){if(!B){return }switch(B){case"now":A="today";E=new Date();break;case"today":A="today";var D=new Date();TomTom.Utils.setDateToday(E);break;default:F=false;break}this.departureMoment=B;if(B!="no_specific"){this.departureDay=A;this.departureTime=TomTom.FormatHelper.formatTime(E,TomTom.FormatHelper.TWENTY_FOUR)}this.iqRouteType=this.getIQRouteType(E);var C=this.dayTimeSelection(this.departureMoment,this.departureDay,E);this.daySelection=C.day;this.timeSelection=C.time;this.includeTraffic=(this.departureMoment=="now"||(this.departureDay=="today"&&TomTom.Utils.isTimeWithinXMinutes(E,30)));this.minimiseDelays=this.includeTraffic&&F},getIQRouteType:function(B){var A=TomTom.TripAdvisorConstants;if(this.departureMoment=="no_specific"){return A.routeIQType.WEEKDAY}else{return A.routeIQType.VERSION2}},dayTimeSelection:function(D,C,E){var A=TomTom.TripAdvisorConstants;var B;var F;if(D=="now"){B=A.dayCodes.today;F=A.timeTypeCodes.RIGHT_NOW}else{if(D=="today"){B=A.dayCodes.today;F=this.minutesFromMidnight(E)}else{if(D=="tomorrow"){B=A.dayCodes.tomorrow;F=this.minutesFromMidnight(E)}else{if(D=="no_specific"){B=A.dayCodes.no_specific;F=A.timeTypeCodes.ANY_TIME}else{B=A.dayCodes[C];F=this.minutesFromMidnight(E)}}}}return{day:B,time:F}},minutesFromMidnight:function(A){return A.getHours()*60+A.getMinutes()},serialize:function(A){var B=(this.minimiseDelays?"true":"false");if(this.departureMoment=="now"){return"leave=now&traffic="+B}else{if(this.departureMoment=="today"){if(A){return"leave=today@"+this.departureTime+"&traffic="+B}return"leave="+Date.today().getDayName().toLowerCase()+"@"+this.departureTime}else{if(this.departureMoment=="tomorrow"){return"leave="+Date.today().add(1).day().getDayName().toLowerCase()+"@"+this.departureTime}else{if(this.departureMoment=="no_specific"){return"leave=anytime"}else{return"leave="+this.departureDay+"@"+this.departureTime}}}}}};TomTom.TripAdvisor=function(){var K,P=TomTom.MessageBus,Y=TomTom.CookieManager,x=TomTom.Config,AG="departure_dropbox_expanded",A=x.defaultTripAdvisorDeparture,AD=[{id:"now",name:"",color:""},{id:"today",name:"",color:""},{id:"tomorrow",name:"",color:""},{id:"other",name:"",color:""},{id:"no_specific",name:"",color:""}],u=0,e=1,O=2,M=3,W=4,AM="day_dropbox_expanded",AL=Date.today().getDayName().toLowerCase(),AQ=[{id:"today",name:"",color:"",label:""},{id:"monday",name:"",color:"",label:""},{id:"tuesday",name:"",color:"",label:""},{id:"wednesday",name:"",color:"",label:""},{id:"thursday",name:"",color:"",label:""},{id:"friday",name:"",color:"",label:""},{id:"saturday",name:"",color:"",label:""},{id:"sunday",name:"",color:"",label:""}],z=[{id:"cal_today.content",text:""},{id:"cal_monday.content",text:""},{id:"cal_tuesday.content",text:""},{id:"cal_wednesday.content",text:""},{id:"cal_thursday.content",text:""},{id:"cal_friday.content",text:""},{id:"cal_saturday.content",text:""},{id:"cal_sunday.content",text:""},{id:"time.type",text:"24"},{id:"tripAdvisor_rightnow.content",text:""},{id:"tripAdvisor_today.content",text:""},{id:"tripAdvisor_tomorrow.content",text:""},{id:"tripAdvisor_otherdatetime.content",text:""},{id:"tripAdvisor_nospecificdaytime.content",text:""},{id:"tripAdvisor_contexthelp_title.content",text:""},{id:"tripAdvisor_contexthelp_body1.content",text:""},{id:"tripAdvisor_contexthelp_body2.content",text:""},{id:"day_today.content",text:"today"},{id:"day_tomorrow.content",text:"tomorrow"},{id:"day_monday.content",text:"Monday"},{id:"day_tuesday.content",text:"Tuesday"},{id:"day_wednesday.content",text:"Wednesday"},{id:"day_thursday.content",text:"Thursday"},{id:"day_friday.content",text:"Friday"},{id:"day_saturday.content",text:"Saturday"},{id:"day_sunday.content",text:"Sunday"},{id:"learn_more.content",text:"Learn more..."},{id:"close_text.content",text:"Close"},{id:"leavenow_text.content",text:"Leave now"},{id:"minimise_traffic_delays.content",text:""},{id:"minimise_traffic_delays_body1.content",text:""}],v="time_dropbox_expanded",a="time_selection",AS="time_selection_link",AE="time_input_arrow",AO=null,B="",AR=30,S=$("route_planner_content"),N=$("tripAdvisor_container"),h=$("time_dropbox_collapsed"),c=$("cb_avoid_traffic_link"),AK=$("cb_avoid_traffic"),AP=$("cb_avoid_traffic_disabled"),Q=$("tripAdvisor_leaving_help"),AF=null,l=function(){A=x.defaultTripAdvisorDeparture;switch(A){case"now_with_traffic":AT(AD[u]);X(true);break;case"now_without_traffic":AT(AD[u]);X(false);break;case"today":AT(AD[e]);break;case"tomorrow":AT(AD[O]);break;case"other":AT(AD[M]);break;default:AT(AD[M]);break}},y=function(AW){var AV=AQ.length;for(var AX=0;AX<AV;AX++){if(AQ[AX].id==AW){return AQ[AX]}}},AT=function(AW){var AV=TomTom.FormatHelper;A=AW.id;if(AW.name&&AW.name!=""){departureDropbox.setOption(AW)}switch(AW.id){case"now":X(true);F(AV.formatTime(new Date(),AJ()));f(y("today"));d(false);break;case"today":X(false);d(true);f(y("today"));F(AV.parseTimeForLaterToday(AJ()));H();break;case"tomorrow":X(false);d(true);f(y(Date.today().add(1).day().getDayName().toLowerCase()));F(AV.formatTime(new Date(1976,0,6,12,0,0),AJ()));H();break;case"no_specific":X(false);d(false);AL=null;break;default:X(false);d(true);f(y(Date.today().getDayName().toLowerCase()));break}},X=function(AV){if(AV){AK.show();AP.hide();c.addClassName("checked")}else{c.removeClassName("checked");AK.hide();AP.show()}},I=function(){c.className="checked"},d=function(AV){if(AV){dayDropbox.enable();timeDropbox.enable()}else{dayDropbox.disable();timeDropbox.disable()}},f=function(AW){AL=AW.id;var AY=(AL=="today");var AV=Date.today().add(1).day();var AX=(AV.getDayName().toLowerCase()==AL.toLowerCase());if(((A=="today"||A=="now")&&!AY)||(A=="tomorrow"&&!AX)){AT(AD[M])}else{if(A=="other"&&AL=="today"){AT(AD[e])}}if(AY){if(A=="today"){F(TomTom.FormatHelper.parseTimeForLaterToday(AJ()))}else{if(G().compareTo(new Date())==-1){AN()}}}H();if(AW.name&&AW.name!=""){dayDropbox.setOption(AW)}},AN=function(){F(TomTom.FormatHelper.formatTime(new Date(),AJ()));H()},AJ=function(){var AV=C("time.type");if(AV==null){AV=TomTom.FormatHelper.TWENTY_FOUR}return AV},R=function(AV,Ab){var Ac=TomTom.FormatHelper;var AW=AR;var AY=Ac.timeString2Date(AV,AJ());if(!AY){AY=new Date()}var Aa=U(AY.getMinutes()+"","0",2);var Ad=U(AY.getHours()+"","0",2);var Ae,Af;if(AJ()==Ac.TWELVE){Af=J(AY);if(AY.getHours()<12){Ae=" "+Ac.AM}else{Ae=" "+Ac.PM}}else{Ae="";Af=AY.getHours()}Ad=U(Af+"","0",2);if(AY.getMinutes()%AW!=0){var AZ=(Math.floor(AY.getMinutes()/AW)*AW)+AW;Aa=AZ+"";if(AZ==60){AZ=0;Aa="00";if(AJ()==Ac.TWELVE){Af=Af+1;if(Af==13){Af="01"}if(Af==12){if(AY.getHours()<12){Ae=" "+Ac.PM}else{Ae=" "+Ac.AM}}}else{Af=AY.getHours()+1;if(Af==24){Af="00"}}Ad=U(Af+"","0",2)}}AV=Ad+":"+Aa+Ae;var Ag;if(Ab!=null){Ag=Ab}else{Ag=j()}var AX=Z(Ag,AV);if(AX!=null){return AX.id}return 0},J=function(AW){var AV=AW.getHours();if(AV==0){return 12}else{if(AV>12){return AV-12}}return AV},U=function(AV,AX,AW){while(AV.length<AW){AV=AX+AV}return AV},Z=function(AW,AX){for(var AV=0;AV<AW.length;AV++){if(AW[AV].name==AX){return AW[AV]}}return null},V=function(AV){if(A=="now"){AT(AD[M])}F(j()[AV.id].name)},F=function(AV){if(AV!=B){P.publish("tripadvisorchanged")}AO.value=AV;B=AV},j=function(){var AV=TomTom.FormatHelper;var Aa;if(AJ()==TomTom.FormatHelper.TWELVE){Aa=AU(12,12," "+AV.AM,0);Aa=Aa.concat(AU(1,11," "+AV.AM,2));Aa=Aa.concat(AU(12,12," "+AV.PM,24));Aa=Aa.concat(AU(1,11," "+AV.PM,26))}else{Aa=AU(0,23,"",0)}if(AL=="today"){var AW=AV.formatTime(new Date(),AJ());var Ab=R(AW,Aa);var AZ=new Array(Aa.length-Ab);for(var AX=Ab;AX<Aa.length;AX++){var AY=Aa[AX];AY.id=AX-Ab;AZ[AX-Ab]=AY}return AZ}return Aa},AU=function(AY,Ae,Ag,Ah){var AX=AR;var AW=(Ae-AY+1)*(60/AX);var Af=new Array(AW);var Ad=0;for(var Ac=AY;Ac<=Ae;Ac++){var Aa=U(Ac+"","0",2);for(var Ab=0;Ab<60;Ab=Ab+AX){var AZ=U(Ab+"","0",2);var AV=Aa+":"+AZ+Ag;Af[Ad]={id:Ad+Ah,name:AV,color:""};Ad++}}return Af},AI=function(AX){var AV=G();var AW=new TomTom.TripAdvisorInfo(A,AL,AV,n());AX.iqRouteType=AW.iqRouteType;AX.departureTime=T();AX.daySelection=AW.daySelection;AX.timeSelection=AW.timeSelection;AX.minimiseDelays=AW.minimiseDelays;AX.includeTraffic=AW.includeTraffic;P.publish("tripadvisorrequestparamsprepared",AX)},G=function(){var AV=TomTom.TripAdvisorConstants;var AW=TomTom.FormatHelper;if(A=="now"){return new Date()}else{if(A=="today"){return AW.calculateDate(AV.dayCodes.today,T())}else{if(A=="tomorrow"){return AW.calculateDate(AV.dayCodes.tomorrow,T())}else{if(A=="no_specific"){return AW.calculateDate(AV.dayCodes.no_specific)}else{return AW.calculateDate(AL,T())}}}}},p=function(){var AV=G();var AW=new TomTom.TripAdvisorInfo(A,AL,AV,n());P.wbrpState.tripAdvisorInfo=AW},n=function(){return c.hasClassName("checked")},b=function(AV){if(AV==true){c.addClassName("checked")}else{c.removeClassName("checked")}},AA=function(AW){var AV=TomTom.FormatHelper;AT(k(AD,AW.departureMoment));if(AW.departureMoment=="other"){f(k(AQ,AW.departureDay));F(AV.formatTime(AV.timeString2Date(AW.departureTime,AV.TWENTY_FOUR),AJ()))}b(AW.minimiseDelays)},AC=function(AW){var AV=TomTom.FormatHelper;if(AL=="today"){return AV.parseTimeForToday(AW,AJ())}else{return AV.parseTimeForAnyDay(AW,AJ())}},D=function(AW){var AV=AC(AW);F(AV);L(AV);H()},H=function(){var AV=R(AO.value);timeDropbox.setOption(j()[AV])},L=function(AW){var AV=TomTom.FormatHelper;if(!AW){AW=AO.value}if(A=="today"&&AV.timeString2Date(AW,AJ())&&AV.timeString2Date(AW,AJ()).compareTo(new Date())==-1){AN()}},k=function(AW,AY){for(var AX=0,AV=AW.length;AX<AV;AX++){if(AW[AX].id==AY){return AW[AX]}}return null},E=function(AV){var AX=P.wbrpState;var AW=new TomTom.RouteSummary(AV,AX.tripAdvisorInfo);AX.tripAdvisorSummary=AW},AH=function(AW){var AV=AW.width;dropBoxWidth=(AV==null)?dropBoxWidth:AV-5;if(departureDropbox){departureDropbox.resize(dropBoxWidth)}},w=function(){if(A=="today"){var AV=new Date();if(AV.addMinutes(30).compareTo(T())>=0){return true}else{return false}}},AB=function(){S.onclick=function(Ac){return true};var AW=C("leavenow_text.content");var Aa='<span id="minimise_traffic_delays">'+C("minimise_traffic_delays.content")+"</span>";var AY='<span id="minimise_traffic_delays_body1"> '+C("minimise_traffic_delays_body1.content")+"</span>";var AV="<table style='width:101%;padding:0px;line-height:12px;' border='0'><tr><td><span><span style='float: left; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;line-height: 0px; padding-top: 2px; '></span>"+AY+"</span></td></tr></table>";var Ab=Position.cumulativeOffset($("cb_avoid_traffic_disabled"));var AZ=departureDropbox.topOffset()+11;AZ=isIE6?AZ-6:AZ;var AX=TomTom.Utils.createLeaveCloseBalloon({x:Ab[0]-25,y:Ab[1]+AZ},Aa,AV,AW,null,null,{top:"ptrleft",bottom:"noptr"},"tripadvisor");AX.callback=function(){$("route_planner_content").onclick=function(Ac){P.publish("clearpopup")}};AX.id="tripAdvisor_traffic_info";P.publish("popup",AX)},C=function(AV){return TomTom.Utils.getText(z,AV)},q=function(){if($(AG)){$(AG).hide()}AD=[{id:"now",name:C("tripAdvisor_rightnow.content"),color:""},{id:"today",name:C("tripAdvisor_today.content"),color:""},{id:"tomorrow",name:C("tripAdvisor_tomorrow.content"),color:""},{id:"other",name:C("tripAdvisor_otherdatetime.content"),color:""},{id:"no_specific",name:C("tripAdvisor_nospecificdaytime.content"),color:""}];if($(AM)){$(AM).hide()}AQ=[{id:"today",name:C("cal_today.content"),color:"",label:C("day_today.content")},{id:"monday",name:C("cal_monday.content"),color:"",label:C("day_monday.content")},{id:"tuesday",name:C("cal_tuesday.content"),color:"",label:C("day_tuesday.content")},{id:"wednesday",name:C("cal_wednesday.content"),color:"",label:C("day_wednesday.content")},{id:"thursday",name:C("cal_thursday.content"),color:"",label:C("day_thursday.content")},{id:"friday",name:C("cal_friday.content"),color:"",label:C("day_friday.content")},{id:"saturday",name:C("cal_saturday.content"),color:"",label:C("day_saturday.content")},{id:"sunday",name:C("cal_sunday.content"),color:"",label:C("day_sunday.content")}]},t=function(AV){TomTom.Utils.updateTexts(z,AV)},T=function(){return TomTom.FormatHelper.timeString2Date(AO.value,AJ())},g=function(){var Ae="http://www.tomtom.com/whytomtom/topic.php?topic=5&subject=3&Lid="+x.tomtomLocales[P.wbrpState.locale];S.onclick=function(Af){return true};var Ad='<span id="tripAdvisor_contexthelp_title">'+C("tripAdvisor_contexthelp_title.content")+"</span>";var AY='<span id="tripAdvisor_contexthelp_body1">'+C("tripAdvisor_contexthelp_body1.content")+"</span>";var AX='<span id="tripAdvisor_contexthelp_body2">'+C("tripAdvisor_contexthelp_body2.content")+"</span>";var Aa="<table style='width:101%;padding:0px;line-height:12px;' border='0'><tr><td><span><span style='float: left; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;line-height: 0px; padding-top: 2px; padding-right: 10px;'><img style='width:35px;height:35px;' src='"+x.staticDir+"/images/icon_iqroutes.png'/></span>"+AY+"<span><br><br>"+AX+"</span></span><div id='toolbar_menu' style='margin-left:0px;height:36px;'><div class='left'><li><a  style='color:#00AEEF;text-decoration: underline;' target='_blank' href='"+Ae+'\'><span id="learn_more">'+C("learn_more.content")+"</span></a></li></div></td></tr></table>";var Ac=Position.cumulativeOffset(Q);var AW=Ac[0];if(Prototype.Browser.IE){AW=Q.getBoundingClientRect().left}var AZ=departureDropbox.topOffset()+11;AZ=isIE6?AZ-6:AZ;var AV=(Prototype.Browser.IE)?-220:-218;var Ab=TomTom.Utils.createInfoBalloon({x:AW+AV,y:Ac[1]+AZ},Ad,Aa,null,null,{top:"ptrright",bottom:"noptr"},"tripadvisor");Ab.callback=function(){$("route_planner_content").onclick=function(Af){P.publish("clearpopup")}};Ab.id="tripAdvisor_help";P.publish("popup",Ab)},m=function(){q();var AV=Prototype.Browser.IE?200:210;departureDropbox=new TomTom.Dropbox("departure",function(){return AD},K,false,AV,AD.length*24,false,true);dayDropbox=new TomTom.Dropbox("day",function(){return AQ},K,false,120,AQ.length*24,false,true);timeDropbox=new TomTom.Dropbox("time",j,K,true,82,191,false,false)};K={initialize:function(){m();P.subscribe(["restoretripadvisorstate","requesttripadvisorstate","afterload","tripadvisorrequest","i18nupdated","timeBoxUpdated","afterplanroute","planrouteclick","balloonleavenow","planroutestandardsearchclick","resizedropboxes"],this);AO=$("time_input");AO.onblur=function(){P.publish("timeBoxUpdated",AO.value)}.bind(this);AO.onkeyup=function(){var AV=AC(AO.value);var AW=R(AV);if(AW!=null){timeDropbox.scrollToSelectedOptionIndex(AW)}}.bind(this);S.onclick=function(AV){P.publish("clearpopup");return false};c.onclick=TomTom.Utils.switchCheckbox;AP.onclick=AB;l();Event.observe($("trip_advisor_help"),"click",g)},notified:function(AV,AW){switch(AV){case"afterload":if(AO.value==""||AO.value==null){AN()}break;case"setdeparture_dropbox":AT(AW);P.publish("tripadvisorchanged");break;case"setday_dropbox":f(AW);P.publish("tripadvisorchanged");break;case"settime_dropbox":V(AW);X(w());P.publish("tripadvisorchanged");break;case"tripadvisorrequest":L();AI(AW);break;case"requesttripadvisorstate":p();break;case"restoretripadvisorstate":AA(AW);break;case"i18nupdated":t(AW);q();departureDropbox.setOptions(function(){return AD},{id:A});dayDropbox.setOptions(function(){return AQ},{id:AL});var AX=P.wbrpState.locale=="pl"?100:120;dayDropbox.resize(AX);AO.value=TomTom.FormatHelper.formatTimeString(B,AJ());if(AF==null){AF=Y.getField(Y.defaultCookieName,"tt_help");if(AF==null){if($("planRoute").className=="routeActiveTab"){g();Y.setField(Y.defaultCookieName,"tt_help","false")}}}break;case"timeBoxUpdated":D(AW);X(w());break;case"afterplanroute":E(AW);break;case"planrouteclick":L();break;case"planroutestandardsearchclick":departureDropbox.setScrollableContainer(null);dayDropbox.setScrollableContainer(null);timeDropbox.setScrollableContainer(null);break;case"resizedropboxes":AH(AW);break;case"balloonleavenow":P.publish("setdeparture_dropbox",AD[u]);I();P.publish("clearpopup");break;default:break}}};return K}();TomTom.Toolbar=function(){var O=TomTom.MessageBus,W=TomTom.CookieManager,T=[{id:"legend_minor_delays.content",evtid:null,text:""},{id:"legend_moderate_delays.content",evtid:null,text:""},{id:"legend_major_delays.content",evtid:null,text:""},{id:"legend_unknown_delays.content",evtid:null,text:""},{id:"legend_traffic_jam.content",evtid:null,text:""},{id:"legend_accident.content",evtid:null,text:""},{id:"legend_lane_closed.content",evtid:null,text:""},{id:"legend_road_construction.content",evtid:null,text:""},{id:"legend_multiple_incidents.content",evtid:null,text:""},{id:"legend_view_full_legend.content",evtid:null,text:""},{id:"home_button_tooltip.content",evtid:"home_tip",text:""},{id:"home_marker_tooltip.content",evtid:"home_marker_tip",text:""},{id:"close_text.content",evtid:"close_text",text:""},{id:"no_cookie_support.content",evtid:"no_cookies",text:""},{id:"no_home_location_set.content",evtid:"no_home_loc",text:""},{id:"no_home_location_set_title.content",evtid:"no_home_loc_title",text:""},{id:"film_text.content",evtid:null,text:""},{id:"home_link_text.content",evtid:null,text:""},{id:"link_to_this_page_text.content",evtid:"link_to_this_page_text",text:""}],X=$("link_to_this_map_view"),N=$("legend_link"),C=$("home_link"),B=$("view_traffic_info_update_text"),R=$("view_traffic_info_text"),e=$("view_traffic_info"),V=$("print"),H=$("link2mapview"),Y={},Q={size:new OpenLayers.Size(40,55),offset:new OpenLayers.Pixel(-15,-45),url:TomTom.Config.staticDir+"/images/HomeLocationMarker.png",alphaNeeded:true,zIndex:-999},U=function(){e.onclick=function(){e.blur();O.publish("trafficstatechanged");return false};R.removeClassName("disabled");e.removeClassName("disabled")},P=function(h){e.onclick=function(){e.blur();return false};R.addClassName("disabled");if(h){e.addClassName("disabled")}},g=function(h){if(h.isEnabled){U()}else{P(h.isOn)}},Z=function(h){B.innerHTML=h},M=function(h){if(h==null){if(e.hasClassName("checked")){e.removeClassName("checked")}else{e.addClassName("checked")}}else{if(h){e.addClassName("checked")}else{e.removeClassName("checked")}}},E=function(){var m='<span id="link_to_this_page_text">'+D("link_to_this_page_text")+"</span>";var l=window.location.protocol+"//"+window.location.host+O.wbrpState.serialize();var n=navigator.appName;var k=n=="Microsoft Internet Explorer"?"block":"none";var j="<div id='infoballoon_body_link'>"+m+"<div class='form'><div class='input_div'><span class='input_left'></span><span class='input_middle'><input id='link2mapview' type='text' value = '"+TomTom.Utils.protectString(l)+"'/></span><span class='input_right'></span></div></div>  <div id='toolbar_menu' style='margin-left:0px;height:36px;display:"+k+";'>    <div class='left'>      <li>        <a style='color:#00AEEF;text-decoration: underline;' onclick='TomTom.MessageBus.publish(\"addToFavourites\");return false;' href='#'>Add this page to my favourites</a>      </li>    </div>  </div></div>";if(Prototype.Browser.WebKit&&navigator.userAgent.indexOf("Version/2")>-1){tt="<br>"+m+"<br><br>"}var h=110;if(Prototype.Browser.IE){h=163}if(isIE6){h=148}S("link",X,null,j,null,h);setTimeout(function(){if($("link2mapview")){var p=$("link2mapview");p.onmouseover=function(q){document.oncontextmenu=function(t){return true}};p.onmouseout=function(q){document.oncontextmenu=function(t){return false}};p.onclick=function(q){select()};p.select()}},300)},S=function(p,l,m,j,k,h){var n=l.cumulativeOffset();Y=TomTom.Utils.createInfoBalloon({x:n.left,y:n.top},m,j,k,h);Y.id=p;O.publish("popup",Y)},L=function(){var h=$("link2mapview").value;if(window.sidebar){}else{if(window.external){O.publish("sitestat","bookmark");window.external.AddFavorite(h,document.title)}}O.publish("clearpopup")},F=function(){var j=O.wbrpState.serializeWithBBox();var h=TomTom.Config.staticDir+"/print"+j;var k=window.open(h,"TomTomRoutesPrint");if(window.focus){k.focus()}return false},a=function(){N.blur();var l=TomTom.Config.lbsStaticDir+"/images/traffic/";var j=T;var k='<div style="margin: 10px 5px 0 5px;"><table border="0" cellpadding="0" cellspacing="05"><tr><td align="center" valign="middle"><img src="'+l+'t_01_minor.gif" alt="tube minor" width="25" height="12" hspace="10" vspace="2" /> </td><td valign="middle">'+j[0].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'t_02_moderate.gif" alt="tube moderate" width="25" height="12" vspace="2" hspace="10"/></td><td valign="middle">'+j[1].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'t_03_major.gif" alt="tube major" width="25" height="12" hspace="10" vspace="2" /></td><td valign="middle">'+j[2].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'t_04_unknown.gif" alt="tube unknown" width="25" height="12" hspace="10" vspace="2" /></td><td valign="middle">'+j[3].text+'</td></tr><tr><td align="center" valign="middle">&nbsp;</td><td valign="middle">&nbsp;</td></tr><tr><td align="center" valign="middle"><img src="'+l+'traffic-06.gif" alt="traffic jam" width="20" height="20" />              </td><td valign="middle">'+j[4].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'traffic-01.gif" alt="accident" width="20" height="20" /></td><td valign="middle">'+j[5].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'traffic-07.gif" alt="lane closed" width="20" height="20" />              </td><td valign="middle">'+j[6].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'traffic-09.gif" width="20" height="20" /></td><td valign="middle">'+j[7].text+'</td></tr><tr><td align="center" valign="middle"><img src="'+l+'traffic-13.gif" width="26" height="26" /></td><td valign="middle">'+j[8].text+'</td></tr><tr><td align="center" valign="middle">&nbsp;</td><td valign="middle"><a href="'+TomTom.Config.staticDir+'/help/legend" target="_blank">'+j[9].text+"</a></td></tr></table></div>";var h=375;if(Prototype.Browser.IE){h=363}if(isIE6){h=342}S("legend",N,null,k,null,h);return false},J=function(){C.blur();var h=true;if(!W.accept()){var k=D("no_cookies");h=false}else{if(!W.hasHomeSet()){var k=D("no_home_loc");var j=D("no_home_loc_title");h=false}}if(h){G()}else{S("home",C,j,k,null,120)}return false},G=function(){var j=W.hasHomeSet();if(j){O.publish("clearhomemarker");var h=j.evalJSON();O.publish("setcenter",new TomTom.Map.SetCenterData(h,h.zoom,{forceCenter:true}));d(h);O.publish("homeset",h);O.publish("popup",TomTom.ContextMenu.locationInfoBalloon(h,h.formattedAddress,{latitude:h.coordinate.mercY,longitude:h.coordinate.mercX},{type:"homemarker"},[]))}},K=function(){if(O.wbrpState.action=="homeset"){O.publish("clearlocationmarker");O.publish("clearroute");if(O.wbrpState.home){var h=O.wbrpState.home;O.publish("setcenter",new TomTom.Map.SetCenterData(h,h.zoom,{forceCenter:true}));d(h)}}},I=function(){W.removeField(W.defaultCookieName,W.homeField)},A=function(h){if(h!=null){var j=h.location,l=j.coordinate,k=TomTom.Utils.forwardMercator(l.longitude,l.latitude);if(l.mercX==null){l.mercX=k.lon}if(l.mercY==null){l.mercY=k.lat}if($(h.titleId).innerHTML!=null){j.formattedAddress=$(h.titleId).innerHTML}W.setField(W.defaultCookieName,W.homeField,Object.toJSON(j));if(!j.rightClick){O.publish("clearlocationmarker")}d(j)}},b=function(){var j=W.hasHomeSet();if(j){var h=j.evalJSON();d(h)}},d=function(h){var j=h.coordinate;O.publish("clearhomemarker");O.publish("registermarker",{icon:Object.clone(Q),name:"home",location:{latitude:j.mercY,longitude:j.mercX},callback:function(k,l,m,n){return c(h,k)},iconDivId:TomTom.Config.Icons.home})},c=function(h,j){return TomTom.ContextMenu.locationInfoBalloon(h,h.formattedAddress,j,{type:"homemarker"},["home"])},D=function(h){return TomTom.Utils.getText(T,h)},f=function(h){TomTom.Utils.updateTexts(T,h)};return{initialize:function(){O.subscribe(["updatetrafficinfostyle","updatetrafficinfotext","statechanged","i18nupdated","addToFavourites","sethomelocation","clearhomelocation","gohome","mapchanged","trafficstatechanged","tripadvisorrequestparamsprepared"],this);X.onclick=function(){O.publish("sitestat","link_to_this_page");E();return false};Event.observe(V,"click",F);Event.observe(N,"click",a);Event.observe(C,"click",J);U();var h=TomTom.Config.staticDir+"/images/";Q={size:new OpenLayers.Size(40,55),offset:new OpenLayers.Pixel(-15,-45),url:h+"HomeLocationMarker.png",zIndex:-999,alphaNeeded:true};Y.delay=0;linkToThisMapViewBgImg=h+"blank.gif";legendBgImg=h+"balloon_legend.gif";homeBgImg=h+"blank.gif"},notified:function(h,j){switch(h){case"i18nupdated":f(j);break;case"addToFavourites":L();break;case"sethomelocation":A(j);break;case"clearhomelocation":I();break;case"gohome":G();break;case"statechanged":K();break;case"updatetrafficinfostyle":g(j);break;case"updatetrafficinfotext":Z(j.text);break;case"mapchanged":b();break;case"trafficstatechanged":M(j);break;case"tripadvisorrequestparamsprepared":M(j.includeTraffic);break;default:break}}}}();TomTom.ContextMenu=function(){var J,M=TomTom.MessageBus,X=null,W="popup_title",E=null,h=null,R=null,j=0,O=null,A=[{id:"contextmenu_title.content",evtid:"title",text:""},{id:"contextmenu_start.content",evtid:"start",text:""},{id:"contextmenu_end.content",evtid:"finish",text:""},{id:"contextmenu_set_home_location.content",evtid:"set_home",text:""},{id:"contextmenu_clear_home_location.content",evtid:"clear_home",text:""},{id:"contextmenu_sendtodevice.content",evtid:"sendtodevice",text:""},{id:"contextmenu_zoomin.content",evtid:"zoomin",text:""},{id:"contextmenu_zoomout.content",evtid:"zoomout",text:""}],g=function(){U();if(M.wbrpState.map!=null){X=M.wbrpState.map;X.events.register("mousedown",this,function(n){I(n)})}},U=function(){document.oncontextmenu=function(n){S(n);return false}},S=function(n){if(Prototype.Browser.IE){if(h!=null){if(!n){n=window.event}if(j==2){c(n)}else{if(j==1){j++}}}}},e=function(){document.oncontextmenu=function(n){S(n);return true}},I=function(n){U();X.div.style.cursor="";j++;if(h==null){n=n?n:window.event;targetId=n.target?n.target.id:n.srcElement.id;O={x:n.pointerX(),y:n.pointerY()};if(n.target){if(n.target.id==TomTom.Config.Icons.home||(n.target.parentNode&&n.target.parentNode.id==TomTom.Config.Icons.home)){targetId=TomTom.Config.Icons.home}}else{if(n.srcElement.id==TomTom.Config.Icons.home||(n.srcElement.parentNode&&n.srcElement.parentNode.id==TomTom.Config.Icons.home)){targetId=TomTom.Config.Icons.home}}h=setTimeout(function(){h=null;var p=[];if(targetId==TomTom.Config.Icons.home){p=["home"]}var q=b(n,p);q.id=new Date().getTime();q.callback=k;M.publish("popup",q);j=0;return false},500)}else{c(n)}OpenLayers.Event.stop(n);return false},k=function(){if(M.wbrpState.reverseGeocodeLocation){var p=M.wbrpState.reverseGeocodeLocation;var n=$(W);if(p.street!=null&&p.city!=null&&n){n.innerHTML=p.street+", "+p.city+(p.countryCode?", "+p.countryCode:"")}}},c=function(n){clearTimeout(h);h=null;j=0;if(n.xy){var p=n.xy;if(!p){return }var t=F(p)}else{var t=F(new OpenLayers.Pixel(n.clientX,n.clientY))}var q=P();q=(q==0)?0:q-1;M.publish("setcenter",new TomTom.Map.SetCenterData.fromLonLat(t.lon,t.lat,q,{animated:true}))},F=function(n){var p=null;if(X!=null&&X.baseLayer!=null){p=X.baseLayer.getLonLatFromViewPortPx(n);var q=TomTom.Utils.inverseMercator(p.lon,p.lat);K(q)}return p},P=function(){var n=null;if(X!=null&&X.baseLayer!=null){n=X.getZoom()}return n},K=function(n){M.wbrpState.reverseGeocodeLocation=null;new TomTom.ReverseGeocodeRequest({coord:n.lat+","+n.lon})},b=function(w,p){var u=w.xy;if(!u){return }var n=new OpenLayers.Pixel(u.x,u.y);var v=F(n);var t=new Object();var q=TomTom.Utils.inverseMercator(v.lon,v.lat);t.coordinate=new Object();t.coordinate.latitude=q.lat;t.coordinate.longitude=q.lon;t.coordinate.mercY=v.lat;t.coordinate.mercX=v.lon;t.formattedAddress=TomTom.Utils.formatLonLat(q);t.rightClick=true;return J.locationInfoBalloon(t,t.formattedAddress,O,{type:"mapclick"},p)},H=function(n,q,p,t,u){return V(n,q,p,t,u,"start")},f=function(n,q,p,t,u){return V(n,q,p,t,u,"finish")},V=function(n,q,p,t,v,u){n+="<div id='cm_"+u+"here' class=\"option"+t+"\">   <div class='left'>       <li><a ";var w=(u=="start")?"departure":"destination";n=G(p,n,'           onclick=\'               TomTom.MessageBus.publish("findLocationPopUpLinkClicked",                   {"target":"'+w+'","location":'+N(Object.toJSON(q))+'                   ,"titleId":"'+W+'"                   ,"source":'+Object.toJSON(v)+'});               TomTom.MessageBus.publish("clearpopup");return false;\'');n+=" href='javascript:;'>           <span>"+C(u)+"</span>           </a></li>   </div></div>";return n},Y=function(n,q,p,t){n+="<div id='cm_home' class=\"option home"+t+"\">	<div class='left'>		<li><a onclick='TomTom.MessageBus.publish(\"clearhomemarker\");";if(p){n+='TomTom.MessageBus.publish("sethomelocation",					{"location":'+N(Object.toJSON(q))+',"titleId":"'+W+'"});'}else{n+='TomTom.MessageBus.publish("clearhomelocation");'}n+='TomTom.MessageBus.publish("clearpopup");return false;\'';var u=p?"set_home":"clear_home";n+=' href="javascript:;"><span>'+C(u)+"</span></a></li></div></div>";return n},m=function(n,q,p,t){n=n+"<div id='cm_sendtodevice' class=\"option"+t+"\">	<div class='left'>	<li><a ";n=G(p,n,"onclick='TomTom.MessageBus.publish(\"clearpopup\");' href='"+TomTom.Oasis.sendLocationLink(q)+"' target='_blank'");n+="><span>"+C("sendtodevice")+"</span></a>	</li>	</div></div>";return n},Q=function(n,q,p,u,t){return B(n,q,p,u,t,"in")},L=function(n,q,p,u,t){return B(n,q,p,u,t,"out")},B=function(n,q,p,v,t,u){n+="<div id='cm_zoom"+u+"' class=\"option"+t+"\">   <div class='left'>       <li><a ";n=G(p,n,"           onclick='TomTom.MessageBus.publish(\"contextmenuzoom"+u+'",                    { "location":'+N(Object.toJSON(q))+'                   ,"source":'+Object.toJSON(v)+'});               TomTom.MessageBus.publish("clearpopup");return false;\'');n+=" href='javascript:;'>           <span>"+C("zoom"+u)+"</span>           </a></li>   </div></div>";return n},Z=function(p,n){return p.indexOf(n)!=-1},G=function(q,n,p){if(q){n+=p}return n},N=function(n){return TomTom.Utils.protectString(n)},C=function(n){return TomTom.Utils.getText(A,n)},d=function(n){TomTom.Utils.updateTexts(A,n)},a=function(n){n.x+=15;if(!window.XMLHttpRequest){n.x+=9}n.y+=84;var q=($("map").getHeight()-n.y<0);var p=($("map").getWidth()-n.x<134);n.top=q;if(p){n.x-=149}if(q){n.y-=81}if(q&&!window.XMLHttpRequest){n.y+=2}return TomTom.Config.staticDir+"/images/context_routeonly_balloon_"+(q?"t":"b")+(p?"l":"r")+".gif"},T=function(n){if(n.lon){return new OpenLayers.LonLat(n.lon,n.lat)}else{return new OpenLayers.LonLat(n.coordinate.mercX,n.coordinate.mercY)}},l=function(n,t,p){M.publish("setcenter",new TomTom.Map.SetCenterData(n,X.getZoom()+p,{animated:true}));var q=T(n);D(t,q)},D=function(p,n){if(p.type=="instructionclick"&&!X.getExtent().containsLonLat(n)){X.setCenter(n);M.publish("instructionshown",p.index)}};J={initialize:function(){M.subscribe(["disablecontextmenu","enablecontextmenu","maploaded","rightclicked","i18nupdated","reverseGeocodeOk","contextmenuzoomin","contextmenuzoomout"],this)},notified:function(n,p){switch(n){case"maploaded":g();break;case"i18nupdated":d(p);break;case"reverseGeocodeOk":M.wbrpState.country=p.country;M.wbrpState.reverseGeocodeLocation=p;k();break;case"contextmenuzoomin":l(p.location,p.source,1);break;case"contextmenuzoomout":l(p.location,p.source,-1);break;case"disablecontextmenu":U();break;case"enablecontextmenu":e();break;default:break}},locationInfoBalloon:function(AA,y,z,n,p){var q=new Object();q.starthere="";q.finishhere="";q.home="";q.sendtodevice="";q.zoomin="";q.zoomout="";if(!p){p=[]}var AB=P();if(AB!=null){AA.zoom=AB}else{AB=AA.zoom}if(AB==TomTom.Config.Map.Resolutions.length-1){p.push("zoomin")}if(AB==0){p.push("zoomout")}for(var t=0;t<p.length;t++){if(p[t]=="home"){q[p[t]]+=" clear"}else{q[p[t]]+=" disabled"}}var w="";w=H(w,AA,!Z(p,"starthere"),q.starthere,n);w=f(w,AA,!Z(p,"finishhere"),q.finishhere,n);w+='<div class="line"></div> ';w=Y(w,AA,!Z(p,"home"),q.home);w=m(w,AA,!Z(p,"sendtodevice"),q.sendtodevice);w+='<div class="line"></div> ';w=Q(w,AA,!Z(p,"zoomin"),n,q.zoomin);w=L(w,AA,!Z(p,"zoomout"),n,q.zoomout);var v=200;var x=TomTom.Utils.createInfoBalloon({x:0,y:0},y,w,"contextmenu");var u="<div id='temp_node' style='position:absolute;left:50px;top:20px;z-index:99999;display:none'>"+x.text+"</div>";$("map_canvas").insert(u);v=$("temp_node").getHeight();$("temp_node").remove();return TomTom.Utils.createInfoBalloon(z,y,w,"contextmenu",v)}};return J}();TomTom.CookieManager={wbrpLocaleCookie:"wbrplocale",tomtomLocaleCookie:"tt_locale",defaultCookieName:"WBRPPrefs",defaultDelimeter:"&",homeField:"tt_home",uiField:"ui",preferredUnitsField:"pu",defaultPath:"/",prefsPath:TomTom.Config.wbrpContextRoot,defaultExpiry:30,set:function(C,D,B,E){var A="";if(!B){B=this.defaultExpiry}if(!E){E=this.defaultPath}var F=new Date();F.setTime(F.getTime()+(86400000*parseFloat(B)));A="; expires="+F.toGMTString()+"; path="+(E.length>0?E:this.defaultPath);return(document.cookie=escape(C)+"="+escape(D||"")+A)},get:function(A){var B=document.cookie.match(new RegExp("(^|;)\\s*"+escape(A)+"=([^;\\s]*)"));return(B?unescape(B[2]):null)},getField:function(C,G,B){if(B==null){B=this.defaultDelimeter}var E=this.get(C);if(E!=null){var A=E.split(B);for(var D=0;D<A.length;D++){var F=A[D].split("=");if(F[0]==G){if(F.length>1){return F[1]}else{return""}}}}return null},setField:function(B,I,C,F,E){if(E==null){E=this.defaultDelimeter}if(F==null){F=this.defaultExpiry}var D=this.get(B);var J=false;if(D!=null){var H=D.split(E);for(var G=0;G<H.length;G++){var A=H[G].split("=");if(A[0]==I){H[G]=A[0]+"="+C;J=true}}if(!J){H[H.length]=I+"="+C}this.set(B,H.join(E),F,this.prefsPath)}else{this.set(B,I+"="+C,F,this.prefsPath)}return this.get(B)},removeField:function(C,G){var E=this.get(C);var B=[];if(E!=null){var A=E.split(this.defaultDelimeter);for(var D=0;D<A.length;D++){var F=A[D].split("=");if(F[0]!=G){B.push(F[0]+"="+F[1])}}}this.set(C,B.join(this.defaultDelimeter),this.defaultExpiry,this.prefsPath)},erase:function(A){var B=Cookie.get(A)||true;Cookie.set(A,"",-1);return B},accept:function(){if(typeof navigator.cookieEnabled=="boolean"){return navigator.cookieEnabled}Cookie.set("_test","1");return(Cookie.erase("_test")==="1")},hasHomeSet:function(){var A=this.getField(this.defaultCookieName,this.homeField);if(A){return A}return false},addLocation:function(A){TomTom.LocationsCookie.addLocation(A)},loadLocations:function(){TomTom.LocationsCookie.loadLocations()},getSavedLocations:function(){return TomTom.LocationsCookie.getSavedLocations()},clearLocations:function(){TomTom.LocationsCookie.clearLocations()}};TomTom.Oasis=function(){var B=function(C,D,F){throw"This has to be defined and implemented";var E=C.poiUrl;return D+"content?action=install&apikey="+F+"&uri="+E+"&source=http://routes.tomtom.com"},A=function(C,F,H){var J=C.coordinate,I=J.latitude,E=J.longitude,G=TomTom.Config.getWbrpAbsoluteUrl()+"/images/ui/logo_tomtom.png",D=encodeURIComponent(C.formattedAddress),D=D.replace(/'/g,"%27");return F+"georeference?action=add&apikey="+H+"&logo="+G+"&name="+D+"&latitude="+I+"&longitude="+E+"&source="+encodeURIComponent(window.location.href)};return{sendLocationLink:function(C){var D=TomTom.Config.oasisUrl;var E=TomTom.Config.oasisKey;return A(C,D,E)}}}();TomTom.PersonalNavigator=function(){var C=$("tomtom_personal_navigator_iframe"),B=TomTom.Config.personalNavigatorUrl,A=function(D){C.src=B+"?Lid="+TomTom.Config.tomtomLocales[D]};return{initialize:function(){if(TomTom.Config.tomtomDomain&&!TomTom.MessageBus.wbrpState.testing){try{document.domain=TomTom.Config.tomtomDomain}catch(D){console.log("WARNING: document domain ["+document.domain+"] could not be changed to ["+TomTom.Config.tomtomDomain+"]")}}TomTom.MessageBus.subscribe(["setlocale"],this)},notified:function(D,E){switch(D){case"setlocale":A(E);break;default:break}}}}();TomTom.WbrpStats=function(){var C="http://nl.sitestat.com/tomtom/route/s?";var B=null;var A={now:"right_now",today:"later_today",tomorrow:"tomorrow_at",no_specific:"no_specific_day_and_time",other:"specific_day_and_time"};return{initialize:function(){TomTom.MessageBus.subscribe(["sitestat"],this)},notified:function(D,E){B=E;switch(D){case"sitestat":if(B=="plan_a_route.result"){B+="."+A[TomTom.MessageBus.wbrpState.tripAdvisorInfo.departureMoment]}sitestat(C+B);B+=".OK";break}}}}()
/*
Copyright (c) 2007 Brian Dillard and Brad Neuberg:
Brian Dillard | Project Lead | bdillard@pathf.com | http://blogs.pathf.com/agileajax/
Brad Neuberg | Original Project Creator | http://codinginparadise.org
   
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
;TomTom.History={isIE:false,isOpera:false,isSafari:false,isKonquerer:false,isGecko:false,isSupported:false,listener:{},baseDir:TomTom.Config.staticDir,create:function(D){var G=this;var F=navigator.userAgent.toLowerCase();var A=navigator.platform.toLowerCase();var H=navigator.vendor||"";if(H=="KDE"){this.isKonqueror=true;this.isSupported=false}else{if(typeof window.opera!="undefined"){this.isOpera=true;this.isSupported=true}else{if(typeof document.all!="undefined"){this.isIE=true;this.isSupported=true}else{if((H.indexOf("Apple Computer, Inc.")>-1)&&parseFloat(navigator.appVersion)<3.1){this.isSafari=true;this.isSupported=(A.indexOf("mac")>-1)}else{if(F.indexOf("gecko")!=-1){this.isGecko=true;this.isSupported=true}}}}}window.historyStorage.setup(D);if(this.isSafari){this.createSafari()}else{if(this.isOpera){this.createOpera()}}var B=this.getCurrentLocation();this.currentLocation=B;if(this.isIE){if(TomTom.Config.tomtomDomain&&!TomTom.MessageBus.wbrpState.testing){this.documentDomainString="&domain="+TomTom.Config.tomtomDomain}else{this.documentDomainString=""}this.createIE(B)}var E=function(){G.firstLoad=null};this.addEventListener(window,"unload",E);if(this.isIE){this.ignoreLocationChange=true}else{if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.ignoreLocationChange=true;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.ignoreLocationChange=false;this.fireOnNewListener=true}}var C=function(){G.checkLocation()};setInterval(C,100)},initialize:function(){if(this.isIE){if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.fireOnNewListener=false;this.firstLoad=true;historyStorage.put(this.PAGELOADEDSTRING,true)}else{this.fireOnNewListener=true;this.firstLoad=false}}},addListener:function(A){this.listener=A;if(this.fireOnNewListener){this.fireHistoryEvent(this.currentLocation);this.fireOnNewListener=false}},addEventListener:function(C,B,A){if(C.addEventListener){C.addEventListener(B,A,false)}else{if(C.attachEvent){C.attachEvent("on"+B,function(){A(window.event)})}}},add:function(C,D){if(this.isSafari){C=this.removeHash(C);historyStorage.put(C,D);this.currentLocation=C;window.location.hash=C;this.putSafariState(C)}else{var B=this;var A=function(){if(B.currentWaitTime>0){B.currentWaitTime=B.currentWaitTime-B.waitTime}C=B.removeHash(C);if(document.getElementById(C)&&B.debugMode){var J="Exception: History locations can not have the same value as _any_ IDs that might be in the document, due to a bug in IE; please ask the developer to choose a history location that does not match any HTML IDs in this document. The following ID is already taken and cannot be a location: "+C;throw new Error(J)}historyStorage.put(C,D);B.ignoreLocationChange=true;B.ieAtomicLocationChange=true;B.currentLocation=C;if(!Prototype.Browser.IE){var H=document.getElementById("favicon");var F=H.href;var I=H.type;var E=H.rel;var G=document.getElementsByTagName("head");G[0].removeChild(H)}window.location.hash=C;TomTom.MessageBus.publish("historyadded");if(!Prototype.Browser.IE){element=document.createElement("link");element.setAttribute("id","favicon");element.setAttribute("rel",E);element.setAttribute("type",I);element.setAttribute("href",F);G[0].appendChild(element)}if(B.isIE){B.iframe.src=B.baseDir+"/js/rsh/blank.html?"+C+B.documentDomainString}B.ieAtomicLocationChange=false};window.setTimeout(A,this.currentWaitTime);this.currentWaitTime=this.currentWaitTime+this.waitTime}},isFirstLoad:function(){return this.firstLoad},getVersion:function(){return"0.6"},getCurrentLocation:function(){var A=(this.isSafari?this.getSafariState():this.getCurrentHash());return A},getCurrentHash:function(){var B=window.location.href;var A=B.indexOf("#");return(A>=0?B.substr(A+1):"")},PAGELOADEDSTRING:"DhtmlHistory_pageLoaded",listener:null,waitTime:200,currentWaitTime:0,currentLocation:null,iframe:null,safariHistoryStartPoint:null,safariStack:null,safariLength:null,ignoreLocationChange:null,fireOnNewListener:null,firstLoad:null,ieAtomicLocationChange:null,createIE:function(A){this.waitTime=400;var B=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var D="rshHistoryFrame";var C='<iframe frameborder="0" id="'+D+'" style="'+B+'" src='+this.baseDir+"/js/rsh/blank.html?"+A+this.documentDomainString+"></iframe>";document.write(C);this.iframe=document.getElementById(D)},createOpera:function(){this.waitTime=400;var A='<img src="javascript:location.href=\'javascript:TomTom.History.checkLocation();\';" style="'+historyStorage.hideStyles+'" />';document.write(A)},createSafari:function(){var E="rshSafariForm";var D="rshSafariStack";var C="rshSafariLength";var B=historyStorage.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var A=(historyStorage.debugMode?"width:800px;height:20px;border:1px solid black;margin:0;padding:0;":historyStorage.hideStyles);var F='<form id="'+E+'" style="'+B+'"><input type="text" style="'+A+'" id="'+D+'" value="[]"/><input type="text" style="'+A+'" id="'+C+'" value=""/></form>';document.write(F);this.safariStack=document.getElementById(D);this.safariLength=document.getElementById(C);if(!historyStorage.hasKey(this.PAGELOADEDSTRING)){this.safariHistoryStartPoint=history.length;this.safariLength.value=this.safariHistoryStartPoint}else{this.safariHistoryStartPoint=this.safariLength.value}},getSafariStack:function(){var A=this.safariStack.value;return historyStorage.fromJSON(A)},getSafariState:function(){var A=this.getSafariStack();var B=A[history.length-this.safariHistoryStartPoint-1];return B},putSafariState:function(B){var A=this.getSafariStack();A[history.length-this.safariHistoryStartPoint]=B;this.safariStack.value=historyStorage.toJSON(A)},fireHistoryEvent:function(A){var B=historyStorage.get(A);if(this.listener){this.listener.call(null,A,B)}},checkLocation:function(){if(!this.isIE&&this.ignoreLocationChange){this.ignoreLocationChange=false;return }if(!this.isIE&&this.ieAtomicLocationChange){return }var A=this.getCurrentLocation();if(decodeURIComponent(A)==decodeURIComponent(this.currentLocation)){return }this.ieAtomicLocationChange=true;if(this.isIE&&this.getIframeHash()!=A){this.iframe.src=this.baseDir+"/js/rsh/blank.html?"+A+this.documentDomainString}else{if(this.isIE){return }}this.currentLocation=A;this.ieAtomicLocationChange=false;this.fireHistoryEvent(A)},getIframeHash:function(){var B=this.iframe.contentWindow.document;var A=String(B.location.search);if(A.length==1&&A.charAt(0)=="?"){A=""}else{if(A.length>=2&&A.charAt(0)=="?"){A=A.substring(1)}}return A},removeHash:function(B){var A;if(B==null||B==undefined){A=null}else{if(B==""){A=""}else{if(B.length==1&&B.charAt(0)=="#"){A=""}else{if(B.length>1&&B.charAt(0)=="#"){A=B.substring(1)}else{A=B}}}}return A},iframeLoaded:function(A){if(this.ignoreLocationChange){this.ignoreLocationChange=false;return }var B=String(A.search);if(TomTom.Config.tomtomDomain&&!TomTom.MessageBus.wbrpState.testing){B=B.substr(0,B.indexOf(this.documentDomainString))}if(B.length==1&&B.charAt(0)=="?"){B=""}else{if(B.length>=2&&B.charAt(0)=="?"){B=B.substring(1)}}window.location.hash=B;this.fireHistoryEvent(B)}};window.historyStorage={setup:function(B){if(typeof B!="undefined"){if(B.debugMode){this.debugMode=B.debugMode}if(B.toJSON){this.toJSON=B.toJSON}if(B.fromJSON){this.fromJSON=B.fromJSON}}var D="rshStorageForm";var F="rshStorageField";var A=this.debugMode?historyStorage.showStyles:historyStorage.hideStyles;var E=(historyStorage.debugMode?"width: 800px;height:80px;border:1px solid black;":historyStorage.hideStyles);var C='<form id="'+D+'" style="'+A+'"><textarea id="'+F+'" style="'+E+'"></textarea></form>';document.write(C);this.storageField=document.getElementById(F);if(typeof window.opera!="undefined"){this.storageField.focus()}},put:function(A,B){this.assertValidKey(A);if(this.hasKey(A)){this.remove(A)}this.storageHash[A]=B;this.saveHashTable()},get:function(A){this.assertValidKey(A);this.loadHashTable();var B=this.storageHash[A];if(B==undefined){B=null}return B},remove:function(A){this.assertValidKey(A);this.loadHashTable();delete this.storageHash[A];this.saveHashTable()},reset:function(){this.storageField.value="";this.storageHash={}},hasKey:function(A){this.assertValidKey(A);this.loadHashTable();return(typeof this.storageHash[A]!="undefined")},isValidKey:function(A){return(typeof A=="string")},showStyles:"border:0;margin:0;padding:0;",hideStyles:"left:-1000px;top:-1000px;width:1px;height:1px;border:0;position:absolute;",debugMode:false,storageHash:{},hashLoaded:false,storageField:{},assertValidKey:function(A){var B=this.isValidKey(A);if(!B&&this.debugMode){throw new Error("Please provide a valid key for window.historyStorage. Invalid key = "+A+".")}},loadHashTable:function(){if(!this.hashLoaded){var A=this.storageField.value;if(A!=""&&A!=null){this.storageHash=this.fromJSON(A);this.hashLoaded=true}}},saveHashTable:function(){this.loadHashTable();var A=this.toJSON(this.storageHash);this.storageField.value=A},toJSON:function(A){return Object.toJSON(A)},fromJSON:function(A){return A.evalJSON()}};TomTom.Markers=function(){var G;var B;var J={url:TomTom.Config.staticDir+"/images/marker.png",size:new OpenLayers.Size(51,60),offset:new OpenLayers.Pixel(-21,-52)};var E=function(T){var P;if(T.name=="home"){var S=G.marker.markers;for(var Q=0;Q<S.length;Q++){if(S[Q].name=="route"){if((parseFloat(S[Q].lonlat.lat)==parseFloat(T.location.latitude))&&(parseFloat(S[Q].lonlat.lon)==parseFloat(T.location.longitude))){return false}}}}if(T.icon){P=L(T.id,T.name,T.location.latitude,T.location.longitude,T.layer,T.icon)}else{P=L(T.id,T.name,T.location.latitude,T.location.longitude)}if(T.iconDivId!=null){P.id=T.iconDivId}var U={callback:T.callback,marker:P,map:B,type:T.type,param:T.param,id:T.id!=null?T.id:P.id,isRightClick:C};icallback=H.bind(U);Event.observe(P,"mousedown",icallback,true);if(T.contextMenu){if(document.createEvent){var R=document.createEvent("MouseEvents");R.initMouseEvent("mousedown",true,false,window,0,12,345,7,220,false,false,true,false,0,null);P.dispatchEvent(R)}else{if(document.createEventObject){var R=document.createEventObject();R.detail=0;R.screenX=12;R.screenY=345;R.clientX=7;R.clientY=220;R.ctrlKey=false;R.altKey=false;R.shiftKey=true;R.metaKey=false;R.button=0;R.relatedTarget=null;P.fireEvent("onmousedown",R)}}}};var L=function(Q,P,X,R,U,W){if(!U){U="marker"}if(!W){W=Object.clone(J);W.alphaNeeded=true}var Z=G[U].map.getLayerPxFromLonLat(new OpenLayers.LonLat(R,X));var V=G[U].id;var T=document.createElement("img");var S=parseInt(Z.x+W.offset.x).toString();var Y=parseInt(Z.y+W.offset.y).toString();if(Q){T.id=Q}if(P=="location"){T.id="findLocationIcon"}if(!T.id){T.id=OpenLayers.Util.createUniqueID()}T.style.position="absolute";T.style.left=S+"px";T.style.top=Y+"px";T.style.cursor="pointer";if(W.zIndex){T.style.zIndex=W.zIndex}T.src=W.url;if(W.alphaNeeded){T=M(T)}document.getElementById(V).appendChild(T);return T};var M=function(Q){if(OpenLayers.Util.alphaHack()){var R=document.createElement("div");R.id=Q.id;Q.id=Q.id+"_inner";R.style.position=Q.style.position;R.style.left=Q.style.left;R.style.top=Q.style.top;R.style.cursor=Q.style.cursor;if(Q.style.zIndex){R.style.zIndex=Q.style.zIndex}Q.removeAttribute("style");Q.style.cursor="pointer";if(R.style.display!="none"){R.style.display="inline-block"}var P="scale";R.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+Q.src+"', sizingMethod='"+P+"')";if(parseFloat(R.style.opacity)>=0&&parseFloat(R.style.opacity)<1){R.style.filter+=" alpha(opacity="+R.style.opacity*100+")"}Q.style.filter="alpha(opacity=0)";R.appendChild(Q);return R}else{return Q}};var N=function(V,W){var R=W.id;var Q=document.getElementById(R);var U=Q.childNodes;for(var T=U.length-1;T>=0;T--){var X=U[T];var Y=false;if(!X){continue}for(var S=V.length-1;S>=0;S--){var P="img_"+V[S].position.mercX+"_"+V[S].position.mercY+"_"+V[S].iconCategory;if(P==X.id){V.splice(S,1);Y=true;break}}if(!Y){I(X,W)}}};var I=function(R,T){var W=T.id;var V=document.getElementById(W);R.stopObserving();var Q=R.attributes,S,P,U;if(Q){P=Q.length;for(S=0;S<P;S+=1){U=Q[S].name;if(typeof R[U]==="function"){R[U]=null}}}if(R.removeEventListener){R.removeEventListener("mousedown",R.callback,false)}else{if(R.detachEvent&&R.mousedown){R.detachEvent("onmousedown",R.callback)}}V.removeChild(R)};var F=function(T,R){if(R){var W=R.id;var V=document.getElementById(W);if(T=="any"){var U=V.childNodes;if(U){var P=U.length;for(var Q=U.length-1;Q>=0;Q--){I(U[Q],R)}}}else{var S=document.getElementById(T);if(S){I(S,R)}}}};var D=function(){var P=G.marker;F("homeIcon",P)};var O=function(){var P=G.marker;F("findLocationIcon",P)};var K=function(){var P=G.marker;F("startIcon",P);F("finishIcon",P)};var A=function(R,Q){var P=document.getElementById(R);P.style.left=Q.x+"px";P.style.top=Q.y+"px"};var H=function(T){if(this.isRightClick(T)){return }var S=T.target?T.target:T.srcElement;var R=S.cumulativeOffset();var P={x:R.left,y:R.top};var Q=this.callback(P,this.type,this.param,this.id);Q.id=this.id;TomTom.MessageBus.publish("popup",Q);Event.stop(T)};var C=function(P){return(((P.which)&&(P.which==3))||((P.button)&&(P.button==2)))};return{initialize:function(){B=TomTom.Map.getMap();G=TomTom.Map.getLayers();TomTom.MessageBus.subscribe(["addmarker","registermarker","clearmarkers","movemarker","filtermarkers","clearlocationmarker","clearhomemarker","clearroutemarkers"],this)},notified:function(P,Q){switch(P){case"addmarker":L("",Q.lat,Q.lon,Q.layer,Q.icon);break;case"registermarker":E(Q);break;case"clearmarkers":F(Q.name,Q.layer);break;case"filtermarkers":N(Q.markers,Q.layer);break;case"clearlocationmarker":O();break;case"clearhomemarker":D();break;case"clearroutemarkers":K();break;case"movemarker":A(Q.id,Q.position);break;default:break}}}}();TomTom.Modules={modules:[],register:function(){TomTom.MessageBus.initialize();TomTom.ClientState.initialize();TomTom.Init.initialize();TomTom.Map.initialize();TomTom.Leftpanel.initialize();TomTom.i18n.initialize();TomTom.Toolbar.initialize();TomTom.FindLocation.initialize();TomTom.PlanRoute.initialize();TomTom.RouteResult.initialize();TomTom.Poi.initialize();TomTom.TripAdvisor.initialize();TomTom.Effects.initialize();TomTom.Traffic.initialize();TomTom.ContextMenu.initialize();TomTom.PersonalNavigator.initialize();TomTom.WbrpStats.initialize();TomTom.Locale.initialize();TomTom.ViewportInfo.initialize();TomTom.Markers.initialize();this.modules.videooverlay=new TomTom.VideoOverlay();this.modules.webtestHook=new TomTom.WebtestHooks();TomTom.MessageBus.publish("beforeload");TomTom.MessageBus.publish("afterload")}};TomTom.Modules.register();