/*
	Copyright (c) 2004-2011, The Dojo Foundation All Rights Reserved.
	Available via Academic Free License >= 2.1 OR the modified BSD license.
	see: http://dojotoolkit.org/license for details
*/


window[esri._dojoScopeName||"dojo"]._xdResourceLoaded(function(_1,_2,_3){return {depends:[["provide","dojox.widget.Toaster"],["require","dojo.fx"],["require","dojo.window"],["require","dijit._Widget"],["require","dijit._Templated"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dojox.widget.Toaster"]){_4._hasResource["dojox.widget.Toaster"]=true;_4.provide("dojox.widget.Toaster");_4.require("dojo.fx");_4.require("dojo.window");_4.require("dijit._Widget");_4.require("dijit._Templated");_4.declare("dojox.widget.Toaster",[_5._Widget,_5._Templated],{templateString:"<div class=\"dijitToasterClip\" dojoAttachPoint=\"clipNode\"><div class=\"dijitToasterContainer\" dojoAttachPoint=\"containerNode\" dojoAttachEvent=\"onclick:onSelect\"><div class=\"dijitToasterContent\" dojoAttachPoint=\"contentNode\"></div></div></div>",messageTopic:"",messageTypes:{MESSAGE:"message",WARNING:"warning",ERROR:"error",FATAL:"fatal"},defaultType:"message",positionDirection:"br-up",positionDirectionTypes:["br-up","br-left","bl-up","bl-right","tr-down","tr-left","tl-down","tl-right"],duration:2000,slideDuration:500,separator:"<hr></hr>",postCreate:function(){this.inherited(arguments);this.hide();_4.body().appendChild(this.domNode);if(this.messageTopic){_4.subscribe(this.messageTopic,this,"_handleMessage");}},_handleMessage:function(_7){if(_4.isString(_7)){this.setContent(_7);}else{this.setContent(_7.message,_7.type,_7.duration);}},_capitalize:function(w){return w.substring(0,1).toUpperCase()+w.substring(1);},setContent:function(_8,_9,_a){_a=_a||this.duration;if(this.slideAnim){if(this.slideAnim.status()!="playing"){this.slideAnim.stop();}if(this.slideAnim.status()=="playing"||(this.fadeAnim&&this.fadeAnim.status()=="playing")){setTimeout(_4.hitch(this,function(){this.setContent(_8,_9,_a);}),50);return;}}for(var _b in this.messageTypes){_4.removeClass(this.containerNode,"dijitToaster"+this._capitalize(this.messageTypes[_b]));}_4.style(this.containerNode,"opacity",1);this._setContent(_8);_4.addClass(this.containerNode,"dijitToaster"+this._capitalize(_9||this.defaultType));this.show();var _c=_4.marginBox(this.containerNode);this._cancelHideTimer();if(this.isVisible){this._placeClip();if(!this._stickyMessage){this._setHideTimer(_a);}}else{var _d=this.containerNode.style;var pd=this.positionDirection;if(pd.indexOf("-up")>=0){_d.left=0+"px";_d.top=_c.h+10+"px";}else{if(pd.indexOf("-left")>=0){_d.left=_c.w+10+"px";_d.top=0+"px";}else{if(pd.indexOf("-right")>=0){_d.left=0-_c.w-10+"px";_d.top=0+"px";}else{if(pd.indexOf("-down")>=0){_d.left=0+"px";_d.top=0-_c.h-10+"px";}else{throw new Error(this.id+".positionDirection is invalid: "+pd);}}}}this.slideAnim=_4.fx.slideTo({node:this.containerNode,top:0,left:0,duration:this.slideDuration});this.connect(this.slideAnim,"onEnd",function(_e,_f){this.fadeAnim=_4.fadeOut({node:this.containerNode,duration:1000});this.connect(this.fadeAnim,"onEnd",function(evt){this.isVisible=false;this.hide();});this._setHideTimer(_a);this.connect(this,"onSelect",function(evt){this._cancelHideTimer();this._stickyMessage=false;this.fadeAnim.play();});this.isVisible=true;});this.slideAnim.play();}},_setContent:function(_10){if(_4.isFunction(_10)){_10(this);return;}if(_10&&this.isVisible){_10=this.contentNode.innerHTML+this.separator+_10;}this.contentNode.innerHTML=_10;},_cancelHideTimer:function(){if(this._hideTimer){clearTimeout(this._hideTimer);this._hideTimer=null;}},_setHideTimer:function(_11){this._cancelHideTimer();if(_11>0){this._cancelHideTimer();this._hideTimer=setTimeout(_4.hitch(this,function(evt){if(this.bgIframe&&this.bgIframe.iframe){this.bgIframe.iframe.style.display="none";}this._hideTimer=null;this._stickyMessage=false;this.fadeAnim.play();}),_11);}else{this._stickyMessage=true;}},_placeClip:function(){var _12=_4.window.getBox();var _13=_4.marginBox(this.containerNode);var _14=this.clipNode.style;_14.height=_13.h+"px";_14.width=_13.w+"px";var pd=this.positionDirection;if(pd.match(/^t/)){_14.top=_12.t+"px";}else{if(pd.match(/^b/)){_14.top=(_12.h-_13.h-2+_12.t)+"px";}}if(pd.match(/^[tb]r-/)){_14.left=(_12.w-_13.w-1-_12.l)+"px";}else{if(pd.match(/^[tb]l-/)){_14.left=0+"px";}}_14.clip="rect(0px, "+_13.w+"px, "+_13.h+"px, 0px)";if(_4.isIE){if(!this.bgIframe){this.clipNode.id=_5.getUniqueId("dojox_widget_Toaster_clipNode");this.bgIframe=new _5.BackgroundIframe(this.clipNode);}var _15=this.bgIframe.iframe;if(_15){_15.style.display="block";}}},onSelect:function(e){},show:function(){_4.style(this.domNode,"display","block");this._placeClip();if(!this._scrollConnected){this._scrollConnected=_4.connect(window,"onscroll",this,this._placeClip);}},hide:function(){_4.style(this.domNode,"display","none");if(this._scrollConnected){_4.disconnect(this._scrollConnected);this._scrollConnected=false;}_4.style(this.containerNode,"opacity",1);}});}}};});