(function(){tinymce.create("tinymce.plugins.Directionality",{init:function(e,d){var f=this;f.editor=e;e.addCommand("mceDirectionLTR",function(){var a=e.dom.getParent(e.selection.getNode(),e.dom.isBlock);if(a){if(e.dom.getAttrib(a,"dir")!="ltr"){e.dom.setAttrib(a,"dir","ltr")}else{e.dom.setAttrib(a,"dir","")}}e.nodeChanged()});e.addCommand("mceDirectionRTL",function(){var a=e.dom.getParent(e.selection.getNode(),e.dom.isBlock);if(a){if(e.dom.getAttrib(a,"dir")!="rtl"){e.dom.setAttrib(a,"dir","rtl")}else{e.dom.setAttrib(a,"dir","")}}e.nodeChanged()});e.addButton("ltr",{title:"directionality.ltr_desc",cmd:"mceDirectionLTR"});e.addButton("rtl",{title:"directionality.rtl_desc",cmd:"mceDirectionRTL"});e.onNodeChange.add(f._nodeChange,f)},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(f,g,h){var i=f.dom,j;h=i.getParent(h,i.isBlock);if(!h){g.setDisabled("ltr",1);g.setDisabled("rtl",1);return}j=i.getAttrib(h,"dir");g.setActive("ltr",j=="ltr");g.setDisabled("ltr",0);g.setActive("rtl",j=="rtl");g.setDisabled("rtl",0)}});tinymce.PluginManager.add("directionality",tinymce.plugins.Directionality)})();