(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(b,c){var a=this;a.editor=b;b.addCommand("mceDirectionLTR",function(){var d=b.dom.getParent(b.selection.getNode(),b.dom.isBlock);if(d){if(b.dom.getAttrib(d,"dir")!="ltr"){b.dom.setAttrib(d,"dir","ltr")}else{b.dom.setAttrib(d,"dir","")}}b.nodeChanged()});b.addCommand("mceDirectionRTL",function(){var d=b.dom.getParent(b.selection.getNode(),b.dom.isBlock);if(d){if(b.dom.getAttrib(d,"dir")!="rtl"){b.dom.setAttrib(d,"dir","rtl")}else{b.dom.setAttrib(d,"dir","")}}b.nodeChanged()});b.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});b.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});b.onNodeChange.add(a._nodeChange,a)},getInfo:function(){return{longname:"Directionality",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality",version:tinymce.majorVersion+"."+tinymce.minorVersion}},_nodeChange:function(e,d,c){var b=e.dom,a;c=b.getParent(c,b.isBlock);if(!c){d.setDisabled("ltr",1);d.setDisabled("rtl",1);return}a=b.getAttrib(c,"dir");d.setActive("ltr",a=="ltr");d.setDisabled("ltr",0);d.setActive("rtl",a=="rtl");d.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();