/*
	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","dijit._editor.plugins.AlwaysShowToolbar"],["require","dijit._editor._Plugin"]],defineResource:function(_4,_5,_6){if(!_4._hasResource["dijit._editor.plugins.AlwaysShowToolbar"]){_4._hasResource["dijit._editor.plugins.AlwaysShowToolbar"]=true;_4.provide("dijit._editor.plugins.AlwaysShowToolbar");_4.require("dijit._editor._Plugin");_4.declare("dijit._editor.plugins.AlwaysShowToolbar",_5._editor._Plugin,{_handleScroll:true,setEditor:function(e){if(!e.iframe){console.log("Port AlwaysShowToolbar plugin to work with Editor without iframe");return;}this.editor=e;e.onLoadDeferred.addCallback(_4.hitch(this,this.enable));},enable:function(d){this._updateHeight();this.connect(window,"onscroll","globalOnScrollHandler");this.connect(this.editor,"onNormalizedDisplayChanged","_updateHeight");return d;},_updateHeight:function(){var e=this.editor;if(!e.isLoaded){return;}if(e.height){return;}var _7=_4._getMarginSize(e.editNode).h;if(_4.isOpera){_7=e.editNode.scrollHeight;}if(!_7){_7=_4._getMarginSize(e.document.body).h;}if(_7==0){console.debug("Can not figure out the height of the editing area!");return;}if(_4.isIE<=7&&this.editor.minHeight){var _8=parseInt(this.editor.minHeight);if(_7<_8){_7=_8;}}if(_7!=this._lastHeight){this._lastHeight=_7;_4.marginBox(e.iframe,{h:this._lastHeight});}},_lastHeight:0,globalOnScrollHandler:function(){var _9=_4.isIE<7;if(!this._handleScroll){return;}var _a=this.editor.header;var db=_4.body;if(!this._scrollSetUp){this._scrollSetUp=true;this._scrollThreshold=_4.position(_a,true).y;}var _b=_4._docScroll().y;var s=_a.style;if(_b>this._scrollThreshold&&_b<this._scrollThreshold+this._lastHeight){if(!this._fixEnabled){var _c=_4._getMarginSize(_a);this.editor.iframe.style.marginTop=_c.h+"px";if(_9){s.left=_4.position(_a).x;if(_a.previousSibling){this._IEOriginalPos=["after",_a.previousSibling];}else{if(_a.nextSibling){this._IEOriginalPos=["before",_a.nextSibling];}else{this._IEOriginalPos=["last",_a.parentNode];}}_4.body().appendChild(_a);_4.addClass(_a,"dijitIEFixedToolbar");}else{s.position="fixed";s.top="0px";}_4.marginBox(_a,{w:_c.w});s.zIndex=2000;this._fixEnabled=true;}var _d=(this.height)?parseInt(this.editor.height):this.editor._lastHeight;s.display=(_b>this._scrollThreshold+_d)?"none":"";}else{if(this._fixEnabled){this.editor.iframe.style.marginTop="";s.position="";s.top="";s.zIndex="";s.display="";if(_9){s.left="";_4.removeClass(_a,"dijitIEFixedToolbar");if(this._IEOriginalPos){_4.place(_a,this._IEOriginalPos[1],this._IEOriginalPos[0]);this._IEOriginalPos=null;}else{_4.place(_a,this.editor.iframe,"before");}}s.width="";this._fixEnabled=false;}}},destroy:function(){this._IEOriginalPos=null;this._handleScroll=false;_4.forEach(this._connects,_4.disconnect);if(_4.isIE<7){_4.removeClass(this.editor.header,"dijitIEFixedToolbar");}}});}}};});