(function(){var B=function(){};B.prototype={create:function(){return(window.XMLHttpRequest)?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP")},parseRequestData:function(C){var E=null;if(typeof C=="string"){E=C}else{if(typeof C=="object"){E=[];for(property in C){if(C[property]){var D=PHP.urlencode(C[property])}else{var D=""}E.push(property+"="+D)}E=E.join("&")}}return E},open:function(D){var C=this.create();C.open(D.type,D.url,D.async);if(D.type&&D.type.toUpperCase()=="POST"){C.setRequestHeader("Content-type","application/x-www-form-urlencoded")}else{D.type="GET"}if((typeof D.async=="undefined"||D.async!=false)&&D.callback){C.onreadystatechange=D.callback}C.send(this.parseRequestData(D.data));return C}};CKEDITOR.vbajax=new B();function A(C){var E=C.match(/&#([0-9]+);/g);if(E){for(var D=0;typeof E[D]!="undefined";D++){if(submatch=E[D].match(/^&#([0-9]+);$/)){C=C.replace(submatch[0],String.fromCharCode(submatch[1]))}}}return C}CKEDITOR.plugins.add("bbcode",{init:function(D){var C=D.dataProcessor=new CKEDITOR.bbcodeDataProcessor(D)}});CKEDITOR.bbcodeDataProcessor=function(C){this.editor=C;this.writer=new CKEDITOR.htmlWriter();this.dataFilter=new CKEDITOR.htmlParser.filter();this.htmlFilter=new CKEDITOR.htmlParser.filter()};CKEDITOR.bbcodeDataProcessor.prototype={doServerParse:function(F,D){if(F.length>0){var C={towysiwyg:D,message:F,"do":"editorswitch",allowsmilie:1,parsetype:PHP.htmlspecialchars(this.editor.config.parsetype),securitytoken:this.editor.config.vbulletin.securitytoken};if(this.editor.config.ajax_extra){for(id in this.editor.config.ajax_extra){C[id]=this.editor.config.ajax_extra[id]}}var G=CKEDITOR.vbajax.open({url:"ajax.php",type:"POST",data:C,async:false,dataType:"xml"}).responseXML;var E="";if(G&&G.getElementsByTagName&&G.getElementsByTagName("message")[0]&&G.getElementsByTagName("message")[0].firstChild){E=A(G.getElementsByTagName("message")[0].firstChild.nodeValue)}}else{var E=F}return E},toHtml:function(D,C){if(this.editor.hitServer!=false){D=this.doServerParse(D,1)}D=D.replace(/<table(.*?)width=(["'])(.+?)\2/gi,function(F,H,E,G){if(!G.match(/%/)){G=G+"px"}return"<table "+H+' style="width: '+G+'"'});D=D.replace(/<b>/gi,"<strong>");D=D.replace(/<\/b>/gi,"</strong>");D=D.replace(/<i>/gi,"<em>");D=D.replace(/<\/i>/gi,"</em>");return D},toDataFormat:function(F,C,H){F=F.replace(/<div.*>(.+?)<\/div>/gi,"");if(C=="p"){F=F.replace(/<br><\/p>/gi,"<br>");F=F.replace(/<p>/gi,"")}var E=this.editor.document.getElementsByTag("table");for(var D=0;D<E.count();D++){var G=E.getItem(D);G.setAttribute("width",G.getStyle("width").replace(/px/,""))}F=this.editor.document.getBody().getHtml();F=F.replace(/<a .*?_cke_saved_href=(["'])(.+?)\1.*?>(.+?)<\/a>/gi,'<a href="$2">$3</a>');if(!H){F=this.doServerParse(F,0);for(var D=0;D<this.editor.config.smiley_images.length;D++){path=this.editor.config.smiley_images[D].replace(/\//g,"\\/");text=this.editor.config.smiley_descriptions[D];F=F.replace(new RegExp("\\[IMG\\].*?"+PHP.preg_quote(path)+"\\[\\/IMG\\]","gi"),text)}}return F},getAutoSaveData:function(){var E=/(^|<body\b[^>]*>)\s*<(p|div|address|h\d|center)[^>]*>\s*(?:<br[^>]*>|&nbsp;|\u00A0|&#160;)?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi;var C=(this.editor.config.enterMode!=CKEDITOR.ENTER_BR)?this.editor.config.enterMode==CKEDITOR.ENTER_DIV?"div":"p":false;var D=this.editor.document.getBody().getHtml();if(CKEDITOR.env.gecko){D=D.replace(/<br>(?=\s*(:?$|<\/body>))/,"")}D=this.toDataFormat(D,C,true);if(this.editor.config.ignoreEmptyParagraph){D=D.replace(E,function(F,G){return G})}return D}}})();