(function(){function A(C,B){B=B===undefined||B;var E;if(B){E=C.getComputedStyle("text-align")}else{while(!C.hasAttribute||!(C.hasAttribute("align")||C.getStyle("text-align"))){var D=C.getParent();if(!D){break}C=D}E=C.getStyle("text-align")||C.getAttribute("align")||""}E&&(E=E.replace(/-moz-|-webkit-|start|auto/i,""));!E&&B&&(E=C.getComputedStyle("direction")=="rtl"?"right":"left");return E}CKEDITOR.plugins.add("vbjustify",{requires:["justify"],init:function(F){var C=function(){var Q=F.getSelection(),P=F.config.enterMode;if(!Q){return }var I=Q.createBookmarks(),H=Q.getRanges(true);var R=this.cssClassName,N,K;var J=F.config.useComputedState;J=J===undefined||J;for(var M=H.length-1;M>=0;M--){N=H[M].createIterator();N.enlargeBr=P!=CKEDITOR.ENTER_BR;while((K=N.getNextParagraph(P==CKEDITOR.ENTER_P?"p":"div"))){K.removeAttribute("align");K.removeStyle("text-align");var O=R&&(K.$.className=CKEDITOR.tools.ltrim(K.$.className.replace(this.cssClassRegex,"")));var S=(this.state==CKEDITOR.TRISTATE_OFF)&&(!J||(A(K,true)!=this.value));if(R){if(S){K.addClass(R)}else{if(!O){K.removeAttribute("class")}}}else{if(S){if(K.getName()=="li"){var L=new CKEDITOR.dom.element("p");L.setStyle("text-align",this.value);L.setStyle("margin",0);K.moveChildren(L);K.append(L)}else{K.setStyle("text-align",this.value)}}}}}F.focus();F.forceNextSelectionCheck();Q.selectBookmarks(I)};var G=F.getCommand("justifyleft"),B=F.getCommand("justifycenter"),E=F.getCommand("justifyright"),D=F.getCommand("justifyblock");if(G){G.exec=C}if(B){B.exec=C}if(E){E.exec=C}if(D){D.exec=C}F.on("mode",function(){if(F.mode=="wysiwyg"){if(G){F.addCommand("justifyleft",G)}if(B){F.addCommand("justifycenter",B)}if(E){F.addCommand("justifyright",E)}if(D){F.addCommand("justifyblock",D)}}})}})})();