/*
 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.InfoWindow"]){dojo._hasResource["esri.dijit.InfoWindow"]=true;dojo.provide("esri.dijit.InfoWindow");dojo.require("dijit._Widget");dojo.require("dijit._Templated");dojo.require("dijit._Container");dojo.require("esri.InfoWindowBase");dojo.require("esri.utils");dojo.declare("esri.dijit.InfoWindow",[dijit._Widget,dijit._Templated,dijit._Container,esri.InfoWindowBase],{isContainer:true,templateString:"<div id=\"${id}.infowindow\" class=\"infowindow\" dojoAttachPoint=\"_infowindow\"\r\n  ><div style=\"position:relative;\"\r\n    ><div class=\"window\" dojoAttachPoint=\"_window\"\r\n      ><div class=\"top\"\r\n        ><div class=\"left\" dojoAttachPoint=\"_topleft\"><div class=\"sprite\"></div></div\r\n    \t\t><div class=\"right\" dojoAttachPoint=\"_topright\"\r\n    \t\t\t><div class=\"sprite\"></div\r\n    \t\t\t><div class=\"user\" dojoAttachPoint=\"_user\"\r\n    \t\t\t  ><div class=\"titlebar\" dojoAttachPoint=\"_titlebar\"\r\n    \t\t\t    ><a class=\"hide\" dojoAttachPoint=\"_hide\" dojoAttachEvent=\"onclick:hide\"><div class=\"sprite\"></div></a\r\n              ><div class=\"title\" dojoAttachPoint=\"_title\">${title}</div\r\n    \t\t\t  ></div\r\n            ><div class=\"border\" dojoAttachPoint=\"_border\"></div\r\n    \t\t\t  ><div class=\"layout content\" dojoAttachPoint=\"_content, containerNode\"\r\n    \t\t\t  ></div\r\n    \t\t\t></div\r\n    \t\t></div\r\n        ><div class=\"bottom\"\r\n          ><div class=\"left\" dojoAttachPoint=\"_bottomleft\"><div class=\"sprite\"></div></div\r\n\t\t      ><div class=\"right\" dojoAttachPoint=\"_bottomright\"><div class=\"sprite\"></div></div\r\n        ></div\r\n      ></div\r\n    ></div\r\n    ><div class=\"pointer\" dojoAttachPoint=\"_pointer\"><div dojoAttachPoint=\"_sprite\" class=\"sprite\"></div></div\r\n  ></div\r\n></div>\r\n",anchor:"upperright",fixedAnchor:null,coords:null,isShowing:true,isContentShowing:true,isTitleBarShowing:true,width:250,height:150,title:"Info Window",startup:function(){if(this._started){return;}this.inherited(arguments);this._ANCHORS=[esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT,esri.dijit.InfoWindow.ANCHOR_LOWERRIGHT,esri.dijit.InfoWindow.ANCHOR_LOWERLEFT,esri.dijit.InfoWindow.ANCHOR_UPPERLEFT];if(dojo.isIE<7){var _1=dojo.getComputedStyle(this._sprite).backgroundImage.replace(/url\(\"/i,"").replace(/\"\)/,""),_2="progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true', sizingMethod='crop', src='"+_1+"')";var s=dojo.create("div",null,dojo.body());dojo.style(s,{width:"1px",height:"1px",display:"none",backgroundImage:"none",filter:_2});var t=setTimeout(function(){dojo.destroy(s);clearTimeout(t);t=s=null;},100);dojo.query(".sprite",this.domNode).forEach(function(n){n.style.backgroundImage="none";n.style.filter=_2;});}this.resize(this.width,this.height);this.hide();},destroy:function(){if(this._destroyed){return;}this.__unregisterMapListeners();this.destroyDijits(this._title);this.destroyDijits(this._content);this._title.innerHTML=this._content.innerHTML="";this.inherited(arguments);},resize:function(_3,_4){if(!_3||!_4){return;}var _5=dojo.style;_5(this._topleft,{height:_4+"px",marginLeft:_3+"px"});_5(this._topright,{width:_3+"px",height:_4+"px"});_5(this._user,"width",(_3-8)+"px");_5(this._hide,"marginLeft",(_3-22)+"px");_5(this._title,"width",(_3-25)+"px");_5(this._content,"height",(_4-37)+"px");_5(this._bottomleft,{marginLeft:_3+"px",marginTop:_4+"px"});_5(this._bottomright,{width:(_3-5)+"px",marginTop:_4+"px"});this.width=_3;this.height=_4;if(this.coords){this._adjustPosition(this.coords,this.anchor);}this.onResize(_3,_4);},_adjustPosition:function(_6,_7){var _8=dojo.style;_8(this._infowindow,{left:Math.round(_6.x)+"px",top:Math.round(_6.y)+"px"});if(_7===esri.dijit.InfoWindow.ANCHOR_UPPERLEFT){_8(this._window,{left:null,right:(this.width+18)+"px",top:null,bottom:(this.height+50)+"px"});}else{if(_7===esri.dijit.InfoWindow.ANCHOR_UPPERRIGHT){_8(this._window,{left:"6px",right:null,top:null,bottom:(this.height+50)+"px"});}else{if(_7===esri.dijit.InfoWindow.ANCHOR_LOWERRIGHT){_8(this._window,{left:"6px",right:null,top:"43px",bottom:null});}else{if(_7===esri.dijit.InfoWindow.ANCHOR_LOWERLEFT){_8(this._window,{left:null,right:(this.width+18)+"px",top:"43px",bottom:null});}}}}},show:function(_9,_a){if(!_9){return;}if(_9.spatialReference){this.mapCoords=_9;_9=this.coords=this.map.toScreen(_9,true);}else{this.mapCoords=null;this.coords=_9;}var _b=this.map._getFrameWidth();if(_b!==-1){_9.x=_9.x%_b;if(_9.x<0){_9.x+=_b;}if(this.map.width>_b){var _c=(this.map.width-_b)/2;while(_9.x<_c){_9.x+=_b;}}}if(!_a||dojo.indexOf(this._ANCHORS,_a)===-1){_a=this.map.getInfoWindowAnchor(_9);}dojo.removeClass(this._pointer,this.anchor);_a=(this.anchor=this.fixedAnchor||_a);this._adjustPosition(_9,_a);dojo.addClass(this._pointer,_a);esri.show(this.domNode);this.isShowing=true;if(!arguments[2]){this.onShow();}},hide:function(_d){esri.hide(this.domNode);this.isShowing=false;if(!arguments[1]){this.onHide();}},showTitleBar:function(){esri.show(this._titlebar);esri.show(this._border);this.isTitleBarShowing=true;},hideTitleBar:function(){esri.hide(this._titlebar);esri.hide(this._border);this.isTitleBarShowing=false;},showContent:function(){esri.show(this._content);esri.show(this._border);this.isContentShowing=true;},hideContent:function(){esri.hide(this._content);esri.hide(this._border);this.isContentShowing=false;},move:function(_e,_f){if(_f){_e=this.coords.offset(_e.x,_e.y);}else{this.coords=_e;if(this.mapCoords){this.mapCoords=this.map.toMap(_e);}}dojo.style(this._infowindow,{left:Math.round(_e.x)+"px",top:Math.round(_e.y)+"px"});},setFixedAnchor:function(_10){if(_10&&dojo.indexOf(this._ANCHORS,_10)===-1){return;}this.fixedAnchor=_10;if(this.isShowing){this.show(this.mapCoords||this.coords,_10);}this.onAnchorChange(_10);},setTitle:function(_11){this.destroyDijits(this._title);this.__setValue("_title",_11);return this;},setContent:function(_12){this.destroyDijits(this._content);this.__setValue("_content",_12);return this;},onShow:function(){this.__registerMapListeners();this.startupDijits(this._title);this.startupDijits(this._content);},onHide:function(){this.__unregisterMapListeners();},onResize:function(){},onAnchorChange:function(){}});dojo.mixin(esri.dijit.InfoWindow,{ANCHOR_UPPERRIGHT:"upperright",ANCHOR_LOWERRIGHT:"lowerright",ANCHOR_LOWERLEFT:"lowerleft",ANCHOR_UPPERLEFT:"upperleft"});}