//
// This MapControl is a product of Microsoft Research.  It is based on
// the Virtual Earth v2 MapControl, but is not supported by the
// Virtual Earth or Windows Live Local teams.  It is an unsupported
// research product that comes with no guarantees or warranties of
// fitness for a particular purpose.  In particular we do not
// guarantee that it is stable.
//
// (c) Copyright Microsoft Corporation.  All rights reserved.
//

var L_CopyrightMicrosoftCorp_Text="2005 Microsoft Corp";var L_CopyrightNavteq_Text="2004 NAVTEQ";var L_CopyrightImageCourtesyOfNASA_Text="Image courtesy of NASA";var L_CopyrightHarrisCorp_Text="Harris Corp, Earthstar Geographics LLC";var L_CopyrightImageCourtesyOfUSGS_Text="Image courtesy of USGS";var L_CopyrightImageCourtesyOfPictometry_Text="2005 Pictometry International Corp.";var L_DashboardRoad_Text="road";var L_DashboardAerial_Text="aerial";var L_DashboardBirdsEye_Text="bird's eye";var L_DashboardBirdsEyeText_Text="There is Birds Eye imagery available for this location.";var L_DashboardShowLabels_Text="Show labels";var L_ObliqueZoomBarSelectZoom_Text="Select the desired zoom level for the image.";var L_ObliqueModeImageNotAvailable_Text="Bird's Eye images are not available for this area.";var L_ScaleBarMiles_Text="miles";var L_ScaleBarKilometers_Text="km";var L_ScaleBarMeters_Text="m";var L_ScaleBarYards_Text="yds";var L_ScaleBarInches_Text="in";var L_GraphicsInitError_Text="Browser does not support SVG, cannot render driving route.";var img_PoweredLogo="http://local.live.com/i/logo_powered_by.png";function GetEvent(e){return e?e:window.event;}function CancelEvent(e){e.cancelBubble=true;}function IgnoreEvent(e){e=GetEvent(e);CancelEvent(e);return false;}function GetMouseX(e){var posX=0;if(e.pageX)posX=e.pageX;else{if(e.clientX){if(document.documentElement&&document.documentElement.scrollLeft)posX=e.clientX+document.documentElement.scrollLeft;else{if(document.body)posX=e.clientX+document.body.scrollLeft;}}}return posX;}function GetMouseY(e){var posY=0;if(e.pageY)posY=e.pageY;else{if(e.clientY){if(document.documentElement&&document.documentElement.scrollTop)posY=e.clientY+document.documentElement.scrollTop;else{if(document.body)posY=e.clientY+document.body.scrollTop;}}}return posY;}function GetMouseScrollDelta(e){if(e.wheelDelta)return e.wheelDelta;else{if(e.detail)return -e.detail;}return 0;}function GetTarget(e){if(!e)e=window.event;var t=null;if(e.srcElement)t=e.srcElement;else{if(e.target)t=e.target;}if(t&&t.nodeType){if(t.nodeType==3)t=targ.parentNode;}return t;}function GetLeftPosition(b){var offsetTrail=b;var offsetLeft=0;while(offsetTrail){offsetLeft+=offsetTrail.offsetLeft;offsetTrail=offsetTrail.offsetParent;}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.leftMargin!="undefined")offsetLeft+=document.body.leftMargin;return offsetLeft;}function GetTopPosition(c){var offsetTrail=c;var offsetTop=0;while(offsetTrail){offsetTop+=offsetTrail.offsetTop;offsetTrail=offsetTrail.offsetParent;}if(navigator.userAgent.indexOf("Mac")!=-1&&typeof document.body.topMargin!="undefined")offsetTop+=document.body.topMargin;return offsetTop;}function MathFloor(x){return Math.floor(x);}function MathCeil(x){return Math.ceil(x);}function MathMax(x,y){return Math.max(x,y);}function MathMin(x,y){return Math.min(x,y);}function MathAbs(x){return Math.abs(x);}function MathRound(x){return Math.round(x);}function DegToRad(d){return d*Math.PI/180;}function RadToDeg(r){return r*180/Math.PI;}function MatrixMultiply(a,b){if(!a||!b||a[0].length!=b.length)return;var height=a.length;var width=b[0].length;var result=new Array(height);var z=b.length;for(var i=0;i<height;i++){result[i]=new Array(width);for(var j=0;j<width;j++){result[i][j]=0;for(var k=0;k<z;k++){result[i][j]+=a[i][k]*b[k][j];}}}return result;}function RegisterNamespaces(){for(var i=0;i<arguments.length;i++){var astrParts=arguments[i].split(".");var root=window;for(var j=0;j<astrParts.length;j++){if(!root[astrParts[j]])root[astrParts[j]]=new Object();root=root[astrParts[j]];}}}RegisterNamespaces("Msn.Drawing");Msn.Drawing.Exception=function(e){this.message=e;this.name="Msn.Drawing.Exception";};Msn.Drawing.Exception.prototype.toString=function(){return this.name+": "+this.message;};Msn.Drawing.Graphic=function(){};Msn.Drawing.Graphic.CreateGraphic=function(g){if(document.all)return new Msn.Drawing.VMLGraphic(g);else{var major=0;var minor=0;var versionRegex=new RegExp("Firefox/(.*)");var match=versionRegex.exec(navigator.userAgent);if(match[1]){var versionNumbers=match[1].split(".");if(versionNumbers){major=versionNumbers[0];minor=versionNumbers[1];if(parseInt(major)>0&&parseInt(minor)>=5)return new Msn.Drawing.SVGGraphic(g);}}throw new Msn.Drawing.Exception(L_GraphicsInitError_Text);}};Msn.Drawing.Point=function(x,y){this.x=x?x:0;this.y=y?y:0;};Msn.Drawing.Point.prototype.toString=function(){return this.x+","+this.y;};Msn.Drawing.PolyLine=function(h){this.id=0;this.points=h?h:new Array();this.AddPoint=function(j){this.points.push(j);};};Msn.Drawing.PolyLine.prototype.toString=function(){return this.points.join(" ");};Msn.Drawing.Stroke=function(){this.width=1;this.linecap="round";this.opacity=1;this.linejoin="miter";this.color=new Msn.Drawing.Color(255,255,255,1);};Msn.Drawing.Color=function(r,g,b,a){this.R=r?r:0;this.G=g?g:0;this.B=b?b:0;this.A=a?a:1;this.ToHexString=function(){return "#"+Number(this.R).toString(16)+(this.R<16?"0":"")+Number(this.G).toString(16)+(this.G<16?"0":"")+Number(this.B).toString(16)+(this.B<16?"0":"");};};Msn.Drawing.VMLGraphic=function(k){var graphicsElm=k;var color=new Msn.Drawing.Color(255,0,0,1);var stroke=new Msn.Drawing.Stroke();var zIndex=1;var parentLeft=k.offsetLeft;var parentTop=k.offsetTop;k.unselectable="on";var currentShapes=new Array();this.DrawPolyline=function(l){var element=null;element=document.createElement("v:polyline");element.id=l.id;element.unselectable="on";element.style.position="absolute";element.points=l.points.join(" ");element.style.zIndex=zIndex;element.filled="false";graphicsElm.appendChild(element);if(stroke){var strokeElm=document.createElement("v:stroke");strokeElm.unselectable="on";strokeElm.setAttribute("weight",stroke.width);strokeElm.setAttribute("joinstyle",stroke.linejoin);strokeElm.setAttribute("color",stroke.color.ToHexString());strokeElm.setAttribute("endcap",stroke.linecap);strokeElm.setAttribute("opacity",stroke.color.A.toString());element.appendChild(strokeElm);}currentShapes.push(element);};this.SetColor=function(m){color=m;};this.SetStroke=function(n){stroke=n;};this.SetZIndex=function(o){zIndex=o;};this.Clear=function(){var currentShape=null;while(currentShape=currentShapes.pop()){graphicsElm.removeChild(currentShape);currentShape=null;}};this.Destroy=function(){this.Clear();graphicsElm=null;};};Msn.Drawing.SVGGraphic=function(p){var divElm=document.createElement("div");divElm.id="svgCanvas";divElm.style.position="absolute";divElm.style.cursor="pointer";var graphicsElm=null;var zIndex=1;divElm.style.top=p.offsetTop+"px";divElm.style.left=p.offsetLeft+"px";p.appendChild(divElm);var currentShapes=new Array();var color=new Msn.Drawing.Color(255,0,0,1);var stroke=new Msn.Drawing.Stroke();q();graphicsElm=document.createElementNS("http://www.w3.org/2000/svg","svg");graphicsElm.setAttribute("height","100%");graphicsElm.setAttribute("width","100%");divElm.appendChild(graphicsElm);function q(){var startSearchNode=p;while(startSearchNode&&startSearchNode.offsetWidth==0){startSearchNode=startSearchNode.parentNode;}divElm.style.position="absolute";divElm.style.width=startSearchNode.offsetWidth+"px";divElm.style.height=startSearchNode.offsetHeight+"px";}function r(s){if(!s||!s.points||s.points.length<2)return;var points=s.points;var pointsLen=points.length;var minX=0;var maxX=0;var minY=0;var maxY=0;var maxWidth=0;var maxHeight=0;minX=Math.min(points[0].x,points[1].x);maxX=Math.max(points[0].x,points[1].x);minY=Math.min(points[0].y,points[1].y);maxY=Math.max(points[0].y,points[1].y);maxWidth=Math.max(maxX-minX,maxWidth);maxHeight=Math.max(maxY-minX,maxHeight);for(var i=2;i<pointsLen;++i){minX=Math.min(points[i].x,minX);maxX=Math.max(points[i].x,maxX);minY=Math.min(points[i].y,minY);maxY=Math.max(points[i].y,maxY);maxWidth=Math.max(maxX-minX,maxWidth);maxHeight=Math.max(maxY-minY,maxHeight);}divElm.style.top=minY+"px";divElm.style.left=minX+"px";divElm.style.width=maxWidth+"px";divElm.style.height=maxHeight+"px";graphicsElm.setAttribute("width",maxWidth+"");graphicsElm.setAttribute("height",maxHeight+"");for(var i=0;i<pointsLen;++i){points[i].x-=minX;points[i].y-=minY;}}this.DrawPolyline=function(t){r(t);var line=document.createElementNS("http://www.w3.org/2000/svg","polyline");line.setAttribute("points",t.toString());line.setAttribute("fill","none");line.setAttribute("id",t.id);if(stroke){line.setAttribute("stroke",stroke.color.ToHexString());line.setAttribute("stroke-width",stroke.width);line.setAttribute("stroke-opacity",stroke.color.A);}graphicsElm.appendChild(line);currentShapes.push(line);};this.SetColor=function(u){color=u;};this.SetStroke=function(v){stroke=v;};this.SetZIndex=function(w){zIndex=w;divElm.style.zIndex=zIndex;};this.Destroy=function(){this.Clear();};this.Clear=function(){var currentShape=null;while(currentShape=currentShapes.pop()){graphicsElm.removeChild(currentShape);currentShape=null;}};};RegisterNamespaces("Msn.VE");Msn.VE.MapControl=function(A,B){var offsetMeters=20971520;var baseMetersPerPixel=163840;var buffer=0;var animatedMovementEnabled=true;var zoomTotalSteps=6;var keyboardPanSpeed=15;var panToLatLongSpeed=15;var earthRadius=6378137;var earthCircumference=earthRadius*2*Math.PI;var projectionOffset=earthCircumference*0.5;var minZoom=1;var maxZoom=23;var emptyTile="http://virtualearth.msn.com/i/spacer.gif";var minLatitude=-85;var maxLatitude=85;var minLongitude=-180;var maxLongitude=180;var tileSize=256;var generations=new Object();var kbInputZIndex=0;var containerZIndex=0;var mapZIndex=1;var swapZIndex=1;var baseZIndex=2;var debugZIndex=3;var baseZIndex=11;var topZIndex=20;var useAlphaImageLoader=false;var p_this=this;var roadStyle="r";var hybridStyle="h";var aerialStyle="a";var obliqueStyle="o";var currentView=new Msn.VE.MapView();var preferredView=new Msn.VE.MapView();var previousZoomLevel=1;var previousMapStyle=null;var lastOrthoZoomLevel=15;var lastOrthoMapStyle=roadStyle;var x=0;var y=0;var width=0;var height=0;var currentTilesList=new Array();var oldTilesList=null;var originX=0;var originY=0;var offsetX=0;var offsetY=0;var tileViewportX1=0;var tileViewportY1=0;var tileViewportX2=0;var tileViewportY2=0;var tileViewportWidth=0;var tileViewportHeight=0;var dragging=false;var keyboardPan=false;var lastMouseX=0;var lastMouseY=0;var zooming=false;var zoomCounter=0;var panning=false;var panCounter=0;var panningX=0;var panningY=0;var panLatitude=null;var panLongitude=null;var pushpins=new Array();var lines=new Array();var map=document.createElement("div");var keyboard=document.createElement("input");keyboard.id="wl_ve_mapInput";var logo=null;var scaleBar=null;var copyright=null;var dashboardContainer=null;var dashboard=null;var boxTool=null;var panTool=null;var currentTool=null;var orthoMode=null;var obliqueMode=null;var currentMode=null;var currentBounds=null;var eventTable=new Array();var debug=false;var graphicCanvas=null;this.Init=function(){try{var imageLoaderTest=new ActiveXObject("DXImageTransform.Microsoft.AlphaImageLoader");var agt=navigator.userAgent.toLowerCase();var is_ie=agt.indexOf("msie")!=-1&&agt.indexOf("opera")==-1;var is_ie7up=false;if(is_ie){rslt=agt.match(/msie.([\d]+\.[\d]+)/);if(rslt!=null){var ie_version=parseFloat(rslt[1]);if(ie_version>=7)is_ie7up=true;}}if(is_ie7up==false)useAlphaImageLoader=true;}catch(dummy){}generations[roadStyle]=29;generations[aerialStyle]=29;generations[hybridStyle]=29;generations[obliqueStyle]=29;orthoMode=new Bk();orthoMode.Init();if(B.obliqueEnabled&&B.obliqueUrl){obliqueMode=new Dj();obliqueMode.Init(B.obliqueUrl);}C();map.className="Map";map.style.zIndex=mapZIndex;A.appendChild(map);keyboard.className="KeyboardInput";A.appendChild(keyboard);if(!B.fixedView){boxTool=new ml();boxTool.Init();panTool=new vl();panTool.Init();currentTool=panTool;A.attachEvent("onmousedown",Ge);A.attachEvent("onmouseup",Ie);A.attachEvent("onmousemove",He);A.attachEvent("onmousewheel",Ke);A.attachEvent("ondblclick",Je);A.attachEvent("oncontextmenu",Le);keyboard.attachEvent("onkeydown",zc);keyboard.attachEvent("onkeyup",Ac);if(window.addEventListener&&navigator.product&&navigator.product=="Gecko")A.addEventListener("DOMMouseScroll",Ke,false);buffer=tileSize;}if(B.buffer!=undefined&&B.buffer!=null)buffer=B.buffer;if(B.latitude&&B.longitude&&B.zoomlevel&&B.mapstyle)try{var initialView=new Msn.VE.MapView();initialView.SetMapStyle(bb(B.mapstyle),B.obliqueSceneId);initialView.SetZoomLevel(eval(B.zoomlevel));initialView.SetCenterLatLong(new Msn.VE.LatLong(eval(B.latitude),eval(B.longitude)));Xh(initialView);}catch(ex){F();}else F();if(!B.disableLogo){logo=new Ce(A);logo.Init();}copyright=new ac(A);copyright.Init();copyright.Update();if(B.showScaleBar){scaleBar=new Pg(A);scaleBar.Init();pc("onendzoom",scaleBar.Update);pc("onendcontinuouspan",scaleBar.Update);pc("onresize",scaleBar.Reposition);}if(B.showDashboard)D(B.dashboardX,B.dashboardY,B.dashboardSize);if(obliqueMode&&currentMode!=obliqueMode)obliqueMode.UpdateAvailability();try{graphicCanvas=Msn.Drawing.Graphic.CreateGraphic(map);graphicCanvas.SetZIndex(17);}catch(e){}};this.GetDashboard=function(){return dashboard;};this.Destroy=function(){if(!B.fixedView){A.detachEvent("onmousedown",Ge);A.detachEvent("onmouseup",Ie);A.detachEvent("onmousemove",He);A.detachEvent("onmousewheel",Ke);A.detachEvent("ondblclick",Je);A.detachEvent("oncontextmenu",Le);keyboard.detachEvent("onkeydown",zc);keyboard.detachEvent("onkeyup",Ac);}while(currentTilesList.length>0){var tile=currentTilesList.pop();tile.RemoveFromMap();}currentTilesList=null;while(pushpins.length){pushpins.pop().Destroy();}pushpins=null;Mc();if(dashboard){dashboard.Destroy();dashboard=null;}if(dashboardContainer){document.body.removeChild(dashboardContainer);dashboardContainer=null;}if(scaleBar){sc("onendzoom",scaleBar.Update);sc("onendcontinuouspan",scaleBar.Update);sc("onresize",scaleBar.Reposition);scaleBar.Destroy();scaleBar=null;}if(logo){logo.Destroy();logo=null;}if(copyright){copyright.Destroy();copyright=null;}if(orthoMode){orthoMode.Destroy();orthoMode=null;}if(obliqueMode){obliqueMode.Destroy();obliqueMode=null;}if(boxTool){boxTool.Destroy();boxTool=null;}if(panTool){panTool.Destroy();panTool=null;}if(graphicCanvas)graphicCanvas.Destroy();yc();A=p_this=null;};function C(){x=GetLeftPosition(A);y=GetTopPosition(A);width=A.offsetWidth;height=A.offsetHeight;}function D(x,y,E){if(!E)E=Msn.VE.DashboardSize.Normal;if(E==Msn.VE.DashboardSize.Tiny)E=Msn.VE.DashboardSize.Small;dashboardContainer=document.createElement("div");dashboardContainer.id="dashboard";var dbHeader=document.createElement("div");dbHeader.id="dbHeader";dbHeader.style.position="relative";dbHeader.style.top="0";dbHeader.style.left="0";dbHeader.style.height="10px";dbHeader.style.backgroundColor="#ccc";dashboardContainer.appendChild(dbHeader);document.body.appendChild(dashboardContainer);dashboardContainer.className="Dashboard Dashboard_"+E;dashboardContainer.style.top=y+"px";dashboardContainer.style.left=x+"px";dashboard=new Msn.VE.Dashboard(dashboardContainer,p_this,E);dashboard.Init();}function F(){var view=new Msn.VE.MapView();view.SetCenterLatLong(new Msn.VE.LatLong(0,0));view.SetZoomLevel(1);view.SetMapStyle(roadStyle);Xh(view);}function G(H,I){var view=preferredView.MakeCopy();view.SetCenterLatLong(new Msn.VE.LatLong(H,I));Xh(view);}function J(K){orthoMode.AddTileSource(K);responseRangeCeilings[K.MapStyle]=[325,975];}function L(M){return orthoMode.GetTileSource(M);}function N(O){if(O==null||!orthoMode.IsValidMapStyle(O)){alert("Trying to activate unknown alpha layer "+O);return;}var view=currentView.MakeCopy();view.ActivateAlphaLayer(O);Xh(view);}function P(Q){if(Q==null||!orthoMode.IsValidMapStyle(Q)){alert("Trying to deactivate unknown alpha layer "+Q);return;}var view=currentView.MakeCopy();view.DeactivateAlphaLayer(Q);Xh(view);}function R(){var view=currentView.MakeCopy();view.ClearAlphaLayers();Xh(view);}function S(T,U,V,W){if(currentView.mapStyle==obliqueStyle)return null;else{var oldStyle=currentView.mapStyle;currentView.mapStyle=T;var retval=orthoMode.GenerateFilename(U,V,W);currentView.mapStyle=oldStyle;return retval;}}function X(Y,Z,ab){var view=currentView.MakeCopy();view.SetMapStyle(bb(Y),Z,ab);if(currentView.mapStyle!=Y){if(Y==obliqueStyle){view.SetZoomLevel(1);lastOrthoZoomLevel=currentView.zoomLevel;lastOrthoMapStyle=currentView.mapStyle;}else{if(currentView.mapStyle==obliqueStyle)view.SetZoomLevel(lastOrthoZoomLevel);}}view.latlong.latitude=preferredView.latlong.latitude;view.latlong.longitude=preferredView.latlong.longitude;Xh(view);}function bb(cb){if(orthoMode.IsValidMapStyle(cb)||cb==obliqueStyle)return cb;else return roadStyle;}function eb(){return currentView.latlong.latitude;}function gb(){return currentView.latlong.longitude;}function hb(jb){currentView.latlong=currentMode.PixelToLatLong(currentView.center,currentView.zoomLevel);if(jb)preferredView.Copy(currentView);if(obliqueMode)obliqueMode.UpdateAvailability();}function kb(y){var pixel=new Msn.VE.Pixel(originX+offsetX+width/2,originY+offsetY+y);var latlong=currentMode.PixelToLatLong(pixel,currentView.zoomLevel);if(!latlong)return null;return latlong.latitude;}function lb(x){var pixel=new Msn.VE.Pixel(originX+offsetX+x,originY+offsetY+height/2);var latlong=currentMode.PixelToLatLong(pixel,currentView.zoomLevel);if(!latlong)return null;return latlong.longitude;}function mb(nb){var latlong=new Msn.VE.LatLong(nb,currentView.center.longitude);var pixel=currentMode.LatLongToPixel(latlong,currentView.zoomLevel);if(!pixel)return null;return MathRound(pixel.y-originY-offsetY);}function ob(pb){var latlong=new Msn.VE.LatLong(currentView.center.latitude,pb);var pixel=currentMode.LatLongToPixel(latlong,currentView.zoomLevel);if(!pixel)return null;return MathRound(pixel.x-originX-offsetX);}function qb(rb){var pixel=currentMode.LatLongToPixel(rb,currentView.zoomLevel);pixel.x-=(originX+offsetX);pixel.y-=(originY+offsetY);return pixel;}function sb(tb){var adjPixel=new Msn.VE.Pixel(tb.x+originX+offsetX,tb.y+originY+offsetY);var latlong=currentMode.PixelToLatLong(adjPixel,currentView.zoomLevel);return latlong;}function ub(){return currentView.zoomLevel;}function vb(){return currentView.mapStyle;}function wb(xb,yb){if(!xb)xb=currentView.latlong.latitude;if(!yb)yb=currentView.zoomLevel;return Math.cos(DegToRad(xb))*currentMode.MetersPerPixel(yb);}function zb(w,h){if(!w||!h||w<=0||h<=0)return;width=w;height=h;A.style.width=width+"px";A.style.height=height+"px";Ze(currentView);copyright.Reposition();if(logo)logo.Reposition();vc("onresize");}function Ab(){return obliqueMode?obliqueMode.IsAvailable():false;}function Bb(){return obliqueMode?obliqueMode.GetScene():null;}function Cb(Db){animatedMovementEnabled=Db;}function Eb(){return animatedMovementEnabled;}function Fb(Gb){if(obliqueMode)X(obliqueStyle,Gb,null);}function Hb(Ib){if(obliqueMode)X(obliqueStyle,null,Ib);}function Jb(d){debug=d;for(var i=0;i<currentTilesList.length;i++){currentTilesList[i].Debug(d);}}function Kb(Lb,Mb){Nb(Lb,Mb,0,0);}function Nb(Ob,Pb,Qb,Rb){Qb=Sb(Qb,width,Ob.center.x-width/2,Ob.zoomLevel,Pb.z1,Pb.x1,Pb.x2);Rb=Sb(Rb,height,Ob.center.y-height/2,Ob.zoomLevel,Pb.z1,Pb.y1,Pb.y2);Ob.SetCenter(new Msn.VE.Pixel(Ob.center.x+Qb,Ob.center.y+Rb));}function Sb(Tb,Ub,Vb,Wb,Xb,Yb,Zb){var min=tileSize*Yb*Math.pow(2,Wb-Xb);var max=tileSize*Zb*Math.pow(2,Wb-Xb);if(Ub>max-min)return (max-min-Ub)/2-Vb+min;else{if(Vb+Tb<min)return min-Vb;else{if(Vb+Ub+Tb>max)return max-Vb-Ub;}}return Tb;}function ac(bc){var bg=document.createElement("div");var fg=document.createElement("div");var copyrightHeight=13;this.Init=function(){bg.className="Copyright CopyrightBackground";fg.className="Copyright CopyrightForeground";cc();bc.appendChild(bg);bc.appendChild(fg);};this.Destroy=function(){bc.removeChild(bg);bc.removeChild(fg);bg=fg=null;};function cc(){bg.style.top=height-copyrightHeight+"px";bg.style.left=width-234+"px";bg.style.display="block";fg.style.top=height-copyrightHeight-1+"px";fg.style.left=width-235+"px";fg.style.display="block";}function ec(){var c="&copy; "+L_CopyrightMicrosoftCorp_Text;copyrightHeight=13;if(currentView.zoomLevel>=5&&(currentView.mapStyle==roadStyle||currentView.mapStyle==hybridStyle))c+=" &nbsp; &copy; "+L_CopyrightNavteq_Text;if(currentView.mapStyle==hybridStyle||currentView.mapStyle==aerialStyle){c+="<br>";copyrightHeight=21;if(currentView.zoomLevel<=8)c+=L_CopyrightImageCourtesyOfNASA_Text;else{if(currentView.zoomLevel<=13)c+="&copy; "+L_CopyrightHarrisCorp_Text;else c+=L_CopyrightImageCourtesyOfUSGS_Text;}}else{if(currentView.mapStyle==obliqueStyle){c+="<br>&copy; "+L_CopyrightImageCourtesyOfPictometry_Text;copyrightHeight=21;}}bg.innerHTML=c;fg.innerHTML=c;cc();}this.Reposition=cc;this.Update=ec;}function gc(hc,jc,kc){this.view=hc;this.oblique=jc;this.error=kc;}function lc(mc,nc,oc){var view=currentView.MakeCopy();if(mc!=undefined)view.latlong=mc;if(nc!=undefined)view.zoomLevel=nc;if(oc==undefined)oc="";var oblique=null;if(obliqueMode)oblique=obliqueMode.GetEventInfo();return new gc(view,oblique,oc);}function pc(qc,rc){var eventList=eventTable[qc];if(!eventList){eventList=new Array();eventTable[qc]=eventList;}for(var i=0;i<eventList.length;i++){if(eventList[i]==rc)return true;}eventList.push(rc);}function sc(tc,uc){var eventList=eventTable[tc];if(!eventList)return;for(var i=0;i<eventList.length;i++){if(eventList[i]==uc)eventList.splice(i,1);}}function vc(wc,xc){var eventList=eventTable[wc];if(!eventList)return;if(!xc)xc=lc();for(var i=0;i<eventList.length;i++){eventList[i](xc);}}function yc(){while(eventTable.length){var eventList=eventTable.pop();while(eventList.length){eventList.pop();}eventList=null;}eventTable=null;}function zc(e){e=GetEvent(e);var s=keyboardPanSpeed;var x=panningX;var y=panningY;switch(e.keyCode){case 9:if(panning&&keyboardPan)Ve();return true;case 37:x=-s;break;case 38:y=-s;break;case 39:x=s;break;case 40:y=s;break;case 107:case 187:case 61:case 43:x=0;y=0;xj();break;case 109:case 189:x=0;y=0;yj();break;case 65:x=0;y=0;X(aerialStyle);break;case 72:x=0;y=0;X(hybridStyle);break;case 82:case 86:x=0;y=0;X(roadStyle);break;case 66:case 79:x=0;y=0;X(obliqueStyle);break;default:return false;}if(x||y)Pe(x,y,null,true);return false;}function Ac(e){e=GetEvent(e);var x=panningX;var y=panningY;switch(e.keyCode){case 37:x=0;break;case 38:y=0;break;case 39:x=0;break;case 40:y=0;break;default:return false;}Pe(x,y,null,true);return false;}var northLatitude=0;var southLatitude=0;var westLongitude=0;var eastLongitude=0;function Bc(Cc,Dc,Ec,Fc,Gc,Hc,Ic,Jc){if(Cc==null||Dc==null||Ec==null||Ic==null||Jc==null)return null;var regionHeap=new Array();for(var i=0;i<Ic.length;i++){regionHeap.push(Qc(Ic[i],0,Ic[i].length-1));}var line=new Uc();line.Init(Cc,Dc,Ec,Fc,Gc,Hc,regionHeap,Jc);lines.push(line);return line;}function Kc(Lc){for(var i=0;i<lines.length;i++){var line=lines[i];if(line.id==Lc){lines.splice(i,1);line.Destroy();return;}}}function Mc(){while(lines.length>0){lines.pop().Destroy();}}function Nc(){for(var i=0;i<lines.length;i++){lines[i].StartLine();lines[i].Show();}}function Oc(){for(var i=0;i<lines.length;i++){lines[i].Hide();}}function Pc(){for(var i=0;i<lines.length;i++){lines[i].UpdateLine();}}function Qc(Rc,Sc,Tc){var numberOfRegions=Tc-Sc+1;if(numberOfRegions<1)return null;else{if(numberOfRegions==1)return Rc[Sc];}var leftRegion=null;var rightRegion=null;if(numberOfRegions==2){leftRegion=Rc[Sc];rightRegion=Rc[Tc];}else{var i=Math.round((Sc+Tc)/2);leftRegion=Qc(Rc,Sc,i);rightRegion=Qc(Rc,i+1,Tc);}if(leftRegion!=null&&rightRegion!=null){var left=leftRegion.boundingRectangle;var right=rightRegion.boundingRectangle;var northLatitude=left[0].latitude>right[0].latitude?left[0].latitude:right[0].latitude;var eastLongitude=left[0].longitude>right[0].longitude?left[0].longitude:right[0].longitude;var southLatitude=left[1].latitude<right[1].latitude?left[1].latitude:right[1].latitude;var westLongitude=left[1].longitude<right[1].longitude?left[1].longitude:right[1].longitude;var combinedBoundingRectangle=[new Msn.VE.LatLong(northLatitude,eastLongitude),new Msn.VE.LatLong(southLatitude,westLongitude)];return new Msn.VE.LineRegion(combinedBoundingRectangle,null,[leftRegion,rightRegion]);}else{if(leftRegion!=null)return leftRegion;else{if(rightRegion!=null)return rightRegion;}}return null;}function Uc(){var defaultLineWeight=6;var defaultLineColor=new Msn.Drawing.Color(17,221,17,0.7);var routeStroke=new Msn.Drawing.Stroke();var defaultLineZIndex=4;var element=null;var elementId="";var visible=true;var strokeweight="";var strokecolor="";var zIndex=0;var startLatitude=0;var startLongitude=0;var endLatitude=0;var endLongitude=0;var latitudes=null;var longitudes=null;var lineRegions=null;var zoomLevelsForGeneralizedLines=null;var startIndex=0;var endIndex=0;var lastRedrawView=null;function Vc(Wc,Xc,Yc,Zc,ae,be,ce,ee){if(!Zc)Zc=defaultLineWeight;if(!ae)ae=defaultLineColor;if(!be)be=defaultZIndex;this.id=Wc;elementId=Wc;strokeweight=Zc+"pt";strokecolor=ae;zIndex=be;latitudes=Xc;longitudes=Yc;zoomLevelsForGeneralizedLines=ee;lineRegions=ce;startLatitude=latitudes[0];startLongitude=longitudes[0];endLatitude=latitudes[latitudes.length-1];endLongitude=longitudes[longitudes.length-1];lastRedrawView=currentView.MakeCopy();routeStroke.color=defaultLineColor;routeStroke.width=Zc;ne();}function ge(){he();latitudes=longitudes=lineRegions=element=lastRedrawView=null;}function he(){graphicCanvas.Clear();}function je(){if(!visible){ke();return;}if(element)element.style.display="block";}function ke(){if(element)element.style.display="none";}function le(me){visible=me;if(!visible)ke();}function ne(){pe();qe();lastRedrawView.Copy(currentView);}function oe(){if(currentView.zoomLevel==lastRedrawView.zoomLevel&&MathAbs((currentView.center.x-lastRedrawView.center.x)/width)<0.25&&MathAbs((currentView.center.y-lastRedrawView.center.y)/height)<0.25)return;pe();qe();lastRedrawView=currentView.MakeCopy();}function pe(){var bufferHeight=height<900?900:height;var bufferWidth=width<900?900:width;northLatitude=kb(-0.5*bufferHeight);southLatitude=kb(1.5*bufferHeight);westLongitude=lb(-0.5*bufferWidth);eastLongitude=lb(1.5*bufferWidth);}function qe(){if(currentView.mapStyle==obliqueStyle){graphicCanvas.Clear();return;}var points=new Array();var generalizedLineIndex=zoomLevelsForGeneralizedLines.length-1;while(zoomLevelsForGeneralizedLines[generalizedLineIndex]<currentView.zoomLevel&&generalizedLineIndex>=0){generalizedLineIndex--;}re(lineRegions[generalizedLineIndex],points);ue(points);}function re(se,te){if(ze(se.boundingRectangle[0],se.boundingRectangle[1]))return;if(se.childRegions!=null)for(var i=0;i<se.childRegions.length;i++){re(se.childRegions[i],te);}else{var indices=se.indices;var firstPoint=new Msn.VE.LatLong(latitudes[indices[0]],longitudes[indices[0]]);var secondPoint;var inVisibleSegment=false;if(we(firstPoint.latitude,firstPoint.longitude)){var firstPixel=currentMode.LatLongToPixel(firstPoint,currentView.zoomLevel);te.push(new Msn.Drawing.Point(firstPixel.x-originX,firstPixel.y-originY));inVisibleSegment=true;}for(var pointIndex=1;pointIndex<indices.length;pointIndex++){secondPoint=new Msn.VE.LatLong(latitudes[indices[pointIndex]],longitudes[indices[pointIndex]]);if(we(secondPoint.latitude,secondPoint.longitude)){if(!inVisibleSegment){var firstPixel=currentMode.LatLongToPixel(firstPoint,currentView.zoomLevel);te.push(new Msn.Drawing.Point(firstPixel.x-originX,firstPixel.y-originY));}inVisibleSegment=true;var secondPixel=currentMode.LatLongToPixel(secondPoint,currentView.zoomLevel);te.push(new Msn.Drawing.Point(secondPixel.x-originX,secondPixel.y-originY));}else{if(inVisibleSegment){inVisibleSegment=false;var secondPixel=currentMode.LatLongToPixel(secondPoint,currentView.zoomLevel);te.push(new Msn.Drawing.Point(secondPixel.x-originX,secondPixel.y-originY));}}firstPoint=secondPoint;}}}function ue(ve){if(!graphicCanvas)return;ke();graphicCanvas.Clear();var polyline=new Msn.Drawing.PolyLine(ve);polyline.id=elementId;routeStroke.width=4;graphicCanvas.SetZIndex(zIndex);graphicCanvas.SetStroke(routeStroke);graphicCanvas.DrawPolyline(polyline);element=document.getElementById(elementId);if(visible)element.style.display="block";else element.style.display="none";}function we(xe,ye){return xe>=southLatitude&&xe<=northLatitude&&ye>=westLongitude&&ye<=eastLongitude;}function ze(Ae,Be){return Ae.latitude>northLatitude&&Be.latitude>northLatitude||Ae.latitude<southLatitude&&Be.latitude<southLatitude||Ae.longitude>eastLongitude&&Be.longitude>eastLongitude||Ae.longitude<westLongitude&&Be.longitude<westLongitude;}this.Init=Vc;this.Destroy=ge;this.RemoveFromMap=he;this.Show=je;this.Hide=ke;this.ChangeVisibility=le;this.StartLine=ne;this.UpdateLine=oe;}function Ce(De){var image=null;this.Init=function(){if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){image=document.createElement("div");image.className="PoweredByLogo PoweredByLogo_ie";}else{image=document.createElement("img");image.src=img_PoweredLogo;image.className="PoweredByLogo";}image.onclick=function(){window.open("http://local.live.com");};Ee();De.appendChild(image);};this.Destroy=function(){De.removeChild(image);image=null;};function Ee(){image.style.top=height-40+"px";image.style.left="6px";image.style.display="block";}function Fe(){Ee();}this.Reposition=Ee;this.Update=Fe;}function Ge(e){e=GetEvent(e);CancelEvent(e);if(zooming)return false;if(panning)Ve();if(obliqueMode)obliqueMode.CancelRequest();if(e.which&&e.which==2)currentTool=boxTool;else{if(!e.which&&e.button&&e.button==4)currentTool=boxTool;else{if(e.altKey)currentTool=boxTool;}}dragging=true;currentTool.OnMouseDown(e);return false;}function He(e){e=GetEvent(e);if(dragging)currentTool.OnMouseMove(e);return false;}function Ie(e){e=GetEvent(e);CancelEvent(e);dragging=false;currentTool.OnMouseUp(e);currentTool=panTool;try{keyboard.focus();}catch(err){}return false;}function Je(e){e=GetEvent(e);CancelEvent(e);C();if(panning||zooming)return false;var view=preferredView.MakeCopy();view.SetCenter(new Msn.VE.Pixel(originX+offsetX+GetMouseX(e)-x,originY+offsetY+GetMouseY(e)-y));if(e.altKey)view.SetZoomLevel(currentView.zoomLevel-1);else view.SetZoomLevel(currentView.zoomLevel+1);Xh(view);return false;}function Ke(e){e=GetEvent(e);CancelEvent(e);if(panning||zooming)return false;var delta=GetMouseScrollDelta(e);if(delta>0)xj();else{if(delta<0)yj();}return false;}function Le(e){e=GetEvent(e);CancelEvent(e);var clickX=originX+offsetX+GetMouseX(e)-x;var clickY=originY+offsetY+GetMouseY(e)-y;var clickEvent=lc(currentMode.PixelToLatLong(new Msn.VE.Pixel(clickX,clickY),currentView.zoomLevel));vc("oncontextmenu",clickEvent);return false;}function Me(Ne,Oe){if(Ne==0&&Oe==0)return;Nb(currentView,currentBounds,Ne,Oe);offsetX=currentView.center.x-originX-width/2;offsetY=currentView.center.y-originY-height/2;map.style.top=-offsetY+"px";map.style.left=-offsetX+"px";copyright.Update();window.setTimeout(Wh,1);window.setTimeout(Pc,2);}function Pe(Qe,Re,Se,Te){if(zooming)return;if(!Se)Se=-1;panningX=Qe;panningY=Re;panCounter=Se;if(!Qe&&!Re){Ve();return;}keyboardPan=Te;if(!panning){panning=true;Ue();vc("onstartcontinuouspan");}}function Ue(){if(panning){Me(panningX,panningY);if(panCounter>0)panCounter--;if(panCounter!=0)window.setTimeout(Ue,10);else Ve();}}function Ve(){panningX=0;panningY=0;panning=false;keyboardPan=false;if(panLatitude!=null&&panLongitude!=null){var latlong=new Msn.VE.LatLong(panLatitude,panLongitude);var pixel=currentMode.LatLongToPixel(latlong,currentView.zoomLevel);var dx=pixel.x-(originX+offsetX+width/2);var dy=pixel.y-(originY+offsetY+height/2);Me(dx,dy);currentView.latlong.latitude=panLatitude;currentView.latlong.longitude=panLongitude;preferredView.Copy(currentView);panLatitude=null;panLongitude=null;if(obliqueMode)obliqueMode.UpdateAvailability();}else hb(true);vc("onendcontinuouspan");vc("onchangeview");}function We(Xe,Ye){panLatitude=Xe;panLongitude=Ye;cg(currentMode.LatLongToPixel(new Msn.VE.LatLong(Xe,Ye),currentView.zoomLevel));}function Ze(ag){cg(ag.center);}function cg(eg){if(currentView.mapStyle==obliqueStyle){var scene=obliqueMode.GetScene();if(!scene||!scene.ContainsPixel(eg,currentView.zoomLevel)){var view=preferredView.MakeCopy();view.sceneId=null;view.SetCenterLatLong(obliqueMode.PixelToLatLong(eg,currentView.zoomLevel));Xh(view);return;}}var dx=eg.x-(originX+offsetX+width/2);var dy=eg.y-(originY+offsetY+height/2);var distance=Math.sqrt(dx*dx+dy*dy);if(!animatedMovementEnabled||MathAbs(dx)>2*width||MathAbs(dy)>2*height||distance>1.5*Math.sqrt(width*width+height*height)){var view=preferredView.MakeCopy();view.SetCenter(eg);Xh(view);return;}var angle=Math.atan2(dy,dx);var count=MathCeil(distance/panToLatLongSpeed);var speed=MathRound(distance/count);dx=MathRound(Math.cos(angle)*speed);dy=MathRound(Math.sin(angle)*speed);Pe(dx,dy,count);}function gg(hg,jg,kg,lg,mg,ng,og,pg){var pin=new ug();pin.Init(hg,jg,kg,lg,mg,ng,og,pg);pushpins.push(pin);return pin.pin;}function qg(rg){for(var i=0;i<pushpins.length;i++){var p=pushpins[i];if(p.id==rg){pushpins.splice(i,1);p.Destroy();return;}}}function sg(){while(pushpins.length>0){pushpins.pop().Destroy();}}function tg(){for(var i=0;i<pushpins.length;i++){pushpins[i].Reposition();}}function ug(){var pin=document.createElement("a");pin.href="javascript://pushin hover";pin.vePushpin=this;this.pin=pin;var x1=0;var y1=0;var x2=0;var y2=0;var center=null;var w=0;var h=0;var n=zoomTotalSteps+1;var xs=new Array(n);var ys=new Array(n);this.Init=function(vg,wg,xg,yg,zg,Ag,Bg,Cg){this.id=vg;pin.id=vg;pin.className=Ag;pin.style.position="absolute";pin.style.zIndex=Cg;pin.innerHTML=Bg;if(!B.fixedView){pin.attachEvent("ondblclick",Ng);pin.attachEvent("onmousewheel",Og);}pin.unselectable="on";center=new Msn.VE.LatLong(wg,xg);w=yg;h=zg;var pixel=currentMode.LatLongToPixel(center,currentView.zoomLevel);if(pixel){x1=MathRound(pixel.x-originX);y1=MathRound(pixel.y-originY);x2=x1;y2=y1;Eg();Fg(0);pin.style.display="block";}else pin.style.display="none";map.appendChild(pin);};this.Destroy=function(){pin.detachEvent("ondblclick",Ng);pin.detachEvent("onmousewheel",Og);Mg();pin.vePushpin=null;pin=null;this.pin=null;while(xs.length>0){xs.pop();}while(ys.length>0){ys.pop();}};this.GetLatitude=function(){return center.latitude;};this.GetLongitude=function(){return center.longitude;};function Dg(){var n=zoomTotalSteps;for(var i=0;i<=n;i++){xs[i]=x1-w/2+"px";ys[i]=y1-h/2+"px";}}function Eg(){var n=zoomTotalSteps;for(var i=0;i<=n;i++){var a=i/n;var b=1-a;xs[i]=MathFloor(b*x1+a*x2-w/2)+"px";ys[i]=MathFloor(b*y1+a*y2-h/2)+"px";}}function Fg(i){pin.style.left=xs[i];pin.style.top=ys[i];}function Gg(){var t=0;t=x1;x1=x2;x2=t;t=y1;y1=y2;y2=t;}function Hg(){var pixel=currentMode.LatLongToPixel(center,currentView.zoomLevel);if(pixel){x1=MathRound(pixel.x-originX);y1=MathRound(pixel.y-originY);Dg();Fg(0);pin.style.display="block";}else pin.style.display="none";}function Ig(Jg,Kg,Lg){x1-=offsetX;y1-=offsetY;var pixel=currentMode.LatLongToPixel(center,Lg);if(pixel){x2=MathRound(pixel.x-Jg);y2=MathRound(pixel.y-Kg);Eg();pin.style.display="block";}else pin.style.display="none";}function Mg(){if(pin.parentNode==map)map.removeChild(pin);}function Ng(e){e=GetEvent(e);CancelEvent(e);if(panning||zooming)return false;var view=preferredView.MakeCopy();view.SetCenterLatLong(center);if(e.altKey)view.SetZoomLevel(currentView.zoomLevel-1);else view.SetZoomLevel(currentView.zoomLevel+1);Xh(view);return false;}function Og(e){e=GetEvent(e);CancelEvent(e);if(panning||zooming)return false;var delta=GetMouseScrollDelta(e);if(delta>0)xj();else{if(delta<0)yj();}return false;}this.ClearSteps=Dg;this.PrecomputeSteps=Eg;this.SetFactor=Fg;this.SwapStates=Gg;this.Reposition=Hg;this.PrepareForZoom=Ig;this.RemoveFromMap=Mg;}function Pg(Qg){var labelBg=document.createElement("div");var labelFg=document.createElement("div");var barBg=document.createElement("div");var barFg=document.createElement("div");var scaleBarWidth=150;this.Init=function(){labelBg.className="ScaleBarLabel ScaleBarLabelBackground";labelFg.className="ScaleBarLabel ScaleBarLabelForeground";barBg.className="ScaleBar ScaleBarBackground";barFg.className="ScaleBar ScaleBarForeground";Yg();Rg();Qg.appendChild(labelBg);Qg.appendChild(labelFg);Qg.appendChild(barBg);Qg.appendChild(barFg);};this.Destroy=function(){Qg.removeChild(labelBg);Qg.removeChild(labelFg);Qg.removeChild(barBg);Qg.removeChild(barFg);labelBg=labelFg=barBg=BarFg=null;};function Rg(){labelBg.style.top=height-45+"px";labelBg.style.left=width-160+"px";labelBg.style.display="block";labelFg.style.top=height-46+"px";labelFg.style.left=width-161+"px";labelFg.style.display="block";barBg.style.top=height-30+"px";barBg.style.left=width-160+"px";barBg.style.display="block";barFg.style.top=height-31+"px";barFg.style.left=width-161+"px";barFg.style.display="block";}function Sg(Tg){return Tg*0.001;}function Ug(Vg){return Vg*0.000621371192;}function Wg(Xg){return Xg*1.0936133;}function Yg(){try{var mpp=wb();var maxMeters=mpp*scaleBarWidth;var units=L_ScaleBarMiles_Text;var dMeasure=Ug(maxMeters);var niceValue=Zg(dMeasure);if(niceValue<0.5){units=L_ScaleBarYards_Text;dMeasure=Wg(maxMeters);niceValue=Zg(dMeasure);}bh("us",units,niceValue,Math.round(niceValue/dMeasure*scaleBarWidth));}catch(ex){}}function Zg(ah){var dLog10=Math.log(ah)/Math.log(10);var dExponent=Math.floor(dLog10);var dExponentValue=Math.pow(10,dExponent);var dRoot=ah/dExponentValue;var dIntegerRoot=Math.floor(dRoot);if(dIntegerRoot>=3)return dIntegerRoot*dExponentValue;var dNiceRoot=Math.floor(dRoot*2)*0.5;return dNiceRoot*dExponentValue;}function bh(ch,eh,gh,hh){if(gh<1)gh=gh.toFixed(1);var text=gh+" "+eh;labelBg.innerHTML=text;labelFg.innerHTML=text;barBg.style.width=hh;barFg.style.width=hh;}this.Update=Yg;this.Reposition=Rg;}var totalRequestTime=0;var totalRequestCount=0;var totalFailureCount=0;var responseRangeCeilings=new Array();responseRangeCeilings[roadStyle]=[325,975];responseRangeCeilings[aerialStyle]=[350,1050];responseRangeCeilings[hybridStyle]=[425,1275];responseRangeCeilings[obliqueStyle]=[450,1350];var responseRangeCounts=[0,0,0];function jh(x,y,z,s){var t=new ph();t.Init(x,y,z,s,x*tileSize-originX,y*tileSize-originY);return t;}function kh(lh){while(lh.length>0){var tile=lh.pop();tile.Destroy();tile=null;}}function mh(){var total=0;for(var i=0;i<responseRangeCounts.length;i++){total+=responseRangeCounts[i];}if(total==0)return responseRangeCounts;var responseRangePercentages=new Array(responseRangeCounts.length);for(var i=0;i<responseRangeCounts.length;i++){responseRangePercentages[i]=responseRangeCounts[i]/total;}return responseRangePercentages;}function nh(){for(var i=0;i<responseRangeCounts.length;i++){responseRangeCounts[i]=0;}}function oh(){return totalFailureCount/totalRequestCount;}function ph(){var img=null;var request=null;var overlay=document.createElement("div");var alphaLayerImageArray=null;var alphaLayerDivArray=null;var tileX=0;var tileY=0;var tileZoom=0;var mapStyle=0;var zIndex=0;var n=zoomTotalSteps+1;var xs=new Array(n);var ys=new Array(n);var ws=new Array(n);var hs=new Array(n);var animated=false;var x1=0;var y1=0;var w1=0;var h1=0;var x2=0;var y2=0;var w2=0;var h2=0;var startTime=null;this.Init=function(qh,rh,sh,th,x,y){tileX=qh;tileY=rh;tileZoom=sh;mapStyle=th;overlay.style.font="7pt Verdana, sans-serif";overlay.style.color="Red";overlay.style.backgroundColor="White";if(!currentMode.IsValidTile(tileX,tileY,tileZoom))return;vh(x,y,tileSize,tileSize);wh(x,y,tileSize,tileSize);yh();alphaLayerImageArray=new Array(currentView.alphaLayerNameList.length);if(useAlphaImageLoader)alphaLayerDivArray=new Array(currentView.alphaLayerNameList.length);for(var i=0;i<currentView.alphaLayerNameList.length;i++){alphaLayerImageArray[i]=new Image();alphaLayerImageArray[i].style.display="none";alphaLayerImageArray[i].onload=uh;alphaLayerImageArray[i].onmousedown=function(e){return false;};alphaLayerImageArray[i].src=currentMode.GetFilenameForLayer(currentView.alphaLayerNameList[i],tileX,tileY,tileZoom);}request=new Image();request.onload=Ch;request.onerror=Dh;startTime=new Date();request.src=currentMode.GetFilename(tileX,tileY,tileZoom);};function uh(e){this.style.display="inline";if(!zooming)zh(zoomCounter);}this.Destroy=function(){if(img)img.onmousedown=null;Bh();while(xs.length>0){xs.pop();}while(ys.length>0){ys.pop();}while(ws.length>0){ws.pop();}while(hs.length>0){hs.pop();}xs=ys=ws=hs=null;};function vh(x,y,w,h){x1=x;y1=y;w1=w;h1=h;}this.SetCurrentState=vh;function wh(x,y,w,h){x2=x;y2=y;w2=w;h2=h;}this.SetNextState=wh;function xh(){for(var i=0;i<=zoomTotalSteps;i++){xs[i]=x1+"px";ys[i]=y1+"px";ws[i]=w1+"px";hs[i]=h1+"px";}}this.ClearSteps=xh;function yh(){for(var i=0;i<=zoomTotalSteps;i++){var a=i/zoomTotalSteps;var b=1-a;xs[i]=MathFloor(b*x1+a*x2)+"px";ys[i]=MathFloor(b*y1+a*y2)+"px";ws[i]=MathCeil(b*w1+a*w2)+"px";hs[i]=MathCeil(b*h1+a*h2)+"px";}}this.PrecomputeSteps=yh;function zh(i){if(img==null&&(alphaLayerImageArray==null||alphaLayerImageArray.length==0))return;if(zooming&&!animated)return;for(var layerIndex=0;layerIndex<alphaLayerImageArray.length;layerIndex++){var AlphaZIndex=100+3*currentMode.GetZIndexForLayer(currentView.alphaLayerNameList[layerIndex]);if(alphaLayerImageArray[layerIndex]!=null&&alphaLayerImageArray[layerIndex].style.display!="none"){var child=null;if(useAlphaImageLoader){if(alphaLayerDivArray[layerIndex]==null)alphaLayerDivArray[layerIndex]=document.createElement("div");child=alphaLayerDivArray[layerIndex];}else child=alphaLayerImageArray[layerIndex];child.style.left=xs[i];child.style.top=ys[i];child.style.width=ws[i];child.style.height=hs[i];if(useAlphaImageLoader)child.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+alphaLayerImageArray[layerIndex].src+"', sizingMethod='scale')";if(child.parentNode!=map){child.style.position="absolute";child.style.cursor="pointer";child.style.zIndex=zIndex+AlphaZIndex;map.appendChild(child);}}}if(img==null)return;var style=img.style;style.left=xs[i];style.top=ys[i];style.width=ws[i];style.height=hs[i];var overlayStyle=overlay.style;if(debug&&i==0){style.border="1px dashed red";overlayStyle.left=xs[i];overlayStyle.top=ys[i];}if(img.parentNode!=map){style.position="absolute";style.cursor="pointer";style.zIndex=zIndex;map.appendChild(img);if(debug&&overlay.parentNode!=map){var path=img.src;overlay.innerHTML=path.substring(path.lastIndexOf("/")+1,path.lastIndexOf("."));overlayStyle.position="absolute";overlayStyle.zIndex=zIndex+1;map.appendChild(overlay);}}}this.SetFactor=zh;function Ah(){var t=0;t=x1;x1=x2;x2=t;t=y1;y1=y2;y2=t;t=w1;w1=w2;w2=t;t=h1;h1=h2;h2=t;}this.SwapStates=Ah;function Bh(){if(request){request.onload=null;request.onerror=null;request=null;}if(img){if(img.parentNode==map)map.removeChild(img);img=null;}if(alphaLayerImageArray!=null)for(var i=0;i<alphaLayerImageArray.length;i++){if(alphaLayerImageArray[i]!=null){if(alphaLayerImageArray[i].parentNode==map)map.removeChild(alphaLayerImageArray[i]);alphaLayerImageArray[i]=null;}}if(alphaLayerDivArray!=null)for(var i=0;i<alphaLayerDivArray.length;i++){if(alphaLayerDivArray[i]!=null){if(alphaLayerDivArray[i].parentNode==map)map.removeChild(alphaLayerDivArray[i]);alphaLayerDivArray[i]=null;}}if(overlay){if(overlay.parentNode==map)map.removeChild(overlay);overlay=null;}}this.RemoveFromMap=Bh;function Ch(){if(tileZoom!=currentView.zoomLevel||request==null)return;var endTime=new Date();var lastTime=endTime.getTime()-startTime.getTime();Eh(lastTime);totalRequestTime+=lastTime;totalRequestCount++;if(debug)window.status="last="+lastTime+", average="+totalRequestTime/totalRequestCount;request.onload=null;request.onerror=null;img=request;img.onmousedown=function(e){return false;};request=null;if(!zooming)zh(zoomCounter);}function Dh(){if(tileZoom!=currentView.zoomLevel||request==null)return;var endTime=new Date();var lastTime=endTime.getTime()-startTime.getTime();Eh(lastTime);totalRequestTime+=lastTime;totalRequestCount++;totalFailureCount++;request.onload=null;request.onerror=null;request=null;if(!zooming)zh(zoomCounter);}function Eh(Fh){for(var i=0;i<responseRangeCeilings[mapStyle].length;i++){if(Fh<responseRangeCeilings[mapStyle][i]){responseRangeCounts[i]++;return;}}responseRangeCounts[responseRangeCounts.length-1]++;}function Gh(Hh,Ih,Jh,Kh,Lh,Mh){vh(x1-offsetX,y1-offsetY,w1,h1);var deltaZoom=Mh-Jh;var zoomFactor=Math.pow(2,deltaZoom);x2=MathFloor((Hh+x1)*zoomFactor-Kh);y2=MathFloor((Ih+y1)*zoomFactor-Lh);w2=MathCeil((Hh+x1+w1)*zoomFactor-Kh)-x2;h2=MathCeil((Ih+y1+h1)*zoomFactor-Lh)-y2;animated=true;yh();zIndex=baseZIndex;if(img!=null)img.style.zIndex=zIndex;}this.PrepareBaseTile=Gh;function Nh(Oh,Ph,Qh,Rh,Sh,Th){var deltaZoom=Qh-Th;var zoomFactor=Math.pow(2,deltaZoom);x2=MathFloor((Rh+x1)*zoomFactor-Oh);y2=MathFloor((Sh+y1)*zoomFactor-Ph);w2=MathCeil((Rh+x1+w1)*zoomFactor-Oh)-x2;h2=MathCeil((Sh+y1+h1)*zoomFactor-Ph)-y2;var quarterWidth=MathCeil(tileViewportWidth*0.25);var quarterHeight=MathCeil(tileViewportHeight*0.25);animated=Th<Qh&&(tileX<tileViewportX1+quarterWidth||tileX>tileViewportX2-quarterWidth||tileY<tileViewportY1+quarterHeight||tileY>tileViewportY2-quarterHeight);Ah();yh();zIndex=swapZIndex;}this.PrepareSwapTile=Nh;function Uh(d){if(img!=null)img.style.border=d?"1px dashed red":"0px";overlay.style.display=d?"block":"none";}this.Debug=Uh;}function Vh(){kh(currentTilesList);map.style.top="0px";map.style.left="0px";originX=MathRound(currentView.center.x-width/2);originY=MathRound(currentView.center.y-height/2);offsetX=0;offsetY=0;tileViewportX1=MathFloor((originX-buffer)/tileSize);tileViewportY1=MathFloor((originY-buffer)/tileSize);tileViewportX2=MathFloor((originX+width+buffer)/tileSize);tileViewportY2=MathFloor((originY+height+buffer)/tileSize);tileViewportWidth=tileViewportX2-tileViewportX1+1;tileViewportHeight=tileViewportY2-tileViewportY1+1;for(var y=tileViewportY1;y<=tileViewportY2;y++){for(var x=tileViewportX1;x<=tileViewportX2;x++){var tile=jh(x,y,currentView.zoomLevel,currentView.mapStyle);currentTilesList.push(tile);}}}function Wh(){if(zooming)return;var ox=originX+offsetX;var oy=originY+offsetY;var x1=MathFloor((ox-buffer)/tileSize);var y1=MathFloor((oy-buffer)/tileSize);var x2=MathFloor((ox+width+buffer)/tileSize);var y2=MathFloor((oy+height+buffer)/tileSize);while(tileViewportX1<x1){for(var y=tileViewportHeight-1;y>=0;y--){var tile=currentTilesList.splice(y*tileViewportWidth,1)[0];tile.RemoveFromMap();}tileViewportX1++;tileViewportWidth--;}while(tileViewportX1>x1){tileViewportX1--;tileViewportWidth++;for(var y=0;y<tileViewportHeight;y++){var tile=jh(tileViewportX1,tileViewportY1+y,currentView.zoomLevel,currentView.mapStyle);currentTilesList.splice(y*tileViewportWidth,0,tile);}}while(tileViewportY1<y1){for(var x=0;x<tileViewportWidth;x++){var tile=currentTilesList.shift();tile.RemoveFromMap();}tileViewportY1++;tileViewportHeight--;}while(tileViewportY1>y1){tileViewportY1--;tileViewportHeight++;for(var x=tileViewportWidth-1;x>=0;x--){var tile=jh(tileViewportX1+x,tileViewportY1,currentView.zoomLevel,currentView.mapStyle);currentTilesList.unshift(tile);}}while(tileViewportX2>x2){for(var y=tileViewportHeight-1;y>=0;y--){var tile=currentTilesList.splice(y*tileViewportWidth+tileViewportWidth-1,1)[0];tile.RemoveFromMap();}tileViewportX2--;tileViewportWidth--;}while(tileViewportX2<x2){tileViewportX2++;tileViewportWidth++;for(var y=0;y<tileViewportHeight;y++){var tile=jh(tileViewportX2,tileViewportY1+y,currentView.zoomLevel,currentView.mapStyle);currentTilesList.splice(y*tileViewportWidth+tileViewportWidth-1,0,tile);}}while(tileViewportY2>y2){for(var x=0;x<tileViewportWidth;x++){var tile=currentTilesList.pop();tile.RemoveFromMap();}tileViewportY2--;tileViewportHeight--;}while(tileViewportY2<y2){tileViewportY2++;tileViewportHeight++;for(var x=0;x<tileViewportWidth;x++){var tile=jh(tileViewportX1+x,tileViewportY2,currentView.zoomLevel,currentView.mapStyle);currentTilesList.push(tile);}}}function Xh(Yh){if(zooming||panning||dragging)return;var centerLatLong=Yh.latlong;if(Yh.GetViewType()=="latlongRect")centerLatLong=Yh.latlongRect.Center();if(Yh.mapStyle==obliqueStyle){if(obliqueMode==null)return;preferredView.Copy(Yh);currentMode=obliqueMode;A.style.backgroundColor="black";Yh.Resolve(currentMode,width,height);var scene=obliqueMode.GetScene();if((!scene||scene.GetID()!=Yh.sceneId)&&Yh.sceneId!=null){obliqueMode.RequestScene(Yh.sceneId);return;}if(!scene||!scene.ContainsLatLong(centerLatLong,Yh.zoomLevel)&&scene.GetID()!=Yh.sceneId||scene.GetOrientation()!=Yh.sceneOrientation){obliqueMode.RequestSceneAtLatLong(centerLatLong,Yh.sceneOrientation,true);return;}}else{currentMode=orthoMode;if(Yh.mapStyle=="r"||Yh.alphaLayerNameList.length>0)A.style.backgroundColor="#e9e7d4";else A.style.backgroundColor="black";Yh.Resolve(currentMode,width,height);}centerLatLong=Yh.latlong;preferredView.Copy(Yh);currentMode.ValidateZoomLevel(Yh);currentBounds=currentMode.GetBounds(Yh);Kb(Yh,currentBounds);Yh.Resolve(currentMode,width,height);if(Yh.Equals(currentView))return;var deltaX=Yh.GetX(currentView.zoomLevel)-currentView.center.x;var deltaY=Yh.GetY(currentView.zoomLevel)-currentView.center.y;var distance=Math.sqrt(deltaX*deltaX+deltaY*deltaY);var animatedPan=distance<width&&distance<height&&Yh.zoomLevel==currentView.zoomLevel&&animatedMovementEnabled&&Yh.mapStyle==currentView.mapStyle&&Yh.AlphaLayerNameListEquals(currentView)&&(Yh.sceneId==null||Yh.sceneId==currentView.sceneId);if(animatedPan){We(centerLatLong.latitude,centerLatLong.longitude);return;}previousZoomLevel=currentView.zoomLevel;if(currentView.zoomLevel!=Yh.zoomLevel){vc("onstartzoom");zooming=true;}var animatedZoom=distance<width&&distance<height&&(Yh.zoomLevel==currentView.zoomLevel-1||Yh.zoomLevel==currentView.zoomLevel+1)&&animatedMovementEnabled&&Yh.mapStyle==currentView.mapStyle&&Yh.AlphaLayerNameListEquals(currentView)&&(Yh.sceneId==null||Yh.sceneId==currentView.sceneId);if(animatedZoom){var oldOriginX=originX+offsetX;var oldOriginY=originY+offsetY;var oldZoom=currentView.zoomLevel;var newZoom=Yh.zoomLevel;var newOriginX=MathRound(Yh.center.x-width/2);var newOriginY=MathRound(Yh.center.y-height/2);oldTilesList=currentTilesList;currentTilesList=new Array();for(var i=0;i<oldTilesList.length;i++){oldTilesList[i].PrepareBaseTile(oldOriginX,oldOriginY,oldZoom,newOriginX,newOriginY,newZoom);}for(var i=0;i<pushpins.length;i++){pushpins[i].PrepareForZoom(newOriginX,newOriginY,newZoom);}Oc();currentView.Destroy();currentView=Yh;Vh();for(var i=0;i<currentTilesList.length;i++){currentTilesList[i].PrepareSwapTile(oldOriginX,oldOriginY,oldZoom,newOriginX,newOriginY,newZoom);}zoomCounter=1;Zh();return;}oldTilesList=currentTilesList;currentTilesList=new Array();currentView.Destroy();currentView=Yh;Oc();Vh();aj();tg();}function Zh(){if(!zooming)return;for(var i=0;i<oldTilesList.length;i++){oldTilesList[i].SetFactor(zoomCounter);}for(var i=0;i<currentTilesList.length;i++){currentTilesList[i].SetFactor(zoomCounter);}for(var i=0;i<pushpins.length;i++){pushpins[i].SetFactor(zoomCounter);}if(zoomCounter<zoomTotalSteps){zoomCounter++;window.setTimeout(Zh,1);}else{zoomCounter=0;aj();}}function aj(){kh(oldTilesList);oldTilesList=null;zooming=false;for(var i=0;i<currentTilesList.length;i++){currentTilesList[i].SwapStates();currentTilesList[i].ClearSteps();currentTilesList[i].SetFactor(0);}for(var i=0;i<pushpins.length;i++){pushpins[i].SwapStates();pushpins[i].ClearSteps();pushpins[i].SetFactor(0);}currentTilesIndexes=null;oldTilesIndexes=null;window.setTimeout(Nc,250);if(copyright)copyright.Update();if(previousMapStyle!=currentView.mapStyle)vc("onchangemapstyle");if(previousZoomLevel!=currentView.zoomLevel)vc("onendzoom");vc("onchangeview");if(obliqueMode)window.setTimeout(obliqueMode.UpdateAvailability,100);try{CollectGarbage();}catch(ex){}}function bj(cj,ej,gj,hj){var view=preferredView.MakeCopy();view.sceneId=null;view.SetLatLongRectangle(new Msn.VE.LatLongRectangle(new Msn.VE.LatLong(cj,ej),new Msn.VE.LatLong(gj,hj)));Xh(view);}function jj(l){if(!l||l.constructor!=Array)return;var a=l[0].latitude;var b=l[0].longitude;var c=a;var d=b;for(var i=1;i<l.length;i++){a=MathMin(a,l[i].latitude);b=MathMin(b,l[i].longitude);c=MathMax(c,l[i].latitude);d=MathMax(d,l[i].longitude);}var dLat=(c-a)*0.1;var dLon=(d-b)*0.1;a-=dLat;b-=dLon;c+=dLat;d+=dLon;bj(nj(a),pj(b),nj(c),pj(d));}function kj(lj,mj){var latlong=new Msn.VE.LatLong(lj,mj);if(currentView.mapStyle==obliqueStyle){var scene=obliqueMode.GetScene();if(!scene||!scene.ContainsLatLong(latlong))X(lastOrthoMapStyle);}jj(new Array(currentView.latlong,latlong));}function nj(oj){return rj(oj,minLatitude,maxLatitude);}function pj(qj){return rj(qj,minLongitude,maxLongitude);}function rj(n,sj,tj){if(n<sj)return sj;if(n>tj)return tj;return n;}function uj(){var x=null;try{x=new ActiveXObject("Msxml2.XMLHTTP");}catch(ex){try{x=new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){x=null;}}if(!x&&typeof XMLHttpRequest!="undefined")x=new XMLHttpRequest();return x;}function vj(wj){var view=preferredView.MakeCopy();view.SetZoomLevel(wj);Xh(view);}function xj(){var view=preferredView.MakeCopy();view.SetZoomLevel(currentView.zoomLevel+1);Xh(view);}function yj(){var view=preferredView.MakeCopy();view.SetZoomLevel(currentView.zoomLevel-1);Xh(view);}function zj(Aj,Bj,Cj){var view=preferredView.MakeCopy();view.sceneId=null;view.SetCenterLatLong(new Msn.VE.LatLong(Aj,Bj));view.SetZoomLevel(Cj);Xh(view);}function Dj(){var scene=null;var available=false;var availableBefore=false;var xmlHttp=null;var obliqueUrl=null;var showOnLoad=false;var requestUrl=null;var timerId=-1;var bounds=["02121222233","02121222322","02121222323","02121222332","02121222333","02121223222","02121223223","02121223232","02123000101","02123000103","02123000110","02123000111","02123000112","02123000113","02123000130","02123000131","02123001000","02123001001","02123001002","02123001003","02123001010","02123001012","02123001020","02123001021","02123001030","02123002113","02123002131","02123002133","02123002311","02123002313","02123003002","02123003003","02123003012","02123003020","02123003021","02123003022","02123003023","02123003030","02123003032","02123003200","02123003201","02123003202","02123003210","02133301103","02133301112","02133301113","02133301120","02133301121","02133301122","02133301123","02133301130","02133301131","02133301132","02133301133","02133301300","02133301301","02133301303","02133301310","02133301311","02133301312","02133310020","02133310022","02133310200","02133310222","02133310223","02133310232","02133310233","02133310322","02133312000","02133312001","02133312002","02133312003","02133312010","02133312011","02133312012","02133312013","02133312021","02133312030","02133312031","02133312100","02133312102","02133333112","02133333121","02133333122","02133333123","02133333130","02133333131","02133333132","02133333133","02133333201","02133333203","02133333210","02133333211","02133333212","02133333213","02133333300","02133333301","02133333302","02133333303","02133333310","02301020311","02301020313","02301020331","02301020332","02301020333","02301021013","02301021021","02301021022","02301021023","02301021030","02301021031","02301021032","02301021033","02301021122","02301021200","02301021201","02301021202","02301021203","02301021210","02301021211","02301021212","02301021213","02301021222","02301021300","02301022110","02301022111","02301031102","02301031103","02301031120","02301031121","02301031131","02301031133","02301120020","02301120022","02301213211","02301213213","02301213300","02301213301","02301213302","02301213303","02301213310","02301213311","02301213312","02301213313","02301213320","02301213321","02301213322","02301213323","02301213330","02301213331","02301213332","02301213333","02301231013","02301231031","02301231100","02301231101","02301231102","02301231103","02301231110","02301231111","02301231112","02301231113","02301231120","02301231121","02301231130","02301231131","02301231132","02301231133","02301231310","02301231311","02301300230","02301300231","02301300232","02301300233","02301300302","02301300320","02301301131","02301301133","02301301332","02301301333","02301302123","02301302132","02301302133","02301302200","02301302201","02301302202","02301302203","02301302210","02301302211","02301302212","02301302213","02301302220","02301302221","02301302222","02301302223","02301302230","02301302231","02301302232","02301302233","02301302300","02301302301","02301302302","02301302303","02301302310","02301302311","02301302312","02301302313","02301302320","02301302321","02301302322","02301302323","02301302330","02301302331","02301302332","02301302333","02301303021","02301303022","02301303110","02301303111","02301303200","02301303201","02301310020","02301310021","02301310022","02301310023","02301310200","02301310201","02301312033","02301312211","02301312300","02301312302","02301312320","02301312321","02301312332","02301320000","02301320001","02301320002","02301320003","02301320010","02301320011","02301320012","02301320013","02301320020","02301320021","02301320022","02301320023","02301320030","02301320031","02301320032","02301320033","02301320100","02301320101","02301320102","02301320103","02301320110","02301320111","02301320112","02301320113","02301320120","02301320121","02301320130","02301320200","02301320201","02301320203","02301320210","02301320211","02301320212","02301320213","02301320230","02301320231","02301320300","02301321001","02301321002","02301321003","02301321010","02301321011","02301321012","02301321013","02301321100","02301321101","02301321102","02301321103","02301330011","02301330100","02301330101","02301330102","02301330103","02301330110","02310101223","02310101230","02310101232","02310101233","02310103001","02310103010","02310103023","02310103030","02310103031","02310103032","02310103033","02310103120","02310103122","02310103203","02310103210","02310103211","02310103212","02310103213","02310103300","02310103302","02310210322","02310210323","02310210332","02310210333","02310211203","02310211212","02310211213","02310211221","02310211222","02310211223","02310211230","02310211231","02310211232","02310211233","02310211302","02310211303","02310211320","02310211321","02310211322","02310212011","02310212100","02310212101","02310212110","02310212111","02310212112","02310212130","02310212132","02310213000","02310213001","02310213002","02310213003","02310213010","02310213011","02310213012","02310213100","02310213112","02310213113","02310213130","02310213131","02310213132","02310213133","02310213311","02310223202","02310223203","02310223220","02310223221","02310302002","02310302003","02310302012","02310302013","02310302020","02310302021","02310302022","02310302023","02310302030","02310302031","02310302032","02310302033","02310302120","02310302121","02310302122","02310302123","02310302200","02310302201","02310302210","02310302211","02310302212","02310302213","02310302230","02310302231","02310302232","02310302233","02310302300","02310302301","02310302302","02310302320","02311030103","02311030112","02311030113","02311030121","02311030123","02311030130","02311030131","02311030132","02311030133","02311030310","02311030311","02311030313","02311031002","02311031003","02311031020","02311031021","02311031022","02311031023","02311031200","02311031201","02311031202","02311031203","02311102213","02311102231","02311102302","02311102303","02311102320","02311102321","02311102323","02311102332","02311102333","02311103222","02311120101","02311120103","02311120110","02311120111","02311120112","02311120113","02311120121","02311120130","02311120131","02311121000","02311121002","02311121020","02311231220","02311231221","02311231222","02311231223","02311231230","02311231231","02311231232","02311231233","02311231320","02311231322","02311232023","02311232032","02311232033","02311232100","02311232101","02311232102","02311232103","02311232110","02311232111","02311232112","02311232113","02311232120","02311232121","02311232122","02311232123","02311232130","02311232131","02311232132","02311232133","02311232201","02311232210","02311232211","02311232212","02311232213","02311232230","02311232231","02311232300","02311232301","02311232302","02311232310","02311232311","02311233000","02311233001","02311233002","02311233003","02311233010","02311233011","02311233012","02311233013","02311233020","02311233021","02311233022","02311233100","02311233102","02311233200","02311300101","02311300103","02311300110","02311300111","02311300112","02311300113","02311300121","02311300123","02311300130","02311300131","02311300132","02311300133","02311300310","02311300311","02311300312","02311300313","02311300331","02311301000","02311301001","02311301002","02311301003","02311301010","02311301012","02311301020","02311301021","02311301022","02311301023","02311301030","02311301200","02311301201","02311301202","02311301203","02311323131","02311323133","02311323311","02311332020","02311332021","02311332022","02311332023","02311332032","02311332200","02311332201","02311332210","02313032013","02313032030","02313032031","02313032032","02313032033","02313032120","02313032121","02313032122","02313032123","02313032130","02313032131","02313032132","02313032133","02313032210","02313032211","02313032300","02313032301","02313032310","02313032311","02313102232","02313102233","02313102332","02313102333","02313113033","02313113122","02313113210","02313113211","02313113212","02313113213","02313113230","02313113231","02313113233","02313113300","02313113302","02313113303","02313113311","02313113313","02313113320","02313113321","02313113322","02313113323","02313113330","02313113331","02313113332","02313113333","02313120010","02313120011","02313120012","02313120013","02313120030","02313120031","02313120032","02313120100","02313120101","02313120102","02313120103","02313120110","02313120120","02313131101","02313131103","02313131110","02313131111","02313131112","02313131113","02313131121","02313131130","02313131131","02313131132","02313131133","02313210211","02313210213","02313210231","02313210300","02313210301","02313210302","02313210303","02313210310","02313210311","02313210312","02313210313","02313210320","02313210321","02313210322","02313210323","02313210330","02313210331","02313210332","02313210333","03022220013","03022220031","03022220033","03022220102","03022220103","03022220112","03022220113","03022220120","03022220121","03022220122","03022220123","03022220130","03022220131","03022220132","03022220133","03022220211","03022220300","03022220301","03022220310","03022220311","03022313313","03022313330","03022313331","03022313332","03022313333","03022320313","03022322030","03022322031","03022322032","03022322033","03022322120","03022322121","03022322122","03022322123","03022322130","03022322132","03022322210","03022322211","03022323021","03022323022","03022323023","03022323123","03022323200","03022323201","03022323202","03022323203","03022323210","03022323211","03022323212","03022323213","03022323231","03022323233","03022323300","03022323301","03022323302","03022323303","03022323312","03022323320","03022323321","03022323322","03022330332","03022330333","03022331110","03022331111","03022331113","03022331123","03022331130","03022331131","03022331132","03022331133","03022331220","03022331221","03022331222","03022331223","03022331230","03022331232","03022331301","03022331310","03022331311","03022332003","03022332012","03022332013","03022332020","03022332021","03022332022","03022332023","03022332030","03022332031","03022332032","03022332033","03022332101","03022332103","03022332110","03022332111","03022332112","03022332113","03022332200","03022332201","03022332202","03022332203","03022332210","03022332211","03022332212","03022332213","03022332231","03022332232","03022332233","03022332320","03022332321","03022332322","03022332323","03022333000","03022333001","03022333002","03022333003","03022333010","03022333011","03022333012","03022333013","03023202202","03023202203","03023202212","03023202213","03023202220","03023202221","03023202222","03023202223","03023202230","03023202231","03023202232","03023202233","03023202302","03023202303","03023202320","03023202321","03023202322","03023202323","03023202330","03023202331","03023202332","03023202333","03023203213","03023203231","03023203233","03023203302","03023203320","03023203321","03023203322","03023203323","03023203330","03023203331","03023203332","03023203333","03023212222","03023212233","03023220000","03023220001","03023220002","03023220003","03023220010","03023220011","03023220012","03023220013","03023220020","03023220021","03023220022","03023220023","03023220030","03023220031","03023220032","03023220033","03023220100","03023220101","03023220102","03023220103","03023220110","03023220111","03023220112","03023220113","03023220120","03023220122","03023220130","03023220131","03023220132","03023220133","03023220200","03023220201","03023220210","03023220211","03023220212","03023220213","03023220230","03023220231","03023220232","03023220233","03023220300","03023220301","03023220302","03023220303","03023220310","03023220311","03023220312","03023220313","03023220320","03023220321","03023220322","03023220323","03023220330","03023220331","03023220332","03023220333","03023221000","03023221001","03023221002","03023221003","03023221010","03023221011","03023221012","03023221013","03023221020","03023221021","03023221022","03023221023","03023221030","03023221031","03023221032","03023221033","03023221100","03023221101","03023221102","03023221103","03023221110","03023221111","03023221112","03023221113","03023221120","03023221121","03023221122","03023221123","03023221130","03023221131","03023221132","03023221200","03023221201","03023221202","03023221203","03023221210","03023221211","03023221220","03023221221","03023221222","03023221223","03023221230","03023221232","03023221300","03023221303","03023221312","03023221313","03023221320","03023221321","03023221322","03023221323","03023221330","03023221331","03023221332","03023221333","03023222010","03023222011","03023222100","03023222101","03023222110","03023222111","03023223000","03023223001","03023223010","03023223100","03023223101","03023223110","03023223111","03023230000","03023230002","03023230020","03023231130","03023231131","03023231132","03023231133","03023231310","03023231311","03023231312","03023231313","03023231321","03023231323","03023231330","03023231331","03023231332","03023231333","03023233101","03023233110","03023233111","03023233212","03023233213","03023233221","03023233223","03023233230","03023233231","03023233232","03023233233","03023320020","03023320021","03023320022","03023320023","03023320030","03023320031","03023320032","03023320033","03023320120","03023320121","03023320122","03023320123","03023320130","03023320131","03023320132","03023320133","03023320200","03023320201","03023320202","03023320203","03023320210","03023320211","03023320212","03023320213","03023320220","03023320221","03023320222","03023320223","03023320230","03023320231","03023320232","03023320233","03023320300","03023320301","03023320302","03023320303","03023320310","03023320311","03023320312","03023320313","03023320320","03023320321","03023320322","03023320323","03023320330","03023320331","03023320332","03023320333","03023321003","03023321013","03023321020","03023321021","03023321022","03023321023","03023321030","03023321031","03023321032","03023321033","03023321102","03023321103","03023321120","03023321121","03023321122","03023321123","03023321130","03023321132","03023321200","03023321201","03023321202","03023321203","03023321210","03023321211","03023321212","03023321213","03023321220","03023321221","03023321222","03023321223","03023321230","03023321231","03023321232","03023321233","03023321300","03023321301","03023321302","03023321320","03023321321","03023321322","03023321323","03023321332","03023322000","03023322001","03023322010","03023322011","03023322100","03023322101","03023322110","03023322111","03023323000","03023323001","03023323002","03023323003","03023323010","03023323011","03023323012","03023323013","03023323020","03023323021","03023323023","03023323030","03023323031","03023323032","03023323033","03023323100","03023323101","03023323102","03023323103","03023323110","03023323112","03023323113","03023323120","03023323121","03023323122","03023323123","03023323130","03023323131","03023323132","03023323133","03023323201","03023323210","03023323211","03023323300","03023323301","03023323302","03023323303","03023323310","03023323311","03023323312","03023323313","03023330222","03023330223","03023332000","03023332001","03023332002","03023332003","03023332010","03023332012","03023332020","03023332021","03023332022","03023332023","03023332030","03023332032","03023332201","03023332202","03023332203","03023332212","03023332220","03023332221","03131013130","03131013131","03131013132","03131013133","03131102020","03131102022","03131133020","03131133021","03131133022","03131133023","03131133030","03131133032","03131133200","03131133201","03131133210","03131310323","03131310332","03131311113","03131311131","03131311303","03131311312","03131311321","03131311323","03131311330","03131311332","03131312000","03131312001","03131312002","03131312003","03131312010","03131312012","03131312020","03131312021","03131312030","03131312101","03131312103","03131312110","03131312112","03131312312","03131312313","03131312330","03131312331","03131312332","03131312333","03131313111","03131313113","03131313130","03131313131","03131313202","03131313203","03131313212","03131313220","03131313221","03131313222","03131313223","03131313230","03131313232","03131313321","03131313322","03131313323","03131313330","03131313331","03131313332","03131313333","03200000320","03200000321","03200000322","03200000323","03200000330","03200000331","03200000332","03200000333","03200002100","03200002101","03200002102","03200002103","03200002110","03200002111","03200002112","03200002113","03200002120","03200002121","03200002130","03200010303","03200010312","03200010313","03200010321","03200010322","03200010323","03200010330","03200010331","03200010332","03200010333","03200011233","03200011322","03200011323","03200012100","03200012101","03200012102","03200012103","03200012110","03200012111","03200012112","03200012113","03200012120","03200012121","03200012130","03200012131","03200013011","03200013013","03200013100","03200013101","03200013102","03200013103","03200013131","03200013301","03200013303","03200013310","03200013311","03200013312","03200013313","03200013330","03200013331","03200023130","03200023131","03200023132","03200023133","03200023311","03200031310","03200031311","03200031312","03200031313","03200031330","03200031331","03200031333","03200032020","03200032021","03200032022","03200032023","03200032200","03200032201","03200100311","03200100312","03200100313","03200100322","03200100323","03200100330","03200100331","03200100332","03200101202","03200101220","03200102020","03200102021","03200102022","03200102023","03200102030","03200102032","03200102100","03200102101","03200102102","03200102103","03200102110","03200102112","03200102200","03200102201","03200102202","03200102210","03200102220","03200110010","03200110011","03200110100","03200110101","03200120122","03200120123","03200120132","03200120200","03200120202","03200120220","03200120222","03200120300","03200120301","03200120302","03200120303","03200120310","03200120312","03200203001","03200203003","03200203010","03200203011","03200203012","03200203013","03200203021","03200203023","03200203030","03200203031","03200203032","03200203033","03200210033","03200210122","03200210211","03200210212","03200210213","03200210230","03200210231","03200210300","03200210301","03200210302","03200210303","03200210310","03200210320","03200210321","03200213032","03200213033","03200213103","03200213112","03200213113","03200213121","03200213122","03200213123","03200213130","03200213131","03200213132","03200213133","03200213210","03200213211","03200213300","03200230101","03200230102","03200230103","03200230110","03200230111","03200230112","03200230113","03200230120","03200230121","03200230130","03200230131","03200230132","03200231002","03200231020","03200231103","03200231112","03200231113","03200231121","03200231123","03200231130","03200231131","03200231132","03200231133","03200231301","03200231303","03200231310","03200231311","03200231312","03200231313","03200232120","03200232121","03200232122","03200232123","03200232130","03200232131","03200232132","03200232133","03200232300","03200232301","03200232310","03200232311","03200232312","03200302002","03200302020","03200302022","03200302222","03200302223","03200302232","03200320000","03200320001","03200320002","03200320003","03200320010","03200320012","03200320013","03200320020","03200320021","03200320022","03200320023","03200320030","03200320031","03200320032","03200320200","03200320201","03200320210","03200332203","03200332212","03200332220","03200332221","03200332222","03200332223","03200332230","03200332231","03200332232","03200332233","03200332322","03201000333","03201001212","03201001213","03201001220","03201001221","03201001222","03201001223","03201001230","03201001231","03201001232","03201001233","03201001320","03201001322","03201001323","03201002111","03201002113","03201002311","03201002312","03201002313","03201002331","03201002332","03201002333","03201003000","03201003001","03201003002","03201003003","03201003010","03201003011","03201003012","03201003013","03201003033","03201003100","03201003101","03201003102","03201003103","03201003110","03201003112","03201003122","03201003200","03201003201","03201003202","03201003203","03201003211","03201003212","03201003220","03201003221","03201003222","03201003223","03201003230","03201003231","03201003232","03201003233","03201003300","03201003302","03201010032","03201010201","03201010203","03201010210","03201010211","03201010212","03201010213","03201010221","03201010230","03201010231","03201010232","03201010233","03201010300","03201010301","03201010302","03201010303","03201010310","03201010311","03201010312","03201010313","03201010320","03201010321","03201010322","03201010323","03201010330","03201010331","03201011001","03201011002","03201011003","03201011010","03201011011","03201011012","03201011013","03201011020","03201011021","03201011023","03201011030","03201011031","03201011032","03201011033","03201011100","03201011101","03201011102","03201011103","03201011110","03201011112","03201011120","03201011121","03201011122","03201011123","03201011130","03201011202","03201012011","03201012100","03201012101","03201012112","03201012113","03201012121","03201012123","03201012130","03201012131","03201012132","03201012133","03201012301","03201012303","03201012310","03201012311","03201012312","03201012313","03201012321","03201012323","03201012330","03201012332","03201013020","03201013022","03201013023","03201013200","03201020111","03201020132","03201020133","03201021000","03201021001","03201021002","03201021003","03201021010","03201021011","03201021012","03201021013","03201021031","03201022110","03201022111","03201022112","03201022113","03201022130","03201022131","03201023303","03201023312","03201023313","03201023320","03201023321","03201023322","03201023323","03201023330","03201023331","03201023332","03201023333","03201032220","03201032222","03201201100","03201201101","03201201110","03201201111","03201210000","03202002022","03202002023","03202002032","03202002200","03202002201","03202002202","03202002210","03202010333","03202011222","03202011223","03202011232","03202012111","03202012113","03202012130","03202012131","03202013000","03202013001","03202013002","03202013003","03202013010","03202013012","03202013020","03202013021","03202101311","03202101313","03202101323","03202101332","03202101333","03202102331","03202102333","03202103101","03202103103","03202103110","03202103111","03202103112","03202103113","03202103121","03202103123","03202103130","03202103131","03202103132","03202103133","03202103202","03202103203","03202103220","03202103221","03202103222","03202103223","03202103311","03202110001","03202110003","03202110010","03202110011","03202110012","03202110013","03202110100","03202110200","03202110201","03202110202","03202110203","03202110220","03202112000","03202112002","03202112020","03202112021","03202112022","03202112023","03202112200","03202121023","03202121032","03202121033","03202121201","03202121203","03202121210","03202121211","03202121212","03202121213","03202121300","03202121302","03202121311","03202121313","03202121323","03202121331","03202121332","03202121333","03202123100","03202123101","03202123103","03202123110","03202123111","03202123112","03202123113","03202123121","03202123123","03202123130","03202123131","03202123132","03202123133","03202123301","03202123310","03202123311","03202130200","03202130201","03202130202","03202130203","03202130210","03202130212","03202130220","03202130221","03202130222","03202130223","03202130230","03202130231","03202130232","03202130233","03202132000","03202132002","03202132003","03202132020","03202132021","03202132022","03202132023","03202132032","03202132200","03202132201","03202132210","03202301011","03202301013","03202301031","03202301100","03202301102","03202301103","03202301112","03202301113","03202301120","03202301121","03202301122","03202301123","03202301130","03202301131","03202301132","03202301133","03202301300","03202301301","03202301310","03202301311","03202310020","03202310022","03202310200","12020200002","12020200003","12020200020","12020200021","12020200022","12020200023","12020202000","12020202001","12020202002","12020202003","12020202020","12020202021","12020202311"];this.Init=function(Ej){obliqueUrl=Ej;};this.Destroy=function(){};function Fj(Gj,Hj,Ij){return scene.IsValidTile(Gj,Hj,Ij);}function Jj(Kj,Lj,Mj){return scene.GetTileFilename(Kj,Lj,Mj);}function Nj(Oj){if(!scene)return 0;var pixel=new Msn.VE.Pixel(MathRound(originX+offsetX+width/2),MathRound(originY+offsetY+height/2));var latlong1=scene.PixelToLatLong(pixel,Oj);pixel.x++;var latlong2=scene.PixelToLatLong(pixel,Oj);var sinLat1=Math.sin(DegToRad(latlong1.latitude));var sinLat2=Math.sin(DegToRad(latlong2.latitude));var metersHeight=earthRadius/2*MathAbs(Math.log((1+sinLat1)/(1-sinLat1))-Math.log((1+sinLat2)/(1-sinLat2)));var metersWidth=earthRadius*MathAbs(DegToRad(latlong1.longitude)-DegToRad(latlong2.longitude));return Math.sqrt(metersWidth*metersWidth+metersHeight*metersHeight);}function Pj(Qj,Rj){return scene?scene.PixelToLatLong(Qj,Rj):null;}function Sj(Tj,Uj){return scene?scene.LatLongToPixel(Tj,Uj):null;}function Vj(Wj){if(Wj.zoomLevel<1)Wj.SetZoomLevel(1);else{if(Wj.zoomLevel>2)Wj.SetZoomLevel(2);}}function Xj(){return scene;}function Yj(){return scene.GetBounds();}function Zj(){return available;}function ak(){if(!available)return null;var info=new Object();return info;}function bk(){if(currentView.mapStyle==obliqueStyle)return;if(currentView.zoomLevel<12){scene=null;availableBefore=available;available=false;rk();return;}ck(currentView.latlong,"North",false,500);}function ck(ek,gk,hk,jk){mk();showOnLoad=hk;if(!sk(ek)){scene=null;availableBefore=available;available=false;rk();return;}requestUrl=obliqueUrl+"?lat="+ek.latitude+"&lon="+ek.longitude;if(gk)requestUrl+="&o="+gk;if(jk)timerId=window.setTimeout(nk,jk);else{nk();timerId=-1;}}function kk(lk){if(scene&&scene.GetID()==lk)return;mk();showOnLoad=true;requestUrl=obliqueUrl+"?id="+lk;nk();}function mk(){try{if(timerId!=-1)window.clearTimeout(timerId);}catch(ex){}timerId=-1;try{if(xmlHttp){xmlHttp.onreadystatechange=null;xmlHttp.abort();}}catch(ex){}}function nk(){mk();if(!requestUrl)return;if(Msn.VE.API!=null){var network=new VENetwork();network.ServiceUrl=requestUrl;network.BeginInvoke("EndInvokeImagery",null,ok);}else{if(!xmlHttp)xmlHttp=uj();if(xmlHttp){xmlHttp.open("POST",requestUrl,true);xmlHttp.onreadystatechange=qk;xmlHttp.send("");}}}function ok(pk){if(pk!=null){scene=pk;available=true;}else{scene=null;available=false;}rk();}function qk(){if(!xmlHttp||xmlHttp.readyState!=4)return;timerId=-1;availableBefore=available;var code=xmlHttp.responseText;if(code)try{scene=eval(code+"EndInvokeImagery();");available=true;}catch(ex){scene=null;available=false;}else{scene=null;available=false;}rk();}function rk(){if(showOnLoad){showOnLoad=false;if(available){var view=preferredView.MakeCopy();view.SetMapStyle(obliqueStyle,scene.GetID(),scene.GetOrientation());Xh(view);vc("onobliquechange");}else{var view=preferredView.MakeCopy();view.SetMapStyle(lastOrthoMapStyle);if(view.GetViewType()!="latlongRect")view.SetZoomLevel(lastOrthoZoomLevel);Xh(view);vc("onerror",lc(currentView.latlong,currentView.zoomLevel,L_ObliqueModeImageNotAvailable_Text));}}if(availableBefore!=available){if(available)vc("onobliqueenter");else vc("onobliqueleave");}}function sk(tk){if(!tk||!bounds||bounds.length==0)return false;var quadKey=uk(tk,bounds[0].length);return xk(quadKey,0,bounds.length-1);}function uk(vk,wk){var pixel=orthoMode.LatLongToPixel(vk,wk);var tileX=MathFloor(pixel.x/tileSize);var tileY=MathFloor(pixel.y/tileSize);var quadKey="";for(var i=wk;i>0;i--){var cell=0;var mask=1<<i-1;if((tileX&mask)!=0)cell++;if((tileY&mask)!=0)cell+=2;quadKey+=cell+"";}return quadKey;}function xk(yk,zk,Ak){if(Ak<zk)return false;var middle=MathFloor((zk+Ak)/2);if(bounds[middle]==yk)return true;if(yk<bounds[middle])return xk(yk,zk,middle-1);return xk(yk,middle+1,Ak);}this.IsValidTile=Fj;this.GetFilename=Jj;this.MetersPerPixel=Nj;this.PixelToLatLong=Pj;this.LatLongToPixel=Sj;this.GetBounds=Yj;this.ValidateZoomLevel=Vj;this.IsAvailable=Zj;this.UpdateAvailability=bk;this.CancelRequest=mk;this.GetEventInfo=ak;this.GetScene=Xj;this.RequestSceneAtLatLong=ck;this.RequestScene=kk;}function Bk(){var bounds=[new Msn.VE.Bounds(1,30,0,0,2,2)];var TileConfigDictionary=null;this.Init=function(){this.TileConfigDictionary=new Object();this.TileConfigDictionary[roadStyle]=this;this.TileConfigDictionary[aerialStyle]=this;this.TileConfigDictionary[hybridStyle]=this;};this.Destroy=function(){};this.AddTileSource=function(Ck){this.TileConfigDictionary[Ck.MapStyle]=Ck;if(Ck.ExtraBounds!=null)bounds=bounds.concat(Ck.ExtraBounds);};this.GetTileSource=function(Dk){return this.TileConfigDictionary[Dk];};this.IsValidMapStyle=function(Ek){for(var i in this.TileConfigDictionary){if(Ek==i)return 1;}return 0;};function Fk(Gk,Hk,Ik){var max=1<<Ik;return Gk>=0&&Hk>=0&&Gk<max&&Hk<max;}function Jk(Kk,Lk,Mk){return this.GetFilenameForLayer(currentView.mapStyle,Kk,Lk,Mk);}function Nk(Ok,Pk,Qk,Rk){var TileConfig=this.TileConfigDictionary[Ok];return TileConfig.GenerateFilename(Pk,Qk,Rk);}function Sk(Tk){var TileConfig=this.TileConfigDictionary[Tk];if(TileConfig.zIndex==null)return 0;else return TileConfig.zIndex;}this.GenerateFilename=function GenerateFilename(Uk,Vk,Wk){var key="";var cell=0;for(var i=Wk;i>0;i--){cell=0;var mask=1<<i-1;if((Uk&mask)!=0)cell++;if((Vk&mask)!=0)cell+=2;key+=cell+"";}return "http://"+currentView.mapStyle+cell+".ortho.tiles.virtualearth.net/tiles/"+currentView.mapStyle+key+(currentView.mapStyle==roadStyle?".png":".jpeg")+"?g="+generations[currentView.mapStyle];};function Xk(Yk){return earthCircumference/(Math.pow(2,Yk)*tileSize);}function Zk(al,bl){var metersPerPixel=Xk(bl);var metersX=al.x*metersPerPixel-projectionOffset;var metersY=projectionOffset-al.y*metersPerPixel;var latlong=new Msn.VE.LatLong();latlong.latitude=RadToDeg(Math.PI/2-2*Math.atan(Math.exp(-metersY/earthRadius)));latlong.longitude=RadToDeg(metersX/earthRadius);return latlong;}function cl(el,gl){var sinLat=Math.sin(DegToRad(el.latitude));var metersX=earthRadius*DegToRad(el.longitude);var metersY=earthRadius/2*Math.log((1+sinLat)/(1-sinLat));var metersPerPixel=Xk(gl);var pixel=new Msn.VE.Pixel();pixel.x=(projectionOffset+metersX)/metersPerPixel;pixel.y=(projectionOffset-metersY)/metersPerPixel;return pixel;}function hl(jl){if(jl==undefined)jl=currentView;var zoomLevel=jl.zoomLevel;var x=jl.center.x;var y=jl.center.y;for(var i=0;i<bounds.length;i++){var deltaZ=zoomLevel-bounds[i].z1;var factor=tileSize*Math.pow(2,deltaZ);var minX=bounds[i].x1*factor;var maxX=bounds[i].x2*factor;var minY=bounds[i].y1*factor;var maxY=bounds[i].y2*factor;if(x>=minX&&x<=maxX&&y>=minY&&y<=maxY){if(zoomLevel>=bounds[i].z1&&zoomLevel<=bounds[i].z2)return bounds[i];}}}function kl(ll){var x=ll.center.x;var y=ll.center.y;var maxZoom=0;for(var i=0;i<bounds.length;i++){var factor=tileSize*Math.pow(2,ll.zoomLevel-bounds[i].z1);var minX=bounds[i].x1*factor;var maxX=bounds[i].x2*factor;var minY=bounds[i].y1*factor;var maxY=bounds[i].y2*factor;if(x>=minX&&x<=maxX&&y>=minY&&y<=maxY){if(bounds[i].z2>=ll.zoomLevel)return;else{if(bounds[i].z2>maxZoom)maxZoom=bounds[i].z2;}}}ll.SetZoomLevel(maxZoom);}this.IsValidTile=Fk;this.MetersPerPixel=Xk;this.PixelToLatLong=Zk;this.LatLongToPixel=cl;this.GetBounds=hl;this.ValidateZoomLevel=kl;this.GetFilename=Jk;this.GetFilenameForLayer=Nk;this.GetZIndexForLayer=Sk;}function ml(){var bg=document.createElement("div");var fg=document.createElement("div");var x1=0;var y1=0;var x2=0;var y2=0;this.Init=function(){bg.className="ZoomBox_bg";fg.className="ZoomBox_fg";bg.attachEvent("onmouseup",Ie);fg.attachEvent("onmouseup",Ie);map.appendChild(bg);map.appendChild(fg);};this.Destroy=function(){bg.detachEvent("onmouseup",Ie);fg.detachEvent("onmouseup",Ie);map.removeChild(bg);map.removeChild(fg);};function nl(e){x1=x2=GetMouseX(e)-x+offsetX;y1=y2=GetMouseY(e)-y+offsetY;ql(x1,y1,1,1);tl();if(fg.setCapture)fg.setCapture();}function ol(e){x2=GetMouseX(e)-x+offsetX;y2=GetMouseY(e)-y+offsetY;ql(MathMin(x1,x2),MathMin(y1,y2),MathMax(1,MathAbs(x2-x1)),MathMax(1,MathAbs(y2-y1)));}function pl(e){if(MathAbs(x1-x2)>1&&MathAbs(y1-y2)>1){var view=preferredView.MakeCopy();view.SetZoomLevel(currentView.zoomLevel);view.SetPixelRectangle(new Msn.VE.PixelRectangle(new Msn.VE.Pixel(originX+x1,originY+y1),new Msn.VE.Pixel(originX+x2,originY+y2)));Xh(view);}ul();if(fg.releaseCapture)fg.releaseCapture();}function ql(x,y,w,h){rl(bg,x+1,y+1,w,h);rl(fg,x,y,w,h);}function rl(sl,x,y,w,h){sl.style.left=x+"px";sl.style.top=y+"px";sl.style.width=w+"px";sl.style.height=h+"px";}function tl(){bg.style.display="block";fg.style.display="block";}function ul(){bg.style.display="none";fg.style.display="none";}this.OnMouseDown=nl;this.OnMouseMove=ol;this.OnMouseUp=pl;}function vl(){var moved=false;this.Init=function(){};this.Destroy=function(){};function wl(e){moved=false;lastMouseX=GetMouseX(e);lastMouseY=GetMouseY(e);if(A.setCapture)A.setCapture();var clickX=originX+offsetX+GetMouseX(e)-x;var clickY=originY+offsetY+GetMouseY(e)-y;vc("onstartcontinuouspan",lc(currentMode.PixelToLatLong(new Msn.VE.Pixel(clickX,clickY),currentView.zoomLevel)));}function xl(e){var mouseX=GetMouseX(e);var mouseY=GetMouseY(e);Me(lastMouseX-mouseX,lastMouseY-mouseY);lastMouseX=mouseX;lastMouseY=mouseY;moved=true;}function yl(e){hb(true);if(A.releaseCapture)A.releaseCapture();if(moved){vc("onendcontinuouspan");vc("onchangeview");moved=false;}var clickX=originX+offsetX+GetMouseX(e)-x;var clickY=originY+offsetY+GetMouseY(e)-y;var clickEvent=lc(currentMode.PixelToLatLong(new Msn.VE.Pixel(clickX,clickY),currentView.zoomLevel));vc("onmouseup",clickEvent);vc("onclick",clickEvent);}this.OnMouseDown=wl;this.OnMouseMove=xl;this.OnMouseUp=yl;}this.SetCenter=G;this.SetMapStyle=X;this.GetCenterLatitude=eb;this.GetCenterLongitude=gb;this.GetLatitude=kb;this.GetLongitude=lb;this.GetY=mb;this.GetX=ob;this.LatLongToPixel=qb;this.PixelToLatLong=sb;this.GetZoomLevel=ub;this.GetMapStyle=vb;this.GetMetersPerPixel=wb;this.Resize=zb;this.PanMap=Me;this.ContinuousPan=Pe;this.StopContinuousPan=Ve;this.PanToLatLong=We;this.AddPushpin=gg;this.RemovePushpin=qg;this.ClearPushpins=sg;this.SetViewport=bj;this.SetBestMapView=jj;this.IncludePointInViewport=kj;this.SetZoom=vj;this.ZoomIn=xj;this.ZoomOut=yj;this.SetCenterAndZoom=zj;this.AddLine=Bc;this.RemoveLine=Kc;this.ClearLines=Mc;this.AttachEvent=pc;this.DetachEvent=sc;this.IsObliqueAvailable=Ab;this.GetObliqueScene=Bb;this.SetAnimationEnabled=Cb;this.IsAnimationEnabled=Eb;this.SetObliqueScene=Fb;this.SetObliqueOrientation=Hb;this.SetView=Xh;this.Debug=Jb;this.GetResponseRangeCounts=mh;this.ResetResponseRangeCounts=nh;this.GetFailureRate=oh;this.AddOrthoTileSource=J;this.GetOrthoTileSource=L;this.ActivateAlphaLayer=N;this.DeactivateAlphaLayer=P;this.ClearAlphaLayers=R;this.GetOriginalTileFilename=S;};Msn.VE.Bounds=function(zl,Al,Bl,Cl,Dl,El){this.z1=zl;this.z2=Al;this.x1=Bl;this.y1=Cl;this.x2=Dl;this.y2=El;};Msn.VE.Dashboard=function(Fl,Gl,Hl){var roadTab=document.createElement("div");var aerialTab=document.createElement("div");var obliqueTab=document.createElement("div");var selectedTab=null;var separator=document.createElement("hr");var labelsContainer=document.createElement("div");var labelsCheckbox=document.createElement("input");var firstAerial=true;var compass=null;var obliqueCompass=null;var orthoZoom=null;var obliqueZoom=null;var obliqueNotification=null;var obliqueSelector=null;var containerTable=document.createElement("table");containerTable.className="dashboardContainerTable";var containerTBody=document.createElement("tbody");var compassZoomRow=document.createElement("tr");containerTable.appendChild(containerTBody);containerTBody.appendChild(compassZoomRow);var compassCell=document.createElement("td");var zoomCell=document.createElement("td");zoomCell.vAlign="top";var notificationCell=document.createElement("td");notificationCell.colSpan=2;notificationCell.setAttribute("colspan",2);notificationCell.className="obliqueSelectorTable";compassZoomRow.appendChild(compassCell);compassZoomRow.appendChild(zoomCell);var notificationRow=document.createElement("tr");notificationRow.appendChild(notificationCell);containerTBody.appendChild(notificationRow);this.Init=function(){var mapStyle=Gl.GetMapStyle();Jl(roadTab,L_DashboardRoad_Text,am);Jl(aerialTab,L_DashboardAerial_Text,bm);Jl(obliqueTab,L_DashboardBirdsEye_Text,cm);separator.className="Dashboard_separator";Fl.appendChild(separator);Fl.appendChild(containerTable);if(!Hl||Hl==Msn.VE.DashboardSize.Normal){compass=new mm(compassCell,5,30);compass.Init();compass.Show();}obliqueCompass=new Qn(compassCell);obliqueCompass.Hide();orthoZoom=new Em(zoomCell,100,30);orthoZoom.Init();obliqueZoom=new Um(zoomCell);Tl();Ul();obliqueSelector=new tm(notificationCell);obliqueSelector.Init();Gl.AttachEvent("onendzoom",gm);Gl.AttachEvent("onobliqueenter",hm);Gl.AttachEvent("onobliqueleave",jm);Gl.AttachEvent("onchangemapstyle",km);Gl.AttachEvent("onobliquechange",lm);if(Gl.IsObliqueAvailable())Yl();else Zl();switch(mapStyle){case "r":Vl();break;case "a":case "h":Wl();break;case "o":Xl();break;}};this.Destroy=function(){Ol(roadTab,am);Ol(aerialTab,bm);Ol(obliqueTab,cm);selectedTab=roadTab=aerialTab=obliqueTab=null;labelsContainer.removeChild(labelsCheckbox);zoomCell.removeChild(labelsContainer);labelsContainer.detachEvent("onclick",em);labelsContainer=labelsCheckbox=null;if(compass){compass.Destroy();compass=null;}if(obliqueZoom){obliqueZoom.Destroy();obliqueZoom=null;}if(obliqueSelector){obliqueSelector.Destroy();obliqueSelector=null;}if(Gl){Gl.DetachEvent("onendzoom",gm);Gl.DetachEvent("onobliqueenter",hm);Gl.DetachEvent("onobliqueleave",jm);Gl.DetachEvent("onchangemapstyle",km);Gl=null;}};this.SetX=function(Il){Fl.style.left=Il+"px";};this.GetElement=function(){return Fl;};this.GetY=function(){return GetTopPosition(Fl);};this.GetHeight=function(){return Fl.offsetHeight;};function Jl(Kl,Ll,Ml,Nl){Kl.className="Dashboard_tab Dashboard_unselected";Kl.href="javascript:void(0)";Kl.innerText=Ll;Kl.attachEvent("onclick",Ml);Fl.appendChild(Kl);}function Ol(Pl,Ql){Pl.detachEvent("onclick",Ql);Fl.removeChild(Pl);}function Rl(Sl){if(selectedTab)selectedTab.className="Dashboard_tab Dashboard_unselected";Sl.className="Dashboard_tab Dashboard_selected";selectedTab=Sl;}function Tl(){labelsCheckbox.type="checkbox";labelsContainer.className="Dashboard_toggler";labelsContainer.style.display="none";labelsContainer.attachEvent("onclick",em);labelsContainer.appendChild(labelsCheckbox);labelsContainer.appendChild(document.createTextNode(L_DashboardShowLabels_Text));zoomCell.appendChild(labelsContainer);}function Ul(){obliqueNotification=document.createElement("div");obliqueNotification.className="Dashboard_notification";obliqueNotification.innerHTML="<div id=\"obliqueNotifyIcon\">&nbsp;</div> "+L_DashboardBirdsEyeText_Text;obliqueNotification.style.display="none";obliqueNotification.onclick=cm;notificationCell.appendChild(obliqueNotification);}function Vl(){Rl(roadTab);labelsContainer.style.display="none";obliqueSelector.Hide();obliqueZoom.Hide();orthoZoom.Show();if(Gl.IsObliqueAvailable())obliqueNotification.style.display="block";if(compass)compass.Show();obliqueCompass.Hide();}function Wl(){Rl(aerialTab);labelsContainer.style.display="block";obliqueSelector.Hide();obliqueZoom.Hide();orthoZoom.Show();if(Gl.GetMapStyle()=="h")labelsCheckbox.checked=true;else labelsCheckbox.checked=false;if(Gl.IsObliqueAvailable())obliqueNotification.style.display="block";if(compass)compass.Show();obliqueCompass.Hide();}function Xl(){Rl(obliqueTab);labelsContainer.style.display="none";obliqueNotification.style.display="none";obliqueSelector.Show();orthoZoom.Hide();obliqueZoom.Show();if(compass)compass.Hide();obliqueCompass.Show();}function Yl(){obliqueTab.className="Dashboard_tab Dashboard_unselected";obliqueNotification.style.display="block";}function Zl(){obliqueTab.className="Dashboard_tab Dashboard_disabled";obliqueNotification.style.display="none";}function am(){Gl.SetMapStyle("r");}function bm(){if(firstAerial||labelsCheckbox.checked)Gl.SetMapStyle("h");else Gl.SetMapStyle("a");firstAerial=false;}function cm(){Gl.SetMapStyle("o");}function em(e){var mapStyle=Gl.GetMapStyle();if(mapStyle=="a"){Gl.SetMapStyle("h");labelsCheckbox.checked=true;}else{if(mapStyle=="h"){Gl.SetMapStyle("a");labelsCheckbox.checked=false;}}}function gm(e){orthoZoom.UpdateFromMap();obliqueZoom.UpdateFromMap();}function hm(e){if(Gl.GetMapStyle()=="o")return;Yl();obliqueCompass.UpdateFromMap();}function jm(e){Zl();}function km(e){switch(e.view.mapStyle){case "r":Vl();break;case "a":case "h":Wl();break;case "o":Xl();break;}}function lm(e){obliqueSelector.Update();obliqueCompass.UpdateFromMap();}function mm(nm){var Fl=document.createElement("div");var x=0;var y=0;var panning=false;var maxScrollSpeed=15;this.Init=function(){Fl.className="Compass";Fl.attachEvent("onmousedown",om);Fl.attachEvent("onmouseup",qm);Fl.attachEvent("onmousemove",pm);Fl.attachEvent("ondblclick",IgnoreEvent);nm.appendChild(Fl);};this.Destroy=function(){Fl.detachEvent("onmousedown",om);Fl.detachEvent("onmouseup",qm);Fl.detachEvent("onmousemove",pm);Fl.detachEvent("ondblclick",IgnoreEvent);Fl=null;};function om(e){e=GetEvent(e);CancelEvent(e);x=GetLeftPosition(Fl);y=GetTopPosition(Fl);if(Fl.setCapture)Fl.setCapture();var dx=GetMouseX(e)-x-Fl.offsetWidth/2;var dy=GetMouseY(e)-y-Fl.offsetHeight/2;dx=Math.min(Math.max(dx,-maxScrollSpeed),maxScrollSpeed);dy=Math.min(Math.max(dy,-maxScrollSpeed),maxScrollSpeed);Gl.ContinuousPan(dx,dy);panning=true;return false;}function pm(e){e=GetEvent(e);CancelEvent(e);if(panning){var dx=GetMouseX(e)-x-Fl.offsetWidth/2;var dy=GetMouseY(e)-y-Fl.offsetHeight/2;dx=Math.min(Math.max(dx,-maxScrollSpeed),maxScrollSpeed);dy=Math.min(Math.max(dy,-maxScrollSpeed),maxScrollSpeed);Gl.ContinuousPan(dx,dy);}return false;}function qm(e){e=GetEvent(e);CancelEvent(e);if(Fl.releaseCapture)Fl.releaseCapture();Gl.StopContinuousPan();panning=false;return false;}function rm(){Fl.style.display="none";}function sm(){Fl.style.display="block";}this.Hide=rm;this.Show=sm;}function tm(um){var Fl=document.createElement("table");var cells=new Array(3);this.Init=function(){Fl.className="obliqueSelectorTable";wm();um.appendChild(Fl);var tbody=document.createElement("tbody");tbody.className="obliqueSelectorTable";Fl.appendChild(tbody);for(var i=0;i<3;i++){var row=document.createElement("tr");tbody.appendChild(row);cells[i]=new Array(3);for(var j=0;j<3;j++){var link=document.createElement("div");var cell=document.createElement("td");row.appendChild(cell);cell.appendChild(link);link.className="Dashboard_thumbnail";if(i==1&&j==1){cells[i][j]=new ym(link,false);cell.className="obliqueSelectorCellCenter";}else{cells[i][j]=new ym(link,true);cell.className="obliqueSelectorCellOff";}cells[i][j].Init();}}};this.Destroy=function(){um.removeChild(Fl);Fl=null;for(var i=0;i<cells.length;i++){for(var j=0;j<cells[i].length;j++){cells[i][j].Destroy();cells[i][j]=null;}}cells=null;};function vm(){xm();Fl.style.display="block";}function wm(){Fl.style.display="none";}function xm(){var scene=Gl.GetObliqueScene();if(!scene)return;cells[1][1].SetScene(scene);switch(scene.GetOrientation()){case "North":cells[0][0].SetScene(scene.GetNeighbor("Northwest"));cells[0][1].SetScene(scene.GetNeighbor("North"));cells[0][2].SetScene(scene.GetNeighbor("Northeast"));cells[1][0].SetScene(scene.GetNeighbor("West"));cells[1][2].SetScene(scene.GetNeighbor("East"));cells[2][0].SetScene(scene.GetNeighbor("Southwest"));cells[2][1].SetScene(scene.GetNeighbor("South"));cells[2][2].SetScene(scene.GetNeighbor("Southeast"));break;case "East":cells[0][0].SetScene(scene.GetNeighbor("Northeast"));cells[0][1].SetScene(scene.GetNeighbor("East"));cells[0][2].SetScene(scene.GetNeighbor("Southeast"));cells[1][0].SetScene(scene.GetNeighbor("North"));cells[1][2].SetScene(scene.GetNeighbor("South"));cells[2][0].SetScene(scene.GetNeighbor("Northwest"));cells[2][1].SetScene(scene.GetNeighbor("West"));cells[2][2].SetScene(scene.GetNeighbor("Southwest"));break;case "West":cells[0][0].SetScene(scene.GetNeighbor("Southwest"));cells[0][1].SetScene(scene.GetNeighbor("West"));cells[0][2].SetScene(scene.GetNeighbor("Northwest"));cells[1][0].SetScene(scene.GetNeighbor("South"));cells[1][2].SetScene(scene.GetNeighbor("North"));cells[2][0].SetScene(scene.GetNeighbor("Southeast"));cells[2][1].SetScene(scene.GetNeighbor("East"));cells[2][2].SetScene(scene.GetNeighbor("Northeast"));break;case "South":cells[0][0].SetScene(scene.GetNeighbor("Southeast"));cells[0][1].SetScene(scene.GetNeighbor("South"));cells[0][2].SetScene(scene.GetNeighbor("Southwest"));cells[1][0].SetScene(scene.GetNeighbor("East"));cells[1][2].SetScene(scene.GetNeighbor("West"));cells[2][0].SetScene(scene.GetNeighbor("Northeast"));cells[2][1].SetScene(scene.GetNeighbor("North"));cells[2][2].SetScene(scene.GetNeighbor("Northwest"));break;}}function ym(zm,Am){var scene=null;this.Init=function(){zm.title="Select a thumbnail to display an image from the surrounding area.";if(Am){zm.attachEvent("onclick",Bm);zm.attachEvent("onmouseover",Cm);zm.attachEvent("onmouseout",Dm);}};this.Destroy=function(){if(Am){zm.detachEvent("onclick",Bm);zm.detachEvent("onmouseover",Cm);zm.detachEvent("onmouseout",Dm);}};this.SetScene=function(s){scene=s;if(scene){zm.innerHTML="<img src=\""+scene.GetThumbnailFilename()+"\" width=48 height=48 border=0>";if(Am)zm.style.cursor="pointer";}else{zm.innerHTML="";zm.style.cursor="default";}if(Am)zm.parentNode.className="obliqueSelectorCellOff";};function Bm(){if(!scene)return;Gl.SetObliqueScene(scene.GetID());}function Cm(e){zm.parentNode.className="obliqueSelectorCellOn";}function Dm(e){zm.parentNode.className="obliqueSelectorCellOff";}}this.Update=xm;this.Show=vm;this.Hide=wm;}function Em(Fm){var container=document.createElement("div");var plus=document.createElement("div");var bar=document.createElement("div");var slider=document.createElement("div");var minus=document.createElement("div");var x=0;var y=0;var dragging=false;this.Init=function(){minus.className="ZoomBar_minus";minus.unselectable="on";minus.attachEvent("onclick",Nm);slider.className="ZoomBar_slider";slider.unselectable="on";slider.attachEvent("onmousedown",Jm);slider.attachEvent("onmousemove",Km);slider.attachEvent("onmouseup",Lm);slider.attachEvent("onclick",IgnoreEvent);bar.className="ZoomBar_bar";bar.unselectable="on";bar.appendChild(slider);bar.attachEvent("onclick",Om);plus.className="ZoomBar_plus";plus.unselectable="on";plus.attachEvent("onclick",Mm);container.className="ZoomBar";container.appendChild(minus);container.appendChild(bar);container.appendChild(plus);container.attachEvent("onmousedown",IgnoreEvent);container.attachEvent("onmouseup",IgnoreEvent);container.attachEvent("onclick",IgnoreEvent);container.attachEvent("ondblclick",IgnoreEvent);Fm.appendChild(container);Tm();};this.Destroy=function(){minus.detachEvent("onclick",Nm);slider.detachEvent("onmousedown",Jm);slider.detachEvent("onmousemove",Km);slider.detachEvent("onmouseup",Lm);slider.detachEvent("onclick",IgnoreEvent);bar.removeChild(slider);bar.detachEvent("onclick",Om);plus.detachEvent("onclick",Mm);container.removeChild(plus);container.removeChild(bar);container.removeChild(minus);container.detachEvent("onmousedown",IgnoreEvent);container.detachEvent("onmousedown",IgnoreEvent);container.detachEvent("onclick",IgnoreEvent);container.detachEvent("ondblclick",IgnoreEvent);Fm.removeChild(container);Gl.DetachEvent("onendzoom",Tm);minus=slider=bar=plus=container=Fm=Gl=null;};function Gm(){container.style.display="block";}function Hm(){container.style.display="none";}function Im(){x=GetLeftPosition(container);y=GetTopPosition(container);}function Jm(e){e=GetEvent(e);CancelEvent(e);Im();if(slider.setCapture)slider.setCapture();dragging=true;return false;}function Km(e){e=GetEvent(e);CancelEvent(e);if(dragging)slider.style.left=Pm(GetMouseX(e))+"px";return false;}function Lm(e){e=GetEvent(e);CancelEvent(e);if(slider.releaseCapture)slider.releaseCapture();dragging=false;Rm(Pm(GetMouseX(e)));return false;}function Mm(e){Gl.ZoomIn();}function Nm(e){Gl.ZoomOut();}function Om(e){e=GetEvent(e);CancelEvent(e);Im();Rm(Pm(GetMouseX(e)));return false;}function Pm(Qm){Qm-=(x+minus.offsetWidth+slider.offsetWidth);var max=bar.offsetWidth-slider.offsetWidth;if(Qm<0)Qm=0;else{if(Qm>max)Qm=max;}return Qm;}function Rm(Sm){var max=bar.offsetWidth-slider.offsetWidth;var zoom=1+MathRound(Sm/max*18);Gl.SetZoom(zoom);}function Tm(){var max=bar.offsetWidth-slider.offsetWidth;var pos=(Gl.GetZoomLevel()-1)/18*max;slider.style.left=pos+"px";}this.UpdateFromMap=Tm;this.Show=Gm;this.Hide=Hm;}function Um(Vm){var container=document.createElement("div");var smallViewButton=document.createElement("div");var largeViewButton=document.createElement("div");container.title=L_ObliqueZoomBarSelectZoom_Text;container.setAttribute("id","obliqueZoomContainer");smallViewButton.setAttribute("id","obliqueZoomSmall");smallViewButton.className="obliqueZoomSmallOn";largeViewButton.setAttribute("id","obliqueZoomLarge");largeViewButton.className="obliqueZoomLargeOff";smallViewButton.attachEvent("onclick",Ym);largeViewButton.attachEvent("onclick",Zm);container.appendChild(smallViewButton);container.appendChild(largeViewButton);Vm.appendChild(container);function Wm(){container.style.display="block";}function Xm(){container.style.display="none";}function Ym(e){Gl.ZoomOut();smallViewButton.className="obliqueZoomSmallOn";largeViewButton.className="obliqueZoomLargeOff";}function Zm(e){Gl.ZoomIn();smallViewButton.className="obliqueZoomSmallOff";largeViewButton.className="obliqueZoomLargeOn";}function an(){smallViewButton.detachEvent("onclick",Ym);largeViewButton.detachEvent("onclick",Zm);container.removeChild(smallViewButton);container.removeChild(largeViewButton);smallViewButton=null;largeViewButton=null;container.parentNode.removeChild(container);container=null;}function bn(){if(Gl.GetZoomLevel()==1){smallViewButton.className="obliqueZoomSmallOn";largeViewButton.className="obliqueZoomLargeOff";}else{smallViewButton.className="obliqueZoomSmallOff";largeViewButton.className="obliqueZoomLargeOn";}}this.Destroy=an;this.Show=Wm;this.Hide=Xm;this.UpdateFromMap=bn;}function cn(en,gn,hn){var Fl=document.createElement("div");Fl.setAttribute("id",en);Fl.innerHTML=gn;var previousClass="obliqueCompassPointOff";var currentPositionIndex=hn;Fl.onmouseover=jn;Fl.onmouseout=ln;Fl.onclick=kn;this.onclick=null;this.onmouseover=null;this.onmouseout=null;var me=this;var disabled=false;var rotator=new xn(Fl,17,17);function jn(e){if(disabled)return;previousClass=Fl.className;Fl.className="obliqueCompassPointHover";if(me.onmouseover)me.onmouseover(e);}function kn(e){if(disabled)return;jn(e);previousClass="obliqueCompassPointOn";if(me.onclick)me.onclick(e);}function ln(e){if(disabled)return;Fl.className=previousClass;if(me.onmouseout)me.onmouseout(e);}function mn(){previousClass="obliqueCompassPointOn";Fl.className="obliqueCompassPointOn";}function nn(){previousClass="obliqueCompassPointOff";Fl.className="obliqueCompassPointOff";}function on(){disabled=true;nn();}function pn(){disabled=false;mn();}function qn(){return Fl;}function rn(){return currentPositionIndex;}function sn(tn){currentPositionIndex=tn;}function un(){rotator.Reset();pn();}function vn(wn){Fl.style.left=wn.left;Fl.style.top=wn.top;}function xn(yn,zn,An){var Fl=yn;var currentAngle=0;var deltaAngle=0.3;var targetAngle=0;var deltaTime=40;var radius=25;var animating=false;var quartCircle=Math.PI/2;var isCCW=true;var limit=deltaAngle+0.1;function Bn(Cn,Dn,En){if(Dn>=En-Cn&&Dn<=En+Cn)return true;return false;}function Fn(){currentAngle+=deltaAngle;if(currentAngle>Math.PI*2)currentAngle-=Math.PI*2;else{if(currentAngle<0)currentAngle+=Math.PI*2;}if(Bn(limit,currentAngle,targetAngle)){deltaAngle=0.3;currentAngle=targetAngle;Gn(currentAngle);animating=false;return;}Gn(currentAngle);window.setTimeout(Fn,deltaTime);}function Gn(Hn){var x=zn+radius*Math.sin(Hn);var y=An+radius*Math.cos(Hn);Fl.style.left=x+"px";Fl.style.top=y+"px";}function In(Jn){if(animating)return;animating=true;targetAngle=Jn;Fn();}function Kn(Ln,Mn){isCCW=Mn;if(!isCCW)deltaAngle*=-1;In(quartCircle*Ln);}function Nn(){animating=false;currentAngle=0;}this.RotateTo=In;this.RotateToIndex=Kn;this.Reset=Nn;}function Pn(){Fl.parentNode.removeChild(Fl);Fl.onmouseover=null;Fl.onmouseout=null;Fl.onclick=null;Fl=null;}this.GetElement=qn;this.GetCurrentPositionIndex=rn;this.SetCurrentPositionIndex=sn;this.SetCurrentPosition=vn;this.On=mn;this.Off=nn;this.RotateToIndex=rotator.RotateToIndex;this.Reset=un;this.Disable=on;this.Enable=pn;this.Destroy=Pn;}function Qn(Rn){var pointPositions=new Array();pointPositions.push({"top":"-8px","left":"17px"});pointPositions.push({"top":"17px","left":"42px"});pointPositions.push({"top":"42px","left":"17px"});pointPositions.push({"top":"17px","left":"-8px"});var compassContainer=document.createElement("div");compassContainer.setAttribute("id","obliqueCompassContainer");compassContainer.title="Select the direction you want to look toward.";var northElm=new cn("obliqueCompassPointN","N",0);northElm.onclick=eo;northElm.onmouseover=mo;northElm.onmouseout=Yn;var eastElm=new cn("obliqueCompassPointE","E",1);eastElm.onclick=go;eastElm.onmouseover=ko;eastElm.onmouseout=Yn;var southElm=new cn("obliqueCompassPointS","S",2);southElm.onclick=co;southElm.onmouseover=jo;southElm.onmouseout=Yn;var westElm=new cn("obliqueCompassPointW","W",3);westElm.onclick=ho;westElm.onmouseover=lo;westElm.onmouseout=Yn;var arrowElm=document.createElement("div");compassContainer.appendChild(northElm.GetElement());compassContainer.appendChild(eastElm.GetElement());compassContainer.appendChild(southElm.GetElement());compassContainer.appendChild(westElm.GetElement());compassContainer.appendChild(arrowElm);Rn.appendChild(compassContainer);po();function Sn(Tn){if(Tn<0)Tn=4-Math.abs(Tn);return Tn;}function Un(Vn){var pos=Vn.GetCurrentPositionIndex();eastElm.SetCurrentPositionIndex(Sn(eastElm.GetCurrentPositionIndex()-pos));westElm.SetCurrentPositionIndex(Sn(westElm.GetCurrentPositionIndex()-pos));northElm.SetCurrentPositionIndex(Sn(northElm.GetCurrentPositionIndex()-pos));southElm.SetCurrentPositionIndex(Sn(southElm.GetCurrentPositionIndex()-pos));var ccw=true;if(pos==3)ccw=false;northElm.RotateToIndex(2-northElm.GetCurrentPositionIndex()<0?northElm.GetCurrentPositionIndex():2-northElm.GetCurrentPositionIndex(),ccw);eastElm.RotateToIndex(2-eastElm.GetCurrentPositionIndex()<0?eastElm.GetCurrentPositionIndex():2-eastElm.GetCurrentPositionIndex(),ccw);southElm.RotateToIndex(2-southElm.GetCurrentPositionIndex()<0?southElm.GetCurrentPositionIndex():2-southElm.GetCurrentPositionIndex(),ccw);westElm.RotateToIndex(2-westElm.GetCurrentPositionIndex()<0?westElm.GetCurrentPositionIndex():2-westElm.GetCurrentPositionIndex(),ccw);}function Wn(Xn){switch(Xn){case 0:Yn();break;case 1:ao();break;case 2:Zn();break;case 3:bo();break;}}function Yn(){arrowElm.className="obliqueCompassArrowU";}function Zn(){arrowElm.className="obliqueCompassArrowD";}function ao(){arrowElm.className="obliqueCompassArrowR";}function bo(){arrowElm.className="obliqueCompassArrowL";}function co(e){Un(southElm);Wn(0);var scene=Gl.GetObliqueScene();if(scene){var aScene=scene.GetRotation("South");if(aScene)Gl.SetObliqueOrientation("South");}}function eo(e){Un(northElm);Wn(0);var scene=Gl.GetObliqueScene();if(scene){var aScene=scene.GetRotation("North");if(aScene)Gl.SetObliqueOrientation("North");}}function go(e){Un(eastElm);Wn(0);var scene=Gl.GetObliqueScene();if(scene){var aScene=scene.GetRotation("East");if(aScene)Gl.SetObliqueOrientation("East");}}function ho(e){Un(westElm);Wn(0);var scene=Gl.GetObliqueScene();if(scene){var aScene=scene.GetRotation("West");if(aScene)Gl.SetObliqueOrientation("West");}}function jo(e){Wn(southElm.GetCurrentPositionIndex());}function ko(e){Wn(eastElm.GetCurrentPositionIndex());}function lo(e){Wn(westElm.GetCurrentPositionIndex());}function mo(e){Wn(northElm.GetCurrentPositionIndex());}function no(){compassContainer.style.display="none";}function oo(){compassContainer.style.display="block";}function po(){var scene=Gl.GetObliqueScene();if(!scene)return;switch(scene.GetOrientation()){case "North":Un(northElm);break;case "South":Un(southElm);break;case "East":Un(eastElm);break;case "West":Un(westElm);break;}Wn(0);if(scene.GetRotation("North"))northElm.Enable();else northElm.Disable();if(scene.GetRotation("South"))southElm.Enable();else southElm.Disable();if(scene.GetRotation("East"))eastElm.Enable();else eastElm.Disable();if(scene.GetRotation("West"))westElm.Enable();else westElm.Disable();}function qo(){northElm.Destroy();eastElm.Destroy();southElm.Destroy();westElm.Destroy();compassContainer.parentNode.removeChild(compassContainer);compassContainer=null;}this.Hide=no;this.Show=oo;this.UpdateFromMap=po;}};Msn.VE.DashboardSize=new function(){this.Normal="normal";this.Small="small";this.Tiny="tiny";}();Msn.VE.LatLong=function(ro,so){this.latitude=ro;this.longitude=so;this.ToString=function(){return "("+this.latitude+", "+this.longitude+")";};this.Copy=function(to){if(!to)return;this.latitude=to.latitude;this.longitude=to.longitude;};};Msn.VE.LatLongRectangle=function(uo,vo){this.northwest=uo;this.southeast=vo;this.ToString=function(){return "("+(this.northwest?this.northwest.ToString():"null")+", "+(this.southeast?this.southeast.ToString():"null")+")";};this.Copy=function(wo){if(!wo)return;if(!this.northwest)this.northwest=new Msn.VE.LatLong();if(!this.southeast)this.southeast=new Msn.VE.LatLong();this.northwest.Copy(wo.northwest);this.southeast.Copy(wo.southeast);};this.Center=function(){var sinLat1=Math.sin(this.northwest.latitude*Math.PI/180);var sinLat2=Math.sin(this.southeast.latitude*Math.PI/180);var average=0.25*(Math.log((1+sinLat1)/(1-sinLat1))+Math.log((1+sinLat2)/(1-sinLat2)));var center=new Msn.VE.LatLong();center.latitude=Math.atan(Math.exp(average))*360/Math.PI-90;center.longitude=0.5*(this.northwest.longitude+this.southeast.longitude);return center;};this.Contains=function(xo){return xo.latitude<=uo.latitude&&xo.longitude>=uo.longitude&&xo.latitude>=vo.latitude&&xo.longitude<=vo.longitude;};};Msn.VE.MapStyle=new function(){this.Road="r";this.Aerial="a";this.Hybrid="h";this.Oblique="o";}();Msn.VE.MapView=function(){this.zoomLevel=0;this.mapStyle=null;this.alphaLayerNameList=new Array();this.center=new Msn.VE.Pixel();this.latlong=new Msn.VE.LatLong();this.pixelRect=new Msn.VE.PixelRectangle();this.latlongRect=new Msn.VE.LatLongRectangle();this.sceneId=null;this.sceneOrientation=null;var p_this=this;var viewType="pixel";this.Destroy=function(){this.center=this.latlong=p_this=null;};this.GetViewType=function(){return viewType;};function yo(){var copy=new Msn.VE.MapView();copy.Copy(p_this);return copy;}function zo(Ao){p_this.zoomLevel=Ao.zoomLevel;p_this.mapStyle=Ao.mapStyle;p_this.alphaLayerNameList=Ao.alphaLayerNameList.slice(0);p_this.center.Copy(Ao.center);p_this.latlong.Copy(Ao.latlong);p_this.pixelRect.Copy(Ao.pixelRect);p_this.latlongRect.Copy(Ao.latlongRect);p_this.sceneId=Ao.sceneId;p_this.sceneOrientation=Ao.sceneOrientation;viewType=Ao.GetViewType();}function Bo(Co){if(p_this.alphaLayerNameList.length!=Co.alphaLayerNameList.length)return false;for(var i=0;i<p_this.alphaLayerNameList.length;i++){if(p_this.alphaLayerNameList[i]!=Co.alphaLayerNameList[i])return false;}return true;}function Do(Eo){return Eo!=null&&p_this.zoomLevel==Eo.zoomLevel&&p_this.mapStyle==Eo.mapStyle&&p_this.AlphaLayerNameListEquals(Eo)&&MathAbs(p_this.center.x-Eo.center.x)<1E-06&&MathAbs(p_this.center.y-Eo.center.y)<1E-06&&p_this.sceneId==Eo.sceneId&&p_this.sceneOrientation==Eo.sceneOrientation;}function Fo(){return "("+p_this.latlong.ToString()+", "+p_this.zoomLevel+", "+p_this.mapStyle+")";}function Go(Ho){if(!Ho)return;p_this.center=Ho;viewType="pixel";}function Io(Jo){if(!Jo)return;p_this.latlong=Jo;viewType="latlong";}function Ko(Lo){p_this.pixelRect=Lo;viewType="pixelRect";}function Mo(No){p_this.latlongRect=No;viewType="latlongRect";}function Oo(Po){if(Po<=0)return;switch(viewType){case "pixel":var factor=Math.pow(2,Po-p_this.zoomLevel);p_this.center.x*=factor;p_this.center.y*=factor;break;case "pixelRect":var factor=Math.pow(2,Po-p_this.zoomLevel);p_this.pixelRect.topLeft.x*=factor;p_this.pixelRect.topLeft.y*=factor;p_this.pixelRect.bottomRight.x*=factor;p_this.pixelRect.bottomRight.y*=factor;break;}p_this.zoomLevel=Po;}function Qo(Ro,So,To){p_this.mapStyle=Ro;if(viewType=="pixel")viewType="latlong";if(Ro!="o"){p_this.sceneId=null;p_this.sceneOrientation=null;}else{p_this.sceneId=So;p_this.sceneOrientation=To;}}function Uo(Vo){p_this.alphaLayerNameList.push(Vo);}function Wo(Xo){var newList=new Array();for(var i=0;i<p_this.alphaLayerNameList.length;i++){if(p_this.alphaLayerNameList[i]!=Xo)newList.push(p_this.alphaLayerNameList[i]);}p_this.alphaLayerNameList=newList;}function Yo(){p_this.alphaLayerNameList=new Array();}function Zo(ap){if(ap)return p_this.center.x*Math.pow(2,ap-p_this.zoomLevel);return p_this.center.x;}function bp(cp){if(cp)return p_this.center.y*Math.pow(2,cp-p_this.zoomLevel);return p_this.center.y;}function ep(gp){if(gp==undefined)return p_this.center;return new Msn.VE.Pixel(p_this.GetX(gp),p_this.GetY(gp));}function hp(jp,kp,lp){switch(viewType){case "pixel":p_this.latlong=jp.PixelToLatLong(p_this.center,p_this.zoomLevel);break;case "latlong":p_this.center=jp.LatLongToPixel(p_this.latlong,p_this.zoomLevel);break;case "pixelRect":mp(jp,kp,lp);break;case "latlongRect":if(p_this.mapStyle=="o"){p_this.zoomLevel=1;var scene=jp.GetScene();if(!scene.ContainsLatLong(p_this.latlongRect.northwest)||!scene.ContainsLatLong(p_this.latlongRect.southeast)){p_this.latlong=p_this.latlongRect.Center();p_this.center=jp.LatLongToPixel(p_this.latlong,p_this.zoomLevel);}else{p_this.pixelRect.topLeft=jp.LatLongToPixel(p_this.latlongRect.northwest,p_this.zoomLevel);p_this.pixelRect.bottomRight=jp.LatLongToPixel(p_this.latlongRect.southeast,p_this.zoomLevel);mp(jp,kp,lp);}}else{p_this.zoomLevel=12;p_this.pixelRect.topLeft=jp.LatLongToPixel(p_this.latlongRect.northwest,p_this.zoomLevel);p_this.pixelRect.bottomRight=jp.LatLongToPixel(p_this.latlongRect.southeast,p_this.zoomLevel);mp(jp,kp,lp);}break;}viewType="pixel";}function mp(np,op,pp){var zoomPivot=19;var zoomFactor=Math.pow(2,zoomPivot-p_this.zoomLevel);var viewportWidth=MathMax(1,MathAbs(p_this.pixelRect.topLeft.x-p_this.pixelRect.bottomRight.x)*zoomFactor);var viewportHeight=MathMax(1,MathAbs(p_this.pixelRect.topLeft.y-p_this.pixelRect.bottomRight.y)*zoomFactor);var log2=Math.log(2);var horizontalZoom=zoomPivot-Math.ceil(Math.log(viewportWidth/op)/log2);var verticalZoom=zoomPivot-Math.ceil(Math.log(viewportHeight/pp)/log2);var newZoom=MathMin(horizontalZoom,verticalZoom);zoomFactor=Math.pow(2,newZoom-p_this.zoomLevel);p_this.center.x=0.5*(p_this.pixelRect.topLeft.x+p_this.pixelRect.bottomRight.x)*zoomFactor;p_this.center.y=0.5*(p_this.pixelRect.topLeft.y+p_this.pixelRect.bottomRight.y)*zoomFactor;p_this.zoomLevel=newZoom;p_this.latlong=np.PixelToLatLong(p_this.center,p_this.zoomLevel);}this.MakeCopy=yo;this.Copy=zo;this.Equals=Do;this.AlphaLayerNameListEquals=Bo;this.ToString=Fo;this.SetCenter=Go;this.SetCenterLatLong=Io;this.SetPixelRectangle=Ko;this.SetLatLongRectangle=Mo;this.SetZoomLevel=Oo;this.SetMapStyle=Qo;this.ActivateAlphaLayer=Uo;this.DeactivateAlphaLayer=Wo;this.ClearAlphaLayers=Yo;this.GetX=Zo;this.GetY=bp;this.GetCenter=ep;this.Resolve=hp;this.SetZoomLevel=Oo;};Msn.VE.ObliqueScene=function(qp,rp,sp,tp,up,vp,wp,xp,yp,zp,Ap,Bp){var tileSize=256;var bounds=new Msn.VE.Bounds(1,2,0,0,wp/2,xp/2);function Cp(Dp,Ep){var zoomFactor=Math.pow(2,Ep-2);var vector=[[Dp.x/zoomFactor],[Dp.y/zoomFactor],[1]];var result=MatrixMultiply(yp,vector);var latlong=new Msn.VE.LatLong();latlong.longitude=result[0][0]/result[2][0];latlong.latitude=result[1][0]/result[2][0];return latlong;}function Fp(Gp,Hp){var zoomFactor=Math.pow(2,Hp-2);var vector=[[Gp.longitude],[Gp.latitude],[1]];var result=MatrixMultiply(zp,vector);var pixel=new Msn.VE.Pixel();pixel.x=result[0][0]/result[2][0]*zoomFactor;pixel.y=result[1][0]/result[2][0]*zoomFactor;return pixel;}function Ip(Jp,Kp,Lp){if(Jp<0||Kp<0)return false;if(Lp==1)return Jp<wp/2&&Kp<xp/2;return Jp<wp&&Kp<xp;}function Mp(){return qp;}function Np(Op,Pp,Qp){var tileId=Pp*(Qp==1?wp/2:wp)+Op;return "http://c"+Op%2+".p"+vp+".oblique.tiles.virtualearth.net/tiles/o"+rp+"-"+sp+"-"+(up+Qp-2)+"-"+tileId+".jpeg?g=29";}function Rp(){return "http://thumbs.oblique.tiles.virtualearth.net/tiles/ot"+qp+".jpeg?g=29";}function Sp(i){var sceneId=Ap[i];if(sceneId==null||sceneId==-1)return null;return new Msn.VE.ObliqueScene(sceneId);}function Tp(i){var sceneId=Bp[i];if(sceneId==null||sceneId==-1)return null;return new Msn.VE.ObliqueScene(sceneId);}function Up(){return tp;}function Vp(){return bounds;}function Wp(){return wp*tileSize;}function Xp(){return xp*tileSize;}function Yp(Zp){if(!Zp)return false;var pixel=Fp(Zp,2);return aq(pixel,2);}function aq(bq,cq){var zoomFactor=Math.pow(2,2-cq);var x=bq.x*zoomFactor;var y=bq.y*zoomFactor;return x>=0&&y>=0&&x<Wp()&&y<Xp();}this.PixelToLatLong=Cp;this.LatLongToPixel=Fp;this.IsValidTile=Ip;this.GetID=Mp;this.GetTileFilename=Np;this.GetThumbnailFilename=Rp;this.GetNeighbor=Sp;this.GetRotation=Tp;this.GetOrientation=Up;this.GetBounds=Vp;this.GetWidth=Wp;this.GetHeight=Xp;this.ContainsLatLong=Yp;this.ContainsPixel=aq;};Msn.VE.Orientation=new function(){this.North="North";this.East="East";this.West="West";this.South="South";}();Msn.VE.Pixel=function(x,y){this.x=x;this.y=y;this.ToString=function(){return "("+this.x+", "+this.y+")";};this.Copy=function(eq){if(!eq)return;this.x=eq.x;this.y=eq.y;};};Msn.VE.PixelRectangle=function(gq,hq){this.topLeft=gq;this.bottomRight=hq;this.ToString=function(){return "("+(this.topLeft?this.topLeft.ToString():"null")+", "+(this.bottomRight?this.bottomRight.ToString():"null")+")";};this.Copy=function(jq){if(!jq)return;if(!this.topLeft)this.topLeft=new Msn.VE.Pixel();if(!this.bottomRight)this.bottomRight=new Msn.VE.Pixel();this.topLeft.Copy(jq.topLeft);this.bottomRight.Copy(jq.bottomRight);};};Msn.VE.LineRegion=function(kq,lq,mq){this.boundingRectangle=kq;this.indices=lq;this.childRegions=mq;function nq(){return "Bounding Rectangle: "+this.boundingRectangle[0].ToString()+" to "+this.boundingRectangle[1].ToString()+" | Indices: ["+lq+"]";}this.ToString=nq;};RegisterNamespaces("MSR.CVE");MSR.CVE.GetQuadKey=function(oq,pq,qq){var key="";var cell=0;for(var i=qq;i>0;i--){cell=0;var mask=1<<i-1;if((oq&mask)!=0)cell++;if((pq&mask)!=0)cell+=2;key+=cell+"";}return key;};