(function(){var i=tinymce.DOM;tinymce.PluginManager.requireLangPack("pdw");tinymce.create("tinymce.plugins.pdw",{init:function(a,e){var g=this,c=[],d=[],b;d=a.settings.pdw_toggle_toolbars.split(",");for(b=0;b<d.length;b++)c[b]=a.getParam("","toolbar"+d[b].replace(" ",""));a.addCommand("mcePDWToggleToolbars",function(){var j=a.controlManager,f,h;for(h=0;h<c.length;h++){f=a.controlManager.get(c[h]).id;if(i.isHidden(f)){j.setActive("pdw_toggle",0);i.show(f);g._resizeIframe(a,c[h],-26);a.settings.pdw_toggle_on= 0}else{j.setActive("pdw_toggle",1);i.hide(f);g._resizeIframe(a,c[h],26);a.settings.pdw_toggle_on=1}}});a.addButton("pdw_toggle",{title:a.getLang("pdw.desc",0),cmd:"mcePDWToggleToolbars",image:e+"/img/toolbars.gif"});a.onPostRender.add(function(){if(a.settings.pdw_toggle_on==1){var j=a.controlManager,f;for(b=0;b<d.length;b++){tbId=a.getParam("","toolbar"+d[b].replace(" ",""));f=a.controlManager.get(tbId).id;j.setActive("pdw_toggle",1);i.hide(f);g._resizeIframe(a,tbId,26)}}})},_resizeIframe:function(a, e,g){e=a.getContentAreaContainer().firstChild;if($(e).is(":hidden")){var c=$(e).clone().css({position:"absolute",top:"-10000px",left:"-10000px"}).appendTo("body"),d=c.height();c.remove()}else d=e.clientHeight;i.setStyle(e,"height",d+g);a.theme.deltaHeight+=g},getInfo:function(){return{longname:"PDW Toggle Toolbars",author:"Guido Neele",authorurl:"http://www.neele.name/",infourl:"http://www.neele.name/pdw_toggle_toolbars",version:"1.1"}}});tinymce.PluginManager.add("pdw",tinymce.plugins.pdw)})();