/*
 COPYRIGHT 2009 ESRI

 TRADE SECRETS: ESRI PROPRIETARY AND CONFIDENTIAL
 Unpublished material - all rights reserved under the
 Copyright Laws of the United States and applicable international
 laws, treaties, and conventions.

 For additional information, contact:
 Environmental Systems Research Institute, Inc.
 Attn: Contracts and Legal Services Department
 380 New York Street
 Redlands, California, 92373
 USA

 email: contracts@esri.com
 */

if(!dojo._hasResource["esri._coremap"]){dojo._hasResource["esri._coremap"]=true;dojo.provide("esri._coremap");dojo.require("dijit._base.manager");dojo.require("esri.geometry");dojo.require("esri.utils");dojo.require("esri.fx");dojo.require("dojox.gfx.matrix");dojo.require("esri.layers.graphics");dojo.require("esri.dijit.InfoWindow");dojo.declare("esri._CoreMap",null,(function(){var _1=esri.geometry.toMapPoint,_2=esri.geometry.toScreenPoint,dc=dojo.connect,_3=dojo.disconnect,dh=dojo.hitch,ds=dojo.style,_4=dojo.indexOf,_5=dojo.mixin,_6=esri.geometry.Point,_7=esri.geometry.Extent,_8=esri.layers.GraphicsLayer,_9=esri.geometry.Rect,_a=0,_b=esri.config.defaults.map;var _c=1000000,_d=0.75,_e=0.25,_f=3,_10=20,_11=40;function _12(_13,_14){var _15=_13.lods;_15.sort(function(l1,l2){if(l1.scale>l2.scale){return -1;}else{if(l1.scale<l2.scale){return 1;}}return 0;});var _16=[];_15=dojo.filter(_15,function(l){if(_4(_16,l.scale)===-1){_16.push(l.scale);return true;}});var pl=(_14.lods=[]),l;dojo.forEach(_15,function(lod,_17){l=(pl[_17]=new esri.layers.LOD(lod));l.level=_17;});_14.tileInfo=new esri.layers.TileInfo(_5(_13,{lods:pl}));};return {resizeDelay:300,constructor:function(_18,_19){_5(this,{_internalLayerIds:[],_layers:[],_layerDivs:[],_layerSize:0,_clickHandles:[],_connects:[]});_5(this,{_zoomAnimDiv:null,_zoomAnim:null,_layersDiv:null,_firstLayerId:null,_delta:null,_gc:null,_cursor:null,_ratioW:1,_ratioH:1,_params:null});_5(this,{cursor:null,layerIds:[],graphicsLayerIds:[],graphics:null,loaded:false});_5(this,{__panning:false,__zooming:false,__container:null,root:null,__LOD:null,__tileInfo:null,__visibleRect:null,__visibleDelta:null});var _1a=(this.container=dojo.byId(_18));var id=(this.id=dojo.attr(_1a,"id")||dijit.getUniqueId(this.declaredClass));dojo.addClass(_1a,"map");var box=dojo.contentBox(_1a),dac=dojo.addClass,dcr=dojo.create;this.position=new _6(0,0);this._reposition();var _1b=(this.width=(box.w||_b.width));var _1c=(this.height=box.h||_b.height);if(box.w===0){ds(_1a,"width",_1b+"px");}if(box.h===0){ds(_1a,"height",_1c+"px");}var _1d=(this.root=dcr("div",{id:id+"_root",style:{width:_1b+"px",height:_1c+"px"}}));dac(_1d,"container");var _1e=(this.__container=dcr("div",{id:id+"_container"},_1d));ds(_1e,"position","absolute");dac(_1e,"container");_1a.appendChild(_1d);var _1f=(this._params=_5({slider:true,nav:false,extent:null,layer:null,scales:null,showInfoWindowOnClick:true,displayGraphicsOnPan:true,lods:null,tileInfo:null,wrapAround180:false,fitExtent:false},_19||{}));this.wrapAround180=_1f.wrapAround180;if(esri._isDefined(_1f.resizeDelay)){this.resizeDelay=_1f.resizeDelay;}if(_1f.lods){_12({rows:512,cols:512,dpi:96,format:"JPEG",compressionQuality:75,origin:{x:-180,y:90},spatialReference:{wkid:4326},lods:_1f.lods},_1f);this.__tileInfo=_1f.tileInfo;}var ext=(this.extent=_1f.extent);this.spatialReference=(ext&&ext.spatialReference)?ext.spatialReference:null;this.__visibleRect=new _9(0,0,_1b,_1c);this.__visibleDelta=new _9(0,0,_1b,_1c);var _20=(this._layersDiv=dcr("div",{id:id+"_layers"}));dac(_20,"layersDiv");_1e.appendChild(_20);this._zoomAnimDiv=dcr("div",{style:{position:"absolute"}});if(_1f.infoWindow){this.infoWindow=_1f.infoWindow;}else{var iw=(this.infoWindow=new esri.dijit.InfoWindow({map:this,title:"",id:id+"_infowindow"},dcr("div",null,_1d)));iw.startup();iw._ootb=true;ds(iw.domNode,"zIndex",_11);}this._zoomStartHandler=dh(this,this._zoomStartHandler);this._zoomingHandler=dh(this,this._zoomingHandler);this._zoomEndHandler=dh(this,this._zoomEndHandler);this._panningHandler=dh(this,this._panningHandler);this._panEndHandler=dh(this,this._panEndHandler);this._endTranslate=dh(this,this._endTranslate);dojo.addOnWindowUnload(this,this.destroy);},_cleanUp:function(){var iw=this.infoWindow;if(iw){if(iw._ootb){iw.destroy();}else{iw.unsetMap(this);}delete this.infoWindow;}var _21=this._connects,i;for(i=_21.length-1;i>=0;i--){_3(_21[i]);delete _21[i];}_3(this._tsTimeExtentChange_connect);this.setInfoWindowOnClick(false);dojo.destroy(this.root);this.root=null;},_addLayer:function(_22,_23,_24){var id=(_22.id=_22.id||(_22 instanceof _8?_b.graphicsLayerNamePrefix:_b.layerNamePrefix)+(_a++));this._layers[id]=_22;var i;if(_23===this.layerIds||_23===this.graphicsLayerIds){i=this._layerSize;this._layerSize++;}_24=(_24===undefined||_24<0||_24>_23.length)?_23.length:_24;if(i===0){this._firstLayerId=id;}_23.splice(_24,0,id);var _25=dh(this,this._addLayerHandler),_26=this,_27=this._connects,_28=function(){if(_22.loaded){_25(_22);}else{_26[id+"_addtoken_load"]=dc(_22,"onLoad",_26,"_addLayerHandler");_26[id+"_addtoken_err"]=dc(_22,"onError",_26,function(_29){_25(_22,_29,_23);});}};if(this.loaded||i===0||(_22.loaded&&_4(this.graphicsLayerIds,id)===-1)){_28();}else{_27.push(dc(this,"onLoad",_28));}return _22;},_addLayerHandler:function(_2a,_2b,_2c){var id=this.id,_2d=_2a.id,_2e=_4(_2a instanceof _8?this.graphicsLayerIds:this.layerIds,_2d),_2f=_2e,_30=false,_31=this._params;_3(this[_2d+"_addtoken_load"]);_3(this[_2d+"_addtoken_err"]);if(_2b){delete this._layers[_2d];if(_2e!==-1){_2c.splice(_2e,1);this.onLayerAddResult(_2a,_2b);}return;}if(_2e===-1){_2e=_4(this._internalLayerIds,_2d);_2f=_10+_2e;_30=true;}if(_2a instanceof _8){var _32=_2a._setMap(this,this._gc._surface);_32.id=id+"_"+_2d;this._layerDivs[_2d]=_32;this._reorderLayers(this.graphicsLayerIds);if(_31.showInfoWindowOnClick){this._clickHandles.push(dc(_2a,"onClick",this,"_gClickHandler"));}}else{var _33=_2a._setMap(this,this._layersDiv,_2f,this.__LOD);_33.id=id+"_"+_2d;this._layerDivs[_2d]=_33;this._reorderLayers(this.layerIds);if(!_30&&_2a.declaredClass.indexOf("VETiledLayer")!==-1){this._onBingLayerAdd(_2a);}}if(_2d===this._firstLayerId){this.spatialReference=this.spatialReference||_2a.spatialReference;var _34=this.spatialReference;this.wrapAround180=(this.wrapAround180&&_34&&_34._isWrappable())?true:false;if(_2a.tileInfo){if(!this.__tileInfo){_12(_5({},_2a.tileInfo),_31);this.__tileInfo=_31.tileInfo;}else{var _35=this.__tileInfo.lods;this.__tileInfo=_5({},_2a.tileInfo);this.__tileInfo.lods=_35;}}if(this.wrapAround180){var _36=this.__tileInfo,_37=_34._getInfo();if(!_36||Math.abs(_37.origin[0]-_36.origin.x)>_37.dx){this.wrapAround180=false;}if(this.wrapAround180&&_36){esri.TileUtils._addFrameInfo(_36,_37);}}_31.units=_2a.units;this._gc=new esri.layers._GraphicsContainer();var gc=this._gc._setMap(this,this._layersDiv);gc.id=id+"_gc";this.graphics=new _8({id:id+"_graphics",displayOnPan:_31.displayGraphicsOnPan});this._addLayer(this.graphics,this._internalLayerIds,_10);}if(_2a===this.graphics){if(this.extent){var x=this._fixExtent(this.extent,_31.fitExtent);this.extent=x.extent;this.__LOD=x.lod;}var fli=this._firstLayerId;this._firstLayerId=null;this.__setExtent(this.extent||new _7(this._layers[fli].initialExtent),null,null,_31.fitExtent);this.loaded=true;this.infoWindow.setMap(this);this.onLoad(this);}if(!_30){this.onLayerAdd(_2a);this.onLayerAddResult(_2a);}_3(this[_2d+"_addLayerHandler_connect"]);},_reorderLayers:function(_38){var _39=this.onLayerReorder,djp=dojo.place,_3a=this._layerDivs,_3b=this._layers,_3c=this._gc?this._gc._surface.getEventSource():null;if(_38===this.graphicsLayerIds){dojo.forEach(_38,function(id,i){var _3d=_3a[id];if(_3d){djp(_3d.getEventSource(),_3c,i);_39(_3b[id],i);}});}else{var g=this.graphics,gId=g?g.id:null,_3e=this._layersDiv,_3f;dojo.forEach(_38,function(id,i){_3f=_3a[id];if(id!==gId&&_3f){djp(_3f,_3e,i);_39(_3b[id],i);}});if(_3c){_3c=esri.vml?_3c.parentNode:_3c;djp(_3c,_3c.parentNode,_38.length);}}this.onLayersReordered([].concat(_38));},_zoomStartHandler:function(){this.__zoomStart(this._zoomAnimDiv.startingExtent,this._zoomAnimDiv.anchor);},_zoomingHandler:function(_40){var rl=parseFloat(_40.left),rt=parseFloat(_40.top),_41=new _7(rl,rt-parseFloat(_40.height),rl+parseFloat(_40.width),rt,this.spatialReference),_42=this.extent.getWidth()/_41.getWidth();this.__zoom(_41,_42,this._zoomAnimDiv.anchor);},_zoomEndHandler:function(){var _43=this._zoomAnimDiv,_44=_43.extent,_45=this.extent.getWidth()/_44.getWidth();var _46=_43.anchor,_47=_43.newLod,_48=_43.levelChange;_43.extent=_43.anchor=_43.levelChange=_43.startingExtent=_43.newLod=this._delta=this._zoomAnim=null;this.__zoomEnd(_44,_45,_46,_47,_48);},_panningHandler:function(_49){if(isNaN(parseFloat(_49.left))||isNaN(parseFloat(_49.top))){var _4a=Math.round,_4b=dojo.style,_4c=this._panAnim.node;_49.left=(-1*(this._delta.x-_4a(this.width/2)))+"px";_49.top=(-1*(this._delta.y-_4a(this.height/2)))+"px";_4b(_4c,"left",_49.left);_4b(_4c,"top",_49.top);}var d=new _6(parseFloat(_49.left),parseFloat(_49.top)),dm=this.toMap(d);this.onPan(this.extent.offset(dm.x,dm.y),d);},_panEndHandler:function(_4d){this.__panning=false;var _4e=Math.round,_4f=new _6(-_4e(parseFloat(_4d.style.left)),-_4e(parseFloat(_4d.style.top))),dx=_4f.x,dy=_4f.y,_50=this.__visibleRect,_51=this.__visibleDelta;_50.x+=-dx;_50.y+=-dy;_51.x+=-dx;_51.y+=-dy;ds(this._zoomAnimDiv,{left:"0px",top:"0px"});var _52=this.extent,rw=this._ratioW,rh=this._ratioH;_52=(this.extent=new _7(_52.xmin+(dx/rw),_52.ymin-(dy/rh),_52.xmax+(dx/rw),_52.ymax-(dy/rh),this.spatialReference));_4f.setX(-_4f.x);_4f.setY(-_4f.y);this._delta=this._panAnim=null;this.onPanEnd(_52,_4f);this.onExtentChange(_52,_4f,false,this.__LOD);},_fixExtent:function(_53,fit){var _54=this._reshapeExtent(_53),_55=1+_e;while(fit===true&&(_54.extent.getWidth()<_53.getWidth()||_54.extent.getHeight()<_53.getHeight())&&_54.lod.level>0&&_55<=_f){_54=this._reshapeExtent(_53.expand(_55));_55+=_e;}return _54;},_getFrameWidth:function(){var _56=-1,_57=this.spatialReference._getInfo();if(this.__LOD){var _58=this.__LOD._frameInfo;if(_58){_56=_58[3];}}else{if(_57){_56=Math.round((2*_57.valid[1])/(this.extent.getWidth()/this.width));}}return _56;},_reshapeExtent:function(_59){var w=_59.getWidth(),h=_59.getHeight(),r=w/h,_5a=this.width/this.height,dw=0,dh=0;if(this.width>this.height){if(w>h){if(_5a>r){dw=(h*_5a)-w;}else{dh=(w/_5a)-h;}}else{if(w<h){dw=(h*_5a)-w;}else{dw=(h*_5a)-w;}}}else{if(this.width<this.height){if(w>h){dh=(w/_5a)-h;}else{if(w<h){if(_5a>r){dw=(h*_5a)-w;}else{dh=(w/_5a)-h;}}else{dh=(w/_5a)-h;}}}else{if(w<h){dw=h-w;}else{if(w>h){dh=(w/_5a)-h;}}}}if(dw){_59.xmin-=dw/2;_59.xmax+=dw/2;}if(dh){_59.ymin-=dh/2;_59.ymax+=dh/2;}return this._getAdjustedExtent(_59);},_getAdjustedExtent:function(_5b){if(this.__tileInfo){return esri.TileUtils.getCandidateTileInfo(this,this.__tileInfo,_5b);}else{return {extent:_5b};}},_fixedPan:function(dx,dy){this._extentUtil(null,{dx:dx,dy:dy});},_gClickHandler:function(evt){var _5c=evt.graphic,iw=this.infoWindow;if(_5c._getEffInfoTemplate()&&iw){dojo.stopEvent(evt);var _5d=_5c.geometry,_5e=(_5d&&_5d.type==="point")?_5d:evt.mapPoint;iw.setTitle(_5c.getTitle());iw.setContent(_5c.getContent());iw.show(_5e);}},_onBingLayerAdd:function(_5f){this["__"+_5f.id+"_vis_connect"]=dojo.connect(_5f,"onVisibilityChange",this,"_toggleBingLogo");this._toggleBingLogo(_5f.visible);},_onBingLayerRemove:function(_60){dojo.disconnect(this["__"+_60.id+"_vis_connect"]);delete this["__"+_60.id+"_vis_connect"];var _61=this.layerIds;var _62=dojo.some(_61,function(_63){var _64=this._layers[_63];return _64&&_64.visible&&_64.declaredClass.indexOf("VETiledLayer")!==-1;},this);this._toggleBingLogo(_62);},_toggleBingLogo:function(_65){if(_65&&!this._bingLogo){var _66={left:(this._mapParams&&this._mapParams.nav?"25px":"")};if(dojo.isIE===6){_66.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='"+dojo.moduleUrl("esri","../../images/map/logo-med.png")+"')";}var _67=this._bingLogo=dojo.create("div",{style:_66},this.root);dojo.addClass(_67,"bingLogo-lg");}else{if(!_65&&this._bingLogo){dojo.destroy(this._bingLogo);delete this._bingLogo;}}},__panStart:function(x,y){var _68=this._zoomAnim,_69=this._panAnim;if(_68&&_68._active){_68.stop();_68._fire("onEnd",[_68.node]);}else{if(_69&&_69._active){_69.stop();this._panAnim=null;var _6a=_69.curve.getValue(_69._getStep()),rl=Math.round(parseFloat(_6a.left)),rt=Math.round(parseFloat(_6a.top)),_6b=this._dragOrigin;this.__pan(rl,rt);if(_6b){_6b.x-=rl;_6b.y-=rt;}return;}}this.__panning=true;this.onPanStart(this.extent,new _6(x,y));},__pan:function(dx,dy){var _6c=this.extent,rw=this._ratioW,rh=this._ratioH;this.onPan(new _7(_6c.xmin-(dx/rw),_6c.ymin+(dy/rh),_6c.xmax-(dx/rw),_6c.ymax+(dy/rh),this.spatialReference),new _6(dx,dy));},__panEnd:function(dx,dy){var _6d=this.__visibleRect,_6e=this.__visibleDelta;_6d.x+=dx;_6d.y+=dy;_6e.x+=dx;_6e.y+=dy;var d=new _6(dx,dy),_6f=this.extent,rw=this._ratioW,rh=this._ratioH;_6f=(this.extent=new _7(_6f.xmin-(dx/rw),_6f.ymin+(dy/rh),_6f.xmax-(dx/rw),_6f.ymax+(dy/rh),this.spatialReference));this.__panning=false;this.onPanEnd(_6f,d);this.onExtentChange(_6f,d,false,this.__LOD);},__zoomStart:function(_70,_71){this.__zooming=true;this.onZoomStart(_70,1,_71,this.__LOD?this.__LOD.level:null);},__zoom:function(_72,_73,_74){this.onZoom(_72,_73,_74);},__zoomEnd:function(_75,_76,_77,lod,_78){ds(this._layersDiv,{left:"0px",top:"0px"});this._delta=new _6(0,0);this.__visibleRect.x=(this.__visibleRect.y=0);_75=(this.extent=new _7(_75));this.__LOD=lod;this._ratioW=this.width/_75.getWidth();this._ratioH=this.height/_75.getHeight();var _79=this._delta;this._delta=null;this.__zooming=false;this.onZoomEnd(_75,_76,_77,lod?lod.level:null);this.onExtentChange(_75,_79,_78,lod);},_extentUtil:function(_7a,pan,_7b,fit,_7c){var _7d,_7e,_7f,_80,_81,_82,dx,dy,_83=this.width,_84=this.height;if(_7a){_7d=_7a.numLevels;_7e=_7a.targetLevel;_7f=_7a.factor;_80=_7a.mapAnchor;_81=_7a.screenAnchor;_82=_7a.mapCenter;}if(pan){dx=pan.dx;dy=pan.dy;_82=pan.mapCenter;}var _85=this._panAnim,_86=this._stopAnim(),_87=_86?_86.divExtent:this.extent,_88=this.__tileInfo,_89,_8a,ewd,eht;if(_85&&_80&&_81){_80=_1(this.extent,_83,_84,_81);}if(_86&&_80&&_81){_80=_1(_86.divExtent,_83,_84,_81);}if(esri._isDefined(_7e)){if(_88){var _8b=this.getNumLevels()-1;if(_7e<0){_7e=0;}else{if(_7e>_8b){_7e=_8b;}}_7d=_7e-(_86?_86.level:this.getLevel());}else{_7d=_7e>0?-1:1;}}if(_7b){}else{if(esri._isDefined(_7d)){var _8c;if(_88){var _8d=_86?_86.level:this.getLevel();_8c=this.__getExtentForLevel(_8d+_7d,_82,_87).extent;}else{var _8e=_86?_86.end:this.extent;_8c=_8e.expand(_7d>0?0.5*_7d:2*-_7d);}if(_8c){if(_82){_7b=_8c;}else{var _8f=_80||_87.getCenter(),_90=_87.ymax-((_8c.getHeight()-_87.getHeight())*(_8f.y-_87.ymax)/_87.getHeight());_89=_87.xmin-((_8c.getWidth()-_87.getWidth())*(_8f.x-_87.xmin)/_87.getWidth());_7b=new _7(_89,_90-_8c.getHeight(),_89+_8c.getWidth(),_90,this.spatialReference);}}}else{if(esri._isDefined(_7f)){_7b=_87.expand(_7f);}else{if(dx||dy){if(_86){var end=_86.end,c1=end.getCenter(),c2=_2(end,_83,_84,c1);c2.x+=dx;c2.y+=dy;c2=_1(end,_83,_84,c2);_7b=end.offset(c2.x-c1.x,c2.y-c1.y);}else{var _91=new _6((_83/2)+dx,(_84/2)+dy),_92=_1(_87,_83,_84,_91);ewd=_87.getWidth();eht=_87.getHeight();_89=_92.x-(ewd/2);_8a=_92.y-(eht/2);_7b=new _7(_89,_8a,_89+ewd,_8a+eht);}}}}}if(!_7b){if(_82){var ext=_86?_86.end:_87;ewd=ext.getWidth();eht=ext.getHeight();_89=_82.x-(ewd/2);_8a=_82.y-(eht/2);_7b=new _7(_89,_8a,_89+ewd,_8a+eht);}else{if(_86){_7b=_86.end;}}}if(_7b){this.__setExtent(_7b,null,_81,fit,_86,_7c);}},__setExtent:function(_93,_94,_95,fit,_96,_97){try{if(this._firstLayerId){this.extent=_93;return;}var _98=true,ext=_96?_96.divExtent:this.extent,_99=this._fixExtent(_93,fit||false);_93=_99.extent;var _9a=_93.getWidth(),_9b=_93.getHeight(),_9c=Math.round;if(ext){var tw=_9c(ext.getWidth()*_c),w=_9c(_9a*_c),th=_9c(ext.getHeight()*_c),h=_9c(_9b*_c);_98=(tw!==w)||(th!==h);}var _9d,end,_9e,_9f,_a0=_96&&_96.rect,_a1=_96&&_96.divExtent;if(_b.zoomDuration&&_98&&ext){_a1=_a1||new _7(ext);_a0=_a0||{left:ext.xmin,top:ext.ymax,width:ext.getWidth(),height:ext.getHeight()};end={left:_93.xmin,top:_93.ymax,width:_9a,height:_9b};_9e=_a0.width/end.width;_9f=_a0.height/end.height;var mtl=new _6(_93.xmin,_93.ymax),mbl=new _6(_93.xmin,_93.ymin),etl=new _6(this.extent.xmin,this.extent.ymax),ebl=new _6(this.extent.xmin,this.extent.ymin);_9d=esri.geometry.getLineIntersection(etl,mtl,ebl,mbl);if(!_9d&&!_96){_98=false;}}this._ratioW=this.width/_9a;this._ratioH=this.height/_9b;var _a2=this._zoomAnimDiv;if(_98){ds(this._layersDiv,{left:"0px",top:"0px"});_94=new _6(0,0);this.__visibleRect.x=(this.__visibleRect.y=0);if(_a0&&end){this._delta=_94;_a2.id="_zAD";_a2.startingExtent=_a1;_a2.extent=_93;_a2.levelChange=_98;_a2.newLod=_99.lod;if(_95){_a2.anchor=_95;}else{if(!_9d&&_96){_a2.anchor=_96.anchor;}else{_a2.anchor=_2(this.extent,this.width,this.height,_9d);}}this._zoomAnim=esri.fx.resize({node:_a2,start:_a0,end:end,duration:_b.zoomDuration,rate:_b.zoomRate,beforeBegin:!_96?this._zoomStartHandler:null,onAnimate:this._zoomingHandler,onEnd:this._zoomEndHandler}).play();this._fireOnScale(this.extent.getWidth()/_93.getWidth(),_a2.anchor);}else{this.extent=_93;this.onExtentChange(this.extent,_94,_98,(this.__LOD=_99.lod));}}else{if(!this.__panning){if(this.loaded===false||_97){this.extent=_93;this.onExtentChange(this.extent,_94,_98,(this.__LOD=_99.lod));}else{this.__panning=true;_a0=new _9(0,0,this.width,this.height,this.spatialReference).getCenter();_a0.x=_9c(_a0.x);_a0.y=_9c(_a0.y);this.onPanStart(this.extent,new _6(0,0));var _a3=(this._delta=this.toScreen(_93.getCenter()));this._panAnim=esri.fx.slideTo({node:_a2,left:_a0.x-_a3.x,top:_a0.y-_a3.y,duration:_b.panDuration,rate:_b.panRate,onAnimate:this._panningHandler,onEnd:this._panEndHandler});this._panAnim.play();}}}}catch(e){console.log(e.stack);console.error(e);}},_fireOnScale:function(_a4,_a5,_a6){if(this.navigationMode==="css-transforms"){var vd=this.__visibleDelta;this.onScale(dojox.gfx.matrix.scaleAt(_a4,{x:-1*((this.width/2)-(_a5.x-vd.x)),y:-1*((this.height/2)-(_a5.y-vd.y))}),_a6);}},_stopAnim:function(){var _a7=this._zoomAnim,_a8=this._panAnim;if(_a7&&_a7._active){_a7.stop();var _a9=_a7.curve.getValue(_a7._getStep()),rl=parseFloat(_a9.left),rt=parseFloat(_a9.top),_aa=_a7.node;return {anchor:_aa.anchor,start:_aa.startingExtent,end:_aa.extent,level:_aa.newLod&&_aa.newLod.level,rect:_a9,divExtent:new _7(rl,rt-parseFloat(_a9.height),rl+parseFloat(_a9.width),rt,this.spatialReference)};}else{if(_a8&&_a8._active){_a8.stop();_a8._fire("onEnd",[_a8.node]);}}},__getExtentForLevel:function(_ab,_ac,_ad){var ti=this.__tileInfo;_ad=_ad||this.extent;_ac=_ac||_ad.getCenter();if(ti){var _ae=ti.lods;if(_ab<0||_ab>=_ae.length){return {};}var lod=_ae[_ab],_af=this.width*lod.resolution/2,_b0=this.height*lod.resolution/2;return {extent:new _7(_ac.x-_af,_ac.y-_b0,_ac.x+_af,_ac.y+_b0,_ac.spatialReference),lod:lod};}else{return {extent:_ad.expand(_ab).centerAt(_ac)};}},__scaleExtent:function(_b1,_b2,_b3){var _b4=_b3||_b1.getCenter();var _b5=_b1.expand(_b2),_b6=_b1.xmin-((_b5.getWidth()-_b1.getWidth())*(_b4.x-_b1.xmin)/_b1.getWidth()),_b7=_b1.ymax-((_b5.getHeight()-_b1.getHeight())*(_b4.y-_b1.ymax)/_b1.getHeight());return new _7(_b6,_b7-_b5.getHeight(),_b6+_b5.getWidth(),_b7,_b1.spatialReference);},_jobs:0,_incr:function(){if((++this._jobs)===1){this.updating=true;this.onUpdateStart();}},_decr:function(){var _b8=--this._jobs;if(!_b8){this.updating=false;this.onUpdateEnd();}else{if(_b8<0){this._jobs=0;}}},onUpdateStart:function(){},onUpdateEnd:function(){},onLoad:function(){this._setClipRect();},onUnload:function(){},onExtentChange:function(a,b,_b9){if(_b9){this._setClipRect();}},onTimeExtentChange:function(){},onLayerAdd:function(){},onLayerAddResult:function(){},onLayersAddResult:function(){},onLayerRemove:function(){},onLayersRemoved:function(){},onLayerReorder:function(){},onLayersReordered:function(){},onPanStart:function(){},onPan:function(){},onPanEnd:function(){},onScale:function(){},onZoomStart:function(){},onZoom:function(){},onZoomEnd:function(){},onResize:function(){this._setClipRect();},onReposition:function(){},destroy:function(){if(!this._destroyed){this.removeAllLayers();this._cleanUp();if(this._gc){this._gc._cleanUp();}this._destroyed=true;this.onUnload(this);}},setCursor:function(_ba){ds(this.__container,"cursor",(this.cursor=_ba));},setMapCursor:function(c){this.setCursor((this._cursor=c));},resetMapCursor:function(){this.setCursor(this._cursor);},setInfoWindow:function(_bb){var iw=this.infoWindow;if(iw){iw.unsetMap(this);}this.infoWindow=_bb;if(this.loaded&&_bb){_bb.setMap(this);}},setInfoWindowOnClick:function(_bc){var _bd=this._params;if(_bc){if(!_bd.showInfoWindowOnClick){var _be=[this.graphics].concat(dojo.map(this.graphicsLayerIds,this.getLayer,this));dojo.map(_be,function(_bf){if(_bf&&_bf.loaded){this._clickHandles.push(dc(_bf,"onClick",this,"_gClickHandler"));}},this);}}else{dojo.forEach(this._clickHandles,_3);this._clickHandles=[];}_bd.showInfoWindowOnClick=_bc;},getInfoWindowAnchor:function(pt){var w2=this.width/2,h2=this.height/2,_c0;if(pt.y<h2){_c0="LOWER";}else{_c0="UPPER";}if(pt.x<w2){return esri.dijit.InfoWindow["ANCHOR_"+_c0+"RIGHT"];}else{return esri.dijit.InfoWindow["ANCHOR_"+_c0+"LEFT"];}},toScreen:function(pt,_c1){return _2(this.extent,this.width,this.height,pt,_c1);},toMap:function(pt){return _1(this.extent,this.width,this.height,pt);},addLayer:function(_c2,_c3){return this._addLayer(_c2,_c2 instanceof _8?this.graphicsLayerIds:this.layerIds,_c3);},addLayers:function(_c4){var _c5=[],_c6=_c4.length,_c7,i,len=_c4.length;var _c8=function(_c9,_ca){if(dojo.indexOf(_c4,_c9)!==-1){_c6--;_c5.push({"layer":_c9,"success":!_ca,"error":_ca});if(!_c6){dojo.disconnect(_c7);this.onLayersAddResult(_c5);}}};_c7=dojo.connect(this,"onLayerAddResult",_c8);for(i=0;i<len;i++){this.addLayer(_c4[i]);}return this;},removeLayer:function(_cb){var id=_cb.id,ids=_cb instanceof _8?this.graphicsLayerIds:this.layerIds,i=_4(ids,id);if(i>=0){ids.splice(i,1);if(_cb instanceof _8){_3(this["_gl_"+_cb.id+"_click_connect"]);if(_cb.loaded){_cb._unsetMap(this,this._gc._surface);}}else{if(_cb.loaded){_cb._unsetMap(this,this._layersDiv);if(_cb.declaredClass.indexOf("VETiledLayer")!==-1){this._onBingLayerRemove(_cb);}}}delete this._layers[id];delete this._layerDivs[id];this._reorderLayers(ids);this.onLayerRemove(_cb);}},removeAllLayers:function(){var ids=this.layerIds,i;for(i=ids.length-1;i>=0;i--){this.removeLayer(this._layers[ids[i]]);}ids=this.graphicsLayerIds;for(i=ids.length-1;i>=0;i--){this.removeLayer(this._layers[ids[i]]);}this.onLayersRemoved();},reorderLayer:function(_cc,_cd){if(dojo.isString(_cc)){dojo.deprecated(this.declaredClass+": "+esri.bundle.map.deprecateReorderLayerString,null,"v2.0");_cc=this.getLayer(_cc);}var id=_cc.id,ids=_cc instanceof _8?this.graphicsLayerIds:this.layerIds;if(_cd<0){_cd=0;}else{if(_cd>=ids.length){_cd=ids.length-1;}}var i=_4(ids,id);if(i===-1||i===_cd){return;}ids.splice(i,1);ids.splice(_cd,0,id);this._reorderLayers(ids);},getLayer:function(id){return this._layers[id];},setExtent:function(_ce,fit){_ce=new esri.geometry.Extent(_ce.toJson());var _cf=_ce.getWidth(),_d0=_ce.getHeight();if(_cf===0&&_d0===0){this.centerAt(new esri.geometry.Point({x:_ce.xmin,y:_ce.ymin,spatialReference:_ce.spatialReference&&_ce.spatialReference.toJson()}));}else{this._extentUtil(null,null,_ce,fit);}},centerAt:function(_d1){this._extentUtil(null,{mapCenter:_d1});},centerAndZoom:function(_d2,_d3){this._extentUtil({targetLevel:_d3,mapCenter:_d2});},getNumLevels:function(){return this.__tileInfo?this.__tileInfo.lods.length:0;},getLevel:function(){return this.__LOD?this.__LOD.level:-1;},setLevel:function(_d4){this._extentUtil({targetLevel:_d4});},translate:function(dx,dy){dx=dx||0;dy=dy||0;if(!this._txTimer){this._tx=this._ty=0;var _d5=this.toScreen(this.extent.getCenter());this.__panStart(_d5.x,_d5.y);}this._tx+=dx;this._ty+=dy;this.__pan(this._tx,this._ty);clearTimeout(this._txTimer);this._txTimer=setTimeout(this._endTranslate,150);},_endTranslate:function(){clearTimeout(this._txTimer);this._txTimer=null;var dx=this._tx,dy=this._ty;this._tx=this._ty=0;this.__panEnd(dx,dy);},setTimeExtent:function(_d6){this.timeExtent=_d6;var arg=_d6?new esri.TimeExtent(_d6.startTime,_d6.endTime):null;this.onTimeExtentChange(arg);},setTimeSlider:function(_d7){if(this.timeSlider){_3(this._tsTimeExtentChange_connect);this._tsTimeExtentChange_connect=null;this.timeSlider=null;}if(_d7){this.timeSlider=_d7;this.setTimeExtent(_d7.getCurrentTimeExtent());this._tsTimeExtentChange_connect=dc(_d7,"onTimeExtentChange",this,"setTimeExtent");}},resize:function(_d8){var _d9=this,_da=function(){clearTimeout(_d9._resizeT);_d9.reposition();_d9._resize();};clearTimeout(_d9._resizeT);if(_d8===true){_da();}else{_d9._resizeT=setTimeout(_da,_d9.resizeDelay);}},_resize:function(){var w=this.width,h=this.height,box=dojo.contentBox(this.container);if(w===box.w&&h===box.h){return;}var _db=this._zoomAnim||this._panAnim;if(_db){_db.stop();_db._fire("onEnd",[_db.node]);}ds(this.root,{width:(this.width=box.w)+"px",height:(this.height=box.h)+"px"});var wd=this.width,ht=this.height;this.__visibleRect.update(this.__visibleRect.x,this.__visibleRect.y,wd,ht);this.__visibleDelta.update(this.__visibleDelta.x,this.__visibleDelta.y,wd,ht);var r=esri.geometry._extentToRect(this.extent),ne=(esri.geometry._rectToExtent(new _9(r.x,r.y,r.width*(wd/w),r.height*(ht/h),this.spatialReference)));this.onResize(ne,wd,ht);this._extentUtil(null,null,ne,null,true);},reposition:function(){this._reposition();this.onReposition(this.position.x,this.position.y);},_reposition:function(){var pos=dojo.coords(this.container,true),_dc=dojo._getPadBorderExtents(this.container);this.position.update(pos.x+_dc.l,pos.y+_dc.t);},_setClipRect:function(){delete this._clip;var _dd=dojo.isIE?"rect(auto,auto,auto,auto)":null;if(this.wrapAround180){var _de=this.width,_df=this.height,_e0=this._getFrameWidth(),_e1=_de-_e0;if(_e1>0){var _e2=_e1/2;_dd="rect(0px,"+(_e2+_e0)+"px,"+_df+"px,"+_e2+"px)";var _e3=this.extent.getWidth(),_e4=_e3*(_e0/_de);this._clip=[(_e3-_e4)/2,_e4];}}ds(this.__container,"clip",_dd);},_getAvailExtent:function(){var _e5=this.extent,_e6=this._clip;if(_e6){if(!_e5._clip){var _e7=new esri.geometry._extentToRect(_e5);_e7.width=_e6[1];_e7.x=_e7.x+_e6[0];_e5._clip=_e7.getExtent();}return _e5._clip;}return _e5;},panUp:function(){this._fixedPan(0,this.height*-_d);},panUpperRight:function(){this._fixedPan(this.width*_d,this.height*-_d);},panRight:function(){this._fixedPan(this.width*_d,0);},panLowerRight:function(){this._fixedPan(this.width*_d,this.height*_d);},panDown:function(){this._fixedPan(0,this.height*_d);},panLowerLeft:function(){this._fixedPan(this.width*-_d,this.height*_d);},panLeft:function(){this._fixedPan(this.width*-_d,0);},panUpperLeft:function(){this._fixedPan(this.width*-_d,this.height*-_d);},enableSnapping:function(_e8){if(!_e8){_e8={};}if(_e8.declaredClass==="esri.SnappingManager"){this.snappingManager=_e8;}else{this.snappingManager=new esri.SnappingManager(dojo.mixin({map:this},_e8));}return this.snappingManager;},disableSnapping:function(){if(this.snappingManager){this.snappingManager.destroy();}this.snappingManager=null;}};}()));}