/*
 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.graphic"]){dojo._hasResource["esri.graphic"]=true;dojo.provide("esri.graphic");dojo.require("esri.geometry");dojo.require("esri.symbol");dojo.declare("esri.Graphic",null,{constructor:function(_1,_2,_3,_4){if(_1&&!(_1 instanceof esri.geometry.Geometry)){this.geometry=_1.geometry?esri.geometry.fromJson(_1.geometry):null;this.symbol=_1.symbol?esri.symbol.fromJson(_1.symbol):null;this.attributes=_1.attributes||null;this.infoTemplate=_1.infoTemplate?new esri.InfoTemplate(_1.infoTemplate):null;}else{this.geometry=_1;this.symbol=_2;this.attributes=_3;this.infoTemplate=_4;}},_shape:null,_graphicsLayer:null,_visible:true,visible:true,getDojoShape:function(){return this._shape;},getLayer:function(){return this._graphicsLayer;},setGeometry:function(_5){this.geometry=_5;var gl=this._graphicsLayer;if(gl){gl._updateExtent(this);gl._draw(this,true);}return this;},setSymbol:function(_6,_7){var gl=this._graphicsLayer,_8=this._shape;this.symbol=_6;if(_6){this.symbol._stroke=this.symbol._fill=null;}if(gl){if(_7){if(_8){gl._removeShape(this);}gl._draw(this,true);return this;}if(!this.geometry){return this;}var _9=this.geometry.type;if(_9==="point"||_9==="multipoint"){gl._draw(this,true);}else{if(_8){gl._symbolizeShape(this);}}}return this;},setAttributes:function(_a){this.attributes=_a;return this;},setInfoTemplate:function(_b){this.infoTemplate=_b;return this;},_getEffInfoTemplate:function(){var _c=this.getLayer();return this.infoTemplate||(_c&&_c.infoTemplate);},getTitle:function(){var _d=this._getEffInfoTemplate();var _e=_d&&_d.title;if(dojo.isFunction(_e)){_e=_e.call(_d,this);}else{if(dojo.isString(_e)){var _f=this._graphicsLayer;var _10=_f&&_f._getDateOpts;_e=esri.substitute(this.attributes,_e,{first:true,dateFormat:_10&&_10.call(_f)});}}return _e;},getContent:function(){var _11=this._getEffInfoTemplate();var _12=_11&&_11.content;if(dojo.isFunction(_12)){_12=_12.call(_11,this);}else{if(dojo.isString(_12)){var _13=this._graphicsLayer;var _14=_13&&_13._getDateOpts;_12=esri.substitute(this.attributes,_12,{dateFormat:_14&&_14.call(_13)});}}return _12;},show:function(){this.visible=this._visible=true;if(this._shape){var _15=this._shape.getEventSource();if(_15){esri.show(_15);}}else{if(this._graphicsLayer){this._graphicsLayer._draw(this,true);}}return this;},hide:function(){this.visible=this._visible=false;var _16=this._shape;if(_16){var _17=_16.getEventSource();if(_17){esri.hide(_17);}else{var _18=this._graphicsLayer;if(_18){_18._removeShape(this);}}}return this;},toJson:function(){var _19={};if(this.geometry){_19.geometry=this.geometry.toJson();}if(this.attributes){_19.attributes=dojo.mixin({},this.attributes);}if(this.symbol){_19.symbol=this.symbol.toJson();}if(this.infoTemplate){_19.infoTemplate=this.infoTemplate.toJson();}return _19;}});dojo.declare("esri.InfoTemplate",null,{constructor:function(_1a,_1b){if(_1a&&dojo.isObject(_1a)&&!dojo.isFunction(_1a)){dojo.mixin(this,_1a);}else{this.title=_1a||"${*}";this.content=_1b||"${*}";}},setTitle:function(_1c){this.title=_1c;return this;},setContent:function(_1d){this.content=_1d;return this;},toJson:function(){return esri._sanitize({title:this.title,content:this.content});}});}