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