/*
 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.dijit.InfoWindowLite"]){dojo._hasResource["esri.dijit.InfoWindowLite"]=true;dojo.provide("esri.dijit.InfoWindowLite");dojo.require("esri.InfoWindowBase");dojo.require("esri.utils");dojo.declare("esri.dijit.InfoWindow",[esri.InfoWindowBase],{constructor:function(_1,_2){dojo.mixin(this,_1);var _3=(this.domNode=dojo.byId(_2));_3.id=this.id||dijit.getUniqueId(this.declaredClass);dojo.addClass(_3,"simpleInfoWindow");this._title=dojo.create("div",{"class":"title"},_3);this._content=dojo.create("div",{"class":"content"},_3);this._close=dojo.create("div",{"class":"close"},_3);},domNode:null,anchor:"upperright",fixedAnchor:null,coords:null,isShowing:true,width:250,height:150,title:"Info Window",_bufferWidth:10,_bufferHeight:10,startup:function(){this._anchors=[esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT,esri.dijit.InfoWindow.ANCHOR_LOWERRIGHT,esri.dijit.InfoWindow.ANCHOR_LOWERLEFT,esri.dijit.InfoWindow.ANCHOR_UPPERLEFT];this.resize(this.width,this.height);this.hide();this._closeConnect=dojo.connect(this._close,"onclick",this,this.hide);},destroy:function(){if(this.isShowing){this.hide();}this.destroyDijits(this._title);this.destroyDijits(this._content);dojo.disconnect(this._closeConnect);dojo.destroy(this.domNode);this.domNode=this._title=this._content=this._anchors=this._closeConnect=null;},setTitle:function(_4){if(!_4){dojo.addClass(this._title,"empty");}else{dojo.removeClass(this._title,"empty");}this.destroyDijits(this._title);this.__setValue("_title",_4);return this;},setContent:function(_5){if(!_5){dojo.addClass(this._title,"empty");}else{dojo.removeClass(this._title,"empty");}this.destroyDijits(this._content);this.__setValue("_content",_5);return this;},setFixedAnchor:function(_6){if(_6&&dojo.indexOf(this._anchors,_6)===-1){return;}this.fixedAnchor=_6;if(this.isShowing){this.show(this.mapCoords||this.coords,_6);}this.onAnchorChange(_6);},show:function(_7,_8){if(!_7){return;}if(_7.spatialReference){this.mapCoords=_7;_7=this.coords=this.map.toScreen(_7,true);}else{this.mapCoords=null;this.coords=_7;}if(!_8||dojo.indexOf(this._anchors,_8)===-1){_8=this.map.getInfoWindowAnchor(_7);}_8=(this.anchor=this.fixedAnchor||_8);esri.show(this.domNode);this._adjustContentArea();this._adjustPosition(_7,_8);this.isShowing=true;if(!arguments[2]){this.onShow();}},hide:function(){esri.hide(this.domNode);this.isShowing=false;if(!arguments[1]){this.onHide();}},move:function(_9,_a){if(_a){_9=this.coords.offset(_9.x,_9.y);}else{this.coords=_9;if(this.mapCoords){this.mapCoords=this.map.toMap(_9);}}this._adjustPosition(_9,this.anchor);},resize:function(_b,_c){this.width=_b;this.height=_c;dojo.style(this.domNode,{width:_b+"px",height:_c+"px"});dojo.style(this._close,{left:(_b-2)+"px",top:"-12px"});this._adjustContentArea();if(this.coords){this._adjustPosition(this.coords,this.anchor);}this.onResize(_b,_c);},onShow:function(){this.__registerMapListeners();this.startupDijits(this._title);this.startupDijits(this._content);},onHide:function(){this.__unregisterMapListeners();},onResize:function(){},onAnchorChange:function(){},_adjustContentArea:function(){var _d=dojo.contentBox(this.domNode);var _e=dojo.coords(this._title);var _f=dojo.coords(this._content);var _10=dojo.contentBox(this._content);var _11=_f.h-_10.h;dojo.style(this._content,{height:(_d.h-_e.h-_11)+"px"});},_adjustPosition:function(_12,_13){var _14=Math.round(_12.x),_15=Math.round(_12.y);var _16=this._bufferWidth,_17=this._bufferHeight;var _18=dojo.coords(this.domNode);switch(_13){case esri.dijit.InfoWindow.ANCHOR_UPPERLEFT:_14-=(_18.w+_16);_15-=(_18.h+_17);break;case esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT:_14+=_16;_15-=(_18.h+_17);break;case esri.dijit.InfoWindow.ANCHOR_LOWERRIGHT:_14+=_16;_15+=_17;break;case esri.dijit.InfoWindow.ANCHOR_LOWERLEFT:_14-=(_18.w+_16);_15+=_17;break;}dojo.style(this.domNode,{left:_14+"px",top:_15+"px"});}});dojo.mixin(esri.dijit.InfoWindow,{ANCHOR_UPPERRIGHT:"upperright",ANCHOR_LOWERRIGHT:"lowerright",ANCHOR_LOWERLEFT:"lowerleft",ANCHOR_UPPERLEFT:"upperleft"});}