ask.local.ViewMode=new function(){this.Street=0;
this.Aerial_Labels=1;
this.Aerial=2;
this.Physical=3;
this.Physical_Labels=4;
};
ask.local.CursorMode=new function(){this.Pan=0;
this.Select=1;
this.Marker=2;
this.Text=3;
this.Draw=4;
};
ask.local.TileType=new function(){this.Street="map";
this.Satellite="sat";
this.StreetTransparent="mapt";
this.Physical="phy";
};
ask.local.ZoomLevel=new function(){this.Min=0;
this.Address=3;
this.Street=4;
this.Town=6;
this.City=7;
this.Region=10;
this.Min_Physical=11;
this.State=13;
this.Country=15;
this.Continent=16;
this.Globe=17;
this.Max=18;
};
ask.local.OverlayType=new function(){this.Default=0;
this.Marker=1;
this.Text=2;
this.Route=3;
this.Shape=5;
};
ask.local.Defaults={AMX_HOST:"http://api.syndication.ask.com",CurrentHost:window.location.protocol+"//"+window.location.host+window.location.pathname.substr(0,window.location.pathname.lastIndexOf("/")),MapsPath:"/maps",MapsHostPath:this.AMX_HOST+this.MapsPath,StaticTileHost:"http://mapssyn%n.ask.com",CacheTileHost:"http://mapcsyn%n.ask.com",SP:"http://sp.ask.com/sh/i/maps2/",LocalSP:"http://sp.ask.com/sh/i/local/",StaticPrintRoot:"",partnerId:"",qsrc:121};
ask.local.Defaults.getStaticTileHost=function(){var A=Math.round((Math.random()*3))+1;
return ask.local.Defaults.StaticTileHost.replace("%n",A);
};
ask.local.Map=function(A){this.stretchArrowWidth=4;
this.stretchArrowLength=20;
this.stretchArrowZIndex=5000;
this.stretchTiles=[];
this.stretchTime=240;
this.stretchUpdateInterval=40;
this.stretchOverlap=2;
this.stretchTileZIndexIncrease=1;
this.arrowZIndex=998;
ask.util.Events.addListener(__d.documentElement,"mousemove",this.updateMouseMoveEvent,this,true);
this.viewHeight=800;
this.viewWidth=600;
this.halfViewWidth=this.viewWidth>>1;
this.halfViewHeight=this.viewHeight>>1;
this.overlays=[];
this.controls=[];
this.dragStartX=0;
this.dragStartY=0;
this.dragStartCenterX=0;
this.dragStartCenterY=0;
this.dragging=false;
this.changeCursor=false;
this.autoDriving=false;
this.startLat=36.5;
this.startLong=-100.5;
this.startZoom=ask.local.ZoomLevel.Country;
this.centerX=ask.util.GeoMath.long2pix(this.startLong,ask.util.GeoMath.MAXZOOM-5);
this.centerY=ask.util.GeoMath.lat2pix(this.startLat,ask.util.GeoMath.MAXZOOM-5);
this.startX=this.centerX;
this.startY=this.centerY;
this.tileType=ask.local.TileType.Street;
this.hybrid=false;
this.viewMode=ask.local.ViewMode.Street;
this.cursorMode=ask.local.CursorMode.Pan;
this.scrolling=false;
this.enableDragging=true;
this.enableKeySupport=true;
this.enableTruePrint=false;
this.enableAutoGridResize=true;
this.enableEffects=false;
this.cancelClick=false;
this.viewDiv=A;
this.container=A;
this.viewDiv.className+=" view";
this.viewDiv.style.overflow="hidden";
this.viewDiv.style.position="relative";
this.mapDiv=__d.ce("div");
this.content=this.mapDiv;
this.mapDiv.style.position="absolute";
this.mapDiv.style.zIndex=0;
this.mapDiv.style.cursor=ask.util.Browser.openHandCursor;
ask.util.Events.addListener(this.mapDiv,"dblclick",this.dblclick,this,true);
ask.util.Events.addListener(this.mapDiv,"click",this.snglclick,this,true);
ask.util.Events.addListener(this.mapDiv,"contextmenu ",ask.util.Events.cancel);
ask.util.Events.addListener(this.mapDiv,"mouseup",ask.util.Events.returnFalse);
ask.util.Events.addListener(this.mapDiv,"mousedown",this.startDrag,this,true);
this.DIV_SIZE_LIMIT=ask.util.Browser.getDivSizeLimit();
this.leftShift=0;
this.topShift=0;
this._vw_wheel_tmr=null;
this.click=new ask.util.AbstractEvent("click",this);
this.rightClick=new ask.util.AbstractEvent("rightClick",this);
this.zoomChange=new ask.util.AbstractEvent("zoomChange",this);
this.viewModeChange=new ask.util.AbstractEvent("viewModeChange",this);
this.zoomBackgroundChange=new ask.util.AbstractEvent("zoomBackgroundChange",this);
this.disablePhysicalView=new ask.util.AbstractEvent("disablePhysicalView",this);
this.resizeView=new ask.util.AbstractEvent("resizeView",this);
this.togglePlayDirControl=new ask.util.AbstractEvent("togglePlayDirControl",this);
this.renderComplete=new ask.util.AbstractEvent("renderComplete",this);
this.mapMove=new ask.util.AbstractEvent("mapMove",this);
this.viewModeChange.subscribe(function(){if(this.viewMode==ask.local.ViewMode.Street){this.container.style.backgroundColor="#e6e6e6";
}else{this.container.style.backgroundColor="#000";
}});
this.viewModeChange.fire();
this.viewModeChange.subscribe(this.cleanupStretchedTiles);
this.preloadStretchArrows();
this.infoWindow=new ask.local.InfoWindow();
this.infoWindow.setImage(ask.local.Defaults.SP+"bubble.png",7,7,191,74,0,-108);
this.infoWindow.appendToMap(this);
this.copyrightDiv=__d.ce("div");
this.copyrightDiv.id="cpright";
this.copyrightDiv.style.zIndex=2;
this.copyrightDiv.style.position="absolute";
this.copyrightDiv.style.top="25px";
this.copyrightDiv.style.left="10px";
this.copyrightDiv.style.display="none";
this.showCopyright=true;
if(window.location.host.indexOf("ask.com")==-1&&window.location.host.indexOf("askkids.com")==-1){this.logo=__d.ce("img");
this.logo.id="logoImg";
this.logo.style.zIndex=2;
this.logo.style.left="10px";
this.logo.style.position="absolute";
this.logo.style.display="none";
var B=ask.local.Defaults.SP+"ask_logo_maps.png";
this.logo=ask.util.Image.SetPng(this.logo,B);
}this.mapCopyText="Map Data &copy; NAVTEQ&trade;";
this.setCopyright();
this.zoom=ask.util.GeoMath.MAXZOOM-5;
this.fosterParent=__d.ce("div");
this.fosterParent.style.display="none";
this.addCanvas();
this.nextShapeId=1;
this.rendered=false;
};
ask.local.Map.prototype={TILESIZE:256,TILESIZE2:8,render:function(){if(this.rendered){return false;
}this.autoResize();
this.viewDiv.appendChild(this.mapDiv);
this.initGrid();
this.viewDiv.appendChild(this.copyrightDiv);
if(this.logo){this.viewDiv.appendChild(this.logo);
}this.setZoom(this.zoom);
if(this.enableKeySupport){this.hookUpKeyEvents();
}if(this.enableTruePrint){this.initStyles();
this.hookUpPrintEvents();
}this.viewDiv.appendChild(this.fosterParent);
this.rendered=true;
this.renderComplete.fire();
},getTileHost:function(D,C){var B;
var A=0;
switch(D){case ask.local.TileType.Street:A=8;
break;
case ask.local.TileType.StreetTransparent:A=8;
break;
case ask.local.TileType.Satellite:A=11;
break;
case ask.local.TileType.Physical:A=-1;
break;
}if(C<=A){B=ask.local.Defaults.CacheTileHost;
}else{B=ask.local.Defaults.StaticTileHost;
}return B;
},initStyles:function(){var B=ask.util.Dom.appendStyle("screen","cssScreen");
ask.util.Dom.addRule(B,".onlyprint","display:none;");
var A=ask.util.Dom.appendStyle("print","cssPrint");
ask.util.Dom.addRule(A,".noprint","display:none;");
ask.util.Dom.addRule(A,".onlyprint","display:inline;");
ask.util.Dom.addRule(A,".view","border:0px;");
},setPrintImage:function(H){var A=this.getBounds();
var J=A.minLat+","+A.minLong;
var D=A.maxLat+","+A.maxLong;
var G=this.getCenterPoint();
var B=G.lat+","+G.lng;
var C=A.maxX-A.minX;
var K=A.maxY-A.minY;
var L=this.getMapImageUrl(C,K);
if(this.printImage==null){this.printUrl=ask.local.Defaults.SP+"blank.gif";
this.printImage=__d.ce("img");
this.printImage.className="onlyprint";
this.printImage.style.position="absolute";
this.printImage.style.left="0px";
this.printImage.style.top="0px";
this.printImage.style.zIndex=999;
this.mapDiv.className="noprint";
this.viewDiv.appendChild(this.printImage);
}if(H||this.printUrl!=L){printfire("request new print image:"+L,ask.util.MsgType.Info);
var F=this.printImage;
F.height=K;
F.width=C;
var I=__d.get("cssPrint");
ask.util.Dom.setRule(I,".view","height",K+"px");
ask.util.Dom.setRule(I,".view","width",C+"px");
F.src=L;
this.printUrl=L;
var E=this;
ask.util.Events.addListener(F,"load",function(){E.printCallBack(true,H);
});
ask.util.Events.addListener(F,"error",function(){E.printCallBack(false,H);
});
}else{printfire("No change in print image");
}},printCallBack:function(B,A){if(!B){printfire("Print Error: Could not print the map image.",ask.util.MsgType.Exception);
}if(A){if(this.printImage.src.indexOf("blank.gif")==-1){self.print();
}}},getMapImageUrl:function(C,A,B,D,F){var E=this.getPrintImageUrl(C,A);
if(ask.local.Defaults.StaticPrintRoot.length>0){E=E.replace("[$iroot]",ask.local.Defaults.StaticPrintRoot);
}else{E=E.replace("&iroot=[$iroot]","");
}return E;
},getPrintImageUrl:function(C,A,B,D,E){return this.getPrintImageHost()+this.getPrintImagePath(C,A,B,D,E);
},getPrintImageHost:function(){return ask.local.Defaults.CacheTileHost.replace("%n","");
},getPrintImagePath:function(A,C,h,M,F){F=F?F:85;
var W=this.getBounds();
var a=W.minLat+","+W.minLong;
var H=W.maxLat+","+W.maxLong;
var Z=this.getCenterPoint();
var B=Z.lat+","+Z.lng;
var Y="";
var D="";
var l="";
var d="";
var U="";
var c="";
var f="";
var J="";
var n="";
for(var m=this.overlays.length-1;
m>=0;
m--){var o=this.overlays[m];
if(o&&o.parentMap){if(o.overlayType==ask.local.OverlayType.Marker){var V=o.point;
if(V){Y+=V.lat+","+V.lng+"|";
}if(o.icon){if(ask.local.Defaults.StaticPrintRoot.length>0){D+=o.icon.imageUrl.replace(ask.local.Defaults.StaticPrintRoot,"")+"|";
}else{D+=o.icon.realImg.src+"|";
}}}else{if(o.overlayType==ask.local.OverlayType.Route){l+=o.data.start.lat+","+o.data.start.lng+","+o.data.end.lat+","+o.data.end.lng+",";
if(o.data.waypoints&&o.data.waypoints.length){for(var k=0;
k<o.data.waypoints.length;
k++){l+=o.data.waypoints[k].lat+","+o.data.waypoints[k].lng+",";
}}l+="|";
d+=o.data.type+"|";
}else{if(o.overlayType==ask.local.OverlayType.Shape||o.overlayType!=ask.local.OverlayType.Route){ask.util.Dom.convertRGBToHex(o.lineColor);
f+=o.lineWidth+"|";
J+=ask.util.Dom.convertRGBToHex(o.lineColor)+"|";
n+=ask.util.Dom.convertRGBToHex(o.fillColor)+"|";
if(o.shape==ask.local.Shapes.Circle){c+="2|";
var r=o.bounds;
var X=r.maxLat*100000-r.minLat*100000;
var Q=(X/2)+r.minLat*100000;
var T=r.maxLong*100000-r.minLong*100000;
var L=(T/2)+r.minLong*100000;
var e=(Math.sqrt(Math.pow(X,2)+Math.pow(T,2)))/2;
U+=Math.round(Q)+","+Math.round(L)+","+Math.round(e)+"|";
}else{if(o.points){c+=o.shape==ask.local.Shapes.Polyline?"0|":"1|";
var I=o.points[0];
var S=Math.round(I.lat*100000);
var P=Math.round(I.lng*100000);
U+=o.points.length+","+S+","+P;
var E=I;
var q=o.shape==ask.local.Shapes.Polyline?o.drawPoints:o.points;
for(var k=1;
k<q.length;
k++){var g=q[k];
var X=Math.round((g.lat*100000-E.lat*100000));
var T=Math.round((g.lng*100000-E.lng*100000));
U+=","+X+","+T;
E=g;
}U+="|";
}}}}}}}var G;
if(this.viewMode>2){G=this.viewMode+1;
}else{G=this.viewMode;
}var R;
var O="/cgi-bin/smap4.py?";
R=O+"partner="+ask.local.Defaults.partnerId;
R+="&iroot=[$iroot]";
if(A&&C){R+="&p="+Y+"&inames="+D+"&rll="+l+"&tll="+d+"&v="+G+"&o=jpeg&oo="+F+"&z="+this.zoom+"&ctr="+B+"&pw="+A+"&ph="+C;
}else{R+="&p="+Y+"&inames="+D+"&rll="+l+"&tll="+d+"&v="+G+"&o=jpeg&oo="+F+"&z="+this.zoom+"&llmin="+a+"&llmax="+H;
if(h&&M){R+="&tw="+h+"&th="+M;
}}R+="&vrt="+c+"&vrw="+f+"&vrc="+J+"&vrfc="+n;
var K=1990-R.length;
if(K<U.length){U=U.substring(0,K);
var N=U.lastIndexOf("|");
U=U.substring(0,N);
}R+="&vr="+U;
return R;
},setTransparentImage:function(A){A.cleared=true;
if(ask.util.Browser.isIE6){A.style.filter="";
}else{A.src=ask.local.Defaults.SP+"transparent.gif";
}A.cleared=false;
},onImageLoad:function(C,B){if(!B.cleared){if(ask.util.Browser.isIE6){var A=this.src;
setTimeout(function(){B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+")";
B.src=ask.local.Defaults.SP+"transparent.gif";
},5);
}else{B.src=this.src;
}}},initGrid:function(){var F=this.HTILES;
var D=this.VTILES;
var E,C;
if(this.enableAutoGridResize){E=Math.round(parseInt(this.viewWidth)/this.TILESIZE)+2;
C=Math.round(parseInt(this.viewHeight)/this.TILESIZE)+2;
}else{E=6;
C=4;
}if(!F||E>this.HTILES||!D||C>this.VTILES){this.HTILES=E;
this.VTILES=C;
if(this.tiles==null){this.tiles=new Array(this.VTILES);
}this.HTILES2=this.HTILES>>1;
this.VTILES2=this.VTILES>>1;
printfire("Init grid: "+this.HTILES+","+this.VTILES,ask.util.MsgType.Info);
for(var G=0;
G!=this.VTILES;
++G){if(this.tiles[G]==null){this.tiles[G]=new Array(this.HTILES);
}for(var A=0;
A!=this.HTILES;
++A){if(this.tiles[G][A]==null){var B=this.createImage();
B.id="t_"+A+"_"+G;
B.style.zIndex=0;
ask.util.Events.addListener(B,"load",this.popIn,this);
this.tiles[G][A]=B;
this.mapDiv.appendChild(B);
}}}if(this.tiles2==null){this.tiles2=new Array(this.VTILES);
}for(var G=0;
G!=this.VTILES;
++G){if(this.tiles2[G]==null){this.tiles2[G]=new Array(this.HTILES);
}for(var A=0;
A!=this.HTILES;
++A){if(this.tiles2[G][A]==null){var B=this.createImage();
B.id="t2"+A+"_"+G;
B.cleared=true;
B.style.zIndex=1;
B.loader=__d.ce("img");
B.loader.style.visibility="hidden";
ask.util.Events.addListener(B.loader,"load",this.onImageLoad,B);
this.tiles2[G][A]=B;
this.mapDiv.appendChild(B);
}}}}},onImageError:function(A){if(!this.reload&&this.src.indexOf("?e=1")==-1){this.reload=true;
this.src=this.src+"?e=1";
}else{this.reload=false;
}},hookUpKeyEvents:function(){ask.local.Keys.enable();
ask.util.Events.addListener(this.viewDiv,"mousewheel",function(A){clearTimeout(this._vw_wheel_tmr);
var C=event.wheelDelta;
ask.util.Events.cancel(event);
var B=this;
this._vw_wheel_tmr=setTimeout(function(){B.onMouseWheel(C);
},5);
},this,true);
ask.util.Events.addListener(this.viewDiv,"DOMMouseScroll",function(A){clearTimeout(this._vw_wheel_tmr);
var C=A.detail;
ask.util.Events.cancel(A);
var B=this;
this._vw_wheel_tmr=setTimeout(function(){B.onMouseWheel(C);
},5);
},this,true);
ask.util.Events.addListener(this.viewDiv,"mouseover",function(){if(this.enableKeySupport){ask.local.Keys.parentMap=this;
ask.local.Keys.isOverMap=true;
}},this,true);
ask.util.Events.addListener(this.viewDiv,"mouseout",function(A){if(A){ask.local.Keys.isOverMap=false;
}},this.enableKeySupport,true);
},hookUpPrintEvents:function(){var A=this;
if(ask.util.Browser.isIE){ask.util.Events.addListener(window,"beforeprint",function(B){if(A.enableTruePrint){A.setPrintImage(false);
}});
}else{this.printTimeout=null;
ask.util.Events.addListener(__d.body,"mouseout",function(B){if(A.enableTruePrint){if(ask.util.Events.getTarget(B).tagName!="IMG"){clearTimeout(A.printTimeout);
A.printTimeout=setTimeout(function(){A.setPrintImage(false);
},500);
}}});
}},getMousePos:function(C){var D=ask.util.Dom.getXY(this.viewDiv);
var B=ask.util.Events.getPageX(C)-D[0];
var A=ask.util.Events.getPageY(C)-D[1];
return{x:B,y:A};
},startDrag:function(F){for(var D=0;
D<this.overlays.length;
D++){var C=this.overlays[D];
if(C.overlayType==ask.local.OverlayType.Text){C.blur();
C.deactivate();
}}ask.local.Keys.typing=false;
if(!F){F=window.event;
}ask.util.Events.preventDefault(F);
if(F.button==2){F=ask.util.Events.getEvent(F);
var B=this.getMousePos(F);
var H=this.centerX+B.x-this.halfViewWidth;
var E=this.centerY+B.y-this.halfViewHeight;
var A=new ask.local.Point(ask.util.GeoMath.pix2lat(E,this.zoom),ask.util.GeoMath.pix2long(H,this.zoom));
this.rightClick.fire(ask.util.Events.getEvent(F),A,H,E);
}else{this.stopScrolling();
F=ask.util.Events.getEvent(F);
this.dragStartX=F.clientX+__d.body.scrollLeft-this.viewDiv.offsetLeft;
this.dragStartY=F.clientY+__d.body.scrollTop-this.viewDiv.offsetTop;
this.dragStartCenterX=this.centerX;
this.dragStartCenterY=this.centerY;
if(!F["ctrlKey"]){if(this.cursorMode==ask.local.CursorMode.Draw&&this.canvas&&this.drawCanvas&&ask.local.Canvas){ask.local.Canvas.onMouseDown(F);
return false;
}else{if(this.cursorMode!=ask.local.CursorMode.Pan){return false;
}}}this.dragging=true;
if(!ask.util.Browser.isIE){this.mapDiv.style.cursor="-moz-grabbing";
}var G=this;
__d.documentElement.onmousemove=function(I){G.fDrag(I);
};
__d.documentElement.onmouseup=function(I){return G.endDrag(I);
};
return false;
}},fDrag:function(A){if(!this.enableDragging||this.stretchAnimator){return ;
}this.drag(ask.util.Browser.isIE?event:A);
return false;
},drag:function(C){if(C==null||!this.dragging){return false;
}var D=this;
C=ask.util.Events.getEvent(C);
var B=C.clientX+__d.body.scrollLeft-this.viewDiv.offsetLeft;
var A=C.clientY+__d.body.scrollTop-this.viewDiv.offsetTop;
this.move(this.dragStartX+this.dragStartCenterX-B,this.dragStartY+this.dragStartCenterY-A);
return false;
},move:function(F,E){var D=this.getLeftColumn();
var C=this.getTopRow();
this.centerX=F;
this.centerY=E;
var B=this.getLeftColumn();
var A=this.getTopRow();
if(D<B){this.updateTiles(this.HTILES+D,A,(this.HTILES+B),(this.VTILES+A));
}else{if(B<D){this.updateTiles(B,A,D,(this.VTILES+A));
}}if(C<A){this.updateTiles(B,(this.VTILES+C),(this.HTILES+B),(this.VTILES+A));
}else{if(A<C){this.updateTiles(B,A,(this.HTILES+B),C);
}}this.moveView();
},endDrag:function(A){if(this.cursorMode==ask.local.CursorMode.Pan){if(ask.util.Browser.isIE){this.mapDiv.style.cursor=ask.util.Browser.openHandCursor;
}else{this.mapDiv.style.cursor="-moz-grab";
}}else{this.mapDiv.style.cursor=ask.util.Browser.defaultCursor;
}__d.documentElement.onmousemove=null;
__d.documentElement.onmouseup=null;
this.dragging=false;
__d.body.style.cursor=ask.util.Browser.defaultCursor;
this.moveView();
this.drawOverlays();
sct(44037);
this.cancelClick=true;
return false;
},onMouseWheel:function(H){if(this.stretchAnimator){return ;
}if(ask.util.Browser.isIE||ask.util.Browser.isSafari||ask.util.Browser.isOpera){H*=-1/120;
}else{H*=1/3;
}var I=H>0;
var B=ask.util.Dom.getXY(this.viewDiv);
var G=this.centerX+this.lastMouseX-B[0]-this.halfViewWidth;
var E=this.centerY+this.lastMouseY-B[1]-this.halfViewHeight;
var F=(I?1:-1)*(Math.abs(H)>1?2:1);
var A=this.getProposedCenter(G,E,F);
var D=A.x;
var C=A.y;
if(I&&!this.isMinZoomedInForMode(this.getZoom())){this.setZoom(this.getZoom()+F,D>>F,C>>F,G>>F,E>>F,true);
}else{if(!I&&!this.isMaxZoomedInForMode(this.getZoom())){this.setZoom(this.getZoom()+F,D<<-F,C<<-F,G<<-F,E<<-F,true);
}}sct(I?44060:44061);
},updateMouseMoveEvent:function(A){try{this.lastMouseX=ask.util.Events.getPageX(ask.util.Events.getEvent(A));
this.lastMouseY=ask.util.Events.getPageY(ask.util.Events.getEvent(A));
}catch(A){}},getProposedCenter:function(C,B,F){var A=this.getStretchPixelExpansion(F);
var E=(this.centerX*this.TILESIZE+C*A)/(A+this.TILESIZE);
var D=(this.centerY*this.TILESIZE+B*A)/(A+this.TILESIZE);
return{x:E,y:D};
},getStretchPixelExpansion:function(A){if(A==1){return -this.TILESIZE/2;
}else{if(A==2){return -this.TILESIZE*3/4;
}else{if(A==-1){return this.TILESIZE;
}else{if(A==-2){return this.TILESIZE*3;
}}}}},handleViewChangeDuringStretch:function(D,A,C,B){if(this.stretchAnimator){this.stretchLeftOffset+=C-D;
this.stretchTopOffset+=B-A;
this.stretchAnimator.update();
}},_getCenterTiles:function(B){var F=this.getLeftColumn();
var D=this.getTopRow();
var K=-1;
var N=-1;
if(B){var H=ask.util.Dom.getXY(this.viewDiv);
var J=this.centerX+this.lastMouseX-H[0]-this.halfViewWidth;
var I=this.centerY+this.lastMouseY-H[1]-this.halfViewHeight;
if((this.centerX+(this.halfViewWidth/2))<J){K=0;
}else{if((this.centerX-(this.halfViewWidth/2))>J){K=-2;
}}if((this.centerY+(this.halfViewHeight/2))<I){N=0;
}else{if((this.centerY-(this.halfViewHeight/2))>I){N=-2;
}}}var G=this.HTILES2+F+K;
var E=this.VTILES2+D+N;
var C=[];
for(var L=0;
L<=1;
L++){for(var M=-1;
M<=1;
M++){xmod=(G+M)%this.HTILES;
if(xmod<0){xmod+=this.HTILES;
}var A=(E+L)%this.VTILES;
if(A<0){A+=this.VTILES;
}C.push(this.tiles[A][xmod]);
}}return C;
},setupStretchTiles:function(J,C,H,I,A){var G=0;
if(!this.tiles){return ;
}var B=I>0||A>0;
var D=this._getCenterTiles(B);
for(var F=0;
F<D.length;
F++){if(!this.stretchTiles[F]){var E=this.createImage();
this.mapDiv.appendChild(E);
this.stretchTiles[F]=E;
}this.setupStretchTile(D[F],this.stretchTiles[F],J,C,H,I,A);
}},setupStretchTile:function(B,C,A,D,F,G,E){C.width=B.width;
C.height=B.height;
C.style.left=B.offsetLeft+"px";
C.style.top=B.offsetTop+"px";
if(B.style.display!="none"){if(ask.util.Browser.isIE6){C.src=ask.local.Defaults.SP+"transparent.gif";
}C.src=B.src;
}C.style.display="";
C.style.zIndex=parseInt(B.style.zIndex)+this.stretchTileZIndexIncrease;
C.initialLeft=C.offsetLeft;
C.initialTop=C.offsetTop;
C.shiftLeft=((C.initialLeft-this.leftShift-D)/this.TILESIZE)*A+G;
C.shiftTop=((C.initialTop-this.topShift-F)/this.TILESIZE)*A+E;
},stretch:function(D,C,F,A,B){this.cleanupStretchedTiles();
var I=D>0;
var H=this.getStretchPixelExpansion(D);
var G=this.centerX-C;
var E=this.centerY-F;
this.stretchLeftOffset=0;
this.stretchTopOffset=0;
this._stretch(H,C,F,A?G:0,A?E:0,B);
},_stretch:function(A,C,F,G,E,B){this.setupStretchImages(A,C,F,G,E,B);
var D=this;
this.stretchAnimator=new ask.util.Timer();
this.stretchAnimator.start(function(H){D.drawStretchImages(H,A,B);
},this.stretchTime,this.stretchUpdateInterval);
setTimeout(function(){D.endStretch();
},this.stretchTime);
},setupStretchImages:function(A,C,E,F,D,B){this.setupStretchTiles(A,C,E,F,D);
if(B){this.setupStretchArrows(C,E,F,D,A<0);
}},preloadStretchArrows:function(){this.stretchArrows=new Array();
for(var A=0;
A<4;
A++){var B=this.createImage();
this.mapDiv.appendChild(B);
B.src=ask.local.Defaults.SP+"blue_pixel.gif";
B.width=A%2?this.stretchArrowLength:this.stretchArrowWidth;
B.height=A%2?this.stretchArrowWidth:this.stretchArrowLength;
B.style.zIndex=this.stretchArrowZIndex;
this.stretchArrows[A]=B;
}},setupStretchArrows:function(C,F,G,A,I){var B=[[0,-1],[-1,0],[0,1],[1,0]];
var H=this.stretchArrowLength*(I?-2.5:0.5);
var D=this.stretchArrowLength*2;
for(var E=0;
E<B.length;
E++){this.stretchArrows[E].initialLeft=C-this.stretchArrows[E].width/2+B[E][0]*H+this.leftShift;
this.stretchArrows[E].initialTop=F-this.stretchArrows[E].height/2+B[E][1]*H+this.topShift;
this.stretchArrows[E].shiftLeft=G+B[E][0]*D;
this.stretchArrows[E].shiftTop=A+B[E][1]*D;
this.stretchArrows[E].style.top=this.stretchArrows[E].initialTop+"px";
this.stretchArrows[E].style.left=this.stretchArrows[E].initialLeft+"px";
this.stretchArrows[E].style.display="";
}},drawStretchImages:function(B,A,C){this.drawStretchedTiles(B,A);
if(C){this.drawStretchArrows(B);
}},drawStretchArrows:function(B){for(var A=0;
A<this.stretchArrows.length;
A++){var C=this.stretchArrows[A];
C.style.left=C.shiftLeft*B+C.initialLeft-this.stretchLeftOffset+"px";
C.style.top=C.shiftTop*B+C.initialTop-this.stretchTopOffset+"px";
}},drawStretchedTiles:function(B,I){for(var E=0;
E<this.stretchTiles.length;
E++){var F=this.stretchTiles[E];
var D=(F.initialLeft+F.shiftLeft*B-this.stretchLeftOffset);
var A=(F.initialTop+F.shiftTop*B-this.stretchTopOffset);
var C=Math.round(D);
var H=Math.round(A);
var G=Math.max(I*B)+this.stretchOverlap;
var J=this.TILESIZE+G;
F.style.left=C+"px";
F.style.top=H+"px";
F.width=J;
F.height=J;
}},endStretch:function(){for(var A=0;
A<this.stretchTiles.length;
A++){var B=this.stretchTiles[A];
B.style.zIndex=parseInt(B.style.zIndex)-this.stretchTileZIndexIncrease-1;
}this.cleanupStretchArrows();
this.stretchAnimator=null;
},cleanupStretchArrows:function(){for(var A=0;
A<this.stretchArrows.length;
A++){var B=this.stretchArrows[A];
B.style.display="none";
}},cleanupStretchedTiles:function(){for(var A=0;
A<this.stretchTiles.length;
A++){var B=this.stretchTiles[A];
B.style.display="none";
}},reset:function(){this.centerAndZoom(new ask.local.Point(this.startLat,this.startLong),this.startZoom);
},createImage:function(){var A=__d.ce("img");
A.unselectable="on";
A.ondragstart=ask.util.Events.returnFalse;
A.onselectstart=ask.util.Events.returnFalse;
A.oncontextmenu=ask.util.Events.cancel;
A.onerror=this.onImageError;
A.style.position="absolute";
A.width=this.TILESIZE;
A.height=this.TILESIZE;
A.style.display="none";
A.lm={setTimer:null,expected:"",current:""};
return A;
},onImageLoad:function(C,B){if(!B.cleared){if(ask.util.Browser.isIE6){var A=this.src;
setTimeout(function(){B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+")";
B.src=ask.local.Defaults.SP+"transparent.gif";
},5);
}else{B.src=this.src;
}}},getLeftColumn:function(){return((this.centerX+128)>>this.TILESIZE2)-this.HTILES2;
},getTopRow:function(){return((this.centerY+128)>>this.TILESIZE2)-this.VTILES2;
},initTiles:function(){if(this.tiles!=null){var A=this;
setTimeout(function(){A._initTiles();
},5);
}},_initTiles:function(){var C=this.getLeftColumn();
var A=this.getTopRow();
var E=this.HTILES2+C-1;
var B=this.VTILES2+A-1;
if(!(ask.util.Browser.isOpera)){this.setTile(E,B,null,null,50);
this.setTile(E+1,B,null,null,50);
this.setTile(E-1,B,null,null,50);
this.setTile(E,B+1,null,null,50);
this.setTile(E+1,B+1,null,null,50);
this.setTile(E-1,B+1,null,null,50);
this.setTile(E,B-1,null,null,50);
this.setTile(E+1,B-1,null,null,50);
this.setTile(E-1,B-1,null,null,50);
var D={startx:E-1,endx:E+1,starty:B-1,endy:B+1};
}this.updateTiles(C,A,C+this.HTILES,A+this.VTILES,D);
this.moveView();
},setViewMode:function(A){if(this.viewMode!=A){try{switch(A){case ask.local.ViewMode.Street:this.setTileTypeMap();
break;
case ask.local.ViewMode.Aerial_Labels:this.setTileTypeHybrid();
break;
case ask.local.ViewMode.Aerial:this.setTileTypeSatellite();
break;
case ask.local.ViewMode.Physical:this.setTileTypePhysical();
break;
case ask.local.ViewMode.Physical_Labels:this.setTileTypePhysHybrid();
break;
}}catch(B){}this.viewModeChange.fire(A);
}},setTileTypeMap:function(){this.hybrid=false;
this.viewMode=ask.local.ViewMode.Street;
this.hideLayer1();
if(this.tileType==ask.local.TileType.Street){return ;
}this.tileType=ask.local.TileType.Street;
this.initTiles();
this.drawOverlays();
this.setCopyright();
},setTileTypeHybrid:function(){setTileTypeMap();
},setTileTypeSatellite:function(){setTileTypeMap();
},setTileTypePhysical:function(){this.hybrid=false;
this.viewMode=ask.local.ViewMode.Physical;
this.hideLayer1();
this.tileType=ask.local.TileType.Physical;
this.initTiles();
this.drawOverlays();
this.setCopyright();
},setTileTypePhysHybrid:function(){this.hybrid=true;
this.viewMode=ask.local.ViewMode.Physical_Labels;
this.showLayer1();
this.tileType=ask.local.TileType.Physical;
this.initTiles();
this.drawOverlays();
this.setCopyright();
},resize:function(B,A){if(this.viewWidth!=B||this.viewHeight!=A){this.viewWidth=B;
this.viewHeight=A;
this.halfViewWidth=this.viewWidth>>1;
this.halfViewHeight=this.viewHeight>>1;
this.positionControls();
this.resizeView.fire(B,A);
if(this.enableAutoGridResize){this.initGrid();
}this.moveView();
this.initTiles();
this.drawOverlays();
printfire("Map resize:"+B+","+A,ask.util.MsgType.Info);
}},autoResize:function(){var C=this;
var B,A;
if(C.container.style.width&&C.container.style.width.indexOf("%")==-1){B=C.container.style.width?parseInt(C.container.style.width):C.viewWidth;
}if(C.container.style.height&&C.container.style.height.indexOf("%")==-1){A=C.container.style.height?parseInt(C.container.style.height):C.viewHeight;
}if(__d.defaultView){A=parseInt(__d.defaultView.getComputedStyle(C.container,"").getPropertyValue("height"));
B=parseInt(__d.defaultView.getComputedStyle(C.container,"").getPropertyValue("width"));
}else{if(C.container.offsetHeight){A=C.container.offsetHeight;
B=C.container.offsetWidth;
}}if(B!=C.viewWidth||A!=C.viewHeight){C.resize(B,A);
}},positionControls:function(){try{var J=this.controls.slice(0);
J.sort(function(M,L){return L.getImportance()-M.getImportance();
});
var C=[];
for(var F=0;
F<J.length;
F++){J[F].position(C);
}this.controlBoundingBoxes=C;
var E=[];
for(var F=0;
F<C.length;
F++){if(C[F].opaque){E.push(C[F]);
}}var G=ask.util.Geometry.squeeze({left:0,top:0,right:this.viewWidth,bottom:this.viewHeight},E);
if(this.showCopyright){this.copyrightDiv.style.top=(G.bottom-15)+"px";
this.copyrightDiv.style.display="";
}if(this.logo){this.logo.style.top=(G.bottom-40)+"px";
this.logo.style.display="";
}if(this.canvas){var D=this.canvas.context;
var I=D.lineWidth;
var A=D.strokeStyle.replace(/rgb\(/,"rgba(");
var B=D.fillStyle.replace(/rgb\(/,"rgba(");
if(ask.util.Browser.isSafari){this.canvas.width=this.viewWidth;
this.canvas.height=this.viewHeight;
this.canvas.style.width=this.canvas.width+"px";
this.canvas.style.height=this.canvas.height+"px";
}else{this.canvas.width=this.canvas.style.width=this.viewWidth;
this.canvas.height=this.canvas.style.height=this.viewHeight;
}D.lineWidth=I;
D.strokeStyle=A;
D.fillStyle=B;
if(this.drawCanvas){if(ask.util.Browser.isSafari){this.drawCanvas.width=G.right-G.left-5;
this.drawCanvas.height=G.bottom-G.top-5;
this.drawCanvas.style.left=G.left+"px";
this.drawCanvas.style.top=G.top+"px";
this.drawCanvas.style.width=this.drawCanvas.width+"px";
this.drawCanvas.style.height=this.drawCanvas.height+"px";
}else{this.drawCanvas.style.left=G.left+"px";
this.drawCanvas.style.top=G.top+"px";
this.drawCanvas.width=this.drawCanvas.style.width=G.right-G.left-5;
this.drawCanvas.height=this.drawCanvas.style.height=G.bottom-G.top-5;
}var K=this.drawCanvas.context;
K.lineWidth=I;
K.strokeStyle=A;
K.fillStyle=B;
}}}catch(H){printfire("EXCEPTION: Error positioning map controls"+H.message);
}},clr:function(){if(this.tiles==null){printfire("Call Map.render(); before calling methods on the map.",ask.util.MsgType.Exception);
this.render();
}if(this.tiles.length>=this.VTILES){for(var C=0;
C!=this.VTILES;
++C){for(var A=0;
A!=this.HTILES;
++A){var B=this.tiles[C][A];
B.style.display="none";
}}}},setTile:function(J,H,D,B,U){var W=this;
var R=J%this.HTILES;
if(R<0){R+=this.HTILES;
}var X=H%this.VTILES;
if(X<0){X+=this.VTILES;
}if(this.tiles[X]==null){return ;
}var Y=this.tiles[X][R];
var V=this.tiles2[X][R];
var P=1<<(ask.util.GeoMath.MAXZOOM-this.zoom-1);
var T=P>>1;
var K=((J+T)&(P-1))-T;
var F=(J<<this.TILESIZE2);
var O=(H<<this.TILESIZE2);
var C=F>=0?this.leftShift:-(this.leftShift);
var L=O>=0?this.topShift:-(this.topShift);
F=F-C;
O=O-L;
var I=1+(J&1|(H<<1)&2);
var A="?partner="+ask.local.Defaults.partnerId+"&tc="+(this.HTILES*this.VTILES);
var N=this.getTileHost(this.tileType,this.zoom);
var E=this.tileType+"/"+this.zoom+"/"+K+"/"+H;
var G=H<-T||T<=H?ask.local.Defaults.SP+"blank.gif":N.replace("%n",I)+"/"+E+A;
if(Y.lm.current.length==0||Y.lm.current!=E){if(Y.lm.setTimer){clearTimeout(Y.lm.setTimer);
Y.lm.setTimer=null;
Y.lm.current="";
Y.lm.expected="";
}Y.style.display="none";
Y.lm.expected=E;
if(U){Y.lm.setTimer=setTimeout(function(){clearTimeout(Y.lm.setTimer);
Y.lm.setTimer=null;
Y.style.left=F+"px";
Y.style.top=O+"px";
Y.lm.current=E;
Y.src=G;
},U);
}else{Y.style.left=F+"px";
Y.style.top=O+"px";
Y.lm.current=E;
Y.src=G;
}if(this.tileType==ask.local.TileType.Satellite&&R==0&&X==0){ask.local.Proxy.getSatCopy(J,H,this.zoom,function(Z){W.setCopyright(Z);
});
}}if(this.hybrid){var N=this.getTileHost(ask.local.TileType.StreetTransparent,this.zoom);
var Q=(H<-T||T<=H?ask.local.Defaults.SP+"transparent.gif":N.replace("%n",I)+"/"+ask.local.TileType.StreetTransparent+"/"+this.zoom+"/"+K+"/"+H);
var M=V.src.indexOf("?");
var S=V.src;
if(M>-1){S=S.substring(0,M);
}if(S!=Q){Q+=A;
if(V.lm.setTimer){clearTimeout(V.lm.setTimer);
V.lm.setTimer=null;
}if(ask.util.Browser.isIE6){U=U||500;
V.style.filter="";
}else{U=U||200;
}W.setTransparentImage(V);
V.lm.setTimer=setTimeout(function(){V.style.left=F+"px";
V.style.top=O+"px";
V.loader.src=Q;
V.lm.setTimer=null;
},U);
}}},popIn:function(A){if(this.lm.expected==this.lm.current){this.style.display="";
}},fadeIn:function(F,E){if(E.stretchAnimator){var D=E.stretchAnimator.getTimeLeft()-25;
var G=this;
if(D>0){setTimeout(function(){G.style.display="";
},D);
}else{this.style.display="";
}return ;
}if(this.style.display=="none"){if(E.enableEffects){ask.util.Dom.setOpacity(this,0);
this.style.display="";
var C=ask.util.Browser.isIE?30:60;
var B=this;
var A=10;
window.setTimeout(function(){if(__d.get(B.id)){ask.util.Animator.fadeToOpaque(B,0,100,20,C);
}else{if(A){A--;
window.setTimeout(arguments.callee,100);
}}},100);
}else{ask.util.Dom.setOpacity(this,100);
this.style.display="";
}}},setCopyright:function(C){var B="&copy; "+new Date().getFullYear()+" Ask.com";
if((this.viewMode==1)||(this.viewMode==4)||(this.viewMode==0)){B+=" - "+this.mapCopyText;
}if(this.tileType==ask.local.TileType.Physical){B+=" - Elevation Data provided by: GLCF, USDOC, NOAA, NGDC";
}var A=(this.hybrid||this.tileType==ask.local.TileType.Satellite||this.tileType==ask.local.TileType.Physical)?"#fff":"#333333";
B+='&nbsp;<a href="'+ask.util.Defaults.StaticDomain+'en/docs/about/mapstermsofuse.shtml" target="new" style="color:'+A+';font-size:8pt">Terms of Use</a>';
this.copyrightDiv.innerHTML='<span style="font-size:8pt;color:'+A+'">'+B+"</span>";
},updateTiles:function(B,D,A,C,E){var F=this;
setTimeout(function(){F._updateTiles(B,D,A,C,E);
},5);
},_updateTiles:function(C,H,A,F,I){delay=I?200:null;
var B=0;
for(var E=H;
E!=F;
++E){var D=0;
for(var G=C;
G!=A;
++G){if(!I||((G<I.startx||G>I.endx)||(E<I.starty||E>I.endy))){this.setTile(G,E,D,B,delay);
}D++;
}B++;
}},showLayer1:function(){for(var B=0;
B!=this.VTILES;
++B){for(var A=0;
A!=this.HTILES;
++A){this.tiles2[B][A].style.display="";
}}},hideLayer1:function(){for(var B=0;
B!=this.VTILES;
++B){for(var A=0;
A!=this.HTILES;
++A){this.tiles2[B][A].style.display="none";
}}},moveView:function(){var B=-(this.centerX-this.halfViewWidth);
var A=-(this.centerY-this.halfViewHeight);
if((ask.util.Browser.isOpera)&&!(this.scrolling||this.dragging)){this.leftShift=Math.max(-(this.DIV_SIZE_LIMIT-B),0);
this.topShift=Math.max(-(this.DIV_SIZE_LIMIT-A),0);
}B-=this.leftShift;
A-=this.topShift;
this.handleViewChangeDuringStretch(this.mapDiv.offsetLeft,this.mapDiv.offsetTop,B,A);
this.mapDiv.style.left=B+"px";
this.mapDiv.style.top=A+"px";
if(this.canvas&&!this.scrolling&&!this.dragging){this.canvas.style.left=-(B)+"px";
this.canvas.style.top=-(A)+"px";
}if(this.cursorMode==ask.local.CursorMode.Draw){if(this.drawCanvas&&!this.scrolling&&!this.dragging){this.drawCanvas.style.left=-(B)+"px";
this.drawCanvas.style.top=-(A)+"px";
}}if(!this.dragging&&!this.scrolling){this.mapMove.fire();
}},center:function(A,B){this.centerX=A-this.halfViewWidth;
this.centerY=B-this.halfViewHeight;
this.initTiles();
},getViewMode:function(){return this.viewMode;
},setZoomBackground:function(){this.zoomBackgroundChange.fire();
},getZoom:function(){return this.zoom;
},startStretchForZoom:function(G,E,C,F,A){var D;
var B;
if(G>0){D=E?E<<G:this.centerX;
B=C?C<<G:this.centerY;
}else{D=E?E>>-G:this.centerX;
B=C?C>>-G:this.centerY;
}this.stretch(G,D,B,F,A);
},setZoom:function(J,I,G,F,E,D){if((this.viewMode==3||this.viewMode==4)&&(J<ask.local.ZoomLevel.Min_Physical)){var L=ask.local.ZoomLevel.Min_Physical-J;
J=ask.local.ZoomLevel.Min_Physical;
if(L>0){I>>=L;
G>>=L;
}else{I<<=-L;
G<<=-L;
}}J=Math.min(Math.max(J,0),ask.local.ZoomLevel.Max);
var K=J-this.zoom;
if(K==0&&(I==null||I==this.centerX)&&(G==null||G==this.centerY)){return ;
}this.stopScrolling();
if(this.enableEffects&&Math.abs(K)>0&&Math.abs(K)<2.5){this.startStretchForZoom(K,F?F:I,E?E:G,!(F&&E),D);
}var B=this.infoWindow.owner;
var A=this.getBounds();
var H=B!=null&&A.containsPoint(B.point);
if(I&&G){this.centerX=I;
this.centerY=G;
this.zoom=J;
}else{if(!H){if(K>0){this.centerX>>=K;
this.centerY>>=K;
}else{this.centerX<<=-K;
this.centerY<<=-K;
}this.zoom=J;
}else{var N=this.centerX-B.x();
var M=this.centerY-B.y();
this.zoom=J;
this.centerX=B.x()+N;
this.centerY=B.y()+M;
}}if(K!=0){this.clr();
this.zoomChange.fire(J);
this.zoomBackgroundChange.fire();
this.disablePhysicalView.fire();
}this.initTiles();
var C=this;
setTimeout(function(){C.drawOverlays();
},15);
},zoomIn:function(){this.setZoom(this.zoom-1);
},zoomOut:function(){this.setZoom(this.zoom+1);
},zoomInTo:function(B){var C=this.zoom-1;
if(C>=0){var A=ask.util.GeoMath.long2pix(B.lng,C);
var D=ask.util.GeoMath.lat2pix(B.lat,C);
this.setZoom(C,A,D);
}},zoomInToLatLng:function(B,A){this.zoomInTo(new ask.local.Point(B,A));
},zoomOutFrom:function(B){var C=this.zoom+1;
if(C<=(ask.util.GeoMath.MAXZOOM-2)){var A=ask.util.GeoMath.long2pix(B.lng,C);
var D=ask.util.GeoMath.lat2pix(B.lat,C);
this.setZoom(C,A,D);
}},zoomOutFromLatLng:function(B,A){this.zoomOutFrom(new ask.local.Point(B,A));
},beginScrollTo:function(A,E){if(this.centerX==A&&this.centerY==E){return ;
}var B=ask.util.Browser.isIE?10:3;
var C=ask.util.Browser.isIE?5:2;
this.scrollDX=(A-this.centerX)/B;
this.scrollDY=(E-this.centerY)/B;
this.scrollX=this.centerX;
this.scrollY=this.centerY;
this.scrollSteps=B;
if(!this.scrolling){this.scrolling=true;
var D=this;
setTimeout(function(){D.scroll();
},C);
}},scroll:function(){if(this.scrollSteps==0){this.scrolling=false;
if(this.canvas){this.canvas.style.left=-(parseFloat(this.mapDiv.style.left))+"px";
this.canvas.style.top=-(parseFloat(this.mapDiv.style.top))+"px";
}if(this.cursorMode==ask.local.CursorMode.Draw){if(this.drawCanvas&&!this.scrolling&&!this.dragging){this.drawCanvas.style.left=-(parseFloat(this.mapDiv.style.left))+"px";
this.drawCanvas.style.top=-(parseFloat(this.mapDiv.style.top))+"px";
}}this.drawOverlays();
return ;
}this.scrollSteps-=1;
this.scrollX+=this.scrollDX;
this.scrollY+=this.scrollDY;
this.move(Math.round(this.scrollX),Math.round(this.scrollY));
var A=this;
setTimeout(function(){A.scroll();
},5);
},stopScrolling:function(){this.scrollSteps=0;
},moveViewToLLZ:function(C,B,A){this.setZoom(A,ask.util.GeoMath.long2pix(B,A),ask.util.GeoMath.lat2pix(C,A));
},moveViewTo:function(A,B){this.stopScrolling();
if(Math.abs(this.centerX-A)<this.viewWidth&&Math.abs(this.centerY-B)<this.viewHeight){this.beginScrollTo(A,B);
return ;
}this.centerX=A;
this.centerY=B;
this.initTiles();
this.drawOverlays();
},snglclick:function(D){if(!this.cancelClick){D=ask.util.Events.getEvent(D);
var B=this.getMousePos(D);
var E=this.dragStartCenterX+B.x-this.halfViewWidth;
var C=this.dragStartCenterY+B.y-this.halfViewHeight;
var A=new ask.local.Point(ask.util.GeoMath.pix2lat(C,this.zoom),ask.util.GeoMath.pix2long(E,this.zoom));
this.click.fire(ask.util.Events.getEvent(D),A);
}this.cancelClick=false;
},dblclick:function(E){if(this.cursorMode==ask.local.CursorMode.Pan){E=ask.util.Events.getEvent(E);
var B=this.getMousePos(E);
var F=this.dragStartCenterX+B.x-this.halfViewWidth;
var D=this.dragStartCenterY+B.y-this.halfViewHeight;
var C=this.getZoom();
var A=C>ask.local.ZoomLevel.Region?2:1;
if(this.isMaxZoomedInForMode(C)){this.doMove(F,D);
}else{if(!this.stretchAnimator){this.setZoom(C-A,F<<A,D<<A);
}}}},isMaxZoomedInForMode:function(A){var B=this.viewMode==ask.local.ViewMode.Physical||this.viewMode==ask.local.ViewMode.Physical_Labels;
return(A<=ask.local.ZoomLevel.Min)||(B&&A<=ask.local.ZoomLevel.Min_Physical);
},isMinZoomedInForMode:function(A){return A>=ask.local.ZoomLevel.Max;
},doMove:function(B,A){this.dragging=false;
this.moveViewTo(B,A);
},drawOverlays:function(E){if(this.canvas){this.clearCanvas();
}E=E?E:this.overlays;
var B=this.getBounds();
for(var D=0;
D!=E.length;
++D){var C=E[D];
if(C&&C.visible&&C.div){if(C.minDisplayZoom<=this.zoom&&C.maxDisplayZoom>=this.zoom){if(C.overlayType<ask.local.OverlayType.Route){C.div.style.display="";
C.position();
}else{var G=B.intersects(C.getBounds());
if(G){var A=G.getPixelBounds(this.zoom);
var F=C.shape==ask.local.Shapes.Polyline?101:Math.abs((A.maxX-A.minX)*(A.maxY-A.minY));
if(F>100){C.div.style.display="";
C.position();
}else{C.div.style.display="none";
}}}}else{C.div.style.display="none";
}}}if(this.infoWindow){this.infoWindow.position();
}},drawLineOverlays:function(){this.drawOverlaysIf("overlayType",ask.local.OverlayType.Shape);
this.drawOverlaysIf("overlayType",ask.local.OverlayType.Route);
},drawOverlaysIf:function(property,value){var drawOverlays=[];
for(var i=0;
i<this.overlays.length;
i++){var overlay=this.overlays[i];
var draw=eval("this.overlays["+i+"]."+property+"=="+value);
if(draw){drawOverlays.push(overlay);
}}if(drawOverlays.length>0){this.drawOverlays(drawOverlays);
}if(this.infoWindow){this.infoWindow.position();
}},showOverlaysIf:function(property,value){var showOverlays=[];
for(var i=0;
i<this.overlays.length;
i++){var overlay=this.overlays[i];
var show=eval("this.overlays["+i+"]."+property+"=="+value);
if(show){showOverlays.push(overlay);
}}if(showOverlays.length>0){this.showAllOverlays(showOverlays);
}},calcOverlaysPos:function(S,B){S=S?S:this.overlays;
if(S.length==0){this.reset();
return ;
}var F=2;
var E,I,D,G;
for(var Q=0;
Q<S.length;
Q++){var R=S[Q];
if(R&&(B||R.parentMap)){if(R.overlayType==ask.local.OverlayType.Marker||R.overlayType==ask.local.OverlayType.Text||R.overlayType==ask.local.OverlayType.Default){var H=R.point;
E=E==null?H.lat:E;
I=I==null?H.lat:I;
D=D==null?H.lng:D;
G=G==null?H.lng:G;
E=H.lat<E?H.lat:E;
I=H.lat>I?H.lat:I;
D=H.lng<D?H.lng:D;
G=H.lng>G?H.lng:G;
}else{if(R.overlayType==ask.local.OverlayType.Shape||R.overlayType==ask.local.OverlayType.Route){var C=R.getBounds();
E=E==null?C.minLat:E;
I=I==null?C.maxLat:I;
D=D==null?C.minLong:D;
G=G==null?C.maxLong:G;
E=C.minLat<E?C.minLat:E;
I=C.maxLat>I?C.maxLat:I;
D=C.minLong<D?C.minLong:D;
G=C.maxLong>G?C.maxLong:G;
}}}}if(E&&I&&D&&G){var P=100000;
var O=100000;
var M,K,L,J;
var N=this.viewWidth>100?this.viewWidth-100:this.viewWidth;
var A=this.viewHeight>100?this.viewHeight-100:this.viewHeight;
A=__d.get("saveCtrl")==null?A:A-125;
while((P>N||O>A)&&F<ask.util.GeoMath.MAXZOOM){++F;
M=ask.util.GeoMath.long2pix(D,F);
K=ask.util.GeoMath.lat2pix(E,F);
L=ask.util.GeoMath.long2pix(G,F);
J=ask.util.GeoMath.lat2pix(I,F);
P=Math.abs(L-M);
O=Math.abs(J-K);
}return{z:F,x:((M+L)>>1),y:((K+J)>>1),w:P,h:O};
}return undefined;
},showAllOverlays:function(A){var B=this.calcOverlaysPos(A);
if(B){this.setZoom(B.z,B.x,B.y);
this.OverlaysPos=B;
}},forEachOverlay:function(E,A){var D=this.overlays;
for(var C=0;
C!=D.length;
C++){var B=D[C];
if(B){if(A||(B.visible&&B.div)){E(B);
}}}},hasCustomDrawing:function(){var A=false;
this.forEachOverlay(function(B){if(ask.local.OverlayType.Shape==B.overlayType){A=true;
}if(B.saved){A=true;
}});
return A;
},getBoundsLatLng:function(){var B=new ask.local.Bounds();
B.minX=this.centerX-this.halfViewWidth;
B.minY=this.centerY-this.halfViewHeight;
B.maxX=this.centerX+this.halfViewWidth;
B.maxY=this.centerY+this.halfViewHeight;
var A=this.zoom;
B.minLat=ask.util.GeoMath.pix2lat(B.maxY,A);
B.minLong=ask.util.GeoMath.pix2long(B.minX,A);
B.maxLat=ask.util.GeoMath.pix2lat(B.minY,A);
B.maxLong=ask.util.GeoMath.pix2long(B.maxX,A);
return B;
},getBounds:function(){return this.getBoundsLatLng();
},getCenterLatLng:function(){var B=ask.util.GeoMath.pix2lat(this.centerY,this.zoom);
var A=ask.util.GeoMath.pix2long(this.centerX,this.zoom);
return new ask.local.Point(B,A);
},getCenterPoint:function(){return this.getCenterLatLng();
},centerAndZoom:function(A,B){this.setZoom(B,ask.util.GeoMath.long2pix(A.lng,B),ask.util.GeoMath.lat2pix(A.lat,B));
},recenterOrPanToLatLng:function(A,B){B=B?B:0;
this.moveViewTo(ask.util.GeoMath.long2pix(A.lng,this.zoom),ask.util.GeoMath.lat2pix(A.lat,this.zoom)-B);
},centerOn:function(A,B){this.recenterOrPanToLatLng(A,B);
},addControl:function(A){A.parentMap=this;
this.controls.push(A);
if(A.subscribeToEvents){A.subscribeToEvents();
}A.appendTo(this.viewDiv);
},removeControl:function(B){B.parentMap=null;
B.appendTo(this.fosterParent);
for(var A=0;
A<this.controls.length;
A++){if(this.controls[A]==B){this.controls.splice(A,1);
break;
}}B=null;
},addCanvas:function(){try{var B=document.createElement("canvas");
if(B){B.id="__mapCanvas";
B.style.position="absolute";
B.style.display="";
B.style.zIndex=2;
B.style.left="0px";
B.style.top="0px";
B.onselectstart=ask.util.Events.returnFalse;
this.mapDiv.appendChild(B);
if(ask.util.Browser.isIE){B=G_vmlCanvasManager.initElement(B);
}B.context=B.getContext("2d");
B.context.lineCap="round";
B.context.lineJoin="round";
B.context.fillStyle="rgb(0,0,0)";
B.context.strokeStyle="rgb(0,0,0)";
this.canvas=B;
}}catch(A){printfire("Canvas API not supported or error loading canvas object.",ask.util.MsgType.Exception);
}},addDrawCanvas:function(){try{var B=document.createElement("canvas");
if(B){B.id="__drawCanvas";
B.style.position="absolute";
B.style.display="";
B.style.zIndex=3;
B.style.left="-1000px";
B.style.top="-1000px";
B.onselectstart=ask.util.Events.returnFalse;
this.mapDiv.appendChild(B);
if(ask.util.Browser.isIE){B=G_vmlCanvasManager.initElement(B);
}B.context=B.getContext("2d");
B.context.lineCap="round";
B.context.lineJoin="round";
B.context.fillStyle="rgb(0,0,0)";
B.context.strokeStyle="rgb(0,0,0)";
this.drawCanvas=B;
}}catch(A){printfire("Canvas API not supported or error loading canvas object.",ask.util.MsgType.Exception);
}},openInfoWindow:function(A,B,C){this.infoWindow.setOwner(null);
this.infoWindow.open(A,B,0,0,C);
},closeInfoWindow:function(A){if(this.infoWindow!=null){this.infoWindow.close(A);
}},addOverlay:function(A){if(A){A.parentMap=this;
if(A&&A.div){this.overlays.push(A);
if(A.minDisplayZoom<=this.zoom&&A.maxDisplayZoom>=this.zoom){A.div.style.display="";
A.position();
}else{A.div.style.display="none";
}}A.appendTo(this.mapDiv);
}},layerOverlays:function(A){for(var C=0;
C<this.overlays.length;
C++){var B=this.overlays[C];
if(B&&B.div&&B.overlayType==ask.local.OverlayType.Marker){if(B==A){B.div.style.zIndex=202;
}else{if(B.saved){B.div.style.zIndex=201;
}else{B.div.style.zIndex=200;
}}}}},removeOverlay:function(A){if(A){if(A.removed){A.removed.fire();
}this.purgeOverlay(A);
for(var B=0;
B<this.overlays.length;
B++){if(this.overlays[B]==A){this.overlays.splice(B,1);
break;
}}if(A.route){this.removeOverlay(A.route);
}if(A.shape){this.drawOverlays();
}A=null;
}},removeAllOverlays:function(E){var D;
if(!E){D=true;
}E=E?E:this.overlays;
var A=[];
for(var C=0;
C<E.length;
C++){var B=E[C];
if(B.route){A.push(B.route);
}if(B.removed){B.removed.fire();
}this.purgeOverlay(B);
B.parentMap=null;
}if(D){ask.util.Events.removeListenersByKey("overlay");
this.overlays=[];
if(this.canvas){this.clearCanvas();
}}else{this.removeOverlaysIf("parentMap",null);
if(A.length>0){this.removeAllOverlays(A);
}}this.drawOverlays();
},removeOverlaysIf:function(property,value){var newOverlays=[];
var routes=[];
for(var i=0;
i<this.overlays.length;
i++){var overlay=this.overlays[i];
if(overlay){try{var remove=eval("this.overlays["+i+"]."+property+"=="+value);
if(remove){if(overlay.route){routes.push(overlay.route);
}if(overlay.removed){overlay.removed.fire();
}this.purgeOverlay(overlay);
overlay=null;
}else{newOverlays.push(overlay);
}}catch(e){}}}this.overlays=[];
this.overlays=newOverlays;
if(routes.length>0){this.removeAllOverlays(routes);
}this.drawOverlays();
},removeOverlaysIfAll:function(conditions){var newOverlays=[];
var routes=[];
for(var i=0;
i<this.overlays.length;
i++){var overlay=this.overlays[i];
if(overlay){try{var remove=eval(conditions);
if(remove){if(overlay.route){routes.push(overlay.route);
}if(overlay.removed){overlay.removed.fire();
}this.purgeOverlay(overlay);
overlay=null;
}else{newOverlays.push(overlay);
}}catch(e){}}}this.overlays=[];
this.overlays=newOverlays;
if(routes.length>0){this.removeAllOverlays(routes);
}this.drawOverlays();
},purgeOverlay:function(A){if(A){if(A.div){this.fosterParent.appendChild(A.div);
A.div.onclick=null;
A.div.onmousedown=null;
}if(A.icon&&A.icon.image){A.icon.image=null;
A.icon.realImg=null;
A.icon=null;
}A.div=null;
this.fosterParent.innerHTML="";
}},unload:function(){ask.util.Events.removeAllListeners();
if(ask.util.Browser.isIE){var C=__d.getElementsByTagName("canvas");
for(var B=0;
B<C.length;
B++){var D=C[B];
if(D.context_){D.context_.element_=null;
D.context_=null;
}D.getContext=null;
this.fosterParent.appendChild(D);
this.fosterParent.innerHTML="";
D=null;
}}if(this.canvas){this.canvas.context=null;
this.canvas=null;
}if(this.drawCanvas){this.drawCanvas.context=null;
this.drawCanvas=null;
}if(ask.local.Canvas){for(var G in ask.local.Canvas){ask.local.Canvas[G]=null;
}ask.local.Canvas=null;
}for(var B=0;
B<this.controls.length;
B++){var E=this.controls[B];
this.fosterParent.appendChild(E.controlDiv);
this.fosterParent.innerHTML="";
for(var G in E){E[G]=null;
}E=null;
}this.removeAllOverlays();
for(var B=0;
B<this.tiles.length;
B++){for(var A=0;
A<this.tiles[B].length;
A++){try{this.fosterParent.appendChild(this.tiles[B][A]);
}catch(F){}this.tiles[B][A]=null;
}try{this.fosterParent.appendChild(this.tiles[B]);
}catch(F){}this.tiles[B]=null;
}this.tiles=[];
for(var B=0;
B<this.tiles2.length;
B++){for(var A=0;
A<this.tiles2[B].length;
A++){try{this.fosterParent.appendChild(this.tiles2[B][A]);
}catch(F){}this.tiles2[B][A]=null;
}try{this.fosterParent.appendChild(this.tiles2[B]);
}catch(F){}this.tiles2[B]=null;
}this.tiles2=[];
for(var B=0;
B<this.stretchTiles.length;
B++){try{this.fosterParent.appendChild(this.stretchTiles[B]);
}catch(F){}this.tiles[B]=null;
}this.stretchTiles=[];
this.fosterParent.innerHTML="";
for(var G in this){this[G]=null;
}},getShapeId:function(){return this.nextShapeId++;
},findShape:function(C){for(var B=0;
B<this.overlays.length;
B++){var A=this.overlays[B];
if((A.overlayType==ask.local.OverlayType.Shape||A.overlayType==ask.local.OverlayType.Route)&&A.shapeId==C){return A;
}}return null;
},clearCanvas:function(){if(this.canvas){this.canvas.context.beginPath();
this.canvas.context.clearRect(0,0,this.canvas.width,this.canvas.height);
this.canvas.context.closePath();
}}};
ask.local.Bounds=function(D,A,C,B){this.minLat=D;
this.minLong=A;
this.maxLat=C;
this.maxLong=B;
this.minX=null;
this.minY=null;
this.maxX=null;
this.maxY=null;
};
ask.local.Bounds.prototype={getPixelBounds:function(A){if(this.minLong&&this.maxLong&&this.minLat&&this.maxLat){this.minX=ask.util.GeoMath.long2pix(this.minLong,A);
this.maxX=ask.util.GeoMath.long2pix(this.maxLong,A);
this.minY=ask.util.GeoMath.lat2pix(this.minLat,A);
this.maxY=ask.util.GeoMath.lat2pix(this.maxLat,A);
}return this;
},containsPoint:function(A){if(!A){return false;
}var C=A.lat>=this.minLat&&A.lat<=this.maxLat;
var B=A.lng>=this.minLong&&A.lng<=this.maxLong;
return C&&B;
},contains:function(A){return(A.minLong>=this.minLong&&A.maxLong<=this.maxLong&&A.maxLat<=this.maxLat&&A.minLat>=this.minLat);
},intersects:function(C){var D=Math.min(this.maxLat,C.maxLat);
var B=Math.min(this.maxLong,C.maxLong);
var E=Math.max(this.minLat,C.minLat);
var A=Math.max(this.minLong,C.minLong);
if(D>=E&&B>=A){return new ask.local.Bounds(E,A,D,B);
}else{return null;
}}};
ask.local.Point=function(E,B,A,F,D,C){this.fullLat=parseFloat(E);
this.fullLong=parseFloat(B);
this.lat=ask.util.Math.Round(this.fullLat,5);
this.lng=ask.util.Math.Round(this.fullLong,5);
this.address=A;
this.title=F;
this.description=D;
this.link=C;
};
ask.local.Point.prototype={isValid:function(){return this.lat&&this.lng;
}};
ask.local.Icon=function(A,B,D){this.image=__d.ce("img");
this.image.ondragstart=ask.util.Events.returnFalse;
this.imageUrl=A?A:ask.local.Defaults.LocalSP+"blue_m_dot.png";
ask.util.Image.SetPng(this.image,this.imageUrl);
var C=__d.ce("img");
C.src=this.imageUrl;
this.realImg=ask.util.Browser.isIE6?C:this.image;
this.offsetTop=B?B:null;
this.offsetLeft=D?D:null;
if(this.offsetLeft==null&&this.offsetTop==null){if(this.realImg.height>0&&this.realImg.width>0){this.offsetLeft=this.realImg.width/2;
this.offsetTop=this.realImg.height;
}else{var E=this;
this.realImg.onload=function(){if(E.realImg){E.offsetLeft=E.realImg.width/2;
E.offsetTop=E.realImg.height;
}};
}}};
ask.local.Icon.prototype={setImage:function(B){this.imageUrl=B;
var A=this;
setTimeout(function(){ask.util.Image.SetPng(A.image,A.imageUrl);
},20);
this.realImg.src=this.imageUrl;
}};
ask.local.DOMOverlay=function(A,D){this.parentMap=null;
this.point=A;
this.overlayType=ask.local.OverlayType.Default;
this.visible=true;
this.minDisplayZoom=ask.local.ZoomLevel.Min;
this.maxDisplayZoom=ask.local.ZoomLevel.Max;
var C=this;
this.div=__d.ce("div");
this.div.style.zIndex=200;
this.div.style.position="absolute";
this.div.style.cursor=ask.util.Browser.handCursor;
ask.util.Events.addListener(this.div,"click",function(E){ask.util.Events.stopPropagation(E);
C.click.fire(ask.util.Events.getEvent(E));
});
ask.util.Events.addListener(this.div,"mousedown",function(H){H=ask.util.Events.getEvent(H);
ask.util.Events.stopPropagation(H);
if(H.button==2){var E=C.parentMap.getMousePos(H);
var I=C.parentMap.centerX+E.x-C.parentMap.halfViewWidth;
var G=C.parentMap.centerY+E.y-C.parentMap.halfViewHeight;
var F=new ask.local.Point(ask.util.GeoMath.pix2lat(G,C.parentMap.zoom),ask.util.GeoMath.pix2long(I,C.parentMap.zoom));
C.rightClick.fire(H,F,I,G);
}});
this.div.ondblclick=ask.util.Events.stopPropagation;
if(D&&typeof (D)=="object"){try{this.div.appendChild(D);
}catch(B){}}this.click=new ask.util.AbstractEvent("click",this);
this.rightClick=new ask.util.AbstractEvent("rightClick",this);
this.dragStart=new ask.util.AbstractEvent("dragStart",this);
this.dragEnd=new ask.util.AbstractEvent("dragEnd",this);
this.mouseOver=new ask.util.AbstractEvent("mouseOver",this);
this.mouseOut=new ask.util.AbstractEvent("mouseOut",this);
};
ask.local.DOMOverlay.prototype={position:function(){try{var E=(ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom));
var D=(ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom));
var B=D>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var A=E>=0?this.parentMap.topShift:-(this.parentMap.topShift);
D=D-B;
E=E-A;
this.div.style.top=E+"px";
this.div.style.left=D+"px";
}catch(C){}},appendTo:function(A){if(A){A.appendChild(this.div);
}}};
ask.local.Marker=function(A,B){this.uid=ask.util.Math.getUniqueId();
this.lkey="overlay";
this.parentMap=null;
this.point=A;
this.overlayType=ask.local.OverlayType.Marker;
this.visible=true;
this.saved=false;
this.minDisplayZoom=ask.local.ZoomLevel.Min;
this.maxDisplayZoom=ask.local.ZoomLevel.Max;
this.icon=B?B:new ask.local.Icon();
this.icon.image.id="mi_"+this.uid;
this.click=new ask.util.AbstractEvent("click",this);
this.rightClick=new ask.util.AbstractEvent("rightClick",this);
this.dragStart=new ask.util.AbstractEvent("dragStart",this);
this.dragEnd=new ask.util.AbstractEvent("dragEnd",this);
this.mouseOver=new ask.util.AbstractEvent("mouseOver",this);
this.mouseOut=new ask.util.AbstractEvent("mouseOut",this);
this.removed=new ask.util.AbstractEvent("removed",this);
var D=this;
this.icon.image.onmouseover=function(E){D.mouseOver.fire(ask.util.Events.getEvent(E));
};
this.icon.image.onmouseout=function(E){D.mouseOut.fire(ask.util.Events.getEvent(E));
};
this.icon.image.oncontextmenu=ask.util.Events.cancel;
if(this.icon.offsetLeft==null&&this.icon.offsetTop==null){ask.util.Events.addListener(this.icon.realImg,"load",this.position,this,true,this.lkey);
}this.div=__d.ce("div");
this.div.id="m_"+this.uid;
var C=__d.ce("span");
if(!a10.browser.isIE6()){C.className="pinspan";
}this.icon.image.className="pinimg";
C.appendChild(this.icon.image);
this.div.appendChild(C);
if(this.div.firstChild.runtimeStyle){this.div.firstChild.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src='"+this.icon.image.src+"', sizingMethod='image');";
}this.div.style.zIndex=200;
this.div.style.position="absolute";
this.div.style.cursor=ask.util.Browser.handCursor;
this.div.onclick=function(H){ask.util.Events.stopPropagation(H);
H=ask.util.Events.getEvent(H);
var E=D.parentMap.getMousePos(H);
var I=D.parentMap.centerX+E.x-D.parentMap.halfViewWidth;
var G=D.parentMap.centerY+E.y-D.parentMap.halfViewHeight;
var F=new ask.local.Point(ask.util.GeoMath.pix2lat(G,D.parentMap.zoom),ask.util.GeoMath.pix2long(I,D.parentMap.zoom));
D.click.fire(H,F,I,G);
};
this.div.onmousedown=function(E){D.startDrag(ask.util.Events.getEvent(E));
};
this.div.ondblclick=ask.util.Events.stopPropagation;
this.dragMoved=false;
this.enableDragging=false;
ask.local.Marker.fadeAll.subscribe(function(F,E,G){if(!G.div){return ;
}if(E.length&&E[0]){if(E[0].id==G.div.id){G.div.className="";
}else{G.div.className="pintranspdiv";
}}else{G.div.className="";
}},this);
};
ask.local.Marker.fadeAll=new ask.util.AbstractEvent("fadeAll",this);
ask.local.Marker.prototype={position:function(){try{var D=this.icon.offsetLeft?this.icon.offsetLeft:this.icon.realImg.width/2;
var C=this.icon.offsetTop?this.icon.offsetTop:this.icon.realImg.height;
var G=ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom)-D;
var F=ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom)-C;
var B=G>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var A=F>=0?this.parentMap.topShift:-(this.parentMap.topShift);
G=G-B;
F=F-A;
this.div.style.top=F+"px";
this.div.style.left=G+"px";
}catch(E){}},appendTo:function(A){if(A){A.appendChild(this.div);
}},openInfoWindow:function(A,B){if(this.parentMap.infoWindow&&this.icon&&this.point.isValid()){this.parentMap.infoWindow.setOwner(this);
this.parentMap.infoWindow.open(this.point,A,this.icon.offsetTop,this.icon.offsetLeft,B);
}this.parentMap.layerOverlays(this);
},closeInfoWindow:function(A){if(this.parentMap.infoWindow){this.parentMap.infoWindow.close(A);
}},startDrag:function(D){D=ask.util.Events.getEvent(D);
ask.util.Events.stopPropagation(D);
var B=this.parentMap.getMousePos(D);
var F=this.parentMap.centerX+B.x-this.parentMap.halfViewWidth;
var C=this.parentMap.centerY+B.y-this.parentMap.halfViewHeight;
var A=new ask.local.Point(ask.util.GeoMath.pix2lat(C,this.parentMap.zoom),ask.util.GeoMath.pix2long(F,this.parentMap.zoom));
if(D.button==2){this.rightClick.fire(D,A,F,C);
}else{if(this.enableDragging){var E=this;
this.dragStart.fire(ask.util.Events.getEvent(D));
this.dragStartX=this.x();
this.dragStartY=this.y();
this.dragOffsetX=this.dragStartX-F;
this.dragOffsetY=this.dragStartY-C;
__d.documentElement.onmousemove=function(G){return E.drag(G);
};
__d.documentElement.onmouseup=function(G){return E.endDrag(G);
};
return false;
}}},drag:function(C){__d.body.style.cursor="move";
C=ask.util.Events.getEvent(C);
var A=this.parentMap.getMousePos(C);
var D=this.parentMap.centerX+A.x-this.parentMap.halfViewWidth+this.dragOffsetX;
var B=this.parentMap.centerY+A.y-this.parentMap.halfViewHeight+this.dragOffsetY;
if((this.dragStartX==this.x()||this.dragStartY==this.y())){if(Math.abs(this.dragStartX-D)>10||Math.abs(this.dragStartY-B)>10){this.moveTo(D,B);
this.dragMoved=true;
}else{this.dragMoved=false;
}}else{this.moveTo(D,B);
this.dragMoved=true;
}return false;
},moveTo:function(A,D){var C=ask.util.GeoMath.pix2lat(D,this.parentMap.zoom);
var B=ask.util.GeoMath.pix2long(A,this.parentMap.zoom);
this.point=new ask.local.Point(C,B);
this.position();
return false;
},endDrag:function(A){__d.body.style.cursor=ask.util.Browser.DefaultCursor;
__d.documentElement.onmousemove=null;
__d.documentElement.onmouseup=null;
if(this.dragMoved){this.dragEnd.fire(ask.util.Events.getEvent(A));
}this.dragMoved=false;
return false;
},setIcon:function(A){if(this.icon&&A&&this.icon==A){return ;
}var B=this;
this.icon=A?A:new ask.local.Icon();
this.icon.image.onmouseover=function(C){B.mouseOver.fire(ask.util.Events.getEvent(C));
};
this.icon.image.onmouseout=function(C){B.mouseOut.fire(ask.util.Events.getEvent(C));
};
this.div.replaceChild(this.icon.image,this.div.firstChild);
},getIconBounds:function(){var C=new ask.local.Bounds();
if(this.icon){var A=ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom);
var I=ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom);
var D=A+this.icon.offsetLeft;
var H=A-this.icon.offsetLeft;
var B=I-this.icon.offsetTop;
var F=ask.util.GeoMath.pix2long(H,this.parentMap.zoom);
var E=ask.util.GeoMath.pix2long(D,this.parentMap.zoom);
var G=ask.util.GeoMath.pix2lat(B,this.parentMap.zoom);
C.minLong=Math.min(F,E);
C.maxLong=Math.max(F,E);
C.minLat=Math.min(this.point.lat,G);
C.maxLat=Math.max(this.point.lat,G);
C.getPixelBounds(this.parentMap.zoom);
}return C;
},x:function(){return ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom);
},y:function(){return ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom);
}};
ask.local.Marker3D=function(A,C,D){var B=new ask.local.Marker(A,C);
B.saved=true;
B.maxDisplayZoom=ask.local.ZoomLevel.Street;
B.parentMap=D;
B.parentMap.addOverlay(B);
return B;
};
ask.local.Text=function(A,F){this.parentMap=null;
this.point=A;
this.text=F?F:"Type here";
this.overlayType=ask.local.OverlayType.Text;
this.visible=true;
this.minDisplayZoom=ask.local.ZoomLevel.Min;
this.maxDisplayZoom=ask.local.ZoomLevel.Max;
var E=this;
this.div=__d.ce("div");
this.div.style.zIndex=200;
this.div.style.position="absolute";
this.div.style.cursor="text";
this.timeoutID=-1;
this.fontSize=14;
ask.util.Events.addListener(this.div,"click",function(G){ask.util.Events.stopPropagation(G);
E.click.fire(ask.util.Events.getEvent(G));
});
ask.util.Events.addListener(this.div,"mousedown",function(J){J=ask.util.Events.getEvent(J);
ask.util.Events.stopPropagation(J);
if(J.button==2){var G=E.parentMap.getMousePos(J);
var K=E.parentMap.centerX+G.x-E.parentMap.halfViewWidth;
var I=E.parentMap.centerY+G.y-E.parentMap.halfViewHeight;
var H=new ask.local.Point(ask.util.GeoMath.pix2lat(I,E.parentMap.zoom),ask.util.GeoMath.pix2long(K,E.parentMap.zoom));
E.rightClick.fire(J,H,K,I);
}});
this.div.ondblclick=ask.util.Events.stopPropagation;
var D=__d.ce("span");
D.style.left=-10000+"px";
D.style.top=-10000+"px";
D.style.zIndex=-10000;
D.style.font=this.fontSize+"px monospace";
D.innerHTML="x";
__d.body.appendChild(D);
this.charWidth=D.offsetWidth;
this.charHeight=D.offsetHeight;
__d.body.removeChild(D);
this.minCols=12;
this.maxCols=24;
this.minRows=1;
this.maxRows=12;
this.minWidth=this.minCols*this.charWidth;
this.maxWidth=this.maxCols*this.charWidth;
this.minHeight=this.minRows*this.charHeight;
this.maxHeight=this.maxRows*this.charHeight;
this.cornerWidth=10;
this.cornerHeight=10;
this.handleWidth=9;
this.handleHeight=18;
this.textarea=__d.ce("textarea");
this.textarea.style.font=this.fontSize+"px monospace";
this.textarea.style.overflow="hidden";
this.textarea.style.position="absolute";
this.textarea.style.left=(this.handleWidth+this.cornerWidth)+"px";
this.textarea.style.top=this.cornerHeight+"px";
this.textarea.style.zIndex=500;
this.textarea.style.width=this.minWidth+"px";
this.textarea.style.height=this.minHeight+"px";
__d.body.appendChild(this.textarea);
this.hFudge=0;
this.vFudge=0;
while(this.textarea.offsetWidth<this.minWidth+4||this.textarea.offsetHeight<this.minHeight+4){if(this.textarea.offsetWidth<this.minWidth+4){this.hFudge+=2;
this.textarea.style.width=(this.minWidth+this.hFudge)+"px";
}if(this.textarea.offsetHeight<this.minHeight+4){this.vFudge+=2;
this.textarea.style.height=(this.minHeight+this.vFudge)+"px";
}}if(ask.util.Browser.isOpera){this.hFudge+=2;
this.vFudge+=2;
this.textarea.style.width=(this.minWidth+this.hFudge)+"px";
this.textarea.style.height=(this.minHeight+this.vFudge)+"px";
}else{if(ask.util.Browser.isSafari){this.hFudge+=8;
this.vFudge+=2;
this.textarea.style.width=(this.minWidth+this.hFudge)+"px";
this.textarea.style.height=(this.minHeight+this.vFudge)+"px";
}}var B=this.textarea.offsetWidth;
var C=this.textarea.offsetHeight;
this.textarea.value=this.text;
this.div.appendChild(this.textarea);
this.handleImg=__d.ce("img");
ask.util.Image.SetPng(this.handleImg,ask.local.UI.Defaults.SP+"texth.png");
this.handleImg.style.position="absolute";
this.handleImg.style.left="0px";
this.handleImg.style.top=this.cornerHeight+"px";
this.handleImg.style.cursor=ask.util.Browser.handCursor;
this.div.appendChild(this.handleImg);
this.btl=__d.ce("img");
ask.util.Image.SetPng(this.btl,ask.local.UI.Defaults.SP+"texttl.png");
this.btl.style.position="absolute";
this.btl.style.left=this.handleWidth+"px";
this.btl.style.top="0px";
this.btl.style.width=this.cornerWidth+"px";
this.btl.style.height=this.cornerHeight+"px";
this.div.appendChild(this.btl);
this.bt=__d.ce("img");
ask.util.Image.SetPng(this.bt,ask.local.UI.Defaults.SP+"textt.png");
this.bt.style.position="absolute";
this.bt.style.left=(this.handleWidth+this.cornerWidth)+"px";
this.bt.style.top="0px";
this.bt.style.width=B+"px";
this.bt.style.height=this.cornerHeight+"px";
this.div.appendChild(this.bt);
this.btr=__d.ce("img");
ask.util.Image.SetPng(this.btr,ask.local.UI.Defaults.SP+"texttrx.png");
this.btr.style.position="absolute";
this.btr.style.left=(this.handleWidth+this.cornerWidth+B)+"px";
this.btr.style.top="0px";
this.btr.style.width=this.cornerWidth+"px";
this.btr.style.height=this.cornerHeight+"px";
this.btr.style.cursor=ask.util.Browser.handCursor;
this.btr.title="Close";
this.div.appendChild(this.btr);
this.bl=__d.ce("img");
ask.util.Image.SetPng(this.bl,ask.local.UI.Defaults.SP+"textl.png");
this.bl.style.position="absolute";
this.bl.style.left=this.handleWidth+"px";
this.bl.style.top=this.cornerHeight+"px";
this.bl.style.width=this.cornerWidth+"px";
this.bl.style.height=C+"px";
this.div.appendChild(this.bl);
this.bc=__d.ce("img");
ask.util.Image.SetPng(this.bc,ask.local.UI.Defaults.SP+"textc.png");
this.bc.style.position="absolute";
this.bc.style.left=(this.handleWidth+this.cornerWidth)+"px";
this.bc.style.top=this.cornerHeight+"px";
this.bc.style.width=B+"px";
this.bc.style.height=C+"px";
this.div.appendChild(this.bc);
this.br=__d.ce("img");
ask.util.Image.SetPng(this.br,ask.local.UI.Defaults.SP+"textr.png");
this.br.style.position="absolute";
this.br.style.left=(this.handleWidth+this.cornerWidth+B)+"px";
this.br.style.top=this.cornerHeight+"px";
this.br.style.width=this.cornerWidth+"px";
this.br.style.height=C+"px";
this.div.appendChild(this.br);
this.bbl=__d.ce("img");
ask.util.Image.SetPng(this.bbl,ask.local.UI.Defaults.SP+"textbl.png");
this.bbl.style.position="absolute";
this.bbl.style.left=this.handleWidth+"px";
this.bbl.style.top=(this.cornerHeight+C)+"px";
this.bbl.style.width=this.cornerWidth+"px";
this.bbl.style.height=this.cornerHeight+"px";
this.div.appendChild(this.bbl);
this.bb=__d.ce("img");
ask.util.Image.SetPng(this.bb,ask.local.UI.Defaults.SP+"textb.png");
this.bb.style.position="absolute";
this.bb.style.left=(this.handleWidth+this.cornerWidth)+"px";
this.bb.style.top=(this.cornerHeight+C)+"px";
this.bb.style.width=B+"px";
this.bb.style.height=this.cornerHeight+"px";
this.div.appendChild(this.bb);
this.bbr=__d.ce("img");
ask.util.Image.SetPng(this.bbr,ask.local.UI.Defaults.SP+"textbr.png");
this.bbr.style.position="absolute";
this.bbr.style.left=(this.handleWidth+this.cornerWidth+B)+"px";
this.bbr.style.top=(this.cornerHeight+C)+"px";
this.bbr.style.width=this.cornerWidth+"px";
this.bbr.style.height=this.cornerHeight+"px";
this.div.appendChild(this.bbr);
this.handleDiv=__d.ce("div");
this.handleDiv.style.position="absolute";
this.handleDiv.style.left="0px";
this.handleDiv.style.top=this.cornerHeight+"px";
this.handleDiv.style.width=this.handleWidth+"px";
this.handleDiv.style.height=this.handleHeight+"px";
this.handleDiv.style.cursor=ask.util.Browser.handCursor;
this.div.appendChild(this.handleDiv);
ask.util.Events.addListener(this.handleDiv,"mousedown",this.startDrag,this,true);
ask.util.Events.addListener(this.handleImg,"mousedown",this.startDrag,this,true);
this.addTextEvents();
this.click=new ask.util.AbstractEvent("click",this);
this.rightClick=new ask.util.AbstractEvent("rightClick",this);
if(ask.local.UI){ask.local.UI.hookupMarkerEvents(this);
}ask.local.Canvas.drawings.push(this);
};
ask.local.Text.prototype={position:function(){try{var E=(ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom));
var D=(ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom));
var B=D>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var A=E>=0?this.parentMap.topShift:-(this.parentMap.topShift);
D=D-B;
E=E-A;
this.div.style.top=E-parseFloat(this.handleDiv.style.top)-parseFloat(this.handleDiv.style.height)/2+"px";
this.div.style.left=D+"px";
}catch(C){}},appendTo:function(A){if(A){A.appendChild(this.div);
}},addTextEvents:function(){var A=this;
this.textarea.onkeyup=function(){A.update();
};
this.textarea.onmousedown=function(B){B=ask.util.Events.getEvent(B);
if(B.button!=2){ask.util.Events.stopPropagation(B);
}};
this.textarea.onselectstart=function(B){ask.util.Events.stopPropagation(B);
};
this.textarea.ondblclick=function(B){ask.util.Events.stopPropagation(B);
};
this.textarea.onmousemove=function(B){ask.util.Events.stopPropagation(B);
};
this.textarea.onfocus=function(){A.activate();
};
this.textarea.onblur=function(){A.deactivate();
};
this.btr.onclick=function(){A.parentMap.removeOverlay(A);
};
},removeTextEvents:function(){this.textarea.onkeyup=null;
this.textarea.onfocus=null;
this.textarea.onblur=null;
this.textarea.onmousedown=null;
this.textarea.onselectstart=null;
this.textarea.ondblclick=null;
this.textarea.onmousemove=null;
this.textarea.onfocus=null;
this.textarea.onblur=null;
this.btr.onclick=null;
},startDrag:function(E){this.blur();
ask.local.Keys.typing=false;
E=ask.util.Events.getEvent(E);
if(E.button==2){return false;
}this.dragStartX=E.clientX+__d.body.scrollLeft-this.parentMap.viewDiv.offsetLeft;
this.dragStartY=E.clientY+__d.body.scrollTop-this.parentMap.viewDiv.offsetTop;
var D=(ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom));
var C=(ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom));
var B=C>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var A=D>=0?this.parentMap.topShift:-(this.parentMap.topShift);
C-=B;
D-=A;
this.dragStartTop=D;
this.dragStartLeft=C;
this.dragging=true;
var F=this;
__d.documentElement.onmousemove=function(G){return F.drag(G);
};
__d.documentElement.onmouseup=function(G){return F.endDrag(G);
};
this.removeTextEvents();
this.div.style.zIndex=201;
ask.util.Events.stopPropagation(E);
return false;
},drag:function(E){E=ask.util.Events.getEvent(E);
if(!this.dragging){return false;
}var B=E.clientX+__d.body.scrollLeft-this.parentMap.viewDiv.offsetLeft;
var A=E.clientY+__d.body.scrollTop-this.parentMap.viewDiv.offsetTop;
var D=A-this.dragStartY+this.dragStartTop;
var C=B-this.dragStartX+this.dragStartLeft;
this.div.style.top=D-parseFloat(this.handleDiv.style.top)-parseFloat(this.handleDiv.style.height)/2+"px";
this.div.style.left=C+"px";
ask.util.Events.stopPropagation(E);
return false;
},endDrag:function(G){__d.documentElement.onmousemove=null;
__d.documentElement.onmouseup=null;
this.addTextEvents();
this.div.style.zIndex=200;
this.dragging=false;
G=ask.util.Events.getEvent(G);
var D=G.clientX+__d.body.scrollLeft-this.parentMap.viewDiv.offsetLeft;
var C=G.clientY+__d.body.scrollTop-this.parentMap.viewDiv.offsetTop;
if(this.dragStartX==D&&this.dragStartY==C){return false;
}var F=C-this.dragStartY+this.dragStartTop;
var E=D-this.dragStartX+this.dragStartLeft;
var B=E>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var A=F>=0?this.parentMap.topShift:-(this.parentMap.topShift);
E+=B;
F+=A;
this.point=new ask.local.Point(ask.util.GeoMath.pix2lat(F,this.parentMap.zoom),ask.util.GeoMath.pix2long(E,this.parentMap.zoom));
this.position();
return false;
},select:function(){this.textarea.select();
},focus:function(){this.textarea.focus();
this.activate();
},blur:function(){this.textarea.blur();
this.deactivate();
},activate:function(){ask.local.Keys.typing=true;
if(this.timeoutID==-1){var A=this;
this.timeoutID=window.setTimeout(function(){A.timeout();
},1000);
}},deactivate:function(){ask.local.Keys.typing=false;
if(this.timeoutID!=-1){window.clearTimeout(this.timeoutID);
this.timeoutID=-1;
}},timeout:function(){this.update();
var A=this;
this.timeoutID=window.setTimeout(function(){A.timeout();
},1000);
},update:function(){var G=this;
var B=F(this.textarea.value);
var H=B>1?this.maxWidth:Math.max(Math.min(this.textarea.value.length*this.charWidth,this.maxWidth),this.minWidth);
var E=Math.max(Math.min(B*this.charHeight,this.maxHeight),this.minHeight);
this.textarea.style.width=H+this.hFudge+"px";
this.textarea.style.height=E+this.vFudge+"px";
var C=this.textarea.offsetWidth;
var I=this.textarea.offsetHeight;
this.bt.style.width=C+"px";
this.btr.style.left=(this.handleWidth+this.cornerWidth+C)+"px";
this.bl.style.height=I+"px";
this.bc.style.width=C+"px";
this.bc.style.height=I+"px";
this.br.style.left=(this.handleWidth+this.cornerWidth+C)+"px";
this.br.style.height=I+"px";
this.bbl.style.top=(this.cornerHeight+I)+"px";
this.bb.style.top=(this.cornerHeight+I)+"px";
this.bb.style.width=C+"px";
this.bbr.style.left=(this.handleWidth+this.cornerWidth+C)+"px";
this.bbr.style.top=(this.cornerHeight+I)+"px";
this.text=this.textarea.value;
function F(N){var L=0;
var M=0;
while(M<N.length){L++;
numChars=0;
while(M<N.length){if(N.charAt(M)=="\n"){L++;
numChars=0;
M++;
}var K=D(N,M);
if(numChars+K>G.maxCols){if(!numChars){M+=K;
}break;
}numChars+=K;
M+=K;
var J=A(N,M);
if(numChars+J>G.maxCols){if(ask.util.Browser.isIE||ask.util.Browser.isOpera){L++;
numChars=K+J;
M+=J;
}}numChars+=J;
M+=J;
}}return L;
}function A(K,J){var M=0;
var L;
while(J<K.length&&(L=K.charAt(J++))==" "&&L!="\n"){M++;
}return M;
}function D(K,J){var M=0;
var L;
while(J<K.length&&(L=K.charAt(J++))!=" "&&L!="\n"){M++;
}return M;
}}};
ask.local.Shape=function(B,C,A,D){this.parentMap=null;
this.points=B;
this.overlayType=ask.local.OverlayType.Shape;
this.visible=true;
this.minDisplayZoom=ask.local.ZoomLevel.Min;
this.maxDisplayZoom=ask.local.ZoomLevel.Max;
this.lineColor=C;
this.lineWidth=A;
this.fillColor=D;
this.bounds=new ask.local.Bounds();
this.div=__d.ce("img");
this.div.style.zIndex=300;
this.div.style.position="absolute";
this.div.src=ask.local.Defaults.SP+"transparent.gif";
this.click=new ask.util.AbstractEvent("click",this);
this.removed=new ask.util.AbstractEvent("removed",this);
};
ask.local.Shape.prototype={position:function(){},appendTo:function(B){if(B){B.appendChild(this.div);
}var A=this.parentMap.canvas.context;
if(A){this.lineColor=this.lineColor?this.lineColor:A.strokeStyle.replace(/rgb\(/,"rgba(");
this.lineWidth=this.lineWidth?this.lineWidth:A.lineWidth;
this.fillColor=this.fillColor?this.fillColor:A.fillStyle.replace(/rgb\(/,"rgba(");
}if(!this.shapeId){this.shapeId=this.parentMap.getShapeId();
}},getBounds:function(){return this.bounds;
},setStyle:function(){if(this.parentMap){this.lineColor=this.lineColor?this.lineColor:this.parentMap.canvas.context.strokeStyle.replace(/rgb\(/,"rgba(");
this.lineWidth=this.lineWidth?this.lineWidth:this.parentMap.canvas.context.lineWidth;
}},createHandle:function(){this.div.src=ask.local.Defaults.LocalSP+"magglass.gif";
this.div.width=13;
this.div.height=13;
this.div.style.cursor=ask.util.Browser.handCursor;
var A=this;
this.div.onclick=function(B){B=ask.util.Events.getEvent(B);
ask.util.Events.stopPropagation(B);
A.click.fire(B);
};
this.div.onmouseover=function(B){A.highlight();
};
this.div.onmouseout=function(B){if(ask.local.UI&&ask.local.UI.map.pulldownMenu.owner!=A){A.unhighlight();
}};
this.div.onmousedown=ask.util.Events.stopPropagation;
this.div.onmouseup=ask.util.Events.stopPropagation;
},openPulldownMenu:function(B){if(ask.local.UI){var D=ask.local.UI.map.pulldownMenu;
D.open(this.getHandlePoint(),B);
D.setOwner(this);
var C=D.div.getElementsByTagName("input");
for(var A=0;
A<C.length;
A++){if(C[A].type=="text"){C[A].focus();
break;
}}if(ask.local.UI.canvasControl){ask.local.UI.canvasControl.setTool(ask.local.UI.canvasControl.mapTool);
}ask.local.Keys.typing=true;
}},closePulldownMenu:function(A){if(ask.local.UI){var B=ask.local.UI.map.pulldownMenu;
B.close();
B.setOwner(null);
if(!A){this.unhighlight();
}ask.local.Keys.typing=false;
}},handlePulldownMenu:function(A){if(ask.local.UI){var B=ask.local.UI.map.pulldownMenu;
if(B.owner!=this){if(B.owner){B.owner.closePulldownMenu(false);
}this.openPulldownMenu(A);
}else{this.closePulldownMenu(true);
}}},highlight:function(){this.highlighted=true;
this.parentMap.drawOverlays();
},unhighlight:function(){this.highlighted=false;
this.parentMap.drawOverlays();
},getHighlightColor:function(A){var C=A.slice(5,-1).split(",");
if(C[0]==0&&C[1]==0&&C[2]==0){C[0]=C[1]=C[2]=128;
}else{for(var B=0;
B<3;
B++){C[B]=Math.round(parseInt(C[B])*0.5);
}}A="rgba("+C.join(",")+")";
return A;
},getLinearMeasureDisplayString:function(B){var A=B*0.621371192;
return A<1?this.approximateMeasure(A*5280)+" feet":this.approximateMeasure(A)+" miles";
},getSquareMeasureDisplayString:function(A){var B=A*0.386102159;
return(B<1?B*640<1?this.approximateMeasure(B*27878400)+" square feet":this.approximateMeasure(B*640)+" acres":this.approximateMeasure(B)+" square miles");
},approximateMeasure:function(B){var A;
if(B<10){A=ask.util.Math.Round(B,1);
}else{if(B<100){A=Math.round(B);
}else{if(B<1000){A=(Math.round(B/10)*10);
}else{A=(Math.round(B/100)*100);
}}}return A;
}};
ask.local.Rectangle=function(D,F,A,G,E){var B=[];
if(D){if(D.minLat&&D.maxLat&&D.minLong&&D.maxLong){B.push(new ask.local.Point(D.maxLat,D.minLong));
B.push(new ask.local.Point(D.maxLat,D.maxLong));
B.push(new ask.local.Point(D.minLat,D.maxLong));
B.push(new ask.local.Point(D.minLat,D.minLong));
B.push(new ask.local.Point(D.maxLat,D.minLong));
}}var C=new ask.local.Shape(B,F,A,G);
C.shape=ask.local.Shapes.Rectangle;
C.bounds=D;
if(E){C.createHandle();
}C.position=function(){if(this.parentMap.canvas){this.setStyle();
var R=this.parentMap.getBounds();
var P=this.parentMap.zoom;
var N=new Object();
var L=ask.util.GeoMath.long2pix(this.bounds.minLong,P);
var Q=ask.util.GeoMath.lat2pix(this.bounds.maxLat,P);
N.x=L-R.minX;
N.y=Q-R.minY;
var S=new Object();
S.x=ask.util.GeoMath.long2pix(this.bounds.maxLong,P)-R.minX;
S.y=ask.util.GeoMath.lat2pix(this.bounds.minLat,P)-R.minY;
var J=this.parentMap.canvas.context;
var O=J.lineWidth;
var M=J.strokeStyle.replace(/rgb\(/,"rgba(");
var K=J.fillStyle.replace(/rgb\(/,"rgba(");
J.lineWidth=this.lineWidth;
J.strokeStyle=this.highlighted?this.getHighlightColor(this.lineColor):this.lineColor;
J.beginPath();
J.strokeRect(N.x,N.y,S.x-N.x,S.y-N.y);
if(this.fillColor){J.fillStyle=this.fillColor;
J.fillRect(N.x+this.lineWidth/2,N.y+this.lineWidth/2,S.x-N.x-this.lineWidth,S.y-N.y-this.lineWidth);
}J.closePath();
J.lineWidth=O;
J.strokeStyle=M;
J.fillStyle=K;
if(this.div&&this.div.src){var I=this.getHandlePoint();
var H=this.lineWidth?this.lineWidth:0;
this.div.style.left=ask.util.GeoMath.long2pix(I.lng,P)-H+"px";
this.div.style.top=ask.util.GeoMath.lat2pix(I.lat,P)-H+"px";
}}else{printfire("The addCanvas(canvasDOMElement) method must be called before drawing this shape.",ask.util.MsgType.Exception);
}};
C.getHandlePoint=function(){return new ask.local.Point(this.bounds.maxLat,this.bounds.minLong);
};
C.getPerimeter=function(){var I=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.maxLat,this.bounds.minLong);
var H=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.minLat,this.bounds.maxLong);
return this.getLinearMeasureDisplayString((I+H)*2);
};
C.getArea=function(){var I=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.maxLat,this.bounds.minLong);
var H=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.minLat,this.bounds.maxLong);
return this.getSquareMeasureDisplayString(I*H);
};
return C;
};
ask.local.Circle=function(E,I,F,D,G){var B;
var J=[];
var C=new ask.local.Shape(J,I,F,D);
C.shape=ask.local.Shapes.Circle;
if(E){if(E.center&&E.radius){var H=E.center;
var A=E.radius;
B=new ask.local.Bounds(H.lat-A,H.lng-A,H.lat+A,H.lng+A);
C.center=H;
C.radius=A;
J.push(H);
}else{B=E;
if(B.minLat&&B.maxLat&&B.minLong&&B.maxLong){J.push(new ask.local.Point(B.maxLat,B.minLong));
J.push(new ask.local.Point(B.maxLat,B.maxLong));
J.push(new ask.local.Point(B.minLat,B.maxLong));
J.push(new ask.local.Point(B.minLat,B.minLong));
J.push(new ask.local.Point(B.maxLat,B.minLong));
}}}C.points=J;
C.bounds=B;
if(G){C.createHandle();
}C.position=function(){if(this.parentMap.canvas){this.setStyle();
var X=this.parentMap.getBounds();
var V=this.parentMap.zoom;
var T=new Object();
var P=ask.util.GeoMath.long2pix(this.bounds.minLong,V);
var W=ask.util.GeoMath.lat2pix(this.bounds.maxLat,V);
T.x=P-X.minX;
T.y=W-X.minY;
var Y=new Object();
var Z=ask.util.GeoMath.long2pix(this.bounds.maxLong,V);
var K=ask.util.GeoMath.lat2pix(this.bounds.minLat,V);
Y.x=Z-X.minX;
Y.y=K-X.minY;
var N=this.parentMap.canvas.context;
var U=N.lineWidth;
var S=N.strokeStyle.replace(/rgb\(/,"rgba(");
var O=N.fillStyle.replace(/rgb\(/,"rgba(");
N.lineWidth=this.lineWidth;
N.strokeStyle=this.highlighted?this.getHighlightColor(this.lineColor):this.lineColor;
N.beginPath();
var R=Math.max(T.x,Y.x)-Math.abs(T.x-Y.x)/2;
var Q=Math.max(T.y,Y.y)-Math.abs(T.y-Y.y)/2;
T.y=Y.y=Q;
if(ask.util.Browser.isOpera){N.moveTo(T.x,T.y);
}N.arc(R,Q,ask.util.GeoMath.getPxDistance(T,Y)/2,0,Math.PI*2,true);
N.stroke();
N.closePath();
if(this.fillColor){N.beginPath();
if(ask.util.Browser.isOpera){N.moveTo(T.x,T.y);
}N.arc(R,Q,ask.util.GeoMath.getPxDistance(T,Y)/2-this.lineWidth/2,0,Math.PI*2,true);
N.fillStyle=this.fillColor;
N.fill();
N.closePath();
}N.lineWidth=U;
N.strokeStyle=S;
N.fillStyle=O;
if(this.div&&this.div.src){var M=this.getHandlePoint();
var L=this.lineWidth?this.lineWidth:0;
this.div.style.left=ask.util.GeoMath.long2pix(M.lng,V)-L+"px";
this.div.style.top=ask.util.GeoMath.lat2pix(M.lat,V)-L+"px";
}}else{printfire("The addCanvas(canvasDOMElement) method must be called before drawing this shape.",ask.util.MsgType.Exception);
}};
C.getHandlePoint=function(){return new ask.local.Point(this.bounds.maxLat,(this.bounds.minLong+this.bounds.maxLong)/2);
};
C.getPerimeter=function(){var K=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.minLat,this.bounds.maxLong)/2;
return this.getLinearMeasureDisplayString(2*Math.PI*K);
};
C.getArea=function(){var K=ask.util.GeoMath.calculateDistance(this.bounds.minLat,this.bounds.minLong,this.bounds.minLat,this.bounds.maxLong)/2;
return this.getSquareMeasureDisplayString(Math.PI*K*K);
};
return C;
};
ask.local.Polyline=function(C,E,A,F,D){var B=new ask.local.Shape(C,E,A,F);
B.shape=ask.local.Shapes.Polyline;
if(D){B.createHandle();
}B.position=function(){if(this.parentMap.canvas){this.setStyle();
var N=this.parentMap.getBounds();
var I,Y,c,O;
var d=[];
var G=[];
var P=this.parentMap.zoom;
this.drawPoints=[];
var J=this.parentMap.canvas.context;
if(this.points&&this.points.length>0&&J){I=Y=this.points[0].lat;
c=O=this.points[0].lng;
var T=0;
var S=0;
var W,V;
for(var a=0;
a<this.points.length;
a++){var Z=this.points[a];
if(typeof (Z)=="object"&&Z.lat==undefined){if(Z.length&&Z.length==2){var L=Z[0];
var f=Z[1];
Z=new ask.local.Point(L,f);
this.points[a]=Z;
}}var R=parseFloat(ask.util.GeoMath.long2pix(Z.lng,P)-N.minX);
var Q=parseFloat(ask.util.GeoMath.lat2pix(Z.lat,P)-N.minY);
if(this.points.length>10&&a>0&&a<this.points.length-1){T+=Math.abs(R-W);
S+=Math.abs(Q-V);
if(T>3||S>3){d.push(R);
G.push(Q);
T=0;
S=0;
this.drawPoints.push(Z);
}}else{d.push(R);
G.push(Q);
this.drawPoints.push(Z);
}W=R;
V=Q;
I=I<Z.lat?I:Z.lat;
c=c<Z.lng?c:Z.lng;
Y=Y>Z.lat?Y:Z.lat;
O=O>Z.lng?O:Z.lng;
}this.bounds=new ask.local.Bounds(I,c,Y,O);
var P=this.parentMap.zoom;
this.bounds.minY=ask.util.GeoMath.lat2pix(I,P);
this.bounds.minX=ask.util.GeoMath.long2pix(c,P);
this.bounds.maxY=ask.util.GeoMath.lat2pix(Y,P);
this.bounds.maxX=ask.util.GeoMath.long2pix(O,P);
}var K=d[0];
var H=G[0];
var b=J.lineWidth;
var X=J.strokeStyle.replace(/rgb\(/,"rgba(");
var M=J.fillStyle.replace(/rgb\(/,"rgba(");
J.lineWidth=this.lineWidth;
J.strokeStyle=this.highlighted?this.getHighlightColor(this.lineColor):this.lineColor;
J.beginPath();
J.moveTo(K,H);
if(this.shape!=ask.local.Shapes.Polyline&&this.fillColor){J.fillStyle=this.fillColor;
if(this.fillColor){for(a=1;
a<d.length;
a++){J.lineTo(d[a],G[a]);
}J.fill();
}}J.moveTo(K,H);
for(a=1;
a<d.length;
a++){J.lineTo(d[a],G[a]);
}J.stroke();
J.lineWidth=b;
J.strokeStyle=X;
J.fillStyle=M;
if(this.div&&this.div.src){var U=this.getHandlePoint();
var e=this.lineWidth?this.lineWidth:0;
this.div.style.left=(ask.util.GeoMath.long2pix(U.lng,P)-e)+"px";
this.div.style.top=(ask.util.GeoMath.lat2pix(U.lat,P)-e)+"px";
}}else{printfire("The addCanvas() method must be called before drawing this shape.",ask.util.MsgType.Exception);
}};
B.getHandlePoint=function(){return this.points&&this.points.length?this.points[0]:new ask.local.Point(0,0);
};
B.getLength=function(){var H=0;
for(var G=1;
G<this.points.length;
G++){if(!ask.util.General.equal(this.points[G],this.points[G-1])){H+=ask.util.GeoMath.calculateDistance(this.points[G].lat,this.points[G].lng,this.points[G-1].lat,this.points[G-1].lng);
}}return this.getLinearMeasureDisplayString(H);
};
return B;
};
ask.local.Polygon=function(C,F,A,G,E){if(C){var D=C[0];
if(C.length>1){C.push(D);
}}var B=new ask.local.Polyline(C,F,A,G,E);
B.shape=ask.local.Shapes.Polygon;
B.isSimple=function(){var H=[];
var J=null;
for(var I=0;
I<this.points.length-1;
I++){var K={x:this.points[I].lat,y:this.points[I].lng};
if(!J||!ask.util.General.equal(K,J)){H.push(K);
}J=K;
}return ask.util.Geometry.isSimplePoly(H);
};
B.getPerimeter=function(){var H=0;
for(var I=1;
I<this.points.length;
I++){if(!ask.util.General.equal(this.points[I],this.points[I-1])){H+=ask.util.GeoMath.calculateDistance(this.points[I].lat,this.points[I].lng,this.points[I-1].lat,this.points[I-1].lng);
}}return this.getLinearMeasureDisplayString(H);
};
B.getArea=function(){var I=[{x:0,y:0}];
for(var J=1;
J<this.points.length-1;
J++){if(!ask.util.General.equal(this.points[J],this.points[J-1])){var H=this.points[0].lng!=this.points[J].lng?ask.util.GeoMath.calculateDistance(this.points[0].lat,this.points[0].lng,this.points[0].lat,this.points[J].lng)*ask.util.Geometry.sgn(this.points[J].lng-this.points[0].lng):0;
var K=this.points[0].lat!=this.points[J].lat?ask.util.GeoMath.calculateDistance(this.points[0].lat,this.points[0].lng,this.points[J].lat,this.points[0].lng)*ask.util.Geometry.sgn(this.points[J].lat-this.points[0].lat):0;
I.push({x:H,y:K});
}}return this.getSquareMeasureDisplayString(ask.util.Geometry.polyArea(I));
};
return B;
};
ask.local.Shapes=new function(){this.Line=0;
this.Polyline=1;
this.Polygon=2;
this.Rectangle=3;
this.Circle=4;
};
ask.local.InfoWindow=function(){this.parentMap=null;
this.owner=null;
var A=this;
this.enableAutoFit=true;
this.point=new ask.local.Point(0,0);
this.visible=false;
this.div=__d.ce("div");
this.div.style.display="none";
this.markerOffsetTop=0;
this.reason=null;
this.closeButton=ask.util.Image.MakePng(ask.local.Defaults.LocalSP+"close.gif",203,7,301);
ask.util.Events.addListener(this.closeButton,"mousedown",function(B){A.setVisible(false);
ask.util.Events.cancel(B);
});
this.closeButton.title="Close";
this.closeButton.style.cursor=ask.util.Browser.handCursor;
this.div.appendChild(this.closeButton);
ask.util.Events.addListener(this.div,"click",this.onClick,this);
ask.util.Events.addListener(this.div,"contextmenu",ask.util.Events.cancel);
this.textdiv=__d.ce("div");
this.textdiv.style.position="absolute";
this.textdiv.className="infoWin";
this.textdiv.style.cursor="text";
this.textdiv.style.zIndex=200;
this.textdiv.onmousedown=ask.util.Events.stopPropagation;
this.textdiv.onclick=ask.util.Events.stopPropagation;
this.textdiv.ondblclick=ask.util.Events.stopPropagation;
this.textdiv.onkeyup=ask.util.Events.stopPropagation;
this.div.style.position="absolute";
this.div.style.left="100px";
this.div.style.top="100px";
this.div.style.zIndex=301;
this.div.appendChild(this.textdiv);
this.imgDiv=__d.ce("div");
this.div.appendChild(this.imgDiv);
this.closed=new ask.util.AbstractEvent("click",this);
this.ownerChange=new ask.util.AbstractEvent("click",this);
this.repositioned=new ask.util.AbstractEvent("click",this);
};
ask.local.InfoWindow.prototype={x:function(){return ask.util.GeoMath.long2pix(this.point.lng,this.parentMap.zoom);
},y:function(){return ask.util.GeoMath.lat2pix(this.point.lat,this.parentMap.zoom);
},open:function(A,B,C,D,E){this.point=A;
if(B){this.setHtml(B);
}this.setPosition(this.point,C,D);
this.reason=E;
this.setVisible(true);
},close:function(A){if(!A||this.reason==A){this.setVisible(false);
}},position:function(){if(this.parentMap){if(this.div.style.display!="none"){this.repositioned.fire();
}var B=this.realImg&&this.realImg.height?this.realImg.height:this.hints&&this.hints.imgHeight?this.hints.imgHeight:0;
var H=this.hints&&this.hints.vSlices?this.hints.vSlices:[Math.round(B/3),Math.round(B*2/3)];
var E=H[0]+B-H[1];
var A=Math.max(this.height||B,E);
var G=this.x()+this.balloonImgOffsetLeft;
var F=this.y()-(A+this.markerOffsetTop)+this.balloonImgOffsetTop;
var D=G>=0?this.parentMap.leftShift:-(this.parentMap.leftShift);
var C=F>=0?this.parentMap.topShift:-(this.parentMap.topShift);
G=G-D;
F=F-C;
if(!(isNaN(G)||isNaN(F))){this.div.style.left=G+"px";
this.div.style.top=F+"px";
}}},appendTo:function(A){if(A){A.appendChild(this.div);
}},appendToMap:function(A){if(A){A.mapDiv.appendChild(this.div);
this.parentMap=A;
}},setHtml:function(A){ask.util.Dom.removeAllChildNodes(this.textdiv);
if(typeof (A)=="object"){this.textdiv.appendChild(A);
}else{if(typeof (A)=="string"){this.textdiv.innerHTML=A;
}}},setImage:function(){var K,H,D,I,G,C,E,B,J,A;
if(typeof arguments[0]=="object"){K=arguments[0].imgUrl;
H=arguments[0].txtTop;
D=arguments[0].txtLeft;
I=arguments[0].txtWidth;
G=arguments[0].txtHeight;
C=arguments[0].offsetTop;
E=arguments[0].offsetLeft;
B=arguments[0].width;
J=arguments[0].height;
A=arguments[0].hints;
}else{K=arguments[0];
H=arguments[1];
D=arguments[2];
I=arguments[3];
G=arguments[4];
C=arguments[5];
E=arguments[6];
}if(ask.util.General.equal([K,H,D,I,G,C,E,B,J,A],[this.imgUrl,this.txtTop,this.txtLeft,this.txtWidth,this.txtHeight,this.offsetTop,this.offsetLeft,this.width,this.height,this.hints])){return ;
}this.imgUrl=K;
this.txtTop=H;
this.txtLeft=D;
this.txtWidth=I;
this.txtHeight=G;
this.offsetTop=C;
this.offsetLeft=E;
this.width=B;
this.height=J;
this.hints=A;
this.realImg=__d.ce("img");
var F=this;
this.realImg.onload=function(){var L=F.div.style.display!="none";
if(L){F.div.style.display="none";
}F.configure();
if(L){F.position();
F.setVisible(true);
}};
this.realImg.src=this.imgUrl;
this.balloonImgOffsetLeft=this.offsetLeft||0;
this.balloonImgOffsetTop=this.offsetTop||0;
this.textdiv.style.left=this.txtLeft+"px";
this.textdiv.style.top=this.txtTop+"px";
this.textdiv.style.width=this.txtWidth+"px";
this.textdiv.style.height=this.txtHeight+"px";
this.closeButton.style.left=(this.txtLeft+this.txtWidth)+"px";
this.closeButton.style.top=this.txtTop+"px";
},makeRectangular:function(D,C,B,A){this.balloonImgOffsetLeft=0;
this.balloonImgOffsetTop=0;
this.textdiv.style.left=D+"px";
this.textdiv.style.top=C+"px";
this.textdiv.style.width=B+"px";
this.textdiv.style.height=A+"px";
this.textdiv.style.backgroundColor="white";
this.textdiv.style.border="1px solid black";
ask.util.Dom.removeAllChildNodes(this.imgDiv);
},configure:function(){var K=this.realImg.width?this.realImg.width:this.hints&&this.hints.imgWidth?this.hints.imgWidth:0;
var L=this.realImg.height?this.realImg.height:this.hints&&this.hints.imgHeight?this.hints.imgHeight:0;
var B=this.width?this.width:K;
var O=this.height?this.height:L;
ask.util.Dom.removeAllChildNodes(this.imgDiv);
if(!K||!L||!B||!O||B==K&&O==L){var G=__d.ce("img");
G=ask.util.Image.SetPng(G,this.realImg.src);
this.imgDiv.appendChild(G);
}else{var H=this.hints&&this.hints.hSlices?this.hints.hSlices:[Math.round(K/3),Math.round(K*2/3)];
var P=this.hints&&this.hints.vSlices?this.hints.vSlices:[Math.round(L/3),Math.round(L*2/3)];
var I=[H[0]];
var E=H[0];
while(E<B-(K-H[1])){var N=Math.min(H[1]-H[0],B-(K-H[1])-E);
I.push(N);
E+=N;
}I.push(H[1]-H[0]);
var M=[P[0]];
var E=P[0];
while(E<O-(L-P[1])){var N=Math.min(P[1]-P[0],O-(L-P[1])-E);
M.push(N);
E+=N;
}M.push(P[1]-P[0]);
var J=0;
for(var F=0;
F<M.length;
F++){var C=0;
for(var D=0;
D<I.length;
D++){var A=document.createElement("div");
A.style.position="absolute";
A.style.left=C+"px";
A.style.top=J+"px";
A.style.width=I[D]+"px";
A.style.height=M[F]+"px";
A.style.overflow="hidden";
var G=document.createElement("img");
G=ask.util.Image.SetPng(G,this.realImg.src);
G.style.position="absolute";
G.style.left=-(D==0?0:D==I.length-1?H[1]:H[0])+"px";
G.style.top=-(F==0?0:F==M.length-1?P[1]:P[0])+"px";
A.appendChild(G);
this.imgDiv.appendChild(A);
C+=I[D];
}J+=M[F];
}}},setCloseImage:function(A){this.closeButton=ask.util.Image.SetPng(this.closeButton,A);
},setVisible:function(H){var A=this.parentMap.centerX;
var M=this.parentMap.centerY;
if(H){if(this.enableAutoFit&&!((ask.util.Browser.isOpera)&&(this.parentMap.leftShift>0||this.parentMap.rightShift>0))){var I=parseFloat(this.div.style.left);
var G=parseFloat(this.div.style.top);
var B,J,E,C;
if(this.width&&this.height){B=this.width;
J=this.height;
E=0;
C=10;
}else{if(this.realImg){B=this.realImg.width;
J=this.realImg.height;
E=0;
C=10;
}else{B=parseFloat(this.textdiv.style.width);
J=parseFloat(this.textdiv.style.height);
E=10;
C=20;
}}var D=ask.util.Geometry.squeeze({left:0,top:0,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},this.parentMap.controlBoundingBoxes);
var F=this.parentMap.getBounds();
var L=(I+B)-(F.minX+D.right);
if(L>0){A+=L;
}var K=(G-E)-(F.minY+D.top);
if(K<0){M+=K;
}else{K=G+J+C-F.maxY;
if(K>0){M+=K;
}}if(A!=this.parentMap.centerX||M!=this.parentMap.centerY){this.parentMap.stopScrolling();
this.parentMap.moveViewTo(A,M);
}else{if(ask.util.Browser.isIE6&&this.parentMap.zoom<=ask.local.ZoomLevel.Address){this.parentMap.moveViewTo(A+1,M+1);
}}}this.div.style.display="";
}else{this.closed.fire();
this.owner=null;
this.div.style.display="none";
if(ask.util.Browser.isIE6&&this.parentMap.zoom<=ask.local.ZoomLevel.Address){this.parentMap.moveViewTo(A+1,M+1);
}}this.visible=H;
},setPosition:function(A,B,C){this.point=A;
this.markerOffsetTop=B?parseInt(B):0;
this.markerOffsetLeft=C?parseInt(C):0;
this.position();
},setOwner:function(A){if(this.owner!=A){this.ownerChange.fire();
}var B=this;
this.owner=A;
if(A){A.removed.subscribe(function(D,C,E){if(B.owner==E){B.close();
}},A);
}},onClick:function(F,C){F=ask.util.Events.getEvent(F);
var H=C.parentMap.getMousePos(F);
var B=C.parentMap.dragStartCenterX+H.x-C.parentMap.halfViewWidth;
var I=C.parentMap.dragStartCenterY+H.y-C.parentMap.halfViewHeight;
var G=new ask.local.Point(ask.util.GeoMath.pix2lat(I,C.parentMap.zoom),ask.util.GeoMath.pix2long(B,C.parentMap.zoom));
for(var E=0;
E<C.parentMap.overlays.length;
E++){var D=C.parentMap.overlays[E];
if(D&&D.overlayType==ask.local.OverlayType.Marker&&D.div.style.display!="none"){var A=D.getIconBounds();
if(A&&A.containsPoint(G)){ask.util.Events.stopPropagation(F);
D.click.fire(F);
break;
}}}}};
ask.local.Keys=new function(){this.KE_SP_BAR=32;
this.KE_RT_UP=33;
this.KE_RT_DN=34;
this.KE_LF_DN=35;
this.KE_LF_UP=36;
this.KE_LF=37;
this.KE_UP=38;
this.KE_RT=39;
this.KE_DN=40;
this.KE_MINUS=189;
this.KE_PLUS=187;
this.KE_MINUS2=109;
this.KE_PLUS2=107;
this.KE_PLUS2ff=61;
this.KE_ZERO=48;
this.KE_ONE=49;
this.KE_NINE=57;
this.KE_ONE_PAD=97;
this.KE_NINE_PAD=105;
this.KE_C=67;
this.KE_P=80;
this.KE_DF_DELTA=15;
this.KE_DF_INTVL=20;
this.KE_CLR=0;
this.ke_bks=new Array();
this.ke_bks[this.KE_LF]=1;
this.ke_bks[this.KE_UP]=1<<1;
this.ke_bks[this.KE_RT]=1<<2;
this.ke_bks[this.KE_DN]=1<<3;
this.ke_bks[this.KE_LF_UP]=this.ke_bks[this.KE_LF]|this.ke_bks[this.KE_UP];
this.ke_bks[this.KE_LF_DN]=this.ke_bks[this.KE_LF]|this.ke_bks[this.KE_DN];
this.ke_bks[this.KE_RT_UP]=this.ke_bks[this.KE_RT]|this.ke_bks[this.KE_UP];
this.ke_bks[this.KE_RT_DN]=this.ke_bks[this.KE_RT]|this.ke_bks[this.KE_DN];
this.ke_sc_tmr=null;
this.ke_mask=this.KE_CLR;
this.ke_hits=0;
this.parentMap=null;
this.isOverMap=true;
this.typing=false;
this.keyPress=new ask.util.AbstractEvent("keyPress",this);
this.enable=function(){ask.util.Events.addListener(__d.documentElement,"keydown",function(A){return ask.local.Keys.keyDown(A);
});
ask.util.Events.addListener(__d.documentElement,"keyup",function(A){return ask.local.Keys.keyUp(A);
});
};
this.keyDown=function(D){if(this.isOverMap&&!this.typing){D=ask.util.Events.getEvent(D);
var C=D.keyCode;
var E=D["ctrlKey"];
var B=D["shiftKey"];
this.keyPress.fire(D,C,E,B);
if(C>=this.KE_RT_UP&&C<=this.KE_DN&&!E){ask.util.Events.cancel(D);
this.ke_hits++;
var A=(this.ke_hits%5==0)&&((this.ke_hits/5)<5);
if((this.ke_mask&this.ke_bks[C])==0||A){this.ke_mask=this.ke_mask|this.ke_bks[C];
this.updateMap();
}return false;
}else{if(this.ke_mask==this.KE_CLR){if(C==this.KE_PLUS||C==this.KE_PLUS2||C==this.KE_PLUS2ff||C==this.KE_UP&&E){this.parentMap.zoomIn();
ask.util.Events.cancel(D);
return false;
}else{if(C==this.KE_MINUS||C==this.KE_MINUS2||C==this.KE_DN&&E){this.parentMap.zoomOut();
ask.util.Events.cancel(D);
return false;
}else{if(!ask.util.Browser.isIE&&E&&C==this.KE_P){if(this.parentMap.enableTruePrint){this.parentMap.setPrintImage();
}}}}}}}else{return true;
}};
this.keyUp=function(B){if(!B){B=window.event;
}var A=B.keyCode;
if(A<this.KE_RT_UP||A>this.KE_DN){return false;
}clearInterval(this.ke_sc_tmr);
this.ke_mask=this.ke_mask&~(this.ke_bks[B.keyCode]);
this.ke_hits=0;
this.updateMap();
return false;
};
this.updateMap=function(){if(this.ke_mask!=this.KE_CLR){var B=0;
var A=0;
var D=this.ke_hits%5==0?this.KE_DF_DELTA+2.5*(this.ke_hits/5):this.KE_DF_DELTA;
if((this.ke_mask&this.ke_bks[this.KE_LF])>0){B-=D;
}if((this.ke_mask&this.ke_bks[this.KE_UP])>0){A-=D;
}if((this.ke_mask&this.ke_bks[this.KE_RT])>0){B+=D;
}if((this.ke_mask&this.ke_bks[this.KE_DN])>0){A+=D;
}clearInterval(this.ke_sc_tmr);
var C=this;
if(C.parentMap){this.parentMap.scrolling=true;
this.ke_sc_tmr=setInterval(function(){C.parentMap.move(C.parentMap.centerX+B,C.parentMap.centerY+A);
},C.KE_DF_INTVL);
}}else{if(this.isOverMap){if(this.parentMap){this.parentMap.scrolling=false;
this.parentMap.moveView();
this.parentMap.drawOverlays();
}}}};
};
if(navigator.userAgent.toLowerCase().indexOf("msie")!=-1){if(!window.CanvasRenderingContext2D){(function(){var H={init:function(O){var P=O||document;
if(/MSIE/.test(navigator.userAgent)&&!window.opera){var N=this;
ask.util.Events.addListener(P,"readystatechange",function(Q){N.init_(P);
});
}},init_:function(R,Q){if(R.readyState=="complete"){if(!R.namespaces["g_vml_"]){R.namespaces.add("g_vml_","urn:schemas-microsoft-com:vml");
}var P=R.createStyleSheet();
P.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;}canvas *{behavior:url(#default#VML)}";
var O=R.getElementsByTagName("canvas");
for(var N=0;
N<O.length;
N++){if(!O[N].getContext){this.initElement(O[N]);
}}}},fixElement_:function(P){var R=P.outerHTML;
var Q=document.createElement(R);
if(R.slice(-2)!="/>"){var N="/"+P.tagName;
var O;
while((O=P.nextSibling)&&O.tagName!=N){O.removeNode();
}if(O){O.removeNode();
}}P.parentNode.replaceChild(Q,P);
return Q;
},getContext_:function(){if(this.context_){return this.context_;
}return this.context_=new J(this);
},initElement:function(O){O=this.fixElement_(O);
O.getContext=this.getContext_;
var N=O.attributes;
if(N.width&&N.width.specified){O.style.width=N.width.nodeValue+"px";
}if(N.height&&N.height.specified){O.style.height=N.height.nodeValue+"px";
}return O;
}};
H.init();
var M=[];
for(var F=0;
F<16;
F++){for(var E=0;
E<16;
E++){M[F*16+E]=F.toString(16)+E.toString(16);
}}function G(){return[[1,0,0],[0,1,0],[0,0,1]];
}function D(Q,P){var O=G();
for(var N=0;
N<3;
N++){for(var T=0;
T<3;
T++){var R=0;
for(var S=0;
S<3;
S++){R+=Q[N][S]*P[S][T];
}O[N][T]=R;
}}return O;
}function I(O,N){N.fillStyle=O.fillStyle;
N.lineCap=O.lineCap;
N.lineJoin=O.lineJoin;
N.lineWidth=O.lineWidth;
N.miterLimit=O.miterLimit;
N.shadowBlur=O.shadowBlur;
N.shadowColor=O.shadowColor;
N.shadowOffsetX=O.shadowOffsetX;
N.shadowOffsetY=O.shadowOffsetY;
N.strokeStyle=O.strokeStyle;
}function A(O){var R,Q=1;
O=String(O);
if(O.substring(0,3)=="rgb"){var T=O.indexOf("(",3);
var N=O.indexOf(")",T+1);
var S=O.substring(T+1,N).split(",");
R="#";
for(var P=0;
P<3;
P++){R+=M[parseInt(S[P])];
}if((S.length==4)&&(O.substr(3,1)=="a")){Q=S[3];
}}else{R=O;
}return[R,Q];
}function L(N){switch(N){case"butt":return"flat";
case"round":return"round";
case"square":default:return"square";
}}function J(N){this.m_=G();
this.element_=N;
this.mStack_=[];
this.aStack_=[];
this.currentPath_=[];
this.strokeStyle="#000";
this.fillStyle="#ccc";
this.lineWidth=1;
this.lineJoin="miter";
this.lineCap="butt";
this.miterLimit=10;
this.globalAlpha=1;
}var K=J.prototype;
K.clearRect=function(){this.element_.innerHTML="";
this.currentPath_=[];
};
K.beginPath=function(){this.currentPath_=[];
};
K.moveTo=function(O,N){this.currentPath_.push({type:"moveTo",x:O,y:N});
};
K.lineTo=function(O,N){this.currentPath_.push({type:"lineTo",x:O,y:N});
};
K.bezierCurveTo=function(P,N,S,R,Q,O){this.currentPath_.push({type:"bezierCurveTo",cp1x:P,cp1y:N,cp2x:S,cp2y:R,x:Q,y:O});
};
K.quadraticCurveTo=function(Q,P,O,N){this.bezierCurveTo(Q,P,Q,P,O,N);
};
K.arc=function(T,R,S,Q,O,P){if(!P){var W=Q;
Q=O;
O=W;
}var U=T+(Math.cos(Q)*S);
var X=R+Math.round(Math.sin(Q)*S);
var N=T+(Math.cos(O)*S);
var V=R+Math.round(Math.sin(O)*S);
this.currentPath_.push({type:"arc",x:T,y:R,radius:S,xStart:U,yStart:X,xEnd:N,yEnd:V});
};
K.rect=function(P,O,N,Q){this.moveTo(P,O);
this.lineTo(P+N,O);
this.lineTo(P+N,O+Q);
this.lineTo(P,O+Q);
this.closePath();
};
K.strokeRect=function(P,O,N,Q){this.beginPath();
this.moveTo(P,O);
this.lineTo(P+N,O);
this.lineTo(P+N,O+Q);
this.lineTo(P,O+Q);
this.closePath();
this.stroke();
};
K.fillRect=function(P,O,N,Q){this.beginPath();
this.moveTo(P,O);
this.lineTo(P+N,O);
this.lineTo(P+N,O+Q);
this.lineTo(P,O+Q);
this.closePath();
this.fill();
};
K.createLinearGradient=function(O,Q,N,P){var R=new C("gradient");
return R;
};
K.createRadialGradient=function(Q,S,P,O,R,N){var T=new C("gradientradial");
T.radius1_=P;
T.radius2_=N;
T.focus_.x=Q;
T.focus_.y=S;
return T;
};
K.drawImage=function(Y,O){var T,Q,U,f,X,V,a,j;
var R=Y.width;
var e=Y.height;
if(arguments.length==3){T=arguments[1];
Q=arguments[2];
X=V=0;
a=U=R;
j=f=e;
}else{if(arguments.length==5){T=arguments[1];
Q=arguments[2];
U=arguments[3];
f=arguments[4];
X=V=0;
a=R;
j=e;
}else{if(arguments.length==9){X=arguments[1];
V=arguments[2];
a=arguments[3];
j=arguments[4];
T=arguments[5];
Q=arguments[6];
U=arguments[7];
f=arguments[8];
}else{throw"Invalid number of arguments";
}}}var i=this.getCoords_(T,Q);
var P=(a/2);
var N=(j/2);
var g=[];
g.push(" <g_vml_:group",' coordsize="100,100"',' coordorigin="0, 0"',' style="width:100px;height:100px;position:absolute;');
if(this.m_[0][0]!=1||this.m_[0][1]){var S=[];
S.push("M11='",this.m_[0][0],"',","M12='",this.m_[1][0],"',","M21='",this.m_[0][1],"',","M22='",this.m_[1][1],"',","Dx='",i.x,"',","Dy='",i.y,"'");
var c=i;
var b=this.getCoords_(T+U,Q);
var Z=this.getCoords_(T,Q+f);
var W=this.getCoords_(T+U,Q+f);
c.x=Math.max(c.x,b.x,Z.x,W.x);
c.y=Math.max(c.y,b.y,Z.y,W.y);
g.push(" padding:0 ",Math.floor(c.x),"px ",Math.floor(c.y),"px 0;filter:progid:DXImageTransform.Microsoft.Matrix(",S.join(""),", sizingmethod='clip');");
}else{g.push(" top:",i.y,"px;left:",i.x,"px;");
}g.push(' ">','<g_vml_:image src="',Y.src,'"',' style="width:',U,";"," height:",f,';"',' cropleft="',X/R,'"',' croptop="',V/e,'"',' cropright="',(R-X-a)/R,'"',' cropbottom="',(e-V-j)/e,'"'," />","</g_vml_:group>");
this.element_.insertAdjacentHTML("BeforeEnd",g.join(""));
};
K.stroke=function(o){var U=[];
var T=false;
var s=A(o?this.fillStyle:this.strokeStyle);
var k=s[0];
var P=s[1]*this.globalAlpha;
U.push("<g_vml_:shape",' fillcolor="',k,'"',' filled="',Boolean(o),'"',' style="position:absolute;width:10;height:10;"',' coordorigin="0 0" coordsize="10 10"',' stroked="',!o,'"',' strokeweight="',this.lineWidth,'"',' strokecolor="',k,'"',' path="');
var X=false;
var j={x:null,y:null};
var l={x:null,y:null};
for(var m=0;
m<this.currentPath_.length;
m++){var e=this.currentPath_[m];
if(e.type=="moveTo"){U.push(" m ");
var r=this.getCoords_(e.x,e.y);
U.push(Math.floor(r.x),",",Math.floor(r.y));
}else{if(e.type=="lineTo"){U.push(" l ");
var r=this.getCoords_(e.x,e.y);
U.push(Math.floor(r.x),",",Math.floor(r.y));
}else{if(e.type=="close"){U.push(" x ");
}else{if(e.type=="bezierCurveTo"){U.push(" c ");
var r=this.getCoords_(e.x,e.y);
var h=this.getCoords_(e.cp1x,e.cp1y);
var f=this.getCoords_(e.cp2x,e.cp2y);
U.push(Math.floor(h.x),",",Math.floor(h.y),",",Math.floor(f.x),",",Math.floor(f.y),",",Math.floor(r.x),",",Math.floor(r.y));
}else{if(e.type=="arc"){U.push(" ar ");
var r=this.getCoords_(e.x,e.y);
var Y=this.getCoords_(e.xStart,e.yStart);
var S=this.getCoords_(e.xEnd,e.yEnd);
var O=this.m_[0][0];
var R=this.m_[1][1];
U.push(Math.floor(r.x-O*e.radius),",",Math.floor(r.y-R*e.radius)," ",Math.floor(r.x+O*e.radius),",",Math.floor(r.y+R*e.radius)," ",Math.floor(Y.x),",",Math.floor(Y.y)," ",Math.floor(S.x),",",Math.floor(S.y));
}}}}}if(r){if(j.x==null||r.x<j.x){j.x=r.x;
}if(l.x==null||r.x>l.x){l.x=r.x;
}if(j.y==null||r.y<j.y){j.y=r.y;
}if(l.y==null||r.y>l.y){l.y=r.y;
}}}U.push(' ">');
if(typeof this.fillStyle=="object"){var d={x:"50%",y:"50%"};
var g=(l.x-j.x);
var Z=(l.y-j.y);
var q=(g>Z)?g:Z;
d.x=Math.floor((this.fillStyle.focus_.x/g)*100+50)+"%";
d.y=Math.floor((this.fillStyle.focus_.y/Z)*100+50)+"%";
var W=[];
if(this.fillStyle.type_=="gradientradial"){var n=(this.fillStyle.radius1_/q*100);
var b=(this.fillStyle.radius2_/q*100)-n;
}else{var n=0;
var b=100;
}var N={offset:null,color:null};
var Q={offset:null,color:null};
this.fillStyle.colors_.sort(function(c,a){return c.offset-a.offset;
});
for(var m=0;
m<this.fillStyle.colors_.length;
m++){var V=this.fillStyle.colors_[m];
W.push((V.offset*b)+n,"% ",V.color,",");
if(V.offset>N.offset||N.offset==null){N.offset=V.offset;
N.color=V.color;
}if(V.offset<Q.offset||Q.offset==null){Q.offset=V.offset;
Q.color=V.color;
}}W.pop();
U.push("<g_vml_:fill",' color="',Q.color,'"',' color2="',N.color,'"',' type="',this.fillStyle.type_,'"',' focusposition="',d.x,", ",d.y,'"',' colors="',W.join(""),'"',' opacity="',P,'" />');
}else{if(o){U.push('<g_vml_:fill color="',k,'" opacity="',P,'" />');
}else{U.push("<g_vml_:stroke",' opacity="',P,'"',' joinstyle="',this.lineJoin,'"',' miterlimit="',this.miterLimit,'"',' endcap="',L(this.lineCap),'"',' weight="',this.lineWidth,'px"',' color="',k,'" />');
}}U.push("</g_vml_:shape>");
this.element_.insertAdjacentHTML("beforeEnd",U.join(""));
this.currentPath_=[];
};
K.fill=function(){this.stroke(true);
};
K.closePath=function(){this.currentPath_.push({type:"close"});
};
K.getCoords_=function(O,N){return{x:(O*this.m_[0][0]+N*this.m_[1][0]+this.m_[2][0]),y:(O*this.m_[0][1]+N*this.m_[1][1]+this.m_[2][1])};
};
K.save=function(){var N={};
I(this,N);
this.aStack_.push(N);
this.mStack_.push(this.m_);
this.m_=D(G(),this.m_);
};
K.restore=function(){I(this.aStack_.pop(),this);
this.m_=this.mStack_.pop();
};
K.translate=function(P,O){var N=[[1,0,0],[0,1,0],[P,O,1]];
this.m_=D(N,this.m_);
};
K.rotate=function(O){var Q=Math.cos(O);
var P=Math.sin(O);
var N=[[Q,P,0],[-P,Q,0],[0,0,1]];
this.m_=D(N,this.m_);
};
K.scale=function(P,O){var N=[[P,0,0],[0,O,0],[0,0,1]];
this.m_=D(N,this.m_);
};
K.clip=function(){};
K.arcTo=function(){};
K.createPattern=function(){return new B;
};
function C(N){this.type_=N;
this.radius1_=0;
this.radius2_=0;
this.colors_=[];
this.focus_={x:0,y:0};
}C.prototype.addColorStop=function(O,N){N=A(N);
this.colors_.push({offset:1-O,color:N});
};
function B(){}G_vmlCanvasManager=H;
CanvasRenderingContext2D=J;
CanvasGradient=C;
CanvasPattern=B;
})();
}}
ask.local.Control=function(){this.controlDiv=null;
this.positionable=true;
};
ask.local.Control.prototype={appendTo:function(A){if(A){A.appendChild(this.controlDiv);
}},getImportance:function(){return 1;
},isPositionable:function(){return this.positionable;
},setPositionable:function(A){this.positionable=A;
},position:function(A){}};
ask.local.ViewModeControl=function(N){this.parentMap=null;
var C=this;
this.controlDiv=__d.ce("div");
this.controlDiv.id="viewCtrl";
this.controlDiv.className="viewModeControl";
this.controlDiv.style.zIndex=400;
this.controlDiv.style.position="relative";
var P=__d.ce("span");
P.className="viewModeLink";
P.innerHTML="&nbsp;&nbsp;|&nbsp;";
var L=__d.ce("span");
L.className="viewModeLink";
L.innerHTML="&nbsp;&nbsp;|&nbsp;";
var B=__d.ce("a");
B.id="mode0";
B.title="Street";
B.href="javascript:void(0);";
ask.util.Events.addListener(B,"click",function(){C.setViewMode(0);
sct(44055);
});
B.className="viewModeLinkActive";
B.innerHTML="Street";
this.streetMode=B;
var A=__d.ce("a");
A.id="mode2";
A.title="Aerial";
A.href="javascript:void(0);";
ask.util.Events.addListener(A,"click",function(){C.setViewMode(2);
sct(44050);
});
A.className="viewModeLink";
A.innerHTML="Aerial";
this.aerialMode=A;
var E=__d.ce("span");
var O=__d.ce("a");
O.id="mode3";
O.title="Physical";
O.href="javascript:void(0);";
ask.util.Events.addListener(E,"click",function(){if(C.parentMap.zoom>=ask.local.ZoomLevel.Min_Physical){C.setViewMode(3);
}sct(44054);
});
O.className="viewModeLink";
O.innerHTML="Physical";
E.appendChild(O);
this.physicalMode=E;
var M=__d.ce("input");
M.type="checkbox";
M.style.cursor="pointer";
M.style.marginRight="3";
M.style.position="relative";
M.style.bottom="1";
M.style.width="12px";
M.style.height="12px";
M.style.verticalAlign="middle";
M.name="chkLabels";
M.id="chkLabels";
M.checked=true;
ask.util.Events.addListener(M,"click",function(R,Q){Q.addLabels(this);
sct(44052);
},this);
this.labelsCheck=M;
var G=__d.ce("label");
G.id="lblLabel";
G.innerHTML="Labels";
G.style.fontWeight="bold";
G.style.cursor="pointer";
G.htmlFor="chkLabels";
var H=__d.ce("span");
H.id="dvLabels";
H.style.display="none";
H.innerHTML="&nbsp;&nbsp;";
H.appendChild(this.labelsCheck);
H.appendChild(G);
this.labels=H;
var D=false;
var K=false;
var J=false;
var I=false;
if(N){for(var F=0;
F<N.length;
F++){switch(N[F]){case ask.local.ViewMode.Street:D=true;
break;
case ask.local.ViewMode.Aerial_Labels:I=true;
break;
case ask.local.ViewMode.Aerial:I=true;
break;
case ask.local.ViewMode.Physical:J=true;
I=true;
break;
case ask.local.ViewMode.Physical_Labels:J=true;
I=true;
break;
}}}else{D=true;
J=true;
I=true;
}this.table=__d.ce("table");
this.table.style.width="97%";
this.table.cellPadding=0;
this.table.cellSpacing=0;
this.tbody=__d.ce("tbody");
this.table.appendChild(this.tbody);
this.tr=__d.ce("tr");
this.tbody.appendChild(this.tr);
this.tdLeft=__d.ce("td");
this.tr.appendChild(this.tdLeft);
this.tdRight=__d.ce("td");
this.tdRight.style.textAlign="right";
this.tdRight.style.whiteSpace="nowrap";
this.tr.appendChild(this.tdRight);
this.controlDiv.appendChild(this.table);
if(D){if(!N||N.length!=1){this.tdLeft.appendChild(B);
if(K||J){this.tdLeft.appendChild(P);
}}}if(J){this.tdLeft.appendChild(E);
}if(I){this.tdLeft.appendChild(H);
}};
ask.local.ViewModeControl.prototype=new ask.local.Control();
ask.local.ViewModeControl.prototype.subscribeToEvents=function(){this.parentMap.disablePhysicalView.subscribe(this.onDisablePhysicalView,this);
this.parentMap.viewModeChange.subscribe(this.onViewModeChange,this);
};
ask.local.ViewModeControl.prototype.onViewModeChange=function(B,A,C){C.setControlStatus(A[0]);
};
ask.local.ViewModeControl.prototype.onDisablePhysicalView=function(B,A,C){if(this.viewMode!=3&&this.viewMode!=4){C.physicalMode.childNodes[0].className=C.parentMap.zoom<ask.local.ZoomLevel.Min_Physical?"viewModeLinkDis":"viewModeLink";
}};
ask.local.ViewModeControl.prototype.setControlStatus=function(A){if(this.parentMap){if(A==0){this.labels.style.display="none";
this.streetMode.className="viewModeLinkActive";
this.aerialMode.className="viewModeLink";
this.physicalMode.childNodes[0].className="viewModeLink";
}else{this.labels.style.display="inline";
if(A==1||A==2){this.streetMode.className="viewModeLink";
this.aerialMode.className="viewModeLinkActive";
this.physicalMode.childNodes[0].className="viewModeLink";
}else{if(A==3||A==4){this.streetMode.className="viewModeLink";
this.aerialMode.className="viewModeLink";
this.physicalMode.childNodes[0].className="viewModeLinkActive";
}}}this.parentMap.setZoomBackground();
this.parentMap.disablePhysicalView.fire();
}};
ask.local.ViewModeControl.prototype.setViewMode=function(A){if(this.parentMap){if((A==2)&&(this.labelsCheck.checked)){A=1;
}else{if((A==3)&&(this.labelsCheck.checked)){A=4;
}}this.parentMap.setViewMode(A);
}};
ask.local.ViewModeControl.prototype.addLabels=function(B){var A;
if(this.parentMap){if((this.parentMap.viewMode==2)||(this.parentMap.viewMode==1)){if(B.checked){A=1;
}else{A=2;
}}else{if((this.parentMap.viewMode==3)||(this.parentMap.viewMode==4)){if(B.checked){A=4;
}else{A=3;
}}}this.parentMap.setViewMode(A);
}};
ask.local.ViewModeControl.prototype.appendTo=function(A){if(A){A.appendChild(this.controlDiv);
var B=this.labels;
if(B){if(this.parentMap.viewMode==0){B.style.display="none";
}else{B.style.display="inline";
}}this.labelsCheck.checked=true;
}};
ask.local.ViewModeControl.prototype.getImportance=function(){return 8;
};
ask.local.ViewModeControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:0,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left,top:C.top,right:C.right,bottom:C.top+16};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
B.push(A);
};
ask.local.ScrollArrowsControl=function(){this.parentMap=null;
var C=this;
this.moveTimer=null;
var B=150;
var A=ask.util.Image.MakePng(ask.local.Defaults.SP+"north.png",100,22,101);
A.id="img_N";
A.title="Move North";
ask.util.Events.addListener(A,"mousedown",function(){C.movePercent("N");
C.moveTimer=setInterval(function(){C.movePercent("N");
},B);
sct(44039);
});
ask.util.Events.addListener(A,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(A,"mouseout",this.stopMovePercent,this,true);
A.style.cursor=ask.util.Browser.handCursor;
var G=ask.util.Image.MakePng(ask.local.Defaults.SP+"northeast.png",100,22,101);
G.id="img_NE";
G.title="Move North-East";
ask.util.Events.addListener(G,"mousedown",function(){C.movePercent("NE");
C.moveTimer=setInterval(function(){C.movePercent("NE");
},B);
sct(44040);
});
ask.util.Events.addListener(G,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(G,"mouseout",this.stopMovePercent,this,true);
G.style.cursor=ask.util.Browser.handCursor;
var J=ask.util.Image.MakePng(ask.local.Defaults.SP+"northwest.png",1,22,101);
J.id="img_NW";
J.title="Move North-West";
ask.util.Events.addListener(J,"mousedown",function(){C.movePercent("NW");
C.moveTimer=setInterval(function(){C.movePercent("NW");
},B);
sct(44041);
});
ask.util.Events.addListener(J,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(J,"mouseout",this.stopMovePercent,this,true);
J.style.cursor=ask.util.Browser.handCursor;
var H=ask.util.Image.MakePng(ask.local.Defaults.SP+"west.png",2,22,101);
H.id="img_W";
H.title="Move West";
ask.util.Events.addListener(H,"mousedown",function(){C.movePercent("W");
C.moveTimer=setInterval(function(){C.movePercent("W");
},B);
sct(44038);
});
ask.util.Events.addListener(H,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(H,"mouseout",this.stopMovePercent,this,true);
H.style.cursor=ask.util.Browser.handCursor;
var E=ask.util.Image.MakePng(ask.local.Defaults.SP+"east.png",3,22,101);
E.id="img_E";
E.title="Move East";
ask.util.Events.addListener(E,"mousedown",function(){C.movePercent("E");
C.moveTimer=setInterval(function(){C.movePercent("E");
},B);
sct(44038);
});
ask.util.Events.addListener(E,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(E,"mouseout",this.stopMovePercent,this,true);
E.style.cursor=ask.util.Browser.handCursor;
var I=ask.util.Image.MakePng(ask.local.Defaults.SP+"south.png",3,22,101);
I.id="img_S";
I.title="Move South";
ask.util.Events.addListener(I,"mousedown",function(){C.movePercent("S");
C.moveTimer=setInterval(function(){C.movePercent("S");
},B);
sct(44039);
});
ask.util.Events.addListener(I,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(I,"mouseout",this.stopMovePercent,this,true);
I.style.cursor=ask.util.Browser.handCursor;
var D=ask.util.Image.MakePng(ask.local.Defaults.SP+"southeast.png",3,22,101);
D.id="img_SE";
D.title="Move South-East";
ask.util.Events.addListener(D,"mousedown",function(){C.movePercent("SE");
C.moveTimer=setInterval(function(){C.movePercent("SE");
},B);
sct(44042);
});
ask.util.Events.addListener(D,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(D,"mouseout",this.stopMovePercent,this,true);
D.style.cursor=ask.util.Browser.handCursor;
var F=ask.util.Image.MakePng(ask.local.Defaults.SP+"southwest.png",1,22,101);
F.id="img_SW";
F.title="Move South-West";
ask.util.Events.addListener(F,"mousedown",function(){C.movePercent("SW");
C.moveTimer=setInterval(function(){C.movePercent("SW");
},B);
sct(44043);
});
ask.util.Events.addListener(F,"mouseup",this.stopMovePercent,this,true);
ask.util.Events.addListener(F,"mouseout",this.stopMovePercent,this,true);
F.style.cursor=ask.util.Browser.handCursor;
this.controlDiv=__d.ce("div");
this.controlDiv.id="scrollArrowsCntrl";
this.controlDiv.onselectstart=ask.util.Events.returnFalse;
this.controlDiv.appendChild(A);
this.controlDiv.appendChild(G);
this.controlDiv.appendChild(J);
this.controlDiv.appendChild(H);
this.controlDiv.appendChild(E);
this.controlDiv.appendChild(I);
this.controlDiv.appendChild(D);
this.controlDiv.appendChild(F);
};
ask.local.ScrollArrowsControl.prototype=new ask.local.Control();
ask.local.ScrollArrowsControl.prototype.appendTo=function(A){if(A){A.appendChild(this.controlDiv);
}};
ask.local.ScrollArrowsControl.prototype.subscribeToEvents=function(){};
ask.local.ScrollArrowsControl.prototype.movePercent=function(D){var C,G;
var B=this.parentMap.centerX;
var F=this.parentMap.centerY;
var E=parseInt(this.parentMap.viewHeight/5);
var A=parseInt(this.parentMap.viewWidth/5);
if(D=="N"){C=B;
G=F-E;
}else{if(D=="S"){C=B;
G=F+E;
}else{if(D=="W"){C=B-A;
G=F;
}else{if(D=="E"){C=B+A;
G=F;
}else{if(D=="NW"){C=B-A;
G=F-E;
}else{if(D=="NE"){C=B+A;
G=F-E;
}else{if(D=="SW"){C=B-A;
G=F+E;
}else{if(D=="SE"){C=B+A;
G=F+E;
}}}}}}}}if(C&&G){this.parentMap.moveViewTo(C,G);
}};
ask.local.ScrollArrowsControl.prototype.stopMovePercent=function(A){clearInterval(this.moveTimer);
};
ask.local.ScrollArrowsControl.prototype.moveArrows=function(){this.controlDiv.childNodes[0].style.left=this.parentMap.halfViewWidth-15+"px";
this.controlDiv.childNodes[1].style.left=this.parentMap.viewWidth-35+"px";
this.controlDiv.childNodes[3].style.top=this.parentMap.halfViewHeight-15+"px";
this.controlDiv.childNodes[4].style.top=this.parentMap.halfViewHeight-15+"px";
this.controlDiv.childNodes[4].style.left=this.parentMap.viewWidth-30+"px";
this.controlDiv.childNodes[5].style.top=this.parentMap.viewHeight-20+"px";
this.controlDiv.childNodes[5].style.left=this.parentMap.halfViewWidth-15+"px";
this.controlDiv.childNodes[6].style.top=this.parentMap.viewHeight-25+"px";
this.controlDiv.childNodes[6].style.left=this.parentMap.viewWidth-35+"px";
this.controlDiv.childNodes[7].style.top=this.parentMap.viewHeight-25+"px";
};
ask.local.ScrollArrowsControl.prototype.getImportance=function(){return 7;
};
ask.local.ScrollArrowsControl.prototype.position=function(C){if(!this.isPositionable()){return ;
}var G=ask.util.Geometry.squeeze({left:5,top:30,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},C);
var D=G.left;
var I=G.top;
var J=G.right;
var A=G.bottom;
var H=Math.round((G.left+G.right)/2);
var B=Math.round((G.top+G.bottom)/2);
var F=[{left:H-16,top:I,right:H+17,bottom:I+22},{left:J-27,top:I,right:J,bottom:I+28},{left:D,top:I,right:D+28,bottom:I+26},{left:D,top:B-16,right:D+22,bottom:B+17},{left:J-21,top:B-16,right:J,bottom:B+17},{left:H-16,top:A-21,right:H+17,bottom:A},{left:J-28,top:A-28,right:J,bottom:A},{left:D,top:A-28,right:D+27,bottom:A}];
for(var E=0;
E<8;
E++){this.controlDiv.childNodes[E].style.left=F[E].left+"px";
this.controlDiv.childNodes[E].style.top=F[E].top+"px";
C.push(F[E]);
}};
ask.local.AutoDriveControl=function(){this.parentMap=null;
var A=this;
this.playClick=new ask.util.AbstractEvent("resizeView",this);
this.stopClick=new ask.util.AbstractEvent("resizeView",this);
this.pauseClick=new ask.util.AbstractEvent("resizeView",this);
this.playDiv=__d.ce("div");
this.backImgLong=ask.util.Image.MakePng(ask.local.Defaults.SP+"ad-bg.png",0,0,100);
this.backImgLong.className="op";
this.backImgLong.id="img_background_long";
this.backImgLong.style.display="";
this.playOnImg=ask.util.Image.MakeGif(ask.local.Defaults.SP+"go_green_arrow.gif",7,10,101);
this.playOnImg.className="op";
this.playOnImg.title="Play Directions";
this.playOnImg.onclick=function(B){A.parentMap.autoDriving=true;
A.playOnImg.style.display="none";
A.pauseImg.style.display="";
A.stopImg.style.display="none";
A.stopOnImg.style.display="";
A.playClick.fire();
sct(44064);
};
this.playOnImg.style.cursor=ask.util.Browser.handCursor;
this.playOnImg.style.display="";
this.playDiv.appendChild(this.playOnImg);
this.pauseImg=ask.util.Image.MakeGif(ask.local.Defaults.SP+"pause_orange.png",7,10,101);
this.pauseImg.className="op";
this.pauseImg.title="Pause Directions";
this.pauseImg.onclick=function(){A.parentMap.autoDriving=false;
A.playOnImg.style.display="";
A.pauseImg.style.display="none";
A.stopImg.style.display="none";
A.stopOnImg.style.display="";
A.pauseClick.fire();
sct(44063);
};
this.pauseImg.style.cursor=ask.util.Browser.handCursor;
this.pauseImg.style.display="none";
this.playDiv.appendChild(this.pauseImg);
this.stopImg=ask.util.Image.MakeGif(ask.local.Defaults.SP+"darker_stop_button.gif",23,12,101);
this.stopImg.className="op";
this.stopImg.title="Stop Directions";
this.stopImg.style.display="";
this.playDiv.appendChild(this.stopImg);
this.stopOnImg=ask.util.Image.MakeGif(ask.local.Defaults.SP+"stop_red_button.gif",23,12,101);
this.stopOnImg.className="op";
this.stopOnImg.title="Stop Directions";
this.stopOnImg.onclick=function(){A.parentMap.autoDriving=false;
A.playOnImg.style.display="";
A.pauseImg.style.display="none";
A.stopImg.style.display="";
A.stopOnImg.style.display="none";
A.stopClick.fire();
sct(44065);
};
this.stopOnImg.style.cursor=ask.util.Browser.handCursor;
this.stopOnImg.style.display="none";
this.playDiv.appendChild(this.stopOnImg);
this.controlDiv=__d.ce("div");
this.controlDiv.id="autoDrive";
this.controlDiv.className="autoDriveControl";
this.controlDiv.style.position="absolute";
this.controlDiv.style.zIndex=301;
this.controlDiv.onselectstart=ask.util.Events.returnFalse;
this.controlDiv.appendChild(this.playDiv);
this.controlDiv.appendChild(this.backImgLong);
};
ask.local.AutoDriveControl.prototype=new ask.local.Control();
ask.local.AutoDriveControl.prototype.subscribeToEvents=function(){};
ask.local.AutoDriveControl.prototype.toggleVisible=function(A){if(A){this.controlDiv.style.display="";
}else{this.controlDiv.style.display="none";
}};
ask.local.AutoDriveControl.prototype.getImportance=function(){return 0;
};
ask.local.AutoDriveControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:0,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left-40,top:C.top+252,right:C.left+45,bottom:C.top+285};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
B.push(A);
};
ask.local.SmallMapControl=function(){this.parentMap=null;
var E=this;
var A;
A=ask.util.Image.MakePng(ask.local.Defaults.SP+"zoom_background_sm1.png",0,0,100);
A.style.height="94px";
var B=ask.util.Image.MakePng(ask.local.Defaults.SP+"zoom_text.gif",5,7,102);
B.alt="zoom";
var D=ask.util.Image.MakeGif(ask.local.Defaults.SP+"zoom_in.gif",11,25,102);
D.alt=D.title="zoom in";
D.style.cursor=ask.util.Browser.handCursor;
ask.util.Events.addListener(D,"click",this.zoomIn,this,true);
var F=ask.util.Image.MakeGif(ask.local.Defaults.SP+"zoom_out.gif",11,42,102);
F.alt=F.title="zoom out";
F.style.cursor=ask.util.Browser.handCursor;
ask.util.Events.addListener(F,"click",this.zoomOut,this,true);
this.controlDiv=__d.ce("div");
this.controlDiv.id="smMapCtrl";
this.controlDiv.style.position="absolute";
this.controlDiv.className="smallMapControl";
this.controlDiv.onselectstart=ask.util.Events.returnFalse;
this.controlDiv.style.zIndex=301;
this.controlDiv.appendChild(A);
var C=ask.util.Image.MakeGif(ask.local.Defaults.SP+"center.gif",7,68,102);
C.style.cursor=ask.util.Browser.handCursor;
C.title=C.alt="Zoom to all locations";
ask.util.Events.addListener(C,"click",function(){E.parentMap.showAllOverlays();
sct(44056);
});
this.controlDiv.appendChild(B);
this.controlDiv.appendChild(C);
this.controlDiv.appendChild(F);
this.controlDiv.appendChild(D);
};
ask.local.SmallMapControl.prototype=new ask.local.Control();
ask.local.SmallMapControl.prototype.subscribeToEvents=function(){this.parentMap.zoomChange.subscribe(this.onZoomChange,this);
};
ask.local.SmallMapControl.prototype.onZoomChange=function(B,A,C){};
ask.local.SmallMapControl.prototype.zoomIn=function(A){if(this.parentMap){this.parentMap.zoomIn();
}sct(44058);
};
ask.local.SmallMapControl.prototype.zoomOut=function(A){if(this.parentMap){this.parentMap.zoomOut();
}sct(44062);
};
ask.local.SmallMapControl.prototype.getImportance=function(){return 5;
};
ask.local.SmallMapControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:25,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left+5,top:C.top+5,right:C.left+39,bottom:C.top+89};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
B.push(A);
};
ask.local.LargeMapControl=function(){this.parentMap=null;
var E=this;
var A;
A=ask.util.Image.MakePng(ask.local.Defaults.SP+"zoom_background_small.png",0,0,100);
A.className="op";
A.id="img_background";
this.zoomBackground=ask.util.Image.MakePng(ask.local.Defaults.SP+"zoombackground.png",10,46,101);
this.zoomBackground.style.width=28;
this.zoomBackground.style.height=175;
this.zoomBackground.style.cursor=ask.util.Browser.handCursor;
this.zoomBackground.onclick=function(G){E.zoomBackgroundClick(G);
};
var B=ask.util.Image.MakePng(ask.local.Defaults.SP+"zoom_text.gif",7,7,102);
B.alt="zoom";
var D=ask.util.Image.MakeGif(ask.local.Defaults.SP+"zoom_plus_icon.gif",13,25,102);
D.alt=D.title="zoom in";
D.style.cursor=ask.util.Browser.handCursor;
D.onclick=function(){E.zoomIn();
sct(44058);
};
var F=ask.util.Image.MakeGif(ask.local.Defaults.SP+"zoom_minus_icon.gif",13,228,102);
F.alt=F.title="zoom out";
F.style.cursor=ask.util.Browser.handCursor;
F.onclick=function(){E.zoomOut();
sct(44062);
};
this.zoomFader=ask.util.Image.MakeGif(ask.local.Defaults.SP+"arrow_marker.gif",8,58,102);
this.zoomFader.style.cursor=ask.util.Browser.handCursor;
this.zoomFader.ondragstart=ask.util.Events.returnFalse;
this.zoomFader.onmousedown=function(G){sct(44057);
return E.beginZoomDrag(G);
};
this.controlDiv=__d.ce("div");
this.controlDiv.id="lgMapCtrl";
this.controlDiv.style.position="absolute";
this.controlDiv.className="largeMapControl";
this.controlDiv.onselectstart=ask.util.Events.returnFalse;
this.controlDiv.style.zIndex=301;
this.controlDiv.appendChild(A);
var C=ask.util.Image.MakeGif(ask.local.Defaults.SP+"centermap_icon.gif",10,253,102);
C.style.cursor=ask.util.Browser.handCursor;
C.title=C.alt="Zoom to all locations";
C.onclick=function(){E.parentMap.showAllOverlays();
sct(44056);
};
this.controlDiv.appendChild(C);
this.controlDiv.appendChild(this.zoomBackground);
this.controlDiv.appendChild(this.zoomFader);
this.controlDiv.appendChild(F);
this.controlDiv.appendChild(D);
this.controlDiv.appendChild(B);
this.zoomFader.style.top=46+9*(ask.util.GeoMath.MAXZOOM-5)+"px";
};
ask.local.LargeMapControl.prototype=new ask.local.Control();
ask.local.LargeMapControl.prototype.subscribeToEvents=function(){this.parentMap.zoomChange.subscribe(this.onZoomChange,this);
this.parentMap.zoomBackgroundChange.subscribe(this.onZoomBackgroundChange,this);
this.parentMap.togglePlayDirControl.subscribe(this.onTogglePlayDirControl,this);
};
ask.local.LargeMapControl.prototype.onTogglePlayDirControl=function(B,A,C){var D=A[0];
if(D){C.backImg.style.display="none";
C.backImgLong.style.display="";
C.playDiv.style.display="";
}else{C.backImg.style.display="";
C.backImgLong.style.display="none";
C.playDiv.style.display="none";
}};
ask.local.LargeMapControl.prototype.onZoomBackgroundChange=function(B,A,C){C.setZoomBackground();
};
ask.local.LargeMapControl.prototype.onZoomChange=function(B,A,C){if(C.zoomFader){C.zoomFader.style.top=46+9*(parseInt(A[0]))+"px";
C.setZoomBackground();
}};
ask.local.LargeMapControl.prototype.zoomBackgroundClick=function(C){if(this.parentMap){var A=this.parentMap.getMousePos(ask.util.Events.getEvent(C)).y-46-parseInt(this.controlDiv.style.top)-4;
if(A<0||A>(9*ask.util.GeoMath.MAXZOOM)){return ;
}var B=Math.round(A/9);
this.parentMap.setZoom(B);
}};
ask.local.LargeMapControl.prototype.zoomIn=function(A){if(this.parentMap){this.parentMap.zoomIn();
}};
ask.local.LargeMapControl.prototype.zoomOut=function(A){if(this.parentMap){this.parentMap.zoomOut();
}};
ask.local.LargeMapControl.prototype.beginZoomDrag=function(A){var B=this;
__d.documentElement.onmousemove=function(C){return B.doZoomDrag(C);
};
__d.documentElement.onmouseup=function(C){return B.endZoomDrag(C);
};
return false;
};
ask.local.LargeMapControl.prototype.doZoomDrag=function(C){if(this.parentMap){var A=this.parentMap.getMousePos(ask.util.Events.getEvent(C)).y-46-parseInt(this.controlDiv.style.top)-4;
if(A<0){A=0;
}if(A>(ask.util.GeoMath.MAXZOOM-2)*9){A=(ask.util.GeoMath.MAXZOOM-2)*9;
}if(this.parentMap.viewMode==3||this.parentMap.viewMode==4){if(A<(ask.local.ZoomLevel.Min_Physical*9)){A=ask.local.ZoomLevel.Min_Physical*9;
}}this.zoomFader.style.top=A+46+"px";
var B=Math.round(A/9);
return false;
}};
ask.local.LargeMapControl.prototype.endZoomDrag=function(C){if(this.parentMap){__d.documentElement.onmousemove=null;
__d.documentElement.onmouseup=null;
var A=this.parentMap.getMousePos(ask.util.Events.getEvent(C)).y-46-parseInt(this.controlDiv.style.top)-4;
var B=Math.round(A/9);
this.parentMap.setZoom(B);
return false;
}};
ask.local.LargeMapControl.prototype.setZoomBackground=function(){var B=parseInt((this.parentMap.zoom+1)/2+1);
var A;
if(parseInt(this.parentMap.zoom%2)==1){if((this.parentMap.viewMode==3||this.parentMap.viewMode==4)){A=ask.local.Defaults.SP+"zoombackgroundsmall.png";
}else{A=ask.local.Defaults.SP+"zoombackground.png";
}}else{if(B<10){if((this.parentMap.viewMode==3||this.parentMap.viewMode==4)){A=ask.local.Defaults.SP+"zoombackgroundsmall_0"+B+".png";
}else{A=ask.local.Defaults.SP+"zoom_mark_0"+B+".png";
}}else{if((this.parentMap.viewMode==3||this.parentMap.viewMode==4)){A=ask.local.Defaults.SP+"zoombackgroundsmall_"+B+".png";
}else{A=ask.local.Defaults.SP+"zoom_mark_"+B+".png";
}}}if(this.zoomBackground){this.zoomBackground.style.width=28;
this.zoomBackground.style.height=175;
if(ask.util.Browser.isIE6){this.zoomBackground.src=ask.util.Defaults.SP+"transparent.gif";
this.zoomBackground.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"', sizingMethod='none')";
}else{this.zoomBackground.src=A;
}}};
ask.local.LargeMapControl.prototype.getImportance=function(){return 5;
};
ask.local.LargeMapControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:25,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left+5,top:C.top+5,right:C.left+45,bottom:C.top+285};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
B.push(A);
};
ask.local.CanvasControl=function(){this.parentMap=null;
this.toolClick=new ask.util.AbstractEvent("toolClick",this);
this.lineColor="rgb(1,102,254)";
this.fillColor="rgb(1,102,254)";
this.lineWidth=7;
this.fillAlpha=0.4;
this.lineAlpha=0.6;
this.activeTool=null;
var D=__d.ce("div");
D.id="canvasCtrl";
D.className="canvasControl";
D.style.zIndex=400;
D.style.position="absolute";
var J=__d.ce("div");
J.id="canvasColorPicker";
J.style.position="absolute";
J.style.border="1px solid silver";
J.style.backgroundColor="whitesmoke";
J.style.paddingLeft="2px";
J.style.zIndex=500;
J.style.width="120px";
J.style.height="48px";
J.style.display="none";
J.style.top="-200px";
J.style.left="75px";
if(ask.util.Browser.isIE){J.style.paddingTop="3px";
}this.lineColors=["rgb(255,255,255)","rgb(255,255,0)","rgb(255,102,0)","rgb(204,0,1)","rgb(0,153,0)","rgb(1,102,254)","rgb(0,0,254)","rgb(0,0,0)"];
this.fillColors=["rgb(255,255,255)","rgb(255,255,0)","rgb(255,102,0)","rgb(204,0,1)","rgb(0,153,0)","rgb(1,102,254)","rgb(0,0,254)","rgb(0,0,0)"];
var b="2px";
var H=__d.ce("table");
var M=__d.ce("tbody");
var E=__d.ce("tr");
var e=__d.ce("tr");
var d=__d.ce("tr");
var Z=__d.ce("tr");
H.appendChild(M);
H.cellPadding=0;
H.cellSpacing=0;
H.width="100%";
M.appendChild(E);
M.appendChild(e);
M.appendChild(d);
M.appendChild(Z);
J.appendChild(H);
var O=__d.ce("table");
var Q=__d.ce("tbody");
var B=__d.ce("tr");
var Y=__d.ce("td");
var N=__d.ce("td");
N.vAlign="middle";
O.appendChild(Q);
O.cellPadding=0;
O.cellSpacing=0;
O.width="100%";
Q.appendChild(B);
B.appendChild(Y);
B.appendChild(N);
D.appendChild(O);
var R=__d.ce("img");
R.src=ask.local.UI.Defaults.SP+"pointer.gif";
R.height=7;
R.width=10;
R.align="top";
this.linePntr=R;
this.fillPntr=R.cloneNode(false);
var L=this;
function U(o,l,f,n,j){var k=o?L.linePntr:L.fillPntr;
var h=__d.ce("td");
h.style.paddingTop="2px";
h.valign="top";
h.style.fontSize="0px";
var m=__d.ce("img");
m.src=ask.local.Defaults.SP+"transparent.gif";
m.index=l;
if(o){m.style.backgroundColor="whitesmoke";
m.style.border="2px solid "+L.lineColors[l];
}else{m.style.backgroundColor=L.fillColors[l];
m.style.border="2px solid black";
}m.align="absmiddle";
m.height=10;
m.width=10;
m.style.cursor=ask.util.Browser.handCursor;
ask.util.Events.addListener(m,"click",function(c,i){i.setColor(o,ask.util.Events.getTarget(c));
},L);
h.appendChild(m);
n.appendChild(h);
var g=__d.ce("td");
g.align="center";
g.vAlign="top";
g.style.fontSize="0px";
if(l==f){g.appendChild(k);
}j.appendChild(g);
}for(var X=0;
X<this.lineColors.length;
X++){U(true,X,5,E,e);
}this.lineColor=this.lineColors[5];
for(var X=0;
X<this.fillColors.length;
X++){U(false,X,0,d,Z);
}L.fillColor=this.fillColors[0];
J.colorType=-1;
this.colorPicker=J;
var a=__d.ce("img");
a.style.position="absolute";
a.style.display="none";
a.style.left="-100px";
a.style.top="-100px";
a.style.zIndex="1000";
a.fromTop=0;
a.fromLeft=0;
__d.body.appendChild(a);
this.cursor=a;
var S=__d.ce("img");
S.src=ask.local.UI.Defaults.SP+"open_hand.gif";
ask.util.Events.addListener(S,"click",this.onToolClick,this);
S.alt=S.title="map tool";
this.mapTool=S;
var A=__d.ce("img");
A.src=ask.local.UI.Defaults.SP+"text.gif";
ask.util.Events.addListener(A,"click",this.onToolClick,this);
ask.util.Events.addListener(A,"mousedown",function(){sct(43981,this);
});
A.alt=A.title="add a text label";
this.textTool=A;
var V=__d.ce("img");
ask.util.Image.SetPng(V,ask.local.UI.Defaults.SP+"blue_i_dot.png");
V.alt=V.title="add a location to the map";
ask.util.Events.addListener(V,"click",this.onToolClick,this);
ask.util.Events.addListener(V,"mousedown",function(){sct(43980,this);
});
this.pinTool=V;
this.waypointTool={};
var T=__d.ce("img");
T.src=ask.local.UI.Defaults.SP+"paint.gif";
T.alt=T.title="free-hand draw";
ask.util.Events.addListener(T,"click",this.onToolClick,this);
ask.util.Events.addListener(T,"mousedown",function(){sct(43987,this);
});
this.polyTool=T;
var I=__d.ce("img");
I.src=ask.local.UI.Defaults.SP+"line.gif";
I.alt=I.title="segmented line";
ask.util.Events.addListener(I,"click",this.onToolClick,this);
ask.util.Events.addListener(I,"mousedown",function(){sct(43992,this);
});
this.lineTool=I;
var P=__d.ce("img");
P.src=ask.local.UI.Defaults.SP+"polygon.gif";
ask.util.Events.addListener(P,"click",this.onToolClick,this);
ask.util.Events.addListener(P,"mousedown",function(){sct(43988,this);
});
P.alt=P.title="polygon";
this.polygonTool=P;
var G=__d.ce("img");
G.src=ask.local.UI.Defaults.SP+"circle.gif";
ask.util.Events.addListener(G,"click",this.onToolClick,this);
ask.util.Events.addListener(G,"mousedown",function(){sct(43982,this);
});
G.alt=G.title="circle";
this.circleTool=G;
var F=__d.ce("img");
F.src=ask.local.UI.Defaults.SP+"rect.gif";
F.alt=F.title="rectangle";
ask.util.Events.addListener(F,"click",this.onToolClick,this);
ask.util.Events.addListener(F,"mousedown",function(){sct(43989,this);
});
this.rectTool=F;
var C=__d.ce("img");
C.src=ask.local.UI.Defaults.SP+"clear.gif";
ask.util.Events.addListener(C,"click",this.onToolClick,this);
ask.util.Events.addListener(C,"mousedown",function(){sct(43984,this);
});
C.alt=C.title="clear all drawings";
C.style.marginBottom="3px";
this.clearTool=C;
var K=__d.ce("img");
K.src=ask.local.UI.Defaults.SP+"undo.gif";
K.alt=K.title="undo the last draw action";
ask.util.Events.addListener(K,"click",this.onToolClick,this);
ask.util.Events.addListener(K,"mousedown",function(){sct(43994,this);
});
K.style.marginBottom="3px";
this.undoTool=K;
Y.appendChild(this.mapTool);
Y.appendChild(this.textTool);
Y.appendChild(this.pinTool);
Y.appendChild(this.polyTool);
Y.appendChild(this.lineTool);
Y.appendChild(this.polygonTool);
Y.appendChild(this.rectTool);
Y.appendChild(this.circleTool);
Y.appendChild(this.clearTool);
Y.appendChild(this.undoTool);
var W=__d.ce("img");
W.src=ask.local.UI.Defaults.SP+"down.gif";
W.style.cursor=ask.util.Browser.handCursor;
W.alt=W.title="Hide save control";
ask.util.Events.addListener(W,"click",function(f){var c=__d.get("saveCtrl");
if(c){if(c.style.display=="none"){this.src=ask.local.UI.Defaults.SP+"down.gif";
this.alt=this.title="Hide save control";
c.style.display="";
}else{this.src=ask.local.UI.Defaults.SP+"up.gif";
this.alt=this.title="Show save control";
c.style.display="none";
}ask.local.UI.map.positionControls();
ask.local.UI.map.drawOverlays();
}});
N.appendChild(W);
ask.util.Events.addListener(D,"mousedown",ask.util.Events.stopPropagation);
this.controlDiv=D;
this.leftArea=Y;
this.rightArea=N;
this.setTool(this.mapTool);
this.hideDrawTools();
};
ask.local.CanvasControl.prototype=new ask.local.Control();
ask.local.CanvasControl.prototype.moveCursor=function(A,B){A=ask.util.Events.getEvent(A);
B.cursor.style.top=ask.util.Events.getPageY(A)+B.cursor.fromTop+"px";
B.cursor.style.left=ask.util.Events.getPageX(A)+B.cursor.fromLeft+"px";
B.cursor.style.display="";
};
ask.local.CanvasControl.prototype.hideCursor=function(A,B){B.cursor.style.display="none";
};
ask.local.CanvasControl.prototype.removeCursorListeners=function(){ask.util.Events.removeListener(this.parentMap.mapDiv,"mousemove",this.moveCursor);
ask.util.Events.removeListener(this.parentMap.mapDiv,"mouseup",this.moveCursor);
ask.util.Events.removeListener(this.parentMap.mapDiv,"dblclick",this.hideCursor);
ask.util.Events.removeListener(this.parentMap.mapDiv,"mouseout",this.hideCursor);
this.cursor.style.display="none";
};
ask.local.CanvasControl.prototype.initStyle=function(){var B=(this.fillColor.substring(0,this.fillColor.length-1)+","+this.fillAlpha+")").replace(/rgb\(/,"rgba(");
var D=(this.lineColor.substring(0,this.lineColor.length-1)+","+this.lineAlpha+")").replace(/rgb\(/,"rgba(");
var A=this.parentMap.canvas.context;
if(A){A.fillStyle=B;
A.strokeStyle=D;
A.lineWidth=this.lineWidth;
}var C=this.parentMap.drawCanvas.context;
if(C){C.fillStyle=B;
C.strokeStyle=D;
C.lineWidth=this.lineWidth;
}};
ask.local.CanvasControl.prototype.undo=function(){if(ask.local.Canvas.drawings.length>0){var A=ask.local.Canvas.drawings.pop();
this.parentMap.removeOverlay(A);
this.parentMap.drawOverlays();
}};
ask.local.CanvasControl.prototype.setColor=function(I,C){var B;
var H;
if(I){this.lineColor=this.lineColors[C.index];
B=this.linePntr;
H=1;
}else{this.fillColor=this.fillColors[C.index];
B=this.fillPntr;
H=3;
}var G=this.parentMap.canvas.context;
var E=this.parentMap.drawCanvas.context;
var D=(this.lineColor.substring(0,this.lineColor.length-1)+","+this.lineAlpha+")").replace(/rgb\(/,"rgba(");
G.strokeStyle=D;
E.strokeStyle=D;
var F=(this.fillColor.substring(0,this.fillColor.length-1)+","+this.fillAlpha+")").replace(/rgb\(/,"rgba(");
G.fillStyle=F;
E.fillStyle=F;
this.activeTool.style.border="2px solid "+this.lineColor;
var A=C.parentNode.parentNode.parentNode.childNodes[H].childNodes[C.index];
A.appendChild(B);
};
ask.local.CanvasControl.prototype.subscribeToEvents=function(){};
ask.local.CanvasControl.prototype.onToolClick=function(A,B){B.setTool(this);
B.toolClick.fire();
};
ask.local.CanvasControl.prototype.setTool=function(B){if(ask.local.Canvas.drawPoints.length>0){ask.local.Canvas.createOverlay();
}var A=false;
if(B==this.waypointTool){B=this.pinTool;
A=true;
}if(B!=this.clearTool&&B!=this.undoTool){for(var D=0;
D<this.leftArea.childNodes.length;
D++){var E=this.leftArea.childNodes[D];
if(E&&E.style&&E.tagName=="IMG"){if(E.style.border.indexOf("black")==-1){E.style.border="2px solid white";
}E.style.cursor=ask.util.Browser.handCursor;
}}this.activeTool=B;
B.style.border="2px solid "+this.lineColor;
if(this.parentMap){this.removeCursorListeners();
}}var C=this.parentMap;
if(C){if(B==this.mapTool){if(ask.util.Browser.isIE){C.mapDiv.style.cursor=ask.util.Browser.openHandCursor;
}else{C.mapDiv.style.cursor="-moz-grab";
}}else{if(B!=this.undoTool&&B!=this.clearTool){C.mapDiv.style.cursor=ask.util.Browser.defaultCursor;
}}if(B==this.mapTool){C.cursorMode=ask.local.CursorMode.Pan;
C.drawCanvas.style.display="none";
this.hideDrawTools();
}else{if(B==this.textTool){ask.util.Image.SetPng(this.cursor,ask.local.UI.Defaults.SP+"text.png");
this.cursor.fromTop=-10;
this.cursor.fromLeft=10;
C.cursorMode=ask.local.CursorMode.Text;
C.drawCanvas.style.display="none";
this.hideDrawTools();
}else{if(B==this.pinTool){this.cursor.fromTop=-30;
this.cursor.fromLeft=10;
ask.util.Image.SetPng(this.cursor,ask.local.UI.Defaults.SP+(A?"orange_m.png":"blue_m_dot.png"));
C.cursorMode=ask.local.CursorMode.Marker;
C.drawCanvas.style.display="none";
this.hideDrawTools();
}else{if(B==this.clearTool){C.removeAllOverlays(ask.local.Canvas.drawings);
ask.local.Canvas.drawings=[];
}else{if(B==this.undoTool){this.undo();
}else{if(B==this.polyTool){C.mapDiv.style.cursor="crosshair";
C.cursorMode=ask.local.CursorMode.Draw;
ask.local.Canvas.shape=ask.local.Shapes.Polyline;
C.drawCanvas.style.display="";
C.moveView();
this.showDrawTools();
}else{if(B==this.lineTool){ask.util.Image.SetPng(this.cursor,ask.local.UI.Defaults.SP+"polytip.gif");
this.cursor.fromTop=-10;
this.cursor.fromLeft=10;
C.mapDiv.style.cursor="crosshair";
C.cursorMode=ask.local.CursorMode.Draw;
ask.local.Canvas.shape=ask.local.Shapes.Line;
C.drawCanvas.style.display="";
C.moveView();
this.showDrawTools();
}else{if(B==this.rectTool){C.mapDiv.style.cursor="crosshair";
C.cursorMode=ask.local.CursorMode.Draw;
ask.local.Canvas.shape=ask.local.Shapes.Rectangle;
C.drawCanvas.style.display="";
C.moveView();
this.showDrawTools();
}else{if(B==this.circleTool){C.mapDiv.style.cursor="crosshair";
C.cursorMode=ask.local.CursorMode.Draw;
ask.local.Canvas.shape=ask.local.Shapes.Circle;
C.drawCanvas.style.display="";
C.moveView();
this.showDrawTools();
}else{if(B==this.polygonTool){ask.util.Image.SetPng(this.cursor,ask.local.UI.Defaults.SP+"polytip.gif");
this.cursor.fromTop=-10;
this.cursor.fromLeft=10;
C.mapDiv.style.cursor="crosshair";
C.cursorMode=ask.local.CursorMode.Draw;
ask.local.Canvas.shape=ask.local.Shapes.Polygon;
C.drawCanvas.style.display="";
C.moveView();
this.showDrawTools();
}}}}}}}}}}if((B==this.textTool||B==this.pinTool||B==this.lineTool||B==this.polygonTool)&&this.parentMap){if(B!=this.polygonTool&&B!=this.lineTool){ask.util.Events.addListener(this.parentMap.mapDiv,"mousemove",this.moveCursor,this);
ask.util.Events.addListener(this.parentMap.mapDiv,"mouseout",this.hideCursor,this);
}else{ask.util.Events.addListener(this.parentMap.mapDiv,"mousedown",this.moveCursor,this);
ask.util.Events.addListener(this.parentMap.mapDiv,"dblclick",this.hideCursor,this);
}}}};
ask.local.CanvasControl.prototype.showDrawTools=function(){this.colorPicker.style.display="";
};
ask.local.CanvasControl.prototype.hideDrawTools=function(){this.colorPicker.style.display="none";
};
ask.local.CanvasControl.prototype.appendTo=function(A){if(A){A.appendChild(this.controlDiv);
A.appendChild(this.colorPicker);
}ask.local.Canvas.parentMap=this.parentMap;
this.initStyle();
};
ask.local.CanvasControl.prototype.getImportance=function(){return 9;
};
ask.local.CanvasControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:0,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left,top:C.bottom-28,right:C.right,bottom:C.bottom,opaque:true};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
this.colorPicker.style.top=(A.top-50)+"px";
B.push(A);
};
ask.local.Canvas={parentMap:null,drawPoints:[],startPos:{x:-1,y:-1},curPos:{x:-1,y:-1},shape:ask.local.Shapes.Polyline,drawings:[],dx:0,dy:0,getCanvasPos:function(C){var D=ask.util.Dom.getXY(this.parentMap.canvas);
var B=ask.util.Events.getPageX(C)-D[0];
var A=ask.util.Events.getPageY(C)-D[1];
return{x:B,y:A};
},onMouseDown:function(A){A=ask.util.Events.getEvent(A);
var B=this;
if(this.drawPoints.length>0){return ;
}__d.documentElement.onmousemove=function(C){B.onMouseMove(C);
};
__d.documentElement.onmouseup=function(C){return B.onMouseUp(C);
};
if(this.shape==ask.local.Shapes.Line||this.shape==ask.local.Shapes.Polygon){this.parentMap.canvas.context.beginPath();
__d.documentElement.onkeyup=function(C){B.onKeyUp(C);
};
__d.documentElement.ondblclick=function(C){return B.onDblClick(C);
};
}this.drawPoints=[];
this.startPos=this.getCanvasPos(A);
this.drawPoints[0]=this.startPos;
this.curPos=this.startPos;
this.parentMap.drawCanvas.context.moveTo(this.curPos.x,this.curPos.y);
this.parentMap.canvas.context.moveTo(this.curPos.x,this.curPos.y);
},onKeyUp:function(A){A=ask.util.Events.getEvent(A);
if(A.keyCode==13){this.createOverlay();
}else{if(A.keyCode==27){this.drawPoints=[];
this.clearDraw();
this.parentMap.drawOverlays();
this.removeCanvasMouseListeners();
}}ask.util.Events.stopPropagation(A);
},onDblClick:function(A){A=ask.util.Events.getEvent(A);
this.createOverlay();
ask.util.Events.stopPropagation(A);
},onMouseMove:function(B){this.parentMap.drawCanvas.context.beginPath();
this.parentMap.drawCanvas.context.moveTo(this.curPos.x,this.curPos.y);
var A=this.parentMap.getMousePos(B);
this.dx+=Math.abs(this.curPos.x-A.x);
this.dy+=Math.abs(this.curPos.y-A.y);
this.curPos=A;
switch(this.shape){case ask.local.Shapes.Line:this.clearDraw();
this.parentMap.drawCanvas.context.moveTo(this.startPos.x,this.startPos.y);
this.parentMap.canvas.context.moveTo(this.startPos.x,this.startPos.y);
this.drawLine(this.curPos);
break;
case ask.local.Shapes.Polyline:if(this.dx>3||this.dy>3){this.drawPoints.push(this.curPos);
this.drawLine(this.curPos);
this.dx=0;
this.dy=0;
}break;
case ask.local.Shapes.Polygon:this.clearDraw();
this.parentMap.drawCanvas.context.moveTo(this.startPos.x,this.startPos.y);
this.parentMap.canvas.context.moveTo(this.startPos.x,this.startPos.y);
this.drawLine(this.curPos);
break;
case ask.local.Shapes.Circle:this.clearDraw();
this.drawCircle(this.startPos,this.curPos);
this.drawPoints[1]=this.curPos;
break;
case ask.local.Shapes.Rectangle:this.clearDraw();
this.drawRect(this.startPos,this.curPos);
this.drawPoints[1]=this.curPos;
break;
}},onMouseUp:function(A){this.curPos=this.getCanvasPos(A);
if(this.shape==ask.local.Shapes.Line||this.shape==ask.local.Shapes.Polygon){var B=this.curPos;
if(this.drawPoints.length==0){this.parentMap.canvas.context.moveTo(B.x,B.y);
}else{this.parentMap.canvas.context.lineTo(B.x,B.y);
this.parentMap.canvas.context.stroke();
}this.drawPoints.push(this.curPos);
this.startPos=this.curPos;
return false;
}else{this.createOverlay();
}},pixToLL:function(G){var B=this.parentMap;
var A=B.getBounds();
var C=[];
for(var E=0;
E<G.length;
E++){var K=G[E];
var J=K.x+A.minX;
var I=K.y+A.minY;
var F=ask.util.GeoMath.pix2lat(I,B.zoom);
var H=ask.util.GeoMath.pix2long(J,B.zoom);
var D=new ask.local.Point(F,H);
C.push(D);
}return C;
},rectBounds:function(A){var F=this.parentMap;
var B=F.getBounds();
var G=ask.util.GeoMath.pix2lat(A[0].y+B.minY,F.zoom);
var E=ask.util.GeoMath.pix2long(A[0].x+B.minX,F.zoom);
var D=ask.util.GeoMath.pix2lat(A[1].y+B.minY,F.zoom);
var C=ask.util.GeoMath.pix2long(A[1].x+B.minX,F.zoom);
return(new ask.local.Bounds(Math.min(G,D),Math.min(E,C),Math.max(G,D),Math.max(E,C)));
},circleBounds:function(J){var E=(J[0].x+J[1].x)/2;
var C=(J[0].y+J[1].y)/2;
var L=J[0].x-J[1].x;
var K=J[0].y-J[1].y;
var G=Math.sqrt(L*L+K*K)/2;
var B=this.parentMap;
var A=B.getBounds();
var F=ask.util.GeoMath.pix2lat(C-G+A.minY,B.zoom);
var I=ask.util.GeoMath.pix2long(E-G+A.minX,B.zoom);
var D=ask.util.GeoMath.pix2lat(C+G+A.minY,B.zoom);
var H=ask.util.GeoMath.pix2long(E+G+A.minX,B.zoom);
return(new ask.local.Bounds(Math.min(F,D),Math.min(I,H),Math.max(F,D),Math.max(I,H)));
},createOverlay:function(){var A=null;
if(this.drawPoints.length>1){switch(this.shape){case ask.local.Shapes.Polyline:A=new ask.local.Polyline(this.pixToLL(this.drawPoints),null,0,null);
break;
case ask.local.Shapes.Line:A=new ask.local.Polyline(this.pixToLL(this.drawPoints),null,0,null,true);
break;
case ask.local.Shapes.Polygon:A=new ask.local.Polygon(this.pixToLL(this.drawPoints),null,0,null,true);
break;
case ask.local.Shapes.Circle:A=new ask.local.Circle(this.circleBounds(this.drawPoints),null,0,null,true);
break;
case ask.local.Shapes.Rectangle:A=new ask.local.Rectangle(this.rectBounds(this.drawPoints),null,0,null,true);
break;
}}this.drawPoints=[];
this.removeCanvasMouseListeners();
if(A){ask.local.UI.hookupShapeEvents(A);
this.parentMap.addOverlay(A);
this.clearDraw();
this.parentMap.drawOverlays();
this.drawings.push(A);
}},removeCanvasMouseListeners:function(){__d.documentElement.onmousemove=null;
__d.documentElement.onmouseup=null;
__d.documentElement.ondblclick=null;
__d.documentElement.onkeyup=null;
},drawLine:function(A){this.parentMap.drawCanvas.context.lineTo(A.x,A.y);
this.parentMap.drawCanvas.context.stroke();
},drawCircle:function(E,A){var D=Math.max(E.x,A.x)-Math.abs(E.x-A.x)/2;
var C=Math.max(E.y,A.y)-Math.abs(E.y-A.y)/2;
var B=this.parentMap.drawCanvas.context;
B.beginPath();
if(ask.util.Browser.isOpera){B.moveTo(E.x,E.y);
}B.arc(D,C,this.getDistance(E,A)/2,0,Math.PI*2,true);
B.closePath();
B.stroke();
B.beginPath();
if(ask.util.Browser.isOpera){B.moveTo(E.x,E.y);
}B.arc(D,C,this.getDistance(E,A)/2-B.lineWidth/2,0,Math.PI*2,true);
B.closePath();
B.fill();
},drawRect:function(F,C){var D=this.parentMap.drawCanvas.context;
var B=Math.min(F.x,C.x);
var G=Math.min(F.y,C.y);
var E=Math.abs(C.x-F.x);
var A=Math.abs(C.y-F.y);
D.strokeRect(B,G,E,A);
D.fillRect(B+D.lineWidth/2,G+D.lineWidth/2,E-D.lineWidth,A-D.lineWidth);
},getDistance:function(B,A){return Math.sqrt(Math.pow(B.x-A.x,2)+Math.pow(B.y-A.y,2));
},clear:function(){if(this.parentMap){this.parentMap.canvas.context.beginPath();
this.parentMap.canvas.context.clearRect(0,0,this.parentMap.canvas.width,this.parentMap.canvas.height);
this.parentMap.canvas.context.closePath();
}},clearDraw:function(){if(this.parentMap){this.parentMap.drawCanvas.context.beginPath();
this.parentMap.drawCanvas.context.clearRect(0,0,this.parentMap.drawCanvas.width,this.parentMap.drawCanvas.height);
this.parentMap.drawCanvas.context.closePath();
}}};
ask.local.SaveControl=function(){this.parentMap=null;
var A=this;
var K=__d.ce("div");
K.id="saveCtrl";
K.className="saveControl";
K.style.zIndex=400;
K.style.position="absolute";
K.closed=false;
K.maxHeight=100;
K.minHeight=15;
var C=__d.ce("table");
var I=__d.ce("tbody");
var F=__d.ce("tr");
var H=__d.ce("td");
var G=__d.ce("td");
var D=__d.ce("td");
C.style.width="100%";
C.style.height="100%";
H.style.width="10px";
H.vAlign="top";
var B=__d.ce("img");
B.src=ask.local.UI.Defaults.SP+"left.gif";
B.style.marginTop="20px";
B.style.cursor=ask.util.Browser.handCursor;
B.alt=B.title="Scroll left";
ask.util.Events.addListener(B,"click",function(L,M){M.tdm.scrollLeft-=110;
},this);
H.appendChild(B);
G.style.width="100%";
G.style.whiteSpace="nowrap";
G.vAlign="top";
D.style.width="10px";
D.vAlign="top";
var J=__d.ce("img");
J.src=ask.local.UI.Defaults.SP+"right.gif";
J.style.marginTop="20px";
J.style.cursor=ask.util.Browser.handCursor;
J.alt=J.title="Scroll right";
ask.util.Events.addListener(J,"click",function(L,M){M.tdm.scrollLeft+=110;
},this);
D.appendChild(J);
F.appendChild(H);
F.appendChild(G);
F.appendChild(D);
I.appendChild(F);
C.appendChild(I);
K.appendChild(C);
var E=__d.ce("div");
E.id="saveCtrlTileDiv";
E.style.width="93%";
E.style.height="95px";
E.style.position=ask.util.Browser.isIE?"absolute":"relative";
E.style.overflow="hidden";
E.style.border="1px solid silver";
G.appendChild(E);
G.id="saveCtrlTileCell";
this.tdm=E;
this.controlDiv=K;
this.keyTmr=null;
};
ask.local.SaveControl.prototype=new ask.local.Control();
ask.local.SaveControl.prototype.subscribeToEvents=function(){};
ask.local.SaveControl.prototype.appendTo=function(A){if(A){A.appendChild(this.controlDiv);
}var B=this;
if(ask.local.Defaults.eraserEnabled){this.render([]);
}else{setTimeout(function(){ask.local.MyStuff.get(function(C){B.render(C);
});
},250);
}};
ask.local.SaveControl.prototype.render=function(I){var N=[];
for(var G=0;
G<I.length;
G++){if(!I[G].permalink){N.push(I[G]);
}}I=N;
ask.util.Dom.removeAllChildNodes(this.tdm);
var H=[1,2,3,4,5,6,7,8,9,10];
var F=__d.ce("table");
F.cellPadding=0;
F.cellSpacing=0;
var M=__d.ce("tbody");
var K=__d.ce("tr");
M.appendChild(K);
F.appendChild(M);
this.tdm.appendChild(F);
for(var G=0;
G<H.length;
G++){var D=__d.ce("td");
D.vAlign="top";
K.appendChild(D);
var E=__d.ce("div");
E.style.position="relative";
D.appendChild(E);
var P=I[G];
var J=__d.ce("img");
J.id="saveTile_"+G;
J.index=G;
var L="";
J.id="save_img_"+G;
if(P&&P.id&&P.thumbUrl){L=P.title;
J.src=this.parentMap.getPrintImageHost()+P.thumbUrl.replace(/__/g,"&").replace("[$iroot]",ask.local.UI.Defaults.SP)+"&lc=off";
J.alt=J.title="Load "+L;
J.saved=true;
}else{J.src=ask.local.UI.Defaults.SP+"save-to-map.gif";
J.alt=J.title="Save a snapshot of the current map";
J.saved=false;
}if(P&&P.id){J.saveId=P.id;
}J.style.margin="4px";
J.style.marginBottom="0px";
J.style.cursor=ask.util.Browser.handCursor;
J.height=70;
J.width=100;
J.loader=__d.ce("img");
J.loader.id="save_img_loader_"+G;
J.loader.onload=function(){var Q=__d.get(this.id.replace(/_loader/,""));
Q.src=this.src;
};
J.loader.onerror=function(){var Q=__d.get(this.id.replace(/_loader/,""));
Q.src=ask.local.UI.Defaults.SP+"save-to-map.gif";
alert("Could not generate map thumnail.");
};
ask.util.Events.addListener(J,"click",this.onTileClick,this);
ask.util.Events.addListener(J,"mousedown",function(){sct(43993,this);
});
var C=__d.ce("div");
C.id="actionTile_"+G;
C.style.width="40px";
C.style.height="20px";
C.style.top=ask.util.Browser.isIE?"63px":"59px";
C.style.left="4px";
C.style.position="absolute";
C.style.whiteSpace="nowrap";
C.style.zIndex=2;
if(!P||!P.id){C.style.display="none";
}J.action=C;
var O=__d.ce("img");
O.index=G;
O.src=ask.local.UI.Defaults.SP+"delete-button.gif";
O.width=50;
O.height=11;
O.alt=O.title="Delete";
O.style.cursor=ask.util.Browser.handCursor;
ask.util.Events.addListener(O,"click",this.onDeleteClick,this);
var A=__d.ce("img");
A.index=G;
A.src=ask.local.UI.Defaults.SP+"save-button.gif";
A.style.cursor=ask.util.Browser.handCursor;
A.alt=A.title="Save again";
A.width=50;
A.height=11;
ask.util.Events.addListener(A,"click",this.onSaveClick,this);
C.appendChild(A);
C.appendChild(O);
E.appendChild(C);
var B=ask.util.Dhtml.getEditBox("",97);
B.id="save_title_"+G;
B.style.marginLeft="5px";
B.style.display=J.saved?"":"none";
B.style.padding="0px";
B.value=L;
B.className="doSelect textOverlay";
ask.util.Events.addListener(B,"selectstart",ask.util.Events.stopPropagation);
ask.util.Events.addListener(B,"dblclick",ask.util.Events.stopPropagation);
ask.util.Events.addListener(B,"mousemove",ask.util.Events.stopPropagation);
ask.util.Events.addListener(B,"focus",function(){ask.local.Keys.typing=true;
});
ask.util.Events.addListener(B,"blur",function(){ask.local.Keys.typing=false;
});
ask.util.Events.addListener(B,"keyup",function(R,S){R=ask.util.Events.getEvent(R);
var Q=this;
if(R.keyCode==13){clearTimeout(S.keyTmr);
S.rename(__d.get(Q.id.replace(/_title_/,"_img_")),Q.value);
Q.blur();
}else{if(R.keyCode==27){}else{clearTimeout(S.keyTmr);
S.keyTmr=setTimeout(function(){S.rename(__d.get(Q.id.replace(/_title_/,"_img_")),Q.value);
},3000);
}}ask.util.Events.stopPropagation(R);
},this);
J.titleBox=B;
E.appendChild(J);
E.appendChild(__d.ce("br"));
E.appendChild(B);
}};
ask.local.SaveControl.prototype.onTileClick=function(A,B){if(!ask.local.Defaults.eraserEnabled&&!ask.util.Browser.supportsCookies()){alert("Please enable your cookies to save maps.");
}else{if(this.saved){B.load(this);
}else{B.save(this);
}}};
ask.local.SaveControl.prototype.onDeleteClick=function(A,B){B.remove(__d.get("save_img_"+this.index));
};
ask.local.SaveControl.prototype.onSaveClick=function(A,B){B.save(__d.get("save_img_"+this.index));
};
ask.local.SaveControl.prototype.remove=function(A){try{var C=A.saveId.replace(/save_img_/,"");
A.action.style.display="none";
A.titleBox.style.display="none";
A.titleBox.value="";
A.saved=false;
A.src=ask.local.UI.Defaults.SP+"save-to-map.gif";
A.alt=A.title="Save a snapshot of the current map";
A.saveId=undefined;
ask.local.MyStuff.remove(C);
}catch(B){alert("Could not remove saved map.");
}};
ask.local.SaveControl.prototype.save=function(F){if(ask.local.Defaults.eraserEnabled){if(ask.local.UI){ask.local.UI.showEraserDialog();
}return ;
}var H=F.titleBox.value;
if(H.length==0){H=ask.local.UI.getTitle(true);
}F.titleBox.value=H;
F.titleBox.style.display="";
F.src=ask.local.UI.Defaults.SP+"saving.gif";
var E=this.parentMap.getPrintImagePath(null,null,100,70,40);
try{F.loader.src=this.parentMap.getPrintImageHost()+E.replace("[$iroot]",ask.local.UI.Defaults.SP)+"&lc=off";
}catch(G){}ask.local.UI.search.saveMode=true;
for(var D=0;
D<this.parentMap.overlays.length;
D++){var I=this.parentMap.overlays[D];
if(I.id&&I.saved){I.savedToMyStuff=true;
}}var C=ask.local.UI.serialize(true);
ask.local.UI.search.render();
var B=F.saveId?F.saveId:"";
var A=ask.local.UI.map.infoWindow.owner;
if(A){ask.local.UI.map.infoWindow.setHtml(ask.local.UI.getBubbleMsg(A));
}ask.local.MyStuff.save(B,H,E,false,C,function(K,J){F.action.style.display="";
F.saveId=K;
F.shareId=J;
F.saved=true;
F.alt=F.title="Load "+H;
});
};
ask.local.SaveControl.prototype.load=function(A){var C=A.saveId;
var B=this;
ask.local.MyStuff.get(function(E){var F=E[0];
if(F){var D=F.data;
ask.local.UI.search.saveMode=true;
ask.local.UI.deserialize(D,true);
ask.local.History.update();
}else{alert("Save item not found in MyStuff.");
}},C);
};
ask.local.SaveControl.prototype.rename=function(A,B){var C=A.saveId;
ask.local.MyStuff.rename(C,B,function(){printfire("renamed");
});
};
ask.local.SaveControl.prototype.share=function(B,A){var C=B.saveId;
ask.local.MyStuff.share(C,A,function(){printfire("shared");
});
};
ask.local.SaveControl.prototype.getImportance=function(){return 10;
};
ask.local.SaveControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}if(this.controlDiv.style.display=="none"){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:0,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.left,top:C.bottom-this.controlDiv.maxHeight,right:C.right,bottom:C.bottom,opaque:true};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
this.tdm.style.width=((A.right-A.left)-50)+"px";
B.push(A);
};
ask.local.ScaleControl=function(){this.textWidth=70;
this.scaleWidth=115;
this.width=this.textWidth+this.scaleWidth;
this.height=27;
var C={tag:"div",attr:{style:{position:"absolute",width:this.width+"px",height:this.height+"px",zIndex:400,display:"none",backgroundColor:"white",MozOpacity:"0.66",opacity:"0.66",filter:"alpha(opacity=66)",border:"1px solid #CBCBCB",textAlign:"center",cursor:ask.util.Browser.trueDefaultCursor}},kids:{tag:"table",attr:{cellPadding:0,cellSpacing:0},kids:{tag:"tbody",kids:{tag:"tr",kids:[{tag:"td",key:"left",attr:{style:{width:this.textWidth+"px",fontWeight:"bold",fontSize:"11px",textAlign:"center"}},kids:""},{tag:"td",key:"right",style:{align:"center"}}]}}}};
var B={};
this.controlDiv=ask.util.Dom.createTree(C,B);
this.left=B["left"];
this.right=B["right"];
this.controlDiv.onselectstart=ask.util.Events.returnFalse;
this.controlDiv.onmousedown=ask.util.Events.returnFalse;
var A=__d.ce("img");
ask.util.Image.SetPng(A,ask.local.Defaults.SP+"scale.png");
A.onmousedown=function(){sct(44059);
};
this.left.onmousedown=function(){sct(44059);
};
this.right.appendChild(A);
};
ask.local.ScaleControl.prototype=new ask.local.Control();
ask.local.ScaleControl.prototype.getImportance=function(){return 3;
};
ask.local.ScaleControl.prototype.position=function(B){if(!this.isPositionable()){return ;
}var C=ask.util.Geometry.squeeze({left:0,top:25,right:this.parentMap.viewWidth,bottom:this.parentMap.viewHeight},B);
var A={left:C.right-this.width-5,top:C.top+5,right:C.right-5,bottom:C.top+this.height+5};
this.controlDiv.style.left=A.left+"px";
this.controlDiv.style.top=A.top+"px";
this.controlDiv.style.width=(A.right-A.left)+"px";
this.controlDiv.style.height=(A.bottom-A.top)+"px";
this.controlDiv.style.display="";
B.push(A);
};
ask.local.ScaleControl.prototype.subscribeToEvents=function(){this.parentMap.zoomChange.subscribe(this.update,this,true);
this.parentMap.mapMove.subscribe(this.update,this,true);
};
ask.local.ScaleControl.prototype.update=function(){var B=this.parentMap.centerX-this.scaleWidth/2;
var A=B+this.scaleWidth;
var H=this.parentMap.centerY;
var G=this.parentMap.getZoom();
var F=ask.util.GeoMath.pix2long(B,G);
var E=ask.util.GeoMath.pix2long(A,G);
var D=ask.util.GeoMath.pix2lat(H,G);
var C=ask.util.GeoMath.calculateDistance(D,F,D,E);
this.left.innerHTML=this.getDisplayString(C);
};
ask.local.ScaleControl.prototype.getDisplayString=function(B){var A=B*0.621371192;
return A<1?this.approximate(A*5280)+" feet":this.approximate(A)+" miles";
};
ask.local.ScaleControl.prototype.approximate=function(B){var A;
if(B<10){A=ask.util.Math.Round(B,1);
}else{if(B<100){A=Math.round(B);
}else{if(B<1000){A=(Math.round(B/10)*10);
}else{A=(Math.round(B/100)*100);
}}}return A;
};

ask.local.DirectionsMode=new function(){this.Driving=0;
this.Walking=1;
};
ask.local.DirectionsData=function(){this.start=null;
this.end=null;
this.xml=null;
this.html=null;
this.type=ask.local.DirectionsMode.Driving;
this.time=0;
this.length=0;
};
ask.local.Proxy=new function(){this.ProxyPath="";
this.geoPath="max";
this.getProxyPath=function(){var A="";
if(ask.local.Proxy.ProxyPath.length>1){A="http://"+window.location.host+ask.local.Proxy.ProxyPath;
}return A;
};
this.geoCode=function(A,C,E,H,F,G,D){E=E?E:20000;
var B=ask.local.Proxy.getProxyPath()+ask.local.Defaults.AMX_HOST+"/"+this.geoPath+"?q="+encodeURIComponent(A)+"&partner="+ask.local.Defaults.partnerId+"&qsrc="+ask.local.Defaults.qsrc;
if(D){B+="&box="+D.minLat+","+D.minLong+","+D.maxLat+","+D.maxLong;
}printfire("geoCode: "+B);
if(H){AjaxRequest.get({"url":B,"groupName":H,"onSuccess":function(I){ask.local.Proxy.geoCodeCallBack(I,C,G,H);
},"onGroupEnd":function(){if(F){F.call(window,H);
}},"timeout":E});
}else{AjaxRequest.get({"url":B,"onSuccess":function(I){ask.local.Proxy.geoCodeCallBack(I,C,G);
},"timeout":E});
}};
this.geoCodeCallBack=function(H,I,A,K){if(H.status==200){var J=new ask.local.Point();
try{var B=H.responseXML.getElementsByTagName("Match");
var C=B[0].childNodes[1];
var F=parseFloat(C.getAttribute("lat"));
var G=parseFloat(C.getAttribute("long"));
var E=B[0].firstChild.firstChild.nodeValue;
J=new ask.local.Point(F,G,E);
}catch(D){}if(A!=null){J.id=A;
}if(I){I.call(window,J,H.responseXML,K);
}}};
this.getSatCopy=function(A,F,E,C,D){var B=ask.local.Proxy.getProxyPath()+ask.local.Defaults.AMX_HOST+"/satinfo/"+E+"/"+A+"/"+F+"?partner="+ask.local.Defaults.partnerId+"&qsrc="+ask.local.Defaults.qsrc;
printfire("satCopy: "+B);
AjaxRequest.get({"url":B,"onSuccess":function(G){ask.local.Proxy.getSatCopyCallBack(G,C);
}});
};
this.getSatCopyCallBack=function(B,A){if(B.status==200){var E="";
try{var D=B.responseXML.getElementsByTagName("Copyright");
if(D.length>0){E=D[0].firstChild.nodeValue;
}}catch(C){}if(A){A.call(window,E);
}}};
this.SnapRadius=["m50","m50","m50","m50","m100","m200","m200","m500","m500","k1","k1","k1","k1","k1","k1","k1","k1","k5","k5","k5"];
this.reverseGeoCode=function(A,D,C,E,H,F,G){E=E?E:20000;
var B=ask.local.Proxy.getProxyPath()+ask.local.Defaults.AMX_HOST+"/rlook?ll="+encodeURIComponent(A.lat+","+A.lng)+"&r="+encodeURIComponent(ask.local.Proxy.SnapRadius[D])+"&partner="+ask.local.Defaults.partnerId+"&qsrc="+ask.local.Defaults.qsrc;
printfire("reverseGeoCode: "+B);
AjaxRequest.get({"url":B,"onSuccess":function(I){ask.local.Proxy.geoCodeCallBack(I,C,G);
},"timeout":E});
};
this.getPointsFromGeoRSS=function(A,C,B,D){D=D?D:30000;
A=ask.local.Proxy.getProxyPath()+A;
printfire("getPointsFromGeoRSS: "+A);
AjaxRequest.get({"url":A,"onSuccess":function(E){ask.local.Proxy.getPointsFromGeoRSSCallBack(E,C);
},"timeout":D});
};
this.getPointsFromGeoRSSCallBack=function(B,A){if(B.status==200){if(A){A.call(window,ask.local.Proxy.getPointsFromGeoRSSDoc(B.responseXML));
}}};
this.getPointsFromGeoRSSDoc=function(C){var E=C.documentElement.getElementsByTagName("item");
if(E.length==0){E=C.documentElement.getElementsByTagName("entry");
}var M=[];
if(E.length>0){for(var N=0;
N<E.length;
N++){try{var P=E[N];
var B,R;
if(!ask.util.Browser.isIE){B=P.getElementsByTagNameNS("http://www.w3.org/2003/01/geo/wgs84_pos#","lat").length>0?P.getElementsByTagNameNS("http://www.w3.org/2003/01/geo/wgs84_pos#","lat")[0].childNodes[0].nodeValue:null;
R=P.getElementsByTagNameNS("http://www.w3.org/2003/01/geo/wgs84_pos#","long").length>0?P.getElementsByTagNameNS("http://www.w3.org/2003/01/geo/wgs84_pos#","long")[0].childNodes[0].nodeValue:null;
}else{B=P.getElementsByTagName("geo:lat").length>0?P.getElementsByTagName("geo:lat")[0].childNodes[0].nodeValue:null;
R=P.getElementsByTagName("geo:long").length>0?P.getElementsByTagName("geo:long")[0].childNodes[0].nodeValue:null;
}var D;
if(!ask.util.Browser.isIE){D=P.getElementsByTagNameNS("http://www.opengis.net/gml","pos");
}else{D=P.getElementsByTagName("gml:pos");
}if(D.length>0){var I=D[0].childNodes[0].nodeValue;
var H=I.split(" ");
B=H[0];
R=H[1];
}var K=new ask.local.Point(B,R);
if(K.isValid()){for(var L=0;
L<P.childNodes.length;
L++){var J=P.childNodes[L];
if(J&&J.childNodes[0]){K[J.tagName]=J.childNodes[0].nodeValue;
}}M[N]=K;
}}catch(O){}}}var F=[];
if(!ask.util.Browser.isIE){F=C.getElementsByTagNameNS("http://www.opengis.net/gml","posList");
}else{F=C.getElementsByTagName("gml:posList");
}if(F.length>0){for(var N=0;
N<F.length;
N++){var A=F[N].childNodes[0].nodeValue;
var Q=A.trim().split(" ");
var G=[];
for(var L=0;
L<Q.length;
L=L+2){var B=Q[L];
var R=Q[L+1];
if(B&&R){if(B.length>0&&R.length>0){G[G.length]=new ask.local.Point(B,R);
}}}if(G.length>0){M[M.length]=G;
}}}return M;
};
this.generateGeoRss20=function(A){var G="";
var B=new Date().toString();
G+='<feed xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><title>Generated by Ask.com Maps Javascript API</title><link href="http://www.ask.com/maps"/><updated>'+B+"</updated><author><name>Ask.com</name><email>information@ask.com</email></author><id>http://www.ask.com/maps</id>";
var L,C,I;
for(var F=0;
F<A.overlays.length;
F++){var E=A.overlays[F];
if(E.point){var K=E.point;
L=K.title||"";
C=K.link||"";
I=K.description||"";
G+="<entry><title>"+L+'</title><link href="'+C+'"/><id>http://www.ask.com/maps</id><updated>'+B+"</updated><content>"+I+"</content><georss:where><gml:Point><gml:pos>"+K.lat+" "+K.lng+"</gml:pos></gml:Point></georss:where></entry>";
}else{if(E.points){G+="<georss:where><gml:LineString><gml:posList>";
for(var D=0;
D<E.points.length;
D++){var K=E.points[D];
G+=K.lat+" "+K.lng+" ";
}G+="</gml:posList></gml:LineString></georss:where>";
}}}G+="</feed>";
var J;
try{J=ask.util.Xml.parseFromString(G,"application/xml");
}catch(H){}return J;
};
this.getDirections=function(G,A,D,C,E,F){E=E?E:45000;
D=D?D:ask.local.DirectionsMode.Driving;
var B=ask.local.Proxy.getProxyPath()+ask.local.Defaults.AMX_HOST+"/nddx2?sll="+G.lat+","+G.lng+"&fll="+A.lat+","+A.lng+"&wll="+this.pointsToString(F)+"&st="+encodeURIComponent(G.address)+"&ft="+encodeURIComponent(A.address)+"&t="+D+"&partner="+ask.local.Defaults.partnerId+"&qsrc="+ask.local.Defaults.qsrc;
printfire("getDirections: "+B);
AjaxRequest.get({"url":B,"onSuccess":function(H){ask.local.Proxy.getDirectionsCallBack(H,C,G,A,D,F);
},"timeout":E});
};
this.getDirectionsCallBack=function(B,N,I,H,G,P){if(B.status==200){var O=B.responseXML;
var V=O.getElementsByTagName("Status")[0];
var C=parseInt(V.getAttribute("code"));
var M=O.getElementsByTagName("Start")[0];
var T=O.getElementsByTagName("Finish")[0];
var a=O.getElementsByTagName("Route")[0];
var b=new ask.local.DirectionsData();
b.start=I;
b.end=H;
b.xml=O;
b.type=G;
var Y=null;
if(P&&P.length){Y=O.getElementsByTagName("Waypoints")[0];
if(Y){Y=Y.getElementsByTagName("Waypoint");
if(Y.length==P.length){b.waypoints=[];
for(var W=0;
W<Y.length;
W++){b.waypoints.push({lat:Y[W].getAttribute("lat"),lng:Y[W].getAttribute("long"),addr:Y[W].firstChild.nodeValue});
}}else{a=null;
}}else{a=null;
}}if(a){var Q=[];
var U=a.getAttribute("type");
var K=a.getElementsByTagName("Time")[0].firstChild.nodeValue;
var F=a.getElementsByTagName("Length")[0].firstChild.nodeValue;
var X=a.getElementsByTagName("Steps")[0];
var S=X.getElementsByTagName("Item");
var J=Y?Y.length+1:1;
var I=0;
for(var W=0;
W<J;
W++){var E=__d.ce("table");
E.cellSpacing=0;
E.cellPadding=4;
var A=__d.ce("tbody");
E.appendChild(A);
if(W==0){var D=__d.ce("tr");
var L=__d.ce("td");
L.colSpan=3;
var R=__d.ce("div");
R.innerHTML="Distance: <b>"+F+"</b>";
R.innerHTML+=" Estimated time: <b>"+K+"</b>";
L.appendChild(R);
D.appendChild(L);
E.firstChild.appendChild(D);
}var H=I;
while(H<S.length&&!S[H].getAttribute("wpi")){H++;
}if(H<S.length){H++;
}ask.local.Proxy.addSteps(S,E,I,H);
Q.push(E);
I=H;
}b.html=Q;
b.time=K;
b.length=F;
}else{var Z=__d.ce("div");
Z.style.padding="10px";
Z.style.color="#cc0000";
Z.innerHTML="We were unable to find a route connecting your locations.";
b.html=[Z];
}N.call(window,b);
}};
this.getDirectionsByAddress=function(C,I,D,F,E,B){var A=[];
var H=new Date().getTime();
ask.local.Proxy.geoCode(C,function(J){A[0]=J;
},null,H,G,null,B);
ask.local.Proxy.geoCode(I,function(J){A[1]=J;
},null,H,G,null,B);
function G(J){if(A[0]&&A[1]){ask.local.Proxy.getDirections(A[0],A[1],D,function(K){F.call(window,K);
});
}}};
this.addSteps=function(I,A,B,E){for(var G=B;
G<E;
G++){var L=I[G];
var C=G+1;
var K=__d.ce("tr");
var D=__d.ce("td");
D.innerHTML="<b>"+C+".</b>";
K.appendChild(D);
D=__d.ce("td");
var H=L.getAttribute("s");
var F=L.firstChild.nodeValue;
F=ask.util.String.replaceChars(F,"{}","<>");
D.innerHTML=F;
K.appendChild(D);
D=__d.ce("td");
var J=L.getAttribute("di");
D.innerHTML=null!=J?J+"&nbsp;mi":"END";
K.appendChild(D);
A.firstChild.appendChild(K);
}};
this.getLatNode=function(A){return parseFloat(A.getAttribute("lat"));
};
this.getLongNode=function(A){return parseFloat(A.getAttribute("long"));
};
this.getRouteOverlay=function(F){var E=F.xml;
var C=null;
if(E){var B=E.getElementsByTagName("Route")[0];
if(B){C=new ask.local.Route();
var G=B.getElementsByTagName("Box")[0];
var D=G.getElementsByTagName("Min")[0];
var A=G.getElementsByTagName("Max")[0];
C.bounds=new ask.local.Bounds(ask.local.Proxy.getLatNode(D),ask.local.Proxy.getLongNode(D),ask.local.Proxy.getLatNode(A),ask.local.Proxy.getLongNode(A));
C.data=F;
}}return C;
};
this.pointsToString=function(C){var A="";
if(C){for(var B=0;
B<C.length;
B++){if(B>0){A+="|";
}A+=C[B].lat+","+C[B].lng;
}}return A;
};
};
ask.local.Route=function(C,D,A,E){D=D?D:"rgba(0,0,230,.5)";
A=A?A:7;
E=E?E:"rgba(255,255,255,0)";
var B=new ask.local.Shape(C,D,A,E);
B.shape=ask.local.Shapes.Polyline;
B.overlayType=ask.local.OverlayType.Route;
B.loaded=false;
B.data={};
B.routeWidth=[14,12,11,10,9,9,8,8,8,7,6,5,5,5,5,5,5,5,5,5];
B.position=function(){B.getVisiblePointsFromData();
};
B.getVisiblePointsFromData=function(I,J){J=J?J:45000;
var K=this.parentMap.getBounds();
if((this.drawZoom&&this.drawBounds)&&this.parentMap.zoom==this.drawZoom&&this.drawBounds.contains(K)){printfire("Draw bounds contains map bounds");
if(!this.requesting){this.render();
}}else{printfire("Requesting route polyline");
this.loaded=false;
var F=new ask.local.Bounds();
F.minLat=Math.max(-180,K.minLat-Math.abs((K.maxLat-K.minLat)*4));
F.minLong=Math.max(-180,K.minLong-Math.abs((K.maxLong-K.minLong)*4));
F.maxLat=Math.min(180,K.maxLat+Math.abs((K.maxLat-K.minLat)*4));
F.maxLong=Math.min(180,K.maxLong+Math.abs((K.maxLong-K.minLong)*4));
this.drawBounds=F;
this.drawZoom=this.parentMap.zoom;
var G=ask.local.Proxy.getProxyPath()+ask.local.Defaults.AMX_HOST+"/rout?oll="+this.data.start.lat+","+this.data.start.lng+"&dll="+this.data.end.lat+","+this.data.end.lng+"&wll="+ask.local.Proxy.pointsToString(this.data.waypoints)+"&t="+this.data.type+"&z="+this.parentMap.zoom+"&dpx=10&llmin="+F.minLat+","+F.minLong+"&llmax="+F.maxLat+","+F.maxLong;
"&partner="+ask.local.Defaults.partnerId+"&qsrc="+ask.local.Defaults.qsrc;
printfire("getVisiblePointsFromData: "+G);
var H=ask.util.Math.getUniqueId();
this.requestUid=H;
this.requesting=true;
AjaxRequest.get({"url":G,"onSuccess":function(L){B.getVisiblePointsFromDataCallBack(L,I,H);
},"timeout":J});
}};
B.getVisiblePointsFromDataCallBack=function(L,M,K){this.requesting=false;
if(K!=this.requestUid){printfire("Skipping details get "+K);
return ;
}if(L.status==200){var O=L.responseXML;
var H=O.getElementsByTagName("Status")[0];
var F=parseInt(H.getAttribute("code"));
this.data.xml=O;
var P=O.getElementsByTagName("VR")[0];
var J={};
if(P){this.dvsor=P.getAttribute("iLat").length==9?10000000:100000;
J.start=new ask.local.Point(parseFloat(P.getAttribute("iLat"))/this.dvsor,parseFloat(P.getAttribute("iLong")/this.dvsor));
J.walk=this.data.type=="1";
J.text="";
var G=P.getElementsByTagName("D");
var N="";
for(var I=0;
I!=G.length;
++I){N+=G[I].firstChild.nodeValue;
if(I<G.length-1){N+=",";
}}J.vr=N;
}this.data.segments=[J];
this.getPointsFromSegments();
this.loaded=true;
this.render();
if(M){M.call(window);
}}};
B.render=function(){if(this.parentMap.canvas){this.setStyle();
var N=this.parentMap.getBounds();
var a=[];
var F=[];
var O=this.parentMap.zoom;
var G=this.parentMap.canvas.context;
if(this.points&&this.points.length>0&&G){var S=0;
var R=0;
var V,U;
for(var Y=0;
Y<this.points.length;
Y++){var X=this.points[Y];
if(typeof (X)=="object"&&X.lat==undefined){if(X.length&&X.length==2){var L=X[0];
var b=X[1];
X=new ask.local.Point(L,b);
}}var Q=parseFloat(ask.util.GeoMath.long2pix(X.lng,O)-N.minX);
var P=parseFloat(ask.util.GeoMath.lat2pix(X.lat,O)-N.minY);
a.push(Q);
F.push(P);
}var I=a[0];
var H=F[0];
var Z=G.lineWidth;
var W=G.strokeStyle.replace(/rgb\(/,"rgba(");
var M=G.fillStyle.replace(/rgb\(/,"rgba(");
G.lineWidth=this.lineWidth;
G.strokeStyle=this.lineColor;
G.beginPath();
G.moveTo(I,H);
for(var Y=1;
Y<a.length;
Y++){var K=a[Y];
var J=F[Y];
G.lineTo(K,J);
}G.stroke();
G.lineWidth=Z;
G.strokeStyle=W;
G.fillStyle=M;
if(this.div&&this.div.src){var T=this.getHandlePoint();
this.div.style.left=ask.util.GeoMath.long2pix(T.lng,O)-this.lineWidth+"px";
this.div.style.top=ask.util.GeoMath.lat2pix(T.lat,O)-this.lineWidth+"px";
}}}};
B.getHandlePoint=function(){return this.points&&this.points.length?this.points[0]:new ask.local.Point(0,0);
};
B.getPointsFromSegments=function(){var N=this.data.segments;
var S=[];
var I,Y;
var U=parseFloat(this.data.length.replace(/' miles'/,""));
var F,P,W,M;
for(var T=0;
T<N.length;
T++){var V=N[T];
S.push(V.start);
if(T==0){F=P=S[0].lat;
W=M=S[0].lng;
}I=V.start.lat;
Y=V.start.lng;
var K=(V.vr)?V.vr.split(","):null;
var G=0;
var X=0;
if(K){for(var R=0;
R<K.length;
R=R+2){var H=parseFloat(K[R]);
var J=parseFloat(K[R+1]);
G+=H;
X+=J;
var O=parseFloat(G)/this.dvsor;
var L=parseFloat(X)/this.dvsor;
I=ask.util.Math.Round(I+O,5);
Y=ask.util.Math.Round(Y+L,5);
var Q=new ask.local.Point(I,Y);
S.push(Q);
F=F<Q.lat?F:Q.lat;
W=W<Q.lng?W:Q.lng;
P=P>Q.lat?P:Q.lat;
M=M>Q.lng?M:Q.lng;
G=0;
X=0;
}}}this.points=S;
};
return B;
};

