(function(){function e(j){var i=j.getStyle("overflow-y"),c=j.getDocument(),b=CKEDITOR.dom.element.createFromHtml('<span style="margin:0;padding:0;border:0;clear:both;width:1px;height:1px;display:block;">'+(CKEDITOR.env.webkit?"&nbsp;":"")+"</span>",c);c[CKEDITOR.env.ie?"getBody":"getDocumentElement"]().append(b);var a=b.getDocumentPosition(c).y+b.$.offsetHeight;b.remove();j.setStyle("overflow-y",i);return a}function d(h){var c=h.document,b=c.getBody(),a=c.getDocumentElement();return c.$.compatMode=="BackCompat"?b:a}var f=function(l){if(!l.window){return}var k=d(l),j=l.window.getViewPaneSize().height,c=e(k);c+=l.config.autoGrow_bottomSpace||0;var b=l.config.autoGrow_minHeight!=undefined?l.config.autoGrow_minHeight:200,a=l.config.autoGrow_maxHeight||Infinity;c=Math.max(c,b);c=Math.min(c,a);if(c!=j){c=l.fire("autoGrow",{currentHeight:j,newHeight:c}).newHeight;l.resize(l.container.getStyle("width"),c,true)}if(k.$.scrollHeight>k.$.clientHeight&&c<a){k.setStyle("overflow-y","hidden")}else{k.removeStyle("overflow-y")}};CKEDITOR.plugins.add("autogrow",{init:function(c){c.addCommand("autogrow",{exec:f,modes:{wysiwyg:1},readOnly:1,canUndo:false,editorFocus:false});var b={contentDom:1,key:1,selectionChange:1,insertElement:1,mode:1};c.config.autoGrow_onStartup&&(b.instanceReady=1);for(var a in b){c.on(a,function(j){var i=c.getCommand("maximize");if(j.editor.mode=="wysiwyg"&&(!i||i.state!=CKEDITOR.TRISTATE_ON)){setTimeout(function(){f(j.editor);f(j.editor)},100)}})}c.on("beforeCommandExec",function(j){if(j.data.name=="maximize"&&j.editor.mode=="wysiwyg"){if(j.data.command.state==CKEDITOR.TRISTATE_OFF){var i=d(c);i.removeStyle("overflow")}else{f(c)}}})}})})();