/*
 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
 */

window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","esri.layers.graphics"],["require","esri.layers.layer"],["require","dojox.gfx"],["require","esri.graphic"],["require","esri.renderer"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["esri.layers.graphics"]){_4._hasResource["esri.layers.graphics"]=true;_4.provide("esri.layers.graphics");_4.require("esri.layers.layer");_4.require("dojox.gfx");_4.require("esri.graphic");_4.require("esri.renderer");if(_6.gfx.renderer==="vml"){esri.vml=true;_4.addOnLoad(function(){_4.declare("esri.gfx.Path",_6.gfx.Path,{setShape:function(_7){this.rawNode.path.v=(this.vmlPath=_7);return this;}});esri.gfx.Path.nodeType="shape";var _8=_6.gfx.Shape||_6.gfx.vml.Shape,_9=_8.prototype.setStroke;_8.prototype.setStroke=function(){var _a=_9.apply(this,arguments);var _b=this.rawNode,_c=_b&&_b.stroke,_d=this.getParent();if(_c&&_d){var op=esri._isDefined(_d._esriIeOpacity)?_d._esriIeOpacity:1;_c.opacity*=op;}return _a;};var _e=_8.prototype.setFill;_8.prototype.setFill=function(){var _f=_e.apply(this,arguments);var _10=this.rawNode,_11=_10&&_10.fill,_12=this.getParent();if(_11&&_12){var op=esri._isDefined(_12._esriIeOpacity)?_12._esriIeOpacity:1;if(_11.type==="tile"){_4.style(_10,"opacity",op);}else{_11.opacity*=op;}}return _f;};});}_4.declare("esri.layers._GraphicsContainer",null,{_setMap:function(map,_13){var es,_14=(this._connects=[]);this._map=map;if(_6.gfx.renderer==="canvas"){es=_4.create("div",{style:"overflow: visible; position: absolute;"},_13);this._surface={getEventSource:function(){return es;}};_14.push(_4.connect(es,"onmousedown",this,this._canvasDownHandler));_14.push(_4.connect(es,"onmouseup",this,this._canvasUpHandler));_14.push(_4.connect(es,"onclick",this,this._canvasClickHandler));esri.layers._GraphicsLayer.prototype._canvas=true;}else{var _15=(this._surface=_6.gfx.createSurface(_13,map.width,map.height));es=_15.getEventSource();_4.style((es=esri.vml?es.parentNode:es),{overflow:"visible",position:"absolute"});}_14.push(_4.connect(map,"onResize",this,"_onResizeHandler"));return es;},_onResizeHandler:function(_16,_17,_18){var es=this._surface.getEventSource(),map=this._map,_19;if(esri.vml){_4.style((es=es.parentNode),{width:_17+"px",height:_18+"px",clip:"rect(0px "+_17+"px "+_18+"px 0px)"});}_4.attr(es,"width",_17);_4.attr(es,"height",_18);if(!this._surface.declaredClass){_4.forEach(es.childNodes,function(_1a){_4.attr(_1a,"width",_17);_4.attr(_1a,"height",_18);});}if(map.loaded){if(!map.graphics._suspended){map.graphics._resized=true;}_4.forEach(map.graphicsLayerIds,function(_1b){_19=map.getLayer(_1b);if(!_19._suspended){_19._resized=true;}});}},_cleanUp:function(){_4.forEach(this._connects,_4.disconnect,_4);this._map=this._surface=null;},_processEvent:function(evt){var map=this._map;evt.screenPoint=new esri.geometry.Point(evt.pageX-map.position.x,evt.pageY-map.position.y);evt.mapPoint=map.toMap(evt.screenPoint);},_canvasDownHandler:function(evt){this._processEvent(evt);this._downPt=evt.screenPoint.x+","+evt.screenPoint.y;},_canvasUpHandler:function(evt){this._processEvent(evt);this._upPt=evt.screenPoint.x+","+evt.screenPoint.y;},_tolerance:15,_canvasClickHandler:function(evt){if(!this._downPt||!this._upPt||this._downPt!==this._upPt){return;}this._processEvent(evt);var map=this._map;var _1c=_4.map(map.graphicsLayerIds,function(id){return map.getLayer(id);});_1c.push(map.graphics);_1c.reverse();_1c=_4.filter(_1c,function(_1d){return _1d.loaded&&_1d._mouseEvents&&_1d.visible&&(!esri._isDefined(_1d.opacity)||_1d.opacity>0);});var _1e=evt.screenPoint,geo=esri.geometry,_1f=this._tolerance;var _20=_1e.x-_1f,_21=_1e.y+_1f;var _22=_1e.x+_1f,_23=_1e.y-_1f;var _24=new geo.Extent(_20,_23,_22,_21);var _25=map.toMap(new geo.Point(_20,_21));var _26=map.toMap(new geo.Point(_22,_23));var _27=new geo.Extent(_25.x,_25.y,_26.x,_26.y);var _28,_29=esri.isTouchEnabled;_4.some(_1c,function(_2a){var _2b=_4.filter(_2a.graphics,function(_2c){var _2d=_2c.getDojoShape();if(!_2c.visible||!_2d){return false;}var _2e=_2d.getTransformedBoundingBox();if(_2e){var _2f=new geo.Extent(_2e[0].x,_2e[0].y,_2e[2].x,_2e[2].y);return _29?_2f.intersects(_24):_2f.contains(_1e);}else{return _4.some(_2d.children||[],function(_30){_2e=_30.getTransformedBoundingBox();var _31=new geo.Extent(_2e[0].x,_2e[0].y,_2e[2].x,_2e[2].y);return _29?_31.intersects(_24):_31.contains(_1e);});}});if(_2b.length>0){var _32;_4.some(_2b,function(_33){if(_33.geometry&&_27.intersects(_33.geometry)){_32=_33;return true;}return false;});if(_32){_28=_32;return true;}}return false;});if(_28){var _34=_28.getLayer();if(_34){evt.graphic=_28;_34.onClick(evt);}}}});_4.declare("esri.layers._GraphicsLayer",esri.layers.Layer,{constructor:function(_35){if(_35&&(_4.isString(_35)||(_4.isObject(_35)&&_35.layerDefinition))){_35=arguments[1];}this._params=_4.mixin({displayOnPan:true,drawMode:true},_35||{});this.infoTemplate=_35&&_35.infoTemplate;this.graphics=[];this._init=false;this._suspended=false;this._draw=_4.hitch(this,this._draw);this._refresh=_4.hitch(this,this._refresh);},setDrawMode:function(_36){this._params.drawMode=_36;},renderer:null,_setMap:function(map,_37){this._map=map;var _38=map.spatialReference;this._wrap=map.wrapAround180;this._srInfo=_38._getInfo();if(!this._canvas){this._div=_37.createGroup();}else{_37=_6.gfx.createSurface(_37.getEventSource(),map.width,map.height);_4.style(_37.rawNode,"position","absolute");this._div=_37.createGroup();this._div.getEventSource=function(){return _37.rawNode;};this._renderProto=this._div.constructor.prototype._render;this._div._render=_4.hitch(this,this._canvasRender);}this._div.getEventSource().id=this.id+"_layer";this._enableAllConnectors();this._updateStatus();if(!this._suspended&&map.extent&&map.loaded===true){this._onExtentChangeHandler(map.extent,null,null,null);}var op=this.opacity;if(esri._isDefined(op)&&op<1){this.setOpacity(op,true);}return this._div;},_unsetMap:function(map,_39){_4.forEach(this.graphics,function(g){g._shape=null;});if(!this._canvas){this._div.clear();_39.remove(this._div);_4.destroy(this._div.getEventSource());}else{_39=this._div.getParent();_39._parent={};_4.destroy(_39.rawNode);_39.destroy();}this._map=this._div=null;this._init=false;this._disableAllConnectors();},_onZoomStartHandler:function(){esri.hide(this._div.getEventSource());},_onExtentChangeHandler:function(_3a,_3b,_3c,lod){if(_3c||!this._init){var _3d=this._map.__visibleRect,_3e=this._div;this._init=true;this._refresh(true);_3e.setTransform(_6.gfx.matrix.translate({x:_3d.x,y:_3d.y}));if(this._renderProto&&_3e.surface.pendingRender){this._dirty=true;}else{if(this.visible){esri.show(_3e.getEventSource());}}}else{if(this._resized){this._refresh(false);this._resized=false;}}if(this.graphics.length>0){this.onUpdate();}},_canvasRender:function(){var _3f=this._div;if(this._dirty){delete this._dirty;if(this.visible){esri.show(_3f.getEventSource());}}return this._renderProto.apply(_3f,arguments);},_refresh:function(_40){var gs=this.graphics,il=gs.length,i,_41=this._draw;for(i=0;i<il;i++){_41(gs[i],_40);}},refresh:function(){this._refresh(true);},_onPanHandler:function(_42,_43){this._panDx=_43.x;this._panDy=_43.y;var _44=this._map.__visibleRect;this._div.setTransform(_6.gfx.matrix.translate({x:_44.x+_43.x,y:_44.y+_43.y}));},_onPanEndUpdateHandler:function(_45,_46){if(!this._params._child&&(_46.x!==this._panDx||_46.y!==this._panDy)){var _47=this._map.__visibleRect;this._div.setTransform(_6.gfx.matrix.translate({x:_47.x,y:_47.y}));}this._refresh(false);if(this.graphics.length){this.onUpdate();}},_onPanStartHandler:function(){esri.hide(this._div.getEventSource());},_onPanEndHandler:function(){var _48=this._map.__visibleRect,_49=this._div;_49.setTransform(_6.gfx.matrix.translate({x:_48.x,y:_48.y}));this._refresh(false);if(this._renderProto&&_49.surface.pendingRender){this._dirty=true;}else{esri.show(_49.getEventSource());}if(this.graphics.length){this.onUpdate();}},_getDesiredStatus:function(){return this.visible;},_updateStatus:function(){if(this._getDesiredStatus()){if(this._suspended){this._resume();}}else{if(!this._suspended){this._suspend();}}},_suspend:function(){this._suspended=true;esri.hide(this._div.getEventSource());this._disableDrawConnectors();},_resume:function(){var _4a=this._div;this._suspended=false;this._enableDrawConnectors();var _4b=this._map.__visibleRect;_4a.setTransform(_6.gfx.matrix.translate({x:_4b.x,y:_4b.y}));this._refresh(true);if(this._renderProto&&_4a.surface.pendingRender){this._dirty=true;}else{esri.show(_4a.getEventSource());}},_enableAllConnectors:function(){this._disableAllConnectors();this._onVisibilityChangeHandler_connect=_4.connect(this,"onVisibilityChange",this,this._updateStatus);this._enableDrawConnectors();},_disableAllConnectors:function(){this._disableDrawConnectors();_4.disconnect(this._onVisibilityChangeHandler_connect);},_enableDrawConnectors:function(){var map=this._map,dc=_4.connect;this._disableDrawConnectors();if(this._params.displayOnPan){if(!this._params._child){this._onPanHandler_connect=dc(map,"onPan",this,"_onPanHandler");}this._onPanEndHandler_connect=dc(map,"onPanEnd",this,"_onPanEndUpdateHandler");}else{this._onPanStartHandler_connect=dc(map,"onPanStart",this,"_onPanStartHandler");this._onPanEndHandler_connect=dc(map,"onPanEnd",this,"_onPanEndHandler");}this._onZoomStartHandler_connect=dc(map,"onZoomStart",this,"_onZoomStartHandler");this._onExtentChangeHandler_connect=dc(map,"onExtentChange",this,"_onExtentChangeHandler");},_disableDrawConnectors:function(){var dd=_4.disconnect;dd(this._onExtentChangeHandler_connect);dd(this._onZoomStartHandler_connect);dd(this._onPanHandler_connect);dd(this._onPanStartHandler_connect);dd(this._onPanEndHandler_connect);},_updateExtent:function(_4c){var _4d=_4c.geometry,eg=esri.geometry;if(!_4d){_4c._extent=null;return;}var _4e=(_4c._extent=_4d.getExtent());if(!_4e){var x,y;if(_4d instanceof eg.Point){x=_4d.x;y=_4d.y;}else{if(_4d instanceof eg.Multipoint){x=_4d.points[0][0];y=_4d.points[0][1];}else{_4c._extent=null;return;}}_4c._extent=new eg.Extent(x,y,x,y,_4d.spatialReference);}},_intersects:function(map,_4f,_50){if(this._wrap&&!_50){var _51=[],_52=map._getFrameWidth(),_53=this._srInfo,_54,_55=map._clip?map._getAvailExtent():map.extent,_56=_55._getParts(_53),g,m,f,gl,ml,fl,_57,_58,_59=[],_5a=_4f._partwise;if(_5a&&_5a.length){_54=[];for(g=0,gl=_5a.length;g<gl;g++){_54=_54.concat(_5a[g]._getParts(_53));}}else{_54=_4f._getParts(_53);}for(g=0,gl=_54.length;g<gl;g++){_57=_54[g];for(m=0,ml=_56.length;m<ml;m++){_58=_56[m];if(_58.extent.intersects(_57.extent)){for(f=0,fl=_57.frameIds.length;f<fl;f++){_51.push((_58.frameIds[0]-_57.frameIds[f])*_52);}}}}for(g=0,gl=_51.length;g<gl;g++){f=_51[g];if(_4.indexOf(_51,f)===g){_59.push(f);}}return (_59.length)?_59:null;}else{return map.extent.intersects(_4f)?[0]:null;}},_draw:function(_5b,_5c){if(!this._params.drawMode||!this._map){return;}try{var _5d=_5b._extent,_5e;if(_5b.visible&&_5d&&(_5e=this._intersects(this._map,_5d,_5b.geometry._originOnly))){if(!_5b.getDojoShape()||_5c||_5e){var _5f=_5b.geometry.type;if(_5f==="point"){this._drawMarker(_5b,_5e);this._symbolizeMarker(_5b);}else{if(_5f==="multipoint"){this._drawMarkers(_5b,_5e);this._symbolizeMarkers(_5b);}else{this._drawShape(_5b,_5e);this._symbolizeShape(_5b);}}}}else{if(_5b.getDojoShape()){this._removeShape(_5b);}}}catch(err){this._errorHandler(err,_5b);}},_removeShape:function(_60){var _61=_60.getDojoShape();_61.removeShape();_60._shape=null;},_drawShape:function(_62,_63){var _64=_62.geometry,_65=_64.type,map=this._map,me=map.extent,mw=map.width,mh=map.height,eg=esri.geometry,_66=map.__visibleRect,_67=[],i,il;if(_65==="rect"||_65==="extent"){var _68;if(_65==="extent"){_68=eg.toScreenGeometry(me,mw,mh,_64);_68={x:_68.xmin-_66.x+_63[0],y:_68.ymax-_66.y,width:_68.getWidth(),height:_68.getHeight()};}else{var xy=eg.toScreenPoint(me,mw,mh,_64),wh=eg.toScreenPoint(me,mw,mh,{x:_64.x+_64.width,y:_64.y+_64.height});_68={x:xy.x-_66.x+_63[0],y:xy.y-_66.y,width:wh.x-xy.x,height:xy.y-wh.y};}if(_68.width===0){_68.width=1;}if(_68.height===0){_68.height=1;}_62._shape=this._drawRect(this._div,_62.getDojoShape(),_68);}else{if(_65==="polyline"||_65==="polygon"){for(i=0,il=_63.length;i<il;i++){_67=_67.concat(eg._toScreenPath(me,mw,mh,_64,-_66.x+_63[i],-_66.y));}_62._shape=this._drawPath(this._div,_62.getDojoShape(),_67);if(this._rendererLimits){if(_65==="polyline"){this._clipPolyline(_62._shape,_64);}else{this._clipPolygon(_62._shape,_64);}}}}},_drawRect:function(_69,_6a,_6b){return _6a?_6a.setShape(_6b):_69.createRect(_6b);},_drawImage:function(_6c,_6d,_6e){return _6d?_6d.setShape(_6e):_6c.createImage(_6e);},_drawCircle:function(_6f,_70,_71){return _70?_70.setShape(_71):_6f.createCircle(_71);},_drawPath:(function(){if(esri.vml){return function(_72,_73,_74){if(_73){return _73.setShape(_74.join(" "));}else{var p=_72.createObject(esri.gfx.Path,_74.join(" "));_72._overrideSize(p.getEventSource());return p;}};}else{return function(_75,_76,_77){return _76?_76.setShape(_77.join(" ")):_75.createPath(_77.join(" "));};}}()),_drawText:function(_78,_79,_7a){return _79?_79.setShape(_7a):_78.createText(_7a);},_getSymbol:function(_7b){return _7b.symbol||(this.renderer?this.renderer.getSymbol(_7b):null)||null;},_symbolizeShape:function(_7c){var _7d=this._getSymbol(_7c);var _7e=_7d._stroke,_7f=_7d._fill;if(_7e===null||_7f===null){_7e=_7d.getStroke();_7f=_7d.getFill();}_7c.getDojoShape().setStroke(_7e).setFill(_7f);_7d._stroke=_7e;_7d._fill=_7f;},_smsToPath:(function(){if(esri.vml){return function(SMS,_80,x,y,xMh,xPh,yMh,yPh,_81){switch(_80){case SMS.STYLE_SQUARE:return ["M",xMh+","+yMh,"L",xPh+","+yMh,xPh+","+yPh,xMh+","+yPh,"X","E"];case SMS.STYLE_CROSS:return ["M",x+","+yMh,"L",x+","+yPh,"M",xMh+","+y,"L",xPh+","+y,"E"];case SMS.STYLE_X:return ["M",xMh+","+yMh,"L",xPh+","+yPh,"M",xMh+","+yPh,"L",xPh+","+yMh,"E"];case SMS.STYLE_DIAMOND:return ["M",x+","+yMh,"L",xPh+","+y,x+","+yPh,xMh+","+y,"X","E"];case SMS.STYLE_TARGET:return ["M",xMh+","+yMh,"L",xPh+","+yMh,xPh+","+yPh,xMh+","+yPh,xMh+","+yMh,"M",(xMh-_81)+","+y,"L",xMh+","+y,"M",x+","+(yMh-_81),"L",x+","+yMh,"M",(xPh+_81)+","+y,"L",xPh+","+y,"M",x+","+(yPh+_81),"L",x+","+yPh,"E"];}};}else{return function(SMS,_82,x,y,xMh,xPh,yMh,yPh,_83){switch(_82){case SMS.STYLE_SQUARE:return ["M",xMh+","+yMh,xPh+","+yMh,xPh+","+yPh,xMh+","+yPh,"Z"];case SMS.STYLE_CROSS:return ["M",x+","+yMh,x+","+yPh,"M",xMh+","+y,xPh+","+y];case SMS.STYLE_X:return ["M",xMh+","+yMh,xPh+","+yPh,"M",xMh+","+yPh,xPh+","+yMh];case SMS.STYLE_DIAMOND:return ["M",x+","+yMh,xPh+","+y,x+","+yPh,xMh+","+y,"Z"];case SMS.STYLE_TARGET:return ["M",xMh+","+yMh,xPh+","+yMh,xPh+","+yPh,xMh+","+yPh,xMh+","+yMh,"M",(xMh-_83)+","+y,xMh+","+y,"M",x+","+(yMh-_83),x+","+yMh,"M",(xPh+_83)+","+y,xPh+","+y,"M",x+","+(yPh+_83),x+","+yPh];}};}}()),_pathStyles:{"square":1,"cross":1,"x":1,"diamond":1,"target":1},_typeMaps:{"picturemarkersymbol":"image","textsymbol":"text"},_isInvalidShape:function(_84,_85){var _86=_85&&_85.shape&&_85.shape.type,_87=_84&&_84.type,_88=_84&&_84.style;if(!_88){if(_87){_88=this._typeMaps[_87];}}else{if(this._pathStyles[_88]){_88="path";}}if(_86&&_88&&(_86!==_88)){return true;}},_drawPoint:function(_89,_8a,_8b,_8c,_8d){var _8e=_8b.type,map=this._map,_8f=map.__visibleRect,_90=esri.geometry.toScreenPoint(map.extent,map.width,map.height,_8a).offset(-_8f.x+_8d[0],-_8f.y),px=_90.x,py=_90.y,_91;if(this._isInvalidShape(_8b,_8c)){_8c.removeShape();_8c=null;}if(_8e==="simplemarkersymbol"){var _92=_8b.style,_93=_8b.size/2,_94=Math.round,SMS=esri.symbol.SimpleMarkerSymbol;switch(_92){case SMS.STYLE_SQUARE:case SMS.STYLE_CROSS:case SMS.STYLE_X:case SMS.STYLE_DIAMOND:_91=this._drawPath(_89,_8c,this._smsToPath(SMS,_92,px,py,_94(px-_93),_94(px+_93),_94(py-_93),_94(py+_93)));break;case SMS.STYLE_TARGET:var _95=_8b._targetWidth/2,_96=_8b._targetHeight/2;_91=this._drawPath(_89,_8c,this._smsToPath(SMS,_92,px,py,_94(px-_95),_94(px+_95),_94(py-_96),_94(py+_96),_8b._spikeSize));break;default:_91=this._drawCircle(_89,_8c,{cx:px,cy:py,r:_93});}}else{if(_8e==="picturemarkersymbol"){var w=_8b.width,h=_8b.height;_91=this._drawImage(_89,_8c,{x:px-(w/2),y:py-(h/2),width:w,height:h,src:_8b.url});}else{if(_8e==="textsymbol"){_91=this._drawText(_89,_8c,{type:"text",text:_8b.text,x:px,y:py,align:_8b.align,decoration:_8b.decoration,rotated:_8b.rotated,kerning:_8b.kerning});}}}_91.setTransform(_6.gfx.matrix.multiply(_6.gfx.matrix.translate(_8b.xoffset,-_8b.yoffset),_6.gfx.matrix.rotategAt(_8b.angle,_90)));_91._wrapOffsets=_8d;return _91;},_symbolizePoint:function(_97,_98){var _99=_98.type;if(_99==="picturemarkersymbol"){return;}var _9a=_98._stroke,_9b=_98._fill;if(_99==="textsymbol"){_97.setFont(_98.font).setFill(_98.getFill());}else{if(_9a===null||_9b===null){_9a=_98.getStroke();_9b=_98.getFill();}if(_99==="simplemarkersymbol"){_97.setFill(_9b).setStroke(_9a);}_98._stroke=_9a;_98._fill=_9b;}},_drawMarker:function(_9c,_9d){_9c._shape=this._drawPoint(this._div,_9c.geometry,this._getSymbol(_9c),_9c.getDojoShape(),_9d);},_symbolizeMarker:function(_9e){this._symbolizePoint(_9e.getDojoShape(),this._getSymbol(_9e));},_drawMarkers:function(_9f,_a0){var _a1=_9f.geometry,_a2=_a1.points,_a3=this._getSymbol(_9f),_a4=_9f.getDojoShape()||this._div.createGroup(),_a5,i,il=_a2.length,_a6=[],idx=0,j,jl=_a0?_a0.length:0;if(_a4.children[0]&&this._isInvalidShape(_a3,_a4.children[0])){_a4.clear();}for(i=0;i<il;i++){_a5=_a2[i];for(j=0;j<jl;j++){_a6[0]=_a0[j];this._drawPoint(_a4,{x:_a5[0],y:_a5[1]},_a3,_a4.children[idx++],_a6);}}var _a7=_a4.children.length;if(il*_a0.length<_a7){for(i=_a7-1;i>=il*_a0.length;i--){_a4.children[i].removeShape();}}_9f._shape=_a4;},_symbolizeMarkers:function(_a8){var _a9=this._getSymbol(_a8),_aa=_a8.getDojoShape(),_ab=_aa.children,i,il=_ab.length;for(i=0;i<il;i++){this._symbolizePoint(_ab[i],_a9);}},_errorHandler:function(err,_ac){var msg=esri.bundle.layers.graphics.drawingError;if(_ac){err.message=msg+"(geometry:"+(_ac.geometry?_ac.geometry.declaredClass:null)+", symbol:"+(_ac.symbol?_ac.symbol.declaredClass:null)+"): "+err.message;}else{err.message=msg+"(null): "+err.message;}this.inherited(arguments);},_rendererLimits:(function(){var _ad,_ae,_af;if(_4.isFF){_ad=16125;_ae=-32250;_af=32250;}else{if(_4.isIE<9){_ad=100000;_ae=-100000;_af=100000;}else{if(_4.isChrome&&_4.isChrome<6){_ad=8150;_ae=-10000;_af=10000;}}}if(_ad){var _b0,_b1;_b0=[-_ad,-_ad,_ad,_ad];_b1=[[[-_ad,-_ad],[_ad,-_ad]],[[_ad,-_ad],[_ad,_ad]],[[_ad,_ad],[-_ad,_ad]],[[-_ad,_ad],[-_ad,-_ad]]];return {clipLimit:_ad,rangeMin:_ae,rangeMax:_af,clipBBox:_b0,clipSegments:_b1};}}()),_clipPolyline:function(_b2,_b3){var _b4=this._getCorners(_b2,_b3);var _b5=_b4.tl,_b6=_b4.br;var _b7=this._rendererLimits;var _b8=_b7.rangeMin,_b9=_b7.rangeMax,_ba=_b7.clipBBox,_bb=_b7.clipSegments;var _bc=this._isPointWithinRange,_bd=this._isPointWithinBBox,_be=this._getClipperIntersection,_bf=this._getPlaneIndex;if(!_bc(_b5,_b8,_b9)||!_bc(_b6,_b8,_b9)){if(esri.vml){this._createSegments(_b2);}var _c0=[];_4.forEach(_b2.segments,function(_c1){var _c2=_c1.args,len=_c2.length,_c3=[],i;for(i=0;i<len;i+=2){var pt1=[_c2[i],_c2[i+1]];var pt2=[_c2[i+2],_c2[i+3]];var _c4=_bd(pt1,_ba);var _c5=_bd(pt2,_ba);if(_c4^_c5){var _c6=_be([pt1,pt2],_bb);if(_c6){if(!_c4){_c3.push(_c6[1],pt2);}else{if(i){_c3.push(_c6[1]);}else{_c3.push(pt1,_c6[1]);}_c0.push(_c3);_c3=[];}}}else{if(_c4){if(i){_c3.push(pt2);}else{_c3.push(pt1,pt2);}}else{var _c7=_bf(pt1,_ba);var _c8=_bf(pt2,_ba);if(_c7===-1||_c8===-1||_c7===_c8){continue;}var _c9=_be([pt1,pt2],_bb,true);if(_c9.length>0){if(!_c9[_c7]){_c7=_c9[_c7[0]]?_c7[0]:_c7[1];}if(!_c9[_c8]){_c8=_c9[_c8[0]]?_c8[0]:_c8[1];}var _ca=_c9[_c7],_cb=_c9[_c8];if(_ca){_c3.push(_ca);}if(_cb){_c3.push(_cb);_c0.push(_c3);_c3=[];}}}}}_c0.push(_c3);});_b2.setShape(this._getPathStringFromPaths(_c0));}},_clipPolygon:function(_cc,_cd){var _ce=this._getCorners(_cc,_cd);var _cf=_ce.tl,_d0=_ce.br;var _d1=this._rendererLimits;var _d2=_d1.clipLimit,_d3=_d1.rangeMin,_d4=_d1.rangeMax,_d5=_d1.clipBBox,_d6=_d1.clipSegments;var _d7=this._isPointWithinRange,_d8=this._isPointWithinBBox,_d9=this._getClipperIntersection,_da=this._getPlaneIndex,_db=esri.geometry._pointLineDistance;if(!_d7(_cf,_d3,_d4)||!_d7(_d0,_d3,_d4)){if(esri.vml){this._createSegments(_cc);}var _dc=_4.map(_cc.segments,function(_dd){var _de=_dd.args,len=_de.length,_df=[],_e0=[],i;for(i=0;i<len;i+=2){var pt1=[_de[i],_de[i+1]];var pt2=[_de[i+2],_de[i+3]];if(i===(len-2)){_df.push(pt1);break;}var _e1=_d8(pt1,_d5);var _e2=_d8(pt2,_d5);_df.push(pt1);if(_e1^_e2){var _e3=_d9([pt1,pt2],_d6);if(_e3){var _e4=_e3[1];_e4[_e1?"inOut":"outIn"]=true;_df.push(_e4);_e0.push([_e1?"INOUT":"OUTIN",_df.length-1,_e3[0]]);}}else{if(!_e1){var _e5=_da(pt1,_d5);var _e6=_da(pt2,_d5);if(_e5===-1||_e6===-1||_e5===_e6){continue;}var _e3=_d9([pt1,pt2],_d6,true);if(_e3.length>0){if(!_e3[_e5]){_e5=_e3[_e5[0]]?_e5[0]:_e5[1];}if(!_e3[_e6]){_e6=_e3[_e6[0]]?_e6[0]:_e6[1];}var _e7=_e3[_e5],_e8=_e3[_e6];if(_e7){_e7.outIn=true;_df.push(_e7);_e0.push(["OUTIN",_df.length-1,_e5]);}if(_e8){_e8.inOut=true;_df.push(_e8);_e0.push(["INOUT",_df.length-1,_e6]);}}else{if(_4.isArray(_e5)&&_4.isArray(_e6)){var _e9=_e5.concat(_e6);_e9.sort();if(_e9.join("")==="0123"){var _ea=[];if((_e5[0]+_e5[1])===3){_ea.push([_d2,-_d2],[-_d2,_d2]);}else{_ea.push([-_d2,-_d2],[_d2,_d2]);}var d1=_db(_ea[0],[pt1,pt2]);var d2=_db(_ea[1],[pt1,pt2]);_df.push((d1<d2)?_ea[0]:_ea[1]);}}}}}}var _eb=_d5[0],_ec=_d5[1],_ed=_d5[2],_ee=_d5[3];_4.forEach(_df,function(_ef){if(_ef[0]<_eb){if(_ef[1]>=_ec&&_ef[1]<=_ee){_ef[0]=_eb;}else{_ef[0]=_eb;_ef[1]=_ef[1]<_ec?_ec:_ee;}}});_4.forEach(_df,function(_f0){if(_f0[1]<_ec){if(_f0[0]>=_eb&&_f0[0]<=_ed){_f0[1]=_ec;}else{_f0[1]=_ec;_f0[0]=_f0[0]<_eb?_eb:_ed;}}});_4.forEach(_df,function(_f1){if(_f1[0]>_ed){if(_f1[1]>=_ec&&_f1[1]<=_ee){_f1[0]=_ed;}else{_f1[0]=_ed;_f1[1]=_f1[1]<_ec?_ec:_ee;}}});_4.forEach(_df,function(_f2){if(_f2[1]>_ee){if(_f2[0]>=_eb&&_f2[0]<=_ed){_f2[1]=_ee;}else{_f2[1]=_ee;_f2[0]=_f2[0]<_eb?_eb:_ed;}}});var k=0,len=_e0.length;if(len>0){do{var _f3=_e0[k];var _f4=_e0[(k+1)%len];if(_f3[2]===_f4[2]&&_f3[0]==="INOUT"&&_f4[0]==="OUTIN"){var _f5=_f3[1],end=_f4[1],u;if(_f5<end){for(u=_f5+1;u<end;u++){_df[u][2]=true;}}else{if(_f5>end){for(u=_f5+1;u<_df.length;u++){_df[u][2]=true;}for(u=0;u<end;u++){_df[u][2]=true;}}}}k=(k+1)%len;}while(k!==0);}var _f6=_df[0],_f7=_df[_df.length-1];if(_f6[2]){_f7[2]=true;_4.some(_e0,function(_f8){if(_f8[1]===1){_df.splice(_df.length-1,0,_4.clone(_df[1]));return true;}return false;});}_df=_4.filter(_df,function(_f9){return _f9[2]?false:true;});for(k=0;k<_df.length-1;k++){var now=_df[k];var _f4=_df[k+1];if(!_f4||(now[0]!==_f4[0])||(now[1]!==_f4[1])){continue;}if(_f4.outIn){now.outIn=true;}else{if(_f4.inOut){now.inOut=true;}}_df.splice(k+1,1);}var abs=Math.abs,_fa=[];for(k=0;k<_df.length-1;k++){var _f3=_df[k],cx=_f3[0],cy=_f3[1];var x1=(abs(cx)===_d2);var y1=(abs(cy)===_d2);var _f4=_df[k+1],nx=_f4[0],ny=_f4[1];var x2=(abs(nx)===_d2);var y2=(abs(ny)===_d2);if(x1&&y2){_fa.push([k+1,[cx,ny]]);}else{if(y1&&x2){_fa.push([k+1,[nx,cy]]);}}}for(k=_fa.length-1;k>=0;k--){var _fb=_fa[k];var _fc=_df[_fb[0]-1];var now=_df[_fb[0]];if(_fc.outIn||_fc.inOut||now.outIn||now.inOut){continue;}_df.splice(_fb[0],0,_fb[1]);}var _f6=_df[0],_f7=_df[_df.length-1];if(_f6[0]!==_f7[0]||_f6[1]!==_f7[1]){_df.push(_f6);}return _df;});_cc.setShape(this._getPathStringFromPaths(_dc));}},_getCorners:function(_fd,_fe){if(esri.vml){var map=this._map;var _ff=_fe.getExtent();var _100=map.toScreen(new esri.geometry.Point(_ff.xmin,_ff.ymax));var _101=map.toScreen(new esri.geometry.Point(_ff.xmax,_ff.ymin));return {tl:_100,br:_101};}else{var _102=_fd.getTransformedBoundingBox();return {tl:_102[0],br:_102[2]};}},_createSegments:function(_103){_103.shape.path=_103.vmlPath;_103.segmented=false;_103._confirmSegmented();var _104=_103.segments;if(_104.length>1){_103.segments=_4.filter(_104,function(_105,idx,arr){var next=arr[idx+1];if(_105.action==="M"&&next&&next.action==="L"){_105.args=_105.args.concat(next.args);return true;}return false;});}},_getPathStringFromPaths:function(_106){if(esri.vml){_106=_4.map(_106,function(path){var _107=_4.map(path,function(_108,idx){return (idx===1?"l ":"")+_108.join(",");});return "m "+_107.join(" ");});_106.push("e");}else{_106=_4.map(_106,function(path){var _109=_4.map(path,function(_10a){return _10a.join(",");});return "M "+_109.join(" ");});}return _106.join(" ");},_isPointWithinBBox:function(_10b,bbox){var left=bbox[0],top=bbox[1];var _10c=bbox[2],_10d=bbox[3];var x=_10b[0],y=_10b[1];if(x>left&&x<_10c&&y>top&&y<_10d){return true;}else{return false;}},_isPointWithinRange:function(_10e,_10f,_110){var x=_10e.x,y=_10e.y;if(x<_10f||y<_10f||x>_110||y>_110){return false;}else{return true;}},_getClipperIntersection:function(line,_111,_112){var i,_113=esri.geometry._getLineIntersection2,_114=Math.round,data={length:0};for(i=0;i<4;i++){var _115=_113(line,_111[i]);if(_115){_115[0]=_114(_115[0]);_115[1]=_114(_115[1]);if(!_112){return [i,_115];}else{data[i]=_115;data.length++;}}}return _112?data:null;},_getPlaneIndex:function(_116,_117){var px=_116[0],py=_116[1],xmin=_117[0],ymin=_117[1],xmax=_117[2],ymax=_117[3];if(px<=xmin){if((py>=ymin)&&(py<=ymax)){return 3;}else{return (py<ymin)?[0,3]:[2,3];}}if(py<=ymin){if((px>=xmin)&&(px<=xmax)){return 0;}else{return (px<xmin)?[3,0]:[1,0];}}if(px>=xmax){if((py>=ymin)&&(py<=ymax)){return 1;}else{return (py<ymin)?[0,1]:[2,1];}}if(py>=ymax){if((px>=xmin)&&(px<=xmax)){return 2;}else{return (px<xmin)?[3,2]:[1,2];}}return -1;},onGraphicAdd:function(){},onGraphicRemove:function(){},onGraphicsClear:function(){},onOpacityChange:function(){},setInfoTemplate:function(_118){this.infoTemplate=_118;},add:function(_119){var _11a=arguments[1];if(_119._graphicsLayer===this){return _119;}if(!_11a){this.graphics.push(_119);}_119._graphicsLayer=this;this._updateExtent(_119);this._draw(_119);if(!_11a){this.onGraphicAdd(_119);}return _119;},remove:function(_11b){if(!arguments[1]){var _11c=this.graphics,i;if((i=_4.indexOf(_11c,_11b))===-1){return null;}_11b=this.graphics.splice(i,1)[0];}if(_11b.getDojoShape()){this._removeShape(_11b);}_11b._shape=_11b._graphicsLayer=null;this.onGraphicRemove(_11b);return _11b;},clear:function(){var _11d=arguments[1],g=this.graphics;while(g.length>0){this.remove(g[0]);}if(!_11d){this.onGraphicsClear();}},setOpacity:function(op,_11e){if(_11e||this.opacity!=op){var div=this._div;if(div){if(esri.vml){_4.forEach(this.graphics,function(_11f){var _120=_11f._shape;var node=_120&&_120.getNode();if(node){var _121=_120.strokeStyle,_122=node.stroke;if(_121&&_122){_122.opacity=_121.color.a*op;}var _123=_120.fillStyle,fill=node.fill;if(_123&&fill){if(fill.type==="tile"){_4.style(node,"opacity",op);}else{fill.opacity=_123.a*op;}}}});div._esriIeOpacity=op;}else{if(this._canvas){_4.style(div.getEventSource(),"opacity",op);}else{div.getEventSource().setAttribute("opacity",op);}}}this.opacity=op;if(!_11e){this.onOpacityChange(op);}}},setRenderer:function(ren){this.renderer=ren;}});_4.declare("esri.layers.GraphicsLayer",esri.layers._GraphicsLayer,{constructor:function(){this.enableMouseEvents=_4.hitch(this,this.enableMouseEvents);this.disableMouseEvents=_4.hitch(this,this.disableMouseEvents);this._processEvent=_4.hitch(this,this._processEvent);this._initLayer();},_initLayer:function(){this.loaded=true;this.onLoad(this);},_setMap:function(){var d=this.inherited("_setMap",arguments);this.enableMouseEvents();return d;},_unsetMap:function(){this.disableMouseEvents();this.inherited("_unsetMap",arguments);},_processEvent:function(evt){var _124=this._map,g=this.graphics,gl=g.length;evt.screenPoint=new esri.geometry.Point(evt.pageX-_124.position.x,evt.pageY-_124.position.y);evt.mapPoint=_124.toMap(evt.screenPoint);var i,es,gr,ds,_125=evt.target,_126=_125.parentNode;for(i=0;i<gl;i++){gr=g[i];ds=gr.getDojoShape();if(ds){es=ds.getEventSource();if(es===_125||es===_126){evt.graphic=gr;return evt;}}}},_onMouseOverHandler:function(evt){if(this._processEvent(evt)){this.onMouseOver(evt);}},_onMouseMoveHandler:function(evt){if(this._processEvent(evt)){this.onMouseMove(evt);}},_onMouseDragHandler:function(evt){if(this._processEvent(evt)){this.onMouseDrag(evt);}},_onMouseOutHandler:function(evt){if(this._processEvent(evt)){this.onMouseOut(evt);}},_onMouseDownHandler:function(evt){this._downGr=this._downPt=null;if(this._processEvent(evt)){_4.disconnect(this._onmousemove_connect);_4.disconnect(this._onmousedrag_connect);this._onmousedrag_connect=_4.connect(this._div.getEventSource(),"onmousemove",this,"_onMouseDragHandler");this._downGr=evt.graphic;this._downPt=evt.screenPoint.x+","+evt.screenPoint.y;this.onMouseDown(evt);}},_onMouseUpHandler:function(evt){this._upGr=this._upPt=null;if(this._processEvent(evt)){_4.disconnect(this._onmousedrag_connect);_4.disconnect(this._onmousemove_connect);this._onmousemove_connect=_4.connect(this._div.getEventSource(),"onmousemove",this,"_onMouseMoveHandler");this._upGr=evt.graphic;this._upPt=evt.screenPoint.x+","+evt.screenPoint.y;this.onMouseUp(evt);}},_onClickHandler:function(evt){if(this._processEvent(evt)){var _127=this._downGr,upGr=this._upGr;if(_127&&upGr&&_127===upGr&&this._downPt===this._upPt){if(_4.isIE<9){esri.layers.GraphicsLayer._clicked=evt.graphic;}this.onClick(evt);}}},_onDblClickHandler:function(evt){if(this._processEvent(evt)){this.onDblClick(evt);}},onMouseOver:function(){},onMouseMove:function(){},onMouseDrag:function(){},onMouseOut:function(){},onMouseDown:function(){},onMouseUp:function(){},onClick:function(){},onDblClick:function(){},enableMouseEvents:function(){if(this._mouseEvents){return;}var dc=_4.connect,gc=this._div.getEventSource();if(_6.gfx.renderer!=="canvas"){this._onmouseover_connect=dc(gc,"onmouseover",this,"_onMouseOverHandler");this._onmousemove_connect=dc(gc,"onmousemove",this,"_onMouseMoveHandler");this._onmouseout_connect=dc(gc,"onmouseout",this,"_onMouseOutHandler");this._onmousedown_connect=dc(gc,"onmousedown",this,"_onMouseDownHandler");this._onmouseup_connect=dc(gc,"onmouseup",this,"_onMouseUpHandler");this._onclick_connect=dc(gc,"onclick",this,"_onClickHandler");this._ondblclick_connect=dc(gc,"ondblclick",this,"_onDblClickHandler");}this._mouseEvents=true;},disableMouseEvents:function(){if(!this._mouseEvents){return;}var ddc=_4.disconnect;ddc(this._onmouseover_connect);ddc(this._onmousemove_connect);ddc(this._onmousedrag_connect);ddc(this._onmouseout_connect);ddc(this._onmousedown_connect);ddc(this._onmouseup_connect);ddc(this._onclick_connect);ddc(this._ondblclick_connect);this._mouseEvents=false;}});}}};});