Xinha.version={Release:"0.95",Head:"$HeadURL:http://svn.xinha.webfactional.com/trunk/XinhaCore.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),Date:"$LastChangedDate:2008-05-01 14:33:36 +0200 (Do, 01 Mai 2008) $".replace(/^[^:]*:\s*([0-9-]*) ([0-9:]*) ([+0-9]*) \((.*)\)\s*\$/,"$4 $2 $3"),Revision:"$LastChangedRevision:999 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),RevisionBy:"$LastChangedBy:ray $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1")};Xinha._resolveRelativeUrl=function(D,B){if(B.match(/^([^:]+\:)?\/\//)){return B}else{var A=D.split("/");if(A[A.length-1]==""){A.pop()}var C=B.split("/");if(C[0]=="."){C.shift()}while(C[0]==".."){A.pop();C.shift()}return A.join("/")+"/"+C.join("/")}};if(typeof _editor_url=="string"){_editor_url=_editor_url.replace(/\x2f*$/,"/");if(!_editor_url.match(/^([^:]+\:)?\//)){var path=window.location.toString().split("/");path.pop();_editor_url=Xinha._resolveRelativeUrl(path.join("/"),_editor_url)}}else{alert("WARNING: _editor_url is not set!  You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea/', but it can be relative if you prefer.  Further we will try to load the editor files correctly but we'll probably fail.");_editor_url=""}if(typeof _editor_lang=="string"){_editor_lang=_editor_lang.toLowerCase()}else{_editor_lang="en"}if(typeof _editor_skin!=="string"){_editor_skin=""}var __xinhas=[];Xinha.agt=navigator.userAgent.toLowerCase();Xinha.is_ie=((Xinha.agt.indexOf("msie")!=-1)&&(Xinha.agt.indexOf("opera")==-1));Xinha.ie_version=parseFloat(Xinha.agt.substring(Xinha.agt.indexOf("msie")+5));Xinha.is_opera=(Xinha.agt.indexOf("opera")!=-1);if(Xinha.is_opera&&Xinha.agt.match(/opera[\/ ]([0-9.]+)/)){Xinha.opera_version=parseFloat(RegExp.$1)}else{Xinha.opera_version=0}Xinha.is_khtml=(Xinha.agt.indexOf("khtml")!=-1);Xinha.is_webkit=(Xinha.agt.indexOf("applewebkit")!=-1);Xinha.webkit_version=parseInt(navigator.appVersion.replace(/.*?AppleWebKit\/([\d]).*?/,"$1"));Xinha.is_safari=(Xinha.agt.indexOf("safari")!=-1);Xinha.is_mac=(Xinha.agt.indexOf("mac")!=-1);Xinha.is_mac_ie=(Xinha.is_ie&&Xinha.is_mac);Xinha.is_win_ie=(Xinha.is_ie&&!Xinha.is_mac);Xinha.is_gecko=(navigator.product=="Gecko")||Xinha.is_opera;Xinha.is_real_gecko=(navigator.product=="Gecko"&&!Xinha.is_webkit);Xinha.is_ff3=Xinha.is_real_gecko&&parseInt(navigator.productSub)>=2007121016;Xinha.is_ff2=Xinha.is_real_gecko&&parseInt(navigator.productSub)<2007121016;Xinha.isRunLocally=document.URL.toLowerCase().search(/^file:/)!=-1;Xinha.is_designMode=(typeof document.designMode!="undefined"&&!Xinha.is_ie);Xinha.checkSupportedBrowser=function(){return Xinha.is_real_gecko||(Xinha.is_opera&&Xinha.opera_version>=9.2)||Xinha.ie_version>=5.5||Xinha.webkit_version>=522};Xinha.isSupportedBrowser=Xinha.checkSupportedBrowser();if(Xinha.isRunLocally&&Xinha.isSupportedBrowser){alert('Xinha *must* be installed on a web server. Locally opened files (those that use the "file://" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.')}function Xinha(D,B){if(!Xinha.isSupportedBrowser){return}if(!D){throw new Error("Tried to create Xinha without textarea specified.")}if(typeof B=="undefined"){this.config=new Xinha.Config()}else{this.config=B}if(typeof D!="object"){D=Xinha.getElementById("textarea",D)}this._textArea=D;this._textArea.spellcheck=false;Xinha.freeLater(this,"_textArea");this._initial_ta_size={w:D.style.width?D.style.width:(D.offsetWidth?(D.offsetWidth+"px"):(D.cols+"em")),h:D.style.height?D.style.height:(D.offsetHeight?(D.offsetHeight+"px"):(D.rows+"em"))};if(document.getElementById("loading_"+D.id)||this.config.showLoading){if(!document.getElementById("loading_"+D.id)){Xinha.createLoadingMessage(D)}this.setLoadingMessage(Xinha._lc("Constructing object"))}this._editMode="wysiwyg";this.plugins={};this._timerToolbar=null;this._timerUndo=null;this._undoQueue=[this.config.undoSteps];this._undoPos=-1;this._customUndo=true;this._mdoc=document;this.doctype="";this.__htmlarea_id_num=__xinhas.length;__xinhas[this.__htmlarea_id_num]=this;this._notifyListeners={};var A={right:{on:true,container:document.createElement("td"),panels:[]},left:{on:true,container:document.createElement("td"),panels:[]},top:{on:true,container:document.createElement("td"),panels:[]},bottom:{on:true,container:document.createElement("td"),panels:[]}};for(var C in A){if(!A[C].container){continue}A[C].div=A[C].container;A[C].container.className="panels "+C;Xinha.freeLater(A[C],"container");Xinha.freeLater(A[C],"div")}this._panels=A;this._statusBar=null;this._statusBarTree=null;this._statusBarTextMode=null;this._statusBarItems=[];this._framework={};this._htmlArea=null;this._iframe=null;this._doc=null;this._toolBar=this._toolbar=null;this._toolbarObjects={}}Xinha.onload=function(){};Xinha.init=function(){Xinha.onload()};Xinha.RE_tagName=/(<\/|<)\s*([^ \t\n>]+)/ig;Xinha.RE_doctype=/(<!doctype((.|\n)*?)>)\n?/i;Xinha.RE_head=/<head>((.|\n)*?)<\/head>/i;Xinha.RE_body=/<body[^>]*>((.|\n|\r|\t)*?)<\/body>/i;Xinha.RE_Specials=/([\/\^$*+?.()|{}[\]])/g;Xinha.escapeStringForRegExp=function(A){return A.replace(Xinha.RE_Specials,"\\$1")};Xinha.RE_email=/^[_a-z\d\-\.]{3,}@[_a-z\d\-]{2,}(\.[_a-z\d\-]{2,})+$/i;Xinha.RE_url=/(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_-]{2,}(\.[a-z0-9_-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i;Xinha.Config=function(){this.version=Xinha.version.Revision;this.width="auto";this.height="auto";this.sizeIncludesBars=true;this.sizeIncludesPanels=true;this.panel_dimensions={left:"200px",right:"200px",top:"100px",bottom:"100px"};this.iframeWidth=null;this.statusBar=true;this.htmlareaPaste=false;this.mozParaHandler="best";this.getHtmlMethod="DOMwalk";this.undoSteps=20;this.undoTimeout=500;this.changeJustifyWithDirection=false;this.fullPage=false;this.pageStyle="";this.pageStyleSheets=[];this.baseHref=null;this.expandRelativeUrl=true;this.stripBaseHref=true;this.stripSelfNamedAnchors=true;this.only7BitPrintablesInURLs=true;this.sevenBitClean=false;this.specialReplacements={};this.inwardHtml=function(C){return C};this.outwardHtml=function(C){return C};this.killWordOnPaste=true;this.makeLinkShowsTarget=true;this.charSet=(typeof document.characterSet!="undefined")?document.characterSet:document.charset;this.browserQuirksMode=null;this.imgURL="images/";this.popupURL="popups/";this.htmlRemoveTags=null;this.flowToolbars=true;this.toolbarAlign="left";this.showLoading=false;this.stripScripts=true;this.convertUrlsToLinks=true;this.colorPickerCellSize="6px";this.colorPickerGranularity=18;this.colorPickerPosition="bottom,right";this.colorPickerWebSafe=false;this.colorPickerSaveColors=20;this.fullScreen=false;this.fullScreenMargins=[0,0,0,0];this.toolbar=[["popupeditor"],["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],["separator","forecolor","hilitecolor","textindicator"],["separator","subscript","superscript"],["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],["separator","insertorderedlist","insertunorderedlist","outdent","indent"],["separator","inserthorizontalrule","createlink","insertimage","inserttable"],["linebreak","separator","undo","redo","selectall","print"],(Xinha.is_gecko?[]:["cut","copy","paste","overwrite","saveas"]),["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright","righttoleft"],["separator","htmlmode","showhelp","about"]];this.fontname={"&mdash; font &mdash;":"",Arial:"arial,helvetica,sans-serif","Courier New":"courier new,courier,monospace",Georgia:"georgia,times new roman,times,serif",Tahoma:"tahoma,arial,helvetica,sans-serif","Times New Roman":"times new roman,times,serif",Verdana:"verdana,arial,helvetica,sans-serif",impact:"impact",WingDings:"wingdings"};this.fontsize={"&mdash; size &mdash;":"","1 (8 pt)":"1","2 (10 pt)":"2","3 (12 pt)":"3","4 (14 pt)":"4","5 (18 pt)":"5","6 (24 pt)":"6","7 (36 pt)":"7"};this.formatblock={"&mdash; format &mdash;":"","Heading 1":"h1","Heading 2":"h2","Heading 3":"h3","Heading 4":"h4","Heading 5":"h5","Heading 6":"h6",Normal:"p",Address:"address",Formatted:"pre"};this.customSelects={};this.debug=true;this.URIs={blank:_editor_url+"popups/blank.html",link:_editor_url+"modules/CreateLink/link.html",insert_image:_editor_url+"modules/InsertImage/insert_image.html",insert_table:_editor_url+"modules/InsertTable/insert_table.html",select_color:_editor_url+"popups/select_color.html",about:_editor_url+"popups/about.html",help:_editor_url+"popups/editor_help.html"};this.btnList={bold:["Bold",Xinha._lc({key:"button_bold",string:["ed_buttons_main.gif",3,2]},"Xinha"),false,function(C){C.execCommand("bold")}],italic:["Italic",Xinha._lc({key:"button_italic",string:["ed_buttons_main.gif",2,2]},"Xinha"),false,function(C){C.execCommand("italic")}],underline:["Underline",Xinha._lc({key:"button_underline",string:["ed_buttons_main.gif",2,0]},"Xinha"),false,function(C){C.execCommand("underline")}],strikethrough:["Strikethrough",Xinha._lc({key:"button_strikethrough",string:["ed_buttons_main.gif",3,0]},"Xinha"),false,function(C){C.execCommand("strikethrough")}],subscript:["Subscript",Xinha._lc({key:"button_subscript",string:["ed_buttons_main.gif",3,1]},"Xinha"),false,function(C){C.execCommand("subscript")}],superscript:["Superscript",Xinha._lc({key:"button_superscript",string:["ed_buttons_main.gif",2,1]},"Xinha"),false,function(C){C.execCommand("superscript")}],justifyleft:["Justify Left",["ed_buttons_main.gif",0,0],false,function(C){C.execCommand("justifyleft")}],justifycenter:["Justify Center",["ed_buttons_main.gif",1,1],false,function(C){C.execCommand("justifycenter")}],justifyright:["Justify Right",["ed_buttons_main.gif",1,0],false,function(C){C.execCommand("justifyright")}],justifyfull:["Justify Full",["ed_buttons_main.gif",0,1],false,function(C){C.execCommand("justifyfull")}],orderedlist:["Ordered List",["ed_buttons_main.gif",0,3],false,function(C){C.execCommand("insertorderedlist")}],unorderedlist:["Bulleted List",["ed_buttons_main.gif",1,3],false,function(C){C.execCommand("insertunorderedlist")}],insertorderedlist:["Ordered List",["ed_buttons_main.gif",0,3],false,function(C){C.execCommand("insertorderedlist")}],insertunorderedlist:["Bulleted List",["ed_buttons_main.gif",1,3],false,function(C){C.execCommand("insertunorderedlist")}],outdent:["Decrease Indent",["ed_buttons_main.gif",1,2],false,function(C){C.execCommand("outdent")}],indent:["Increase Indent",["ed_buttons_main.gif",0,2],false,function(C){C.execCommand("indent")}],forecolor:["Font Color",["ed_buttons_main.gif",3,3],false,function(C){C.execCommand("forecolor")}],hilitecolor:["Background Color",["ed_buttons_main.gif",2,3],false,function(C){C.execCommand("hilitecolor")}],undo:["Undoes your last action",["ed_buttons_main.gif",4,2],false,function(C){C.execCommand("undo")}],redo:["Redoes your last action",["ed_buttons_main.gif",5,2],false,function(C){C.execCommand("redo")}],cut:["Cut selection",["ed_buttons_main.gif",5,0],false,function(D,C){D.execCommand(C)}],copy:["Copy selection",["ed_buttons_main.gif",4,0],false,function(D,C){D.execCommand(C)}],paste:["Paste from clipboard",["ed_buttons_main.gif",4,1],false,function(D,C){D.execCommand(C)}],selectall:["Select all","ed_selectall.gif",false,function(C){C.execCommand("selectall")}],inserthorizontalrule:["Horizontal Rule",["ed_buttons_main.gif",6,0],false,function(C){C.execCommand("inserthorizontalrule")}],createlink:["Insert Web Link",["ed_buttons_main.gif",6,1],false,function(C){C._createLink()}],insertimage:["Insert/Modify Image",["ed_buttons_main.gif",6,3],false,function(C){C.execCommand("insertimage")}],inserttable:["Insert Table",["ed_buttons_main.gif",6,2],false,function(C){C.execCommand("inserttable")}],htmlmode:["Toggle HTML Source",["ed_buttons_main.gif",7,0],true,function(C){C.execCommand("htmlmode")}],toggleborders:["Toggle Borders",["ed_buttons_main.gif",7,2],false,function(C){C._toggleBorders()}],print:["Print document",["ed_buttons_main.gif",8,1],false,function(C){if(Xinha.is_gecko){C._iframe.contentWindow.print()}else{C.focusEditor();print()}}],saveas:["Save as","ed_saveas.gif",false,function(C){C.execCommand("saveas",false,"noname.htm")}],about:["About this editor",["ed_buttons_main.gif",8,2],true,function(C){C.execCommand("about")}],showhelp:["Help using editor",["ed_buttons_main.gif",9,2],true,function(C){C.execCommand("showhelp")}],splitblock:["Split Block","ed_splitblock.gif",false,function(C){C._splitBlock()}],lefttoright:["Direction left to right",["ed_buttons_main.gif",0,4],false,function(C){C.execCommand("lefttoright")}],righttoleft:["Direction right to left",["ed_buttons_main.gif",1,4],false,function(C){C.execCommand("righttoleft")}],overwrite:["Insert/Overwrite","ed_overwrite.gif",false,function(C){C.execCommand("overwrite")}],wordclean:["MS Word Cleaner",["ed_buttons_main.gif",5,3],false,function(C){C._wordClean()}],clearfonts:["Clear Inline Font Specifications",["ed_buttons_main.gif",5,4],true,function(C){C._clearFonts()}],removeformat:["Remove formatting",["ed_buttons_main.gif",4,4],false,function(C){C.execCommand("removeformat")}],killword:["Clear MSOffice tags",["ed_buttons_main.gif",4,3],false,function(C){C.execCommand("killword")}]};for(var B in this.btnList){var A=this.btnList[B];if(typeof A!="object"){continue}if(typeof A[1]!="string"){A[1][0]=_editor_url+this.imgURL+A[1][0]}else{A[1]=_editor_url+this.imgURL+A[1]}A[0]=Xinha._lc(A[0])}};Xinha.Config.prototype.registerButton=function(G,F,E,D,B,C){var A;if(typeof G=="string"){A=G}else{if(typeof G=="object"){A=G.id}else{alert("ERROR [Xinha.Config::registerButton]:\ninvalid arguments");return false}}switch(typeof G){case"string":this.btnList[G]=[F,E,D,B,C];break;case"object":this.btnList[G.id]=[G.tooltip,G.image,G.textMode,G.action,G.context];break}};Xinha.prototype.registerPanel=function(C,B){if(!C){C="right"}this.setLoadingMessage("Register "+C+" panel ");var A=this.addPanel(C);if(B){B.drawPanelIn(A)}};Xinha.Config.prototype.registerDropdown=function(A){this.customSelects[A.id]=A};Xinha.Config.prototype.hideSomeButtons=function(F){var E=this.toolbar;for(var C=E.length;--C>=0;){var D=E[C];for(var B=D.length;--B>=0;){if(F.indexOf(" "+D[B]+" ")>=0){var A=1;if(/separator|space/.test(D[B+1])){A=2}D.splice(B,A)}}}};Xinha.Config.prototype.addToolbarElement=function(D,H,G){var E=this.toolbar;var K,J,I,F,C;var B=false;var A=false;var P=0;var O=0;var N=0;var M=false;var L=false;if((D&&typeof D=="object")&&(D.constructor==Array)){B=true}if((H&&typeof H=="object")&&(H.constructor==Array)){A=true;P=H.length}if(B){for(J=0;J<D.length;++J){if((D[J]!="separator")&&(D[J].indexOf("T[")!==0)){C=D[J]}}}else{C=D}for(J=0;J<E.length;++J){K=E[J];for(I=0;I<K.length;++I){if(K[I]==C){return}}}for(J=0;!L&&J<E.length;++J){K=E[J];for(I=0;!L&&I<K.length;++I){if(A){for(F=0;F<P;++F){if(K[I]==H[F]){if(F===0){L=true;I--;break}else{N=J;O=I;P=F}}}}else{if(K[I]==H){L=true;break}}}}if(!L&&A){if(H.length!=P){I=O;K=E[N];L=true}}if(L){if(G===0){if(B){K[I]=D[D.length-1];for(J=D.length-1;--J>=0;){K.splice(I,0,D[J])}}else{K[I]=D}}else{if(G<0){I=I+G+1}else{if(G>0){I=I+G}}if(B){for(J=D.length;--J>=0;){K.splice(I,0,D[J])}}else{K.splice(I,0,D)}}}else{E[0].splice(0,0,"separator");if(B){for(J=D.length;--J>=0;){E[0].splice(0,0,D[J])}}else{E[0].splice(0,0,D)}}};Xinha.Config.prototype.removeToolbarElement=Xinha.Config.prototype.hideSomeButtons;Xinha.replaceAll=function(C){var B=document.getElementsByTagName("textarea");for(var A=B.length;A>0;(new Xinha(B[--A],C)).generate()){}};Xinha.replace=function(C,A){var B=Xinha.getElementById("textarea",C);return B?(new Xinha(B,A)).generate():null};Xinha.prototype._createToolbar=function(){this.setLoadingMessage(Xinha._lc("Create Toolbar"));var D=this;var B=document.createElement("div");this._toolBar=this._toolbar=B;B.className="toolbar";B.unselectable="1";B.align=this.config.toolbarAlign;Xinha.freeLater(this,"_toolBar");Xinha.freeLater(this,"_toolbar");var C=null;var A={};this._toolbarObjects=A;this._createToolbar1(D,B,A);this._htmlArea.appendChild(B);return B};Xinha.prototype._setConfig=function(A){this.config=A};Xinha.prototype._addToolbar=function(){this._createToolbar1(this,this._toolbar,this._toolbarObjects)};Xinha._createToolbarBreakingElement=function(){var A=document.createElement("div");A.style.height="1px";A.style.width="1px";A.style.lineHeight="1px";A.style.fontSize="1px";A.style.clear="both";return A};Xinha.prototype._createToolbar1=function(J,I,G){var F;if(J.config.flowToolbars){I.appendChild(Xinha._createToolbarBreakingElement())}function H(){if(typeof F!="undefined"&&F.childNodes.length===0){return}var S=document.createElement("table");S.border="0px";S.cellSpacing="0px";S.cellPadding="0px";if(J.config.flowToolbars){if(Xinha.is_ie){S.style.styleFloat="left"}else{S.style.cssFloat="left"}}I.appendChild(S);var R=document.createElement("tbody");S.appendChild(R);F=document.createElement("tr");R.appendChild(F);S.className="toolbarRow"}H();function C(U,S){var R=this[U];var T=this.element;if(R!=S){switch(U){case"enabled":if(S){Xinha._removeClass(T,"buttonDisabled");T.disabled=false}else{Xinha._addClass(T,"buttonDisabled");T.disabled=true}break;case"active":if(S){Xinha._addClass(T,"buttonPressed")}else{Xinha._removeClass(T,"buttonPressed")}break}this[U]=S}}function B(a){var Z=null;var R=null;var T=null;var W=J.config.customSelects;var V=null;var U="";switch(a){case"fontsize":case"fontname":case"formatblock":Z=J.config[a];T=a;break;default:T=a;var S=W[T];if(typeof S!="undefined"){Z=S.options;V=S.context;if(typeof S.tooltip!="undefined"){U=S.tooltip}}else{alert("ERROR [createSelect]:\nCan't find the requested dropdown definition")}break}if(Z){R=document.createElement("select");R.title=U;var Y={name:a,element:R,enabled:true,text:false,cmd:T,state:C,context:V};Xinha.freeLater(Y);G[a]=Y;for(var X in Z){if(typeof(Z[X])!="string"){continue}var b=document.createElement("option");b.innerHTML=Xinha._lc(X);b.value=Z[X];R.appendChild(b)}Xinha._addEvent(R,"change",function(){J._comboSelected(R,a)})}return R}function O(R){var V,U,W=null;switch(R){case"separator":if(J.config.flowToolbars){H()}V=document.createElement("div");V.className="separator";break;case"space":V=document.createElement("div");V.className="space";break;case"linebreak":H();return false;case"textindicator":V=document.createElement("div");V.appendChild(document.createTextNode("A"));V.className="indicator";V.title=Xinha._lc("Current style");W={name:R,element:V,enabled:true,active:false,text:false,cmd:"textindicator",state:C};Xinha.freeLater(W);G[R]=W;break;default:U=J.config.btnList[R]}if(!V&&U){V=document.createElement("a");V.style.display="block";V.href="javascript:void(0)";V.style.textDecoration="none";V.title=U[0];V.className="button";V.style.direction="ltr";W={name:R,element:V,enabled:true,active:false,text:U[2],cmd:U[3],state:C,context:U[4]||null};Xinha.freeLater(V);Xinha.freeLater(W);G[R]=W;V.ondrag=function(){return false};Xinha._addEvent(V,"mouseout",function(X){if(W.enabled){Xinha._removeClass(V,"buttonActive");if(W.active){Xinha._addClass(V,"buttonPressed")}}});Xinha._addEvent(V,"mousedown",function(X){if(W.enabled){Xinha._addClass(V,"buttonActive");Xinha._removeClass(V,"buttonPressed");Xinha._stopEvent(Xinha.is_ie?window.event:X)}});Xinha._addEvent(V,"click",function(X){X=Xinha.is_ie?window.event:X;J.btnClickEvent=X;if(W.enabled){Xinha._removeClass(V,"buttonActive");if(Xinha.is_gecko){J.activateEditor()}W.cmd(J,W.name,W);Xinha._stopEvent(X)}});var T=Xinha.makeBtnImg(U[1]);var S=T.firstChild;Xinha.freeLater(T);Xinha.freeLater(S);V.appendChild(T);W.imgel=S;W.swapImage=function(X){if(typeof X!="string"){S.src=X[0];S.style.position="relative";S.style.top=X[2]?("-"+(18*(X[2]+1))+"px"):"-18px";S.style.left=X[1]?("-"+(18*(X[1]+1))+"px"):"-18px"}else{W.imgel.src=X;S.style.top="0px";S.style.left="0px"}}}else{if(!V){V=B(R)}}return V}var A=true;for(var E=0;E<this.config.toolbar.length;++E){if(!A){}else{A=false}if(this.config.toolbar[E]===null){this.config.toolbar[E]=["separator"]}var Q=this.config.toolbar[E];for(var D=0;D<Q.length;++D){var P=Q[D];var N;if(/^([IT])\[(.*?)\]/.test(P)){var M=RegExp.$1=="I";var L=RegExp.$2;if(M){L=Xinha._lc(L)}N=document.createElement("td");F.appendChild(N);N.className="label";N.innerHTML=L}else{if(typeof P!="function"){var K=O(P);if(K){N=document.createElement("td");N.className="toolbarElement";F.appendChild(N);N.appendChild(K)}else{if(K===null){alert("FIXME: Unknown toolbar item: "+P)}}}}}}if(J.config.flowToolbars){I.appendChild(Xinha._createToolbarBreakingElement())}return I};var use_clone_img=false;Xinha.makeBtnImg=function(D,C){if(!C){C=document}if(!C._xinhaImgCache){C._xinhaImgCache={};Xinha.freeLater(C._xinhaImgCache)}var B=null;if(Xinha.is_ie&&((!C.compatMode)||(C.compatMode&&C.compatMode=="BackCompat"))){B=C.createElement("span")}else{B=C.createElement("div");B.style.position="relative"}B.style.overflow="hidden";B.style.width="18px";B.style.height="18px";B.className="buttonImageContainer";var A=null;if(typeof D=="string"){if(C._xinhaImgCache[D]){A=C._xinhaImgCache[D].cloneNode()}else{A=C.createElement("img");A.src=D;A.style.width="18px";A.style.height="18px";if(use_clone_img){C._xinhaImgCache[D]=A.cloneNode()}}}else{if(C._xinhaImgCache[D[0]]){A=C._xinhaImgCache[D[0]].cloneNode()}else{A=C.createElement("img");A.src=D[0];A.style.position="relative";if(use_clone_img){C._xinhaImgCache[D[0]]=A.cloneNode()}}A.style.top=D[2]?("-"+(18*(D[2]+1))+"px"):"-18px";A.style.left=D[1]?("-"+(18*(D[1]+1))+"px"):"-18px"}B.appendChild(A);return B};Xinha.prototype._createStatusBar=function(){this.setLoadingMessage(Xinha._lc("Create Statusbar"));var A=document.createElement("div");A.className="statusBar";this._statusBar=A;Xinha.freeLater(this,"_statusBar");var B=document.createElement("span");B.className="statusBarTree";B.innerHTML=Xinha._lc("Path")+": ";this._statusBarTree=B;Xinha.freeLater(this,"_statusBarTree");this._statusBar.appendChild(B);B=document.createElement("span");B.innerHTML=Xinha._lc("You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG.");B.style.display="none";this._statusBarTextMode=B;Xinha.freeLater(this,"_statusBarTextMode");this._statusBar.appendChild(B);if(!this.config.statusBar){A.style.display="none"}return A};Xinha.prototype.generate=function(){if(!Xinha.isSupportedBrowser){return}var F;var O=this;var A;var M=false;var K=document.getElementsByTagName("link");if(!document.getElementById("XinhaCoreDesign")){_editor_css=(typeof _editor_css=="string")?_editor_css:"Xinha.css";for(F=0;F<K.length;F++){if((K[F].rel=="stylesheet")&&(K[F].href==_editor_url+_editor_css)){M=true}}if(!M){Xinha.loadStyle(_editor_css,null,"XinhaCoreDesign",true)}}if(_editor_skin!==""&&!document.getElementById("XinhaSkin")){M=false;for(F=0;F<K.length;F++){if((K[F].rel=="stylesheet")&&(K[F].href==_editor_url+"skins/"+_editor_skin+"/skin.css")){M=true}}if(!M){Xinha.loadStyle("skins/"+_editor_skin+"/skin.css",null,"XinhaSkin")}}if(Xinha.is_ie){A=_editor_url+"modules/InternetExplorer/InternetExplorer.js";if(!Xinha.loadPlugins([{plugin:"InternetExplorer",url:A}],function(){O.generate()})){return false}O._browserSpecificPlugin=O.registerPlugin("InternetExplorer")}else{if(Xinha.is_webkit){A=_editor_url+"modules/WebKit/WebKit.js";if(!Xinha.loadPlugins([{plugin:"WebKit",url:A}],function(){O.generate()})){return false}O._browserSpecificPlugin=O.registerPlugin("WebKit")}else{if(Xinha.is_opera){A=_editor_url+"modules/Opera/Opera.js";if(!Xinha.loadPlugins([{plugin:"Opera",url:A}],function(){O.generate()})){return false}O._browserSpecificPlugin=O.registerPlugin("Opera")}else{if(Xinha.is_gecko){A=_editor_url+"modules/Gecko/Gecko.js";if(!Xinha.loadPlugins([{plugin:"Gecko",url:A}],function(){O.generate()})){return false}O._browserSpecificPlugin=O.registerPlugin("Gecko")}}}}if(typeof Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/dialog.js",this.generate,this)){return false}if(typeof Xinha.Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/inline-dialog.js",this.generate,this)){return false}A=_editor_url+"modules/FullScreen/full-screen.js";if(!Xinha.loadPlugins([{plugin:"FullScreen",url:A}],function(){O.generate()})){return false}A=_editor_url+"modules/ColorPicker/ColorPicker.js";if(!Xinha.loadPlugins([{plugin:"ColorPicker",url:A}],function(){O.generate()})){return false}else{if(typeof ColorPicker!="undefined"){O.registerPlugin("ColorPicker")}}var I=O.config.toolbar;for(F=I.length;--F>=0;){for(var D=I[F].length;--D>=0;){switch(I[F][D]){case"popupeditor":O.registerPlugin("FullScreen");break;case"insertimage":A=_editor_url+"modules/InsertImage/insert_image.js";if(typeof Xinha.prototype._insertImage=="undefined"&&!Xinha.loadPlugins([{plugin:"InsertImage",url:A}],function(){O.generate()})){return false}else{if(typeof InsertImage!="undefined"){O.registerPlugin("InsertImage")}}break;case"createlink":A=_editor_url+"modules/CreateLink/link.js";if(typeof Linker=="undefined"&&!Xinha.loadPlugins([{plugin:"CreateLink",url:A}],function(){O.generate()})){return false}else{if(typeof CreateLink!="undefined"){O.registerPlugin("CreateLink")}}break;case"inserttable":A=_editor_url+"modules/InsertTable/insert_table.js";if(!Xinha.loadPlugins([{plugin:"InsertTable",url:A}],function(){O.generate()})){return false}else{if(typeof InsertTable!="undefined"){O.registerPlugin("InsertTable")}}break}}}if(Xinha.is_gecko&&O.config.mozParaHandler!="built-in"){if(!Xinha.loadPlugins([{plugin:"EnterParagraphs",url:_editor_url+"modules/Gecko/paraHandlerBest.js"}],function(){O.generate()})){return false}O.registerPlugin("EnterParagraphs")}if(Xinha.ie_version==8){this.config.getHtmlMethod="TransformInnerHTML"}switch(this.config.getHtmlMethod){case"TransformInnerHTML":var E=_editor_url+"modules/GetHtml/TransformInnerHTML.js";break;default:var E=_editor_url+"modules/GetHtml/DOMwalk.js";break}if(!Xinha.loadPlugins([{plugin:"GetHtmlImplementation",url:E}],function(){O.generate()})){return false}else{O.registerPlugin("GetHtmlImplementation")}this.setLoadingMessage(Xinha._lc("Generate Xinha framework"));this._framework={table:document.createElement("table"),tbody:document.createElement("tbody"),tb_row:document.createElement("tr"),tb_cell:document.createElement("td"),tp_row:document.createElement("tr"),tp_cell:this._panels.top.container,ler_row:document.createElement("tr"),lp_cell:this._panels.left.container,ed_cell:document.createElement("td"),rp_cell:this._panels.right.container,bp_row:document.createElement("tr"),bp_cell:this._panels.bottom.container,sb_row:document.createElement("tr"),sb_cell:document.createElement("td")};Xinha.freeLater(this._framework);var C=this._framework;C.table.border="0";C.table.cellPadding="0";C.table.cellSpacing="0";C.tb_row.style.verticalAlign="top";C.tp_row.style.verticalAlign="top";C.ler_row.style.verticalAlign="top";C.bp_row.style.verticalAlign="top";C.sb_row.style.verticalAlign="top";C.ed_cell.style.position="relative";C.tb_row.appendChild(C.tb_cell);C.tb_cell.colSpan=3;C.tp_row.appendChild(C.tp_cell);C.tp_cell.colSpan=3;C.ler_row.appendChild(C.lp_cell);C.ler_row.appendChild(C.ed_cell);C.ler_row.appendChild(C.rp_cell);C.bp_row.appendChild(C.bp_cell);C.bp_cell.colSpan=3;C.sb_row.appendChild(C.sb_cell);C.sb_cell.colSpan=3;C.tbody.appendChild(C.tb_row);C.tbody.appendChild(C.tp_row);C.tbody.appendChild(C.ler_row);C.tbody.appendChild(C.bp_row);C.tbody.appendChild(C.sb_row);C.table.appendChild(C.tbody);var B=this._framework.table;this._htmlArea=B;Xinha.freeLater(this,"_htmlArea");B.className="htmlarea";this._framework.tb_cell.appendChild(this._createToolbar());var L=document.createElement("iframe");L.src=this.popupURL(O.config.URIs.blank);L.id="XinhaIFrame_"+this._textArea.id;this._framework.ed_cell.appendChild(L);this._iframe=L;this._iframe.className="xinha_iframe";Xinha.freeLater(this,"_iframe");var J=this._createStatusBar();this._framework.sb_cell.appendChild(J);var H=this._textArea;H.parentNode.insertBefore(B,H);H.className="xinha_textarea";Xinha.removeFromParent(H);this._framework.ed_cell.appendChild(H);Xinha.addDom0Event(this._textArea,"click",function(){if(Xinha._currentlyActiveEditor!=this){O.updateToolbar()}return true});if(H.form){Xinha.prependDom0Event(this._textArea.form,"submit",function(){O.firePluginEvent("onBeforeSubmit");O._textArea.value=O.outwardHtml(O.getHTML());return true});var G=H.value;Xinha.prependDom0Event(this._textArea.form,"reset",function(){O.setHTML(O.inwardHtml(G));O.updateToolbar();return true});if(!H.form.xinha_submit){try{H.form.xinha_submit=H.form.submit;H.form.submit=function(){this.onsubmit();this.xinha_submit()}}catch(N){}}}Xinha.prependDom0Event(window,"unload",function(){O.firePluginEvent("onBeforeUnload");H.value=O.outwardHtml(O.getHTML());if(!Xinha.is_ie){B.parentNode.replaceChild(H,B)}return true});H.style.display="none";O.initSize();this.setLoadingMessage(Xinha._lc("Finishing"));O._iframeLoadDone=false;if(Xinha.is_opera){O.initIframe()}else{Xinha._addEvent(this._iframe,"load",function(P){if(!O._iframeLoadDone){O._iframeLoadDone=true;O.initIframe()}return true})}};Xinha.prototype.initSize=function(){this.setLoadingMessage(Xinha._lc("Init editor size"));var A=this;var C=null;var B=null;switch(this.config.width){case"auto":C=this._initial_ta_size.w;break;case"toolbar":C=this._toolBar.offsetWidth+"px";break;default:C=/[^0-9]/.test(this.config.width)?this.config.width:this.config.width+"px";break}switch(this.config.height){case"auto":B=this._initial_ta_size.h;break;default:B=/[^0-9]/.test(this.config.height)?this.config.height:this.config.height+"px";break}this.sizeEditor(C,B,this.config.sizeIncludesBars,this.config.sizeIncludesPanels);this.notifyOn("panel_change",function(){A.sizeEditor()})};Xinha.prototype.sizeEditor=function(O,N,L,J){if(this._risizing){return}this._risizing=true;this.notifyOf("before_resize",{width:O,height:N});this.firePluginEvent("onBeforeResize",O,N);this._iframe.style.height="100%";this._textArea.style.height="100%";this._iframe.style.width="";this._textArea.style.width="";if(L!==null){this._htmlArea.sizeIncludesToolbars=L}if(J!==null){this._htmlArea.sizeIncludesPanels=J}if(O){this._htmlArea.style.width=O;if(!this._htmlArea.sizeIncludesPanels){var H=this._panels.right;if(H.on&&H.panels.length&&Xinha.hasDisplayedChildren(H.div)){this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.right,10))+"px"}var G=this._panels.left;if(G.on&&G.panels.length&&Xinha.hasDisplayedChildren(G.div)){this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.left,10))+"px"}}}if(N){this._htmlArea.style.height=N;if(!this._htmlArea.sizeIncludesToolbars){this._htmlArea.style.height=(this._htmlArea.offsetHeight+this._toolbar.offsetHeight+this._statusBar.offsetHeight)+"px"}if(!this._htmlArea.sizeIncludesPanels){var D=this._panels.top;if(D.on&&D.panels.length&&Xinha.hasDisplayedChildren(D.div)){this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.top,10))+"px"}var A=this._panels.bottom;if(A.on&&A.panels.length&&Xinha.hasDisplayedChildren(A.div)){this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.bottom,10))+"px"}}}O=this._htmlArea.offsetWidth;N=this._htmlArea.offsetHeight;var M=this._panels;var K=this;var I=1;function F(P){if(M[P].on&&M[P].panels.length&&Xinha.hasDisplayedChildren(M[P].container)){M[P].container.style.display="";return true}else{M[P].container.style.display="none";return false}}if(F("left")){I+=1}if(F("right")){I+=1}this._framework.tb_cell.colSpan=I;this._framework.tp_cell.colSpan=I;this._framework.bp_cell.colSpan=I;this._framework.sb_cell.colSpan=I;if(!this._framework.tp_row.childNodes.length){Xinha.removeFromParent(this._framework.tp_row)}else{if(!Xinha.hasParentNode(this._framework.tp_row)){this._framework.tbody.insertBefore(this._framework.tp_row,this._framework.ler_row)}}if(!this._framework.bp_row.childNodes.length){Xinha.removeFromParent(this._framework.bp_row)}else{if(!Xinha.hasParentNode(this._framework.bp_row)){this._framework.tbody.insertBefore(this._framework.bp_row,this._framework.ler_row.nextSibling)}}if(!this.config.statusBar){Xinha.removeFromParent(this._framework.sb_row)}else{if(!Xinha.hasParentNode(this._framework.sb_row)){this._framework.table.appendChild(this._framework.sb_row)}}this._framework.lp_cell.style.width=this.config.panel_dimensions.left;this._framework.rp_cell.style.width=this.config.panel_dimensions.right;this._framework.tp_cell.style.height=this.config.panel_dimensions.top;this._framework.bp_cell.style.height=this.config.panel_dimensions.bottom;this._framework.tb_cell.style.height=this._toolBar.offsetHeight+"px";this._framework.sb_cell.style.height=this._statusBar.offsetHeight+"px";var E=N-this._toolBar.offsetHeight-this._statusBar.offsetHeight;if(F("top")){E-=parseInt(this.config.panel_dimensions.top,10)}if(F("bottom")){E-=parseInt(this.config.panel_dimensions.bottom,10)}this._iframe.style.height=E+"px";var C=O;if(F("left")){C-=parseInt(this.config.panel_dimensions.left,10)}if(F("right")){C-=parseInt(this.config.panel_dimensions.right,10)}var B=(this.config.iframeWidth)?parseInt(this.config.iframeWidth,10):null;this._iframe.style.width=(B&&B<C)?B+"px":C+"px";this._textArea.style.height=this._iframe.style.height;this._textArea.style.width=this._iframe.style.width;this.notifyOf("resize",{width:this._htmlArea.offsetWidth,height:this._htmlArea.offsetHeight});this.firePluginEvent("onResize",this._htmlArea.offsetWidth,this._htmlArea.offsetWidth);this._risizing=false};Xinha.prototype.registerPanel=function(C,B){if(!C){C="right"}this.setLoadingMessage("Register "+C+" panel ");var A=this.addPanel(C);if(B){B.drawPanelIn(A)}};Xinha.prototype.addPanel=function(A){var B=document.createElement("div");B.side=A;if(A=="left"||A=="right"){B.style.width=this.config.panel_dimensions[A];if(this._iframe){B.style.height=this._iframe.style.height}}Xinha.addClasses(B,"panel");this._panels[A].panels.push(B);this._panels[A].div.appendChild(B);this.notifyOf("panel_change",{action:"add",panel:B});this.firePluginEvent("onPanelChange","add",B);return B};Xinha.prototype.removePanel=function(B){this._panels[B.side].div.removeChild(B);var A=[];for(var C=0;C<this._panels[B.side].panels.length;C++){if(this._panels[B.side].panels[C]!=B){A.push(this._panels[B.side].panels[C])}}this._panels[B.side].panels=A;this.notifyOf("panel_change",{action:"remove",panel:B});this.firePluginEvent("onPanelChange","remove",B)};Xinha.prototype.hidePanel=function(A){if(A&&A.style.display!="none"){try{var C=this.scrollPos(this._iframe.contentWindow)}catch(B){}A.style.display="none";this.notifyOf("panel_change",{action:"hide",panel:A});this.firePluginEvent("onPanelChange","hide",A);try{this._iframe.contentWindow.scrollTo(C.x,C.y)}catch(B){}}};Xinha.prototype.showPanel=function(A){if(A&&A.style.display=="none"){try{var C=this.scrollPos(this._iframe.contentWindow)}catch(B){}A.style.display="";this.notifyOf("panel_change",{action:"show",panel:A});this.firePluginEvent("onPanelChange","show",A);try{this._iframe.contentWindow.scrollTo(C.x,C.y)}catch(B){}}};Xinha.prototype.hidePanels=function(B){if(typeof B=="undefined"){B=["left","right","top","bottom"]}var A=[];for(var C=0;C<B.length;C++){if(this._panels[B[C]].on){A.push(B[C]);this._panels[B[C]].on=false}}this.notifyOf("panel_change",{action:"multi_hide",sides:B});this.firePluginEvent("onPanelChange","multi_hide",B)};Xinha.prototype.showPanels=function(A){if(typeof A=="undefined"){A=["left","right","top","bottom"]}var C=[];for(var B=0;B<A.length;B++){if(!this._panels[A[B]].on){C.push(A[B]);this._panels[A[B]].on=true}}this.notifyOf("panel_change",{action:"multi_show",sides:A});this.firePluginEvent("onPanelChange","multi_show",A)};Xinha.objectProperties=function(C){var B=[];for(var A in C){B[B.length]=A}return B};Xinha.prototype.editorIsActivated=function(){try{return Xinha.is_designMode?this._doc.designMode=="on":this._doc.body.contentEditable}catch(A){return false}};Xinha._someEditorHasBeenActivated=false;Xinha._currentlyActiveEditor=null;Xinha.prototype.activateEditor=function(){if(Xinha._currentlyActiveEditor){if(Xinha._currentlyActiveEditor==this){return true}Xinha._currentlyActiveEditor.deactivateEditor()}if(Xinha.is_designMode&&this._doc.designMode!="on"){try{if(this._iframe.style.display=="none"){this._iframe.style.display="";this._doc.designMode="on";this._iframe.style.display="none"}else{this._doc.designMode="on"}}catch(A){}}else{if(Xinha.is_ie&&this._doc.body.contentEditable!==true){this._doc.body.contentEditable=true}}Xinha._someEditorHasBeenActivated=true;Xinha._currentlyActiveEditor=this;var B=this;this.enableToolbar()};Xinha.prototype.deactivateEditor=function(){this.disableToolbar();if(Xinha.is_designMode&&this._doc.designMode!="off"){try{this._doc.designMode="off"}catch(A){}}else{if(!Xinha.is_designMode&&this._doc.body.contentEditable!==false){this._doc.body.contentEditable=false}}if(Xinha._currentlyActiveEditor!=this){return}Xinha._currentlyActiveEditor=false};Xinha.prototype.initIframe=function(){this.disableToolbar();var G=null;var B=this;try{if(B._iframe.contentDocument){this._doc=B._iframe.contentDocument}else{this._doc=B._iframe.contentWindow.document}G=this._doc;if(!G){if(Xinha.is_gecko){setTimeout(function(){B.initIframe()},50);return false}else{alert("ERROR: IFRAME can't be initialized.")}}}catch(E){setTimeout(function(){B.initIframe()},50)}Xinha.freeLater(this,"_doc");G.open("text/html","replace");var A="";if(B.config.browserQuirksMode===false){var F='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'}else{if(B.config.browserQuirksMode===true){var F=""}else{var F=Xinha.getDoctype(document)}}if(!B.config.fullPage){A+=F+"\n";A+="<html>\n";A+="<head>\n";A+='<meta http-equiv="Content-Type" content="text/html; charset='+B.config.charSet+'">\n';if(typeof B.config.baseHref!="undefined"&&B.config.baseHref!==null){A+='<base href="'+B.config.baseHref+'"/>\n'}A+=Xinha.addCoreCSS();if(typeof B.config.pageStyleSheets!=="undefined"){for(var D=0;D<B.config.pageStyleSheets.length;D++){if(B.config.pageStyleSheets[D].length>0){A+='<link rel="stylesheet" type="text/css" href="'+B.config.pageStyleSheets[D]+'">'}}}if(B.config.pageStyle){A+='<style type="text/css">\n'+B.config.pageStyle+"\n</style>"}A+="</head>\n";A+="<body"+(B.config.bodyID?(' id="'+B.config.bodyID+'"'):"")+">\n";A+=B.inwardHtml(B._textArea.value);A+="</body>\n";A+="</html>"}else{A=B.inwardHtml(B._textArea.value);if(A.match(Xinha.RE_doctype)){B.setDoctype(RegExp.$1)}var C=A.match(/<link\s+[\s\S]*?["']\s*\/?>/gi);A=A.replace(/<link\s+[\s\S]*?["']\s*\/?>\s*/gi,"");C?A=A.replace(/<\/head>/i,C.join("\n")+"\n</head>"):null}G.write(A);G.close();if(this.config.fullScreen){this._fullScreen()}this.setEditorEvents()};Xinha.prototype.whenDocReady=function(A){var B=this;if(this._doc&&this._doc.body){A()}else{setTimeout(function(){B.whenDocReady(A)},50)}};Xinha.prototype.setMode=function(A){var B;if(typeof A=="undefined"){A=this._editMode=="textmode"?"wysiwyg":"textmode"}switch(A){case"textmode":this.firePluginEvent("onBeforeMode","textmode");this.setCC("iframe");B=this.outwardHtml(this.getHTML());this.setHTML(B);this.deactivateEditor();this._iframe.style.display="none";this._textArea.style.display="";if(this.config.statusBar){this._statusBarTree.style.display="none";this._statusBarTextMode.style.display=""}this.findCC("textarea");this.notifyOf("modechange",{mode:"text"});this.firePluginEvent("onMode","textmode");break;case"wysiwyg":this.firePluginEvent("onBeforeMode","wysiwyg");this.setCC("textarea");B=this.inwardHtml(this.getHTML());this.deactivateEditor();this.setHTML(B);this._iframe.style.display="";this._textArea.style.display="none";this.activateEditor();if(this.config.statusBar){this._statusBarTree.style.display="";this._statusBarTextMode.style.display="none"}this.findCC("iframe");this.notifyOf("modechange",{mode:"wysiwyg"});this.firePluginEvent("onMode","wysiwyg");break;default:alert("Mode <"+A+"> not defined!");return false}this._editMode=A};Xinha.prototype.setFullHTML=function(B){var A=RegExp.multiline;RegExp.multiline=true;if(B.match(Xinha.RE_doctype)){this.setDoctype(RegExp.$1)}RegExp.multiline=A;if(0){if(B.match(Xinha.RE_head)){this._doc.getElementsByTagName("head")[0].innerHTML=RegExp.$1}if(B.match(Xinha.RE_body)){this._doc.getElementsByTagName("body")[0].innerHTML=RegExp.$1}}else{var D=this.editorIsActivated();if(D){this.deactivateEditor()}var C=/<html>((.|\n)*?)<\/html>/i;B=B.replace(C,"$1");this._doc.open("text/html","replace");this._doc.write(B);this._doc.close();if(D){this.activateEditor()}this.setEditorEvents();return true}};Xinha.prototype.setEditorEvents=function(){var B=this;var A=this._doc;B.whenDocReady(function(){Xinha._addEvents(A,["mousedown"],function(){B.activateEditor();return true});if(Xinha.is_ie){Xinha._addEvent(B._doc.getElementsByTagName("html")[0],"click",function(){if(B._iframe.contentWindow.event.srcElement.tagName.toLowerCase()=="html"){var E=B._doc.body.createTextRange();E.collapse();E.select()}return true})}Xinha._addEvents(A,["keydown","keypress","mousedown","mouseup","drag"],function(E){return B._editorEvent(Xinha.is_ie?B._iframe.contentWindow.event:E)});for(var C in B.plugins){var D=B.plugins[C].instance;Xinha.refreshPlugin(D)}if(typeof B._onGenerate=="function"){B._onGenerate()}Xinha.addDom0Event(window,"resize",function(E){B.sizeEditor()});B.removeLoadingMessage()})};Xinha.prototype.registerPlugin=function(){if(!Xinha.isSupportedBrowser){return}var C=arguments[0];if(C===null||typeof C=="undefined"||(typeof C=="string"&&typeof window[C]=="undefined")){return false}var B=[];for(var A=1;A<arguments.length;++A){B.push(arguments[A])}return this.registerPlugin2(C,B)};Xinha.prototype.registerPlugin2=function(C,E){if(typeof C=="string"&&typeof window[C]=="function"){C=window[C]}if(typeof C=="undefined"){return false}var F=new C(this,E);if(F){var B={};var A=C._pluginInfo;for(var D in A){B[D]=A[D]}B.instance=F;B.args=E;this.plugins[C._pluginInfo.name]=B;return F}else{alert("Can't register plugin "+C.toString()+".")}};Xinha.getPluginDir=function(A){if(Xinha.externalPlugins[A]){return Xinha.externalPlugins[A][0]}else{return _editor_url+"plugins/"+A}};Xinha.loadPlugin=function(D,C,B){if(!Xinha.isSupportedBrowser){return}Xinha.setLoadingMessage(Xinha._lc("Loading plugin $plugin="+D+"$"));if(typeof window.pluginName!="undefined"){if(C){C(D)}return true}if(!B){var A=this.getPluginDir(D);var E=D.replace(/([a-z])([A-Z])([a-z])/g,function(H,G,F,I){return G+"-"+F.toLowerCase()+I}).toLowerCase()+".js";B=A+"/"+E}Xinha._loadback(B,C?function(){C(D)}:null);return false};Xinha._pluginLoadStatus={};Xinha.externalPlugins={};Xinha.loadPlugins=function(F,G,D){if(!Xinha.isSupportedBrowser){return}Xinha.setLoadingMessage(Xinha._lc("Loading plugins"));var A;for(var E=0;E<F.length;E++){if(typeof F[E]=="object"){A=F[E].url.match(/(.*)(\/[^\/]*)$/);Xinha.externalPlugins[F[E].plugin]=[A[1],A[2]];F[E]=F[E].plugin}}var C=true;var B=Xinha.cloneObject(F);while(B.length){var H=B.pop();if(H=="FullScreen"&&!Xinha.externalPlugins.FullScreen){continue}if(typeof Xinha._pluginLoadStatus[H]=="undefined"){Xinha._pluginLoadStatus[H]="loading";Xinha.loadPlugin(H,function(I){if(typeof window[I]!="undefined"){Xinha._pluginLoadStatus[I]="ready"}else{Xinha._pluginLoadStatus[I]="failed"}},(Xinha.externalPlugins[H]?Xinha.externalPlugins[H][0]+Xinha.externalPlugins[H][1]:D));C=false}else{switch(Xinha._pluginLoadStatus[H]){case"failed":case"ready":break;default:C=false;break}}}if(C){return true}if(G){setTimeout(function(){if(Xinha.loadPlugins(F,G)){G()}},150)}return C};Xinha.refreshPlugin=function(A){if(A&&typeof A.onGenerate=="function"){A.onGenerate()}if(A&&typeof A.onGenerateOnce=="function"){A.onGenerateOnce();A.onGenerateOnce=null}};Xinha.prototype.firePluginEvent=function(C){var A=[];for(var B=1;B<arguments.length;B++){A[B-1]=arguments[B]}for(var B in this.plugins){var D=this.plugins[B].instance;if(D==this._browserSpecificPlugin){continue}if(D&&typeof D[C]=="function"){if(D[C].apply(D,A)){return true}}}var D=this._browserSpecificPlugin;if(D&&typeof D[C]=="function"){if(D[C].apply(D,A)){return true}}return false};Xinha.loadStyle=function(F,E,G,D){var A=_editor_url||"";if(E){A=Xinha.getPluginDir(E)+"/"}A+=F;if(/^\//.test(F)){A=F}var B=document.getElementsByTagName("head")[0];var C=document.createElement("link");C.rel="stylesheet";C.href=A;C.type="text/css";if(G){C.id=G}if(D&&B.getElementsByTagName("link")[0]){B.insertBefore(C,B.getElementsByTagName("link")[0])}else{B.appendChild(C)}};Xinha.prototype.debugTree=function(){var C=document.createElement("textarea");C.style.width="100%";C.style.height="20em";C.value="";function B(D,E){for(;--D>=0;){C.value+=" "}C.value+=E+"\n"}function A(E,H){var D=E.tagName.toLowerCase(),F;var G=Xinha.is_ie?E.scopeName:E.prefix;B(H,"- "+D+" ["+G+"]");for(F=E.firstChild;F;F=F.nextSibling){if(F.nodeType==1){A(F,H+2)}}}A(this._doc.body,0);document.body.appendChild(C)};Xinha.getInnerText=function(C){var A="",B;for(B=C.firstChild;B;B=B.nextSibling){if(B.nodeType==3){A+=B.data}else{if(B.nodeType==1){A+=Xinha.getInnerText(B)}}}return A};Xinha.prototype._wordClean=function(){var H=this;var F={empty_tags:0,mso_class:0,mso_style:0,mso_xmlel:0,orig_len:this._doc.body.innerHTML.length,T:(new Date()).getTime()};var E={empty_tags:"Empty tags removed: ",mso_class:"MSO class names removed: ",mso_style:"MSO inline style removed: ",mso_xmlel:"MSO XML elements stripped: "};function A(){var J="Xinha word cleaner stats: \n\n";for(var K in F){if(E[K]){J+=E[K]+F[K]+"\n"}}J+="\nInitial document length: "+F.orig_len+"\n";J+="Final document length: "+H._doc.body.innerHTML.length+"\n";J+="Clean-up took "+(((new Date()).getTime()-F.T)/1000)+" seconds";alert(J)}function I(J){var K=J.className.replace(/(^|\s)mso.*?(\s|$)/ig," ");if(K!=J.className){J.className=K;if(!(/\S/.test(J.className))){J.removeAttribute("className");++F.mso_class}}}function D(L){var J=L.style.cssText.split(/\s*;\s*/);for(var K=J.length;--K>=0;){if((/^mso|^tab-stops/i.test(J[K]))||(/^margin\s*:\s*0..\s+0..\s+0../i.test(J[K]))){++F.mso_style;J.splice(K,1)}}L.style.cssText=J.join("; ")}var C=null;if(Xinha.is_ie){C=function(J){J.outerHTML=Xinha.htmlEncode(J.innerText);++F.mso_xmlel}}else{C=function(K){var J=document.createTextNode(Xinha.getInnerText(K));K.parentNode.insertBefore(J,K);Xinha.removeFromParent(K);++F.mso_xmlel}}function B(J){if(/^(span|b|strong|i|em|font|div|p)$/i.test(J.tagName)&&!J.firstChild){Xinha.removeFromParent(J);++F.empty_tags}}function G(K){var J=K.tagName.toLowerCase(),L,M;if((Xinha.is_ie&&K.scopeName!="HTML")||(!Xinha.is_ie&&(/:/.test(J)))){C(K);return false}else{I(K);D(K);for(L=K.firstChild;L;L=M){M=L.nextSibling;if(L.nodeType==1&&G(L)){B(L)}}}return true}G(this._doc.body);this.updateToolbar()};Xinha.prototype._clearFonts=function(){var A=this.getInnerHTML();if(confirm(Xinha._lc("Would you like to clear font typefaces?"))){A=A.replace(/face="[^"]*"/gi,"");A=A.replace(/font-family:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font sizes?"))){A=A.replace(/size="[^"]*"/gi,"");A=A.replace(/font-size:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font colours?"))){A=A.replace(/color="[^"]*"/gi,"");A=A.replace(/([^-])color:[^;}"']+;?/gi,"$1")}A=A.replace(/(style|class)="\s*"/gi,"");A=A.replace(/<(font|span)\s*>/gi,"");this.setHTML(A);this.updateToolbar()};Xinha.prototype._splitBlock=function(){this._doc.execCommand("formatblock",false,"div")};Xinha.prototype.forceRedraw=function(){this._doc.body.style.visibility="hidden";this._doc.body.style.visibility=""};Xinha.prototype.focusEditor=function(){switch(this._editMode){case"wysiwyg":try{if(Xinha._someEditorHasBeenActivated){this.activateEditor();this._iframe.contentWindow.focus()}}catch(A){}break;case"textmode":try{this._textArea.focus()}catch(B){}break;default:alert("ERROR: mode "+this._editMode+" is not defined")}return this._doc};Xinha.prototype._undoTakeSnapshot=function(){++this._undoPos;if(this._undoPos>=this.config.undoSteps){this._undoQueue.shift();--this._undoPos}var B=true;var A=this.getInnerHTML();if(this._undoPos>0){B=(this._undoQueue[this._undoPos-1]!=A)}if(B){this._undoQueue[this._undoPos]=A}else{this._undoPos--}};Xinha.prototype.undo=function(){if(this._undoPos>0){var A=this._undoQueue[--this._undoPos];if(A){this.setHTML(A)}else{++this._undoPos}}};Xinha.prototype.redo=function(){if(this._undoPos<this._undoQueue.length-1){var A=this._undoQueue[++this._undoPos];if(A){this.setHTML(A)}else{--this._undoPos}}};Xinha.prototype.disableToolbar=function(C){if(this._timerToolbar){clearTimeout(this._timerToolbar)}if(typeof C=="undefined"){C=[]}else{if(typeof C!="object"){C=[C]}}for(var B in this._toolbarObjects){var A=this._toolbarObjects[B];if(C.contains(B)){continue}if(typeof(A.state)!="function"){continue}A.state("enabled",false)}};Xinha.prototype.enableToolbar=function(){this.updateToolbar()};Xinha.prototype.updateToolbar=function(_126){var doc=this._doc;var text=(this._editMode=="textmode");var _129=null;if(!text){_129=this.getAllAncestors();if(this.config.statusBar&&!_126){while(this._statusBarItems.length){var item=this._statusBarItems.pop();item.el=null;item.editor=null;item.onclick=null;item.oncontextmenu=null;item._xinha_dom0Events.click=null;item._xinha_dom0Events.contextmenu=null;item=null}this._statusBarTree.innerHTML=Xinha._lc("Path")+": ";for(var i=_129.length;--i>=0;){var el=_129[i];if(!el){continue}var a=document.createElement("a");a.href="javascript:void(0)";a.el=el;a.editor=this;this._statusBarItems.push(a);Xinha.addDom0Event(a,"click",function(){this.blur();this.editor.selectNodeContents(this.el);this.editor.updateToolbar(true);return false});Xinha.addDom0Event(a,"contextmenu",function(){this.blur();var info="Inline style:\n\n";info+=this.el.style.cssText.split(/;\s*/).join(";\n");alert(info);return false});var txt=el.tagName.toLowerCase();if(typeof el.style!="undefined"){a.title=el.style.cssText}if(el.id){txt+="#"+el.id}if(el.className){txt+="."+el.className}a.appendChild(document.createTextNode(txt));this._statusBarTree.appendChild(a);if(i!==0){this._statusBarTree.appendChild(document.createTextNode(String.fromCharCode(187)))}Xinha.freeLater(a)}}}for(var cmd in this._toolbarObjects){var btn=this._toolbarObjects[cmd];var _132=true;if(typeof(btn.state)!="function"){continue}if(btn.context&&!text){_132=false;var _133=btn.context;var _134=[];if(/(.*)\[(.*?)\]/.test(_133)){_133=RegExp.$1;_134=RegExp.$2.split(",")}_133=_133.toLowerCase();var _135=(_133=="*");for(var k=0;k<_129.length;++k){if(!_129[k]){continue}if(_135||(_129[k].tagName.toLowerCase()==_133)){_132=true;var _137=null;var att=null;var comp=null;var _13a=null;for(var ka=0;ka<_134.length;++ka){_137=_134[ka].match(/(.*)(==|!=|===|!==|>|>=|<|<=)(.*)/);att=_137[1];comp=_137[2];_13a=_137[3];if(!eval(_129[k][att]+comp+_13a)){_132=false;break}}if(_132){break}}}}btn.state("enabled",(!text||btn.text)&&_132);if(typeof cmd=="function"){continue}var _13c=this.config.customSelects[cmd];if((!text||btn.text)&&(typeof _13c!="undefined")){_13c.refresh(this);continue}switch(cmd){case"fontname":case"fontsize":if(!text){try{var _13d=(""+doc.queryCommandValue(cmd)).toLowerCase();if(!_13d){btn.element.selectedIndex=0;break}var _13e=this.config[cmd];var _13f=0;for(var j in _13e){if((j.toLowerCase()==_13d)||(_13e[j].substr(0,_13d.length).toLowerCase()==_13d)){btn.element.selectedIndex=_13f;throw"ok"}++_13f}btn.element.selectedIndex=0}catch(ex){}}break;case"formatblock":var _141=[];for(var _142 in this.config.formatblock){if(typeof this.config.formatblock[_142]=="string"){_141[_141.length]=this.config.formatblock[_142]}}var _143=this._getFirstAncestor(this.getSelection(),_141);if(_143){for(var x=0;x<_141.length;x++){if(_141[x].toLowerCase()==_143.tagName.toLowerCase()){btn.element.selectedIndex=x}}}else{btn.element.selectedIndex=0}break;case"textindicator":if(!text){try{var _145=btn.element.style;_145.backgroundColor=Xinha._makeColor(doc.queryCommandValue(Xinha.is_ie?"backcolor":"hilitecolor"));if(/transparent/i.test(_145.backgroundColor)){_145.backgroundColor=Xinha._makeColor(doc.queryCommandValue("backcolor"))}_145.color=Xinha._makeColor(doc.queryCommandValue("forecolor"));_145.fontFamily=doc.queryCommandValue("fontname");_145.fontWeight=doc.queryCommandState("bold")?"bold":"normal";_145.fontStyle=doc.queryCommandState("italic")?"italic":"normal"}catch(ex){}}break;case"htmlmode":btn.state("active",text);break;case"lefttoright":case"righttoleft":var _146=this.getParentElement();while(_146&&!Xinha.isBlockElement(_146)){_146=_146.parentNode}if(_146){btn.state("active",(_146.style.direction==((cmd=="righttoleft")?"rtl":"ltr")))}break;default:cmd=cmd.replace(/(un)?orderedlist/i,"insert$1orderedlist");try{btn.state("active",(!text&&doc.queryCommandState(cmd)))}catch(ex){}break}}if(this._customUndo&&!this._timerUndo){this._undoTakeSnapshot();var _147=this;this._timerUndo=setTimeout(function(){_147._timerUndo=null},this.config.undoTimeout)}this.firePluginEvent("onUpdateToolbar")};Xinha.getEditor=function(B){for(var A=__xinhas.length;A--;){var C=__xinhas[A];if(C&&(C._textArea.id==B||C._textArea.name==B||C._textArea==B)){return C}}return null};Xinha.prototype.getPluginInstance=function(A){if(this.plugins[A]){return this.plugins[A].instance}else{return null}};Xinha.prototype.getAllAncestors=function(){var B=this.getParentElement();var A=[];while(B&&(B.nodeType==1)&&(B.tagName.toLowerCase()!="body")){A.push(B);B=B.parentNode}A.push(this._doc.body);return A};Xinha.prototype._getFirstAncestor=function(D,C){var B=this.activeElement(D);if(B===null){try{B=(Xinha.is_ie?this.createRange(D).parentElement():this.createRange(D).commonAncestorContainer)}catch(A){return null}}if(typeof C=="string"){C=[C]}while(B){if(B.nodeType==1){if(C===null){return B}if(C.contains(B.tagName.toLowerCase())){return B}if(B.tagName.toLowerCase()=="body"){break}if(B.tagName.toLowerCase()=="table"){break}}B=B.parentNode}return null};Xinha.prototype._getAncestorBlock=function(B){var A=(Xinha.is_ie?this.createRange(B).parentElement:this.createRange(B).commonAncestorContainer);while(A&&(A.nodeType==1)){switch(A.tagName.toLowerCase()){case"div":case"p":case"address":case"blockquote":case"center":case"del":case"ins":case"pre":case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":case"h7":return A;case"body":case"noframes":case"dd":case"li":case"th":case"td":case"noscript":return null;default:break}}return null};Xinha.prototype._createImplicitBlock=function(B){var C=this.getSelection();if(Xinha.is_ie){C.empty()}else{C.collapseToStart()}var A=this.createRange(C)};Xinha.prototype.surroundHTML=function(C,B){var A=this.getSelectedHTML();this.insertHTML(C+A+B)};Xinha.prototype.hasSelectedText=function(){return this.getSelectedHTML()!==""};Xinha.prototype._comboSelected=function(B,A){this.focusEditor();var D=B.options[B.selectedIndex].value;switch(A){case"fontname":case"fontsize":this.execCommand(A,false,D);break;case"formatblock":if(!D){this.updateToolbar();break}if(!Xinha.is_gecko||D!=="blockquote"){D="<"+D+">"}this.execCommand(A,false,D);break;default:var C=this.config.customSelects[A];if(typeof C!="undefined"){C.action(this)}else{alert("FIXME: combo box "+A+" not implemented")}break}};Xinha.prototype._colorSelector=function(H){var G=this;if(Xinha.is_gecko){try{G._doc.execCommand("useCSS",false,false);G._doc.execCommand("styleWithCSS",false,true)}catch(D){}}var C=G._toolbarObjects[H].element;var F;if(H=="hilitecolor"){if(Xinha.is_ie){H="backcolor";F=Xinha._colorToRgb(G._doc.queryCommandValue("backcolor"))}else{F=Xinha._colorToRgb(G._doc.queryCommandValue("hilitecolor"))}}else{F=Xinha._colorToRgb(G._doc.queryCommandValue("forecolor"))}var E=function(I){G._doc.execCommand(H,false,I)};if(Xinha.is_ie){var B=G.createRange(G.getSelection());E=function(I){B.select();G._doc.execCommand(H,false,I)}}var A=new Xinha.colorPicker({cellsize:G.config.colorPickerCellSize,callback:E,granularity:G.config.colorPickerGranularity,websafe:G.config.colorPickerWebSafe,savecolors:G.config.colorPickerSaveColors});A.open(G.config.colorPickerPosition,C,F)};Xinha.prototype.execCommand=function(A,F,H){var G=this;this.focusEditor();A=A.toLowerCase();if(this.firePluginEvent("onExecCommand",A,F,H)){this.updateToolbar();return false}switch(A){case"htmlmode":this.setMode();break;case"hilitecolor":case"forecolor":this._colorSelector(A);break;case"createlink":this._createLink();break;case"undo":case"redo":if(this._customUndo){this[A]()}else{this._doc.execCommand(A,F,H)}break;case"inserttable":this._insertTable();break;case"insertimage":this._insertImage();break;case"about":this._popupDialog(G.config.URIs.about,null,this);break;case"showhelp":this._popupDialog(G.config.URIs.help,null,this);break;case"killword":this._wordClean();break;case"cut":case"copy":case"paste":this._doc.execCommand(A,F,H);if(this.config.killWordOnPaste){this._wordClean()}break;case"lefttoright":case"righttoleft":if(this.config.changeJustifyWithDirection){this._doc.execCommand((A=="righttoleft")?"justifyright":"justifyleft",F,H)}var B=(A=="righttoleft")?"rtl":"ltr";var E=this.getParentElement();while(E&&!Xinha.isBlockElement(E)){E=E.parentNode}if(E){if(E.style.direction==B){E.style.direction=""}else{E.style.direction=B}}break;case"justifyleft":case"justifyright":A.match(/^justify(.*)$/);var D=this.activeElement(this.getSelection());if(D&&D.tagName.toLowerCase()=="img"){D.align=D.align==RegExp.$1?"":RegExp.$1}else{this._doc.execCommand(A,F,H)}break;default:try{this._doc.execCommand(A,F,H)}catch(C){if(this.config.debug){alert(C+"\n\nby execCommand("+A+");")}}break}this.updateToolbar();return false};Xinha.prototype._editorEvent=function(A){var B=this;if(typeof B._textArea["on"+A.type]=="function"){B._textArea["on"+A.type]()}if(this.isKeyEvent(A)){if(B.firePluginEvent("onKeyPress",A)){return false}if(this.isShortCut(A)){this._shortCuts(A)}}if(A.type=="mousedown"){if(B.firePluginEvent("onMouseDown",A)){return false}}if(B._timerToolbar){clearTimeout(B._timerToolbar)}B._timerToolbar=setTimeout(function(){B.updateToolbar();B._timerToolbar=null},250)};Xinha.prototype._shortCuts=function(B){var A=this.getKey(B).toLowerCase();var D=null;var C=null;switch(A){case"b":D="bold";break;case"i":D="italic";break;case"u":D="underline";break;case"s":D="strikethrough";break;case"l":D="justifyleft";break;case"e":D="justifycenter";break;case"r":D="justifyright";break;case"j":D="justifyfull";break;case"z":D="undo";break;case"y":D="redo";break;case"v":D="paste";break;case"n":D="formatblock";C="p";break;case"0":D="killword";break;case"1":case"2":case"3":case"4":case"5":case"6":D="formatblock";C="h"+A;break}if(D){this.execCommand(D,false,C);Xinha._stopEvent(B)}};Xinha.prototype.convertNode=function(C,B){var A=this._doc.createElement(B);while(C.firstChild){A.appendChild(C.firstChild)}return A};Xinha.prototype.scrollToElement=function(B){if(!B){B=this.getParentElement();if(!B){return}}var A=Xinha.getElementTopLeft(B);this._iframe.contentWindow.scrollTo(A.left,A.top)};Xinha.prototype.getEditorContent=function(){return this.outwardHtml(this.getHTML())};Xinha.prototype.setEditorContent=function(A){this.setHTML(this.inwardHtml(A))};Xinha.prototype.getHTML=function(){var A="";switch(this._editMode){case"wysiwyg":if(!this.config.fullPage){A=Xinha.getHTML(this._doc.body,false,this).trim()}else{A=this.doctype+"\n"+Xinha.getHTML(this._doc.documentElement,true,this)}break;case"textmode":A=this._textArea.value;break;default:alert("Mode <"+this._editMode+"> not defined!");return false}return A};Xinha.prototype.outwardHtml=function(D){for(var C in this.plugins){var B=this.plugins[C].instance;if(B&&typeof B.outwardHtml=="function"){D=B.outwardHtml(D)}}D=D.replace(/<(\/?)b(\s|>|\/)/ig,"<$1strong$2");D=D.replace(/<(\/?)i(\s|>|\/)/ig,"<$1em$2");D=D.replace(/<(\/?)strike(\s|>|\/)/ig,"<$1del$2");D=D.replace(/(<[^>]*on(click|mouse(over|out|up|down))=['"])if\(window\.parent &amp;&amp; window\.parent\.Xinha\)\{return false\}/gi,"$1");var A=location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/";D=D.replace(/https?:\/\/null\//g,A);D=D.replace(/((href|src|background)=[\'\"])\/+/ig,"$1"+A);D=this.outwardSpecialReplacements(D);D=this.fixRelativeLinks(D);if(this.config.sevenBitClean){D=D.replace(/[^ -~\r\n\t]/g,function(E){return"&#"+E.charCodeAt(0)+";"})}D=D.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(freezescript)/gi,"$1javascript");if(this.config.fullPage){D=Xinha.stripCoreCSS(D)}if(typeof this.config.outwardHtml=="function"){D=this.config.outwardHtml(D)}return D};Xinha.prototype.inwardHtml=function(B){for(var A in this.plugins){var D=this.plugins[A].instance;if(D&&typeof D.inwardHtml=="function"){B=D.inwardHtml(B)}}B=B.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");B=B.replace(/(<[^>]*on(click|mouse(over|out|up|down))=["'])/gi,"$1if(window.parent &amp;&amp; window.parent.Xinha){return false}");B=this.inwardSpecialReplacements(B);B=B.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(javascript)/gi,"$1freezescript");var C=new RegExp("((href|src|background)=['\"])/+","gi");B=B.replace(C,"$1"+location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/");B=this.fixRelativeLinks(B);if(this.config.fullPage){B=Xinha.addCoreCSS(B)}if(typeof this.config.inwardHtml=="function"){B=this.config.inwardHtml(B)}return B};Xinha.prototype.outwardSpecialReplacements=function(B){for(var A in this.config.specialReplacements){var E=this.config.specialReplacements[A];var D=A;if(typeof E.replace!="function"||typeof D.replace!="function"){continue}var C=new RegExp(Xinha.escapeStringForRegExp(E),"g");B=B.replace(C,D.replace(/\$/g,"$$$$"))}return B};Xinha.prototype.inwardSpecialReplacements=function(B){for(var A in this.config.specialReplacements){var E=A;var D=this.config.specialReplacements[A];if(typeof E.replace!="function"||typeof D.replace!="function"){continue}var C=new RegExp(Xinha.escapeStringForRegExp(E),"g");B=B.replace(C,D.replace(/\$/g,"$$$$"))}return B};Xinha.prototype.fixRelativeLinks=function(E){if(typeof this.config.expandRelativeUrl!="undefined"&&this.config.expandRelativeUrl){var A=E.match(/(src|href)="([^"]*)"/gi)}var F=document.location.href;if(A){var C,G,H,J,B;for(var D=0;D<A.length;++D){C=A[D].match(/(src|href)="([^"]*)"/i);G=C[2].match(/\.\.\//g);if(G){H=new RegExp("(.*?)(([^/]*/){"+G.length+"})[^/]*$");J=F.match(H);B=C[2].replace(/(\.\.\/)*/,J[1]);E=E.replace(new RegExp(Xinha.escapeStringForRegExp(C[2])),B)}}}if(typeof this.config.stripSelfNamedAnchors!="undefined"&&this.config.stripSelfNamedAnchors){var K=new RegExp('((href|src|background)=")('+Xinha.escapeStringForRegExp(unescape(document.location.href.replace(/&/g,"&amp;")))+")([#?][^'\" ]*)","g");E=E.replace(K,"$1$4")}if(typeof this.config.stripBaseHref!="undefined"&&this.config.stripBaseHref){var I=null;if(typeof this.config.baseHref!="undefined"&&this.config.baseHref!==null){I=new RegExp('((href|src|background|action)=")('+Xinha.escapeStringForRegExp(this.config.baseHref.replace(/([^\/]\/)(?=.+\.)[^\/]*$/,"$1"))+")","g");E=E.replace(I,"$1")}I=new RegExp('((href|src|background|action)=")('+Xinha.escapeStringForRegExp(document.location.href.replace(/^(https?:\/\/[^\/]*)(.*)/,"$1"))+")","g");E=E.replace(I,"$1")}return E};Xinha.prototype.getInnerHTML=function(){if(!this._doc.body){return""}var A="";switch(this._editMode){case"wysiwyg":if(!this.config.fullPage){A=this._doc.body.innerHTML}else{A=this.doctype+"\n"+this._doc.documentElement.innerHTML}break;case"textmode":A=this._textArea.value;break;default:alert("Mode <"+this._editMode+"> not defined!");return false}return A};Xinha.prototype.setHTML=function(A){if(!this.config.fullPage){this._doc.body.innerHTML=A}else{this.setFullHTML(A)}this._textArea.value=A};Xinha.prototype.setDoctype=function(A){this.doctype=A};Xinha._object=null;Array.prototype.isArray=true;RegExp.prototype.isRegExp=true;Xinha.cloneObject=function(obj){if(!obj){return null}var _198=(obj.isArray)?[]:{};if(obj.constructor.toString().match(/\s*function Function\(/)||typeof obj=="function"){_198=obj}else{if(obj.isRegExp){_198=eval(obj.toString())}else{for(var n in obj){var node=obj[n];if(typeof node=="object"){_198[n]=Xinha.cloneObject(node)}else{_198[n]=node}}}}return _198};Xinha.flushEvents=function(){var A=0;var C=Xinha._eventFlushers.pop();while(C){try{if(C.length==3){Xinha._removeEvent(C[0],C[1],C[2]);A++}else{if(C.length==2){C[0]["on"+C[1]]=null;C[0]._xinha_dom0Events[C[1]]=null;A++}}}catch(B){}C=Xinha._eventFlushers.pop()}};Xinha._eventFlushers=[];if(document.addEventListener){Xinha._addEvent=function(B,A,C){B.addEventListener(A,C,true);Xinha._eventFlushers.push([B,A,C])};Xinha._removeEvent=function(B,A,C){B.removeEventListener(A,C,true)};Xinha._stopEvent=function(A){A.preventDefault();A.stopPropagation()}}else{if(document.attachEvent){Xinha._addEvent=function(B,A,C){B.attachEvent("on"+A,C);Xinha._eventFlushers.push([B,A,C])};Xinha._removeEvent=function(A,C,B){A.detachEvent("on"+C,B)};Xinha._stopEvent=function(B){try{B.cancelBubble=true;B.returnValue=false}catch(A){}}}else{Xinha._addEvent=function(A,C,B){alert("_addEvent is not supported")};Xinha._removeEvent=function(A,C,B){alert("_removeEvent is not supported")};Xinha._stopEvent=function(A){alert("_stopEvent is not supported")}}}Xinha._addEvents=function(C,A,D){for(var B=A.length;--B>=0;){Xinha._addEvent(C,A[B],D)}};Xinha._removeEvents=function(C,A,D){for(var B=A.length;--B>=0;){Xinha._removeEvent(C,A[B],D)}};Xinha.addOnloadHandler=function(B,A){A=A?A:window;var C=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(Xinha.onloadTimer){clearInterval(Xinha.onloadTimer)}B()};if(Xinha.is_ie){A.document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");var D=A.document.getElementById("__ie_onload");D.onreadystatechange=function(){if(this.readyState=="loaded"){this.parentNode.removeChild(D);C()}}}else{if(/applewebkit|KHTML/i.test(navigator.userAgent)){Xinha.onloadTimer=A.setInterval(function(){if(/loaded|complete/.test(A.document.readyState)){C()}},10)}else{A.document.addEventListener("DOMContentLoaded",C,false)}}Xinha._addEvent(A,"load",C)};Xinha.addDom0Event=function(B,C,A){Xinha._prepareForDom0Events(B,C);B._xinha_dom0Events[C].unshift(A)};Xinha.prependDom0Event=function(B,C,A){Xinha._prepareForDom0Events(B,C);B._xinha_dom0Events[C].push(A)};Xinha._prepareForDom0Events=function(A,B){if(typeof A._xinha_dom0Events=="undefined"){A._xinha_dom0Events={};Xinha.freeLater(A,"_xinha_dom0Events")}if(typeof A._xinha_dom0Events[B]=="undefined"){A._xinha_dom0Events[B]=[];if(typeof A["on"+B]=="function"){A._xinha_dom0Events[B].push(A["on"+B])}A["on"+B]=function(E){var D=A._xinha_dom0Events[B];var C=true;for(var F=D.length;--F>=0;){A._xinha_tempEventHandler=D[F];if(A._xinha_tempEventHandler(E)===false){A._xinha_tempEventHandler=null;C=false;break}A._xinha_tempEventHandler=null}return C};Xinha._eventFlushers.push([A,B])}};Xinha.prototype.notifyOn=function(B,A){if(typeof this._notifyListeners[B]=="undefined"){this._notifyListeners[B]=[];Xinha.freeLater(this,"_notifyListeners")}this._notifyListeners[B].push(A)};Xinha.prototype.notifyOf=function(C,A){if(this._notifyListeners[C]){for(var B=0;B<this._notifyListeners[C].length;B++){this._notifyListeners[C][B](C,A)}}};Xinha._blockTags=" body form textarea fieldset ul ol dl li div p h1 h2 h3 h4 h5 h6 quote pre table thead tbody tfoot tr td th iframe address blockquote ";Xinha.isBlockElement=function(A){return A&&A.nodeType==1&&(Xinha._blockTags.indexOf(" "+A.tagName.toLowerCase()+" ")!=-1)};Xinha._paraContainerTags=" body td th caption fieldset div";Xinha.isParaContainer=function(A){return A&&A.nodeType==1&&(Xinha._paraContainerTags.indexOf(" "+A.tagName.toLowerCase()+" ")!=-1)};Xinha._closingTags=" a abbr acronym address applet b bdo big blockquote button caption center cite code del dfn dir div dl em fieldset font form frameset h1 h2 h3 h4 h5 h6 i iframe ins kbd label legend map menu noframes noscript object ol optgroup pre q s samp script select small span strike strong style sub sup table textarea title tt u ul var ";Xinha.needsClosingTag=function(A){return A&&A.nodeType==1&&(Xinha._closingTags.indexOf(" "+A.tagName.toLowerCase()+" ")!=-1)};Xinha.htmlEncode=function(A){if(typeof A.replace=="undefined"){A=A.toString()}A=A.replace(/&/ig,"&amp;");A=A.replace(/</ig,"&lt;");A=A.replace(/>/ig,"&gt;");A=A.replace(/\xA0/g,"&nbsp;");A=A.replace(/\x22/g,"&quot;");return A};Xinha.prototype.stripBaseURL=function(C){if(this.config.baseHref===null||!this.config.stripBaseHref){return C}var B=this.config.baseHref.replace(/^(https?:\/\/[^\/]+)(.*)$/,"$1");var A=new RegExp(B);return C.replace(A,"")};String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")};Xinha._makeColor=function(B){if(typeof B!="number"){return B}var D=B&255;var C=(B>>8)&255;var A=(B>>16)&255;return"rgb("+D+","+C+","+A+")"};Xinha._colorToRgb=function(B){if(!B){return""}var F,E,A;function D(G){return(G<16)?("0"+G.toString(16)):G.toString(16)}if(typeof B=="number"){F=B&255;E=(B>>8)&255;A=(B>>16)&255;return"#"+D(F)+D(E)+D(A)}if(B.substr(0,3)=="rgb"){var C=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;if(B.match(C)){F=parseInt(RegExp.$1,10);E=parseInt(RegExp.$2,10);A=parseInt(RegExp.$3,10);return"#"+D(F)+D(E)+D(A)}return null}if(B.substr(0,1)=="#"){return B}return null};Xinha.prototype._popupDialog=function(B,A,C){Dialog(this.popupURL(B),A,C)};Xinha.prototype.imgURL=function(B,A){if(typeof A=="undefined"){return _editor_url+B}else{return _editor_url+"plugins/"+A+"/img/"+B}};Xinha.prototype.popupURL=function(B){var A="";if(B.match(/^plugin:\/\/(.*?)\/(.*)/)){var D=RegExp.$1;var C=RegExp.$2;if(!(/\.(html?|php)$/.test(C))){C+=".html"}A=Xinha.getPluginDir(D)+"/popups/"+C}else{if(B.match(/^\/.*?/)||B.match(/^https?:\/\//)){A=B}else{A=_editor_url+this.config.popupURL+B}}return A};Xinha.getElementById=function(A,E){var C,B,D=document.getElementsByTagName(A);for(B=D.length;--B>=0&&(C=D[B]);){if(C.id==E){return C}}return null};Xinha.prototype._toggleBorders=function(){var B=this._doc.getElementsByTagName("TABLE");if(B.length!==0){if(!this.borders){this.borders=true}else{this.borders=false}for(var A=0;A<B.length;A++){if(this.borders){Xinha._addClass(B[A],"htmtableborders")}else{Xinha._removeClass(B[A],"htmtableborders")}}}return true};Xinha.addCoreCSS=function(A){var B='<style title="XinhaInternalCSS" type="text/css">.htmtableborders, .htmtableborders td, .htmtableborders th {border : 1px dashed lightgrey ! important;}\nhtml, body { border: 0px; } \nbody { background-color: #ffffff; } \nimg, hr { cursor: default } \n</style>\n';if(A&&/<head>/i.test(A)){return A.replace(/<head>/i,"<head>"+B)}else{if(A){return B+A}else{return B}}};Xinha.prototype.addEditorStylesheet=function(B){var A=this._doc.createElement("link");A.rel="stylesheet";A.type="text/css";A.title="XinhaInternalCSS";A.href=B;this._doc.getElementsByTagName("HEAD")[0].appendChild(A)};Xinha.stripCoreCSS=function(A){return A.replace(/<style[^>]+title="XinhaInternalCSS"(.|\n)*?<\/style>/ig,"").replace(/<link[^>]+title="XinhaInternalCSS"(.|\n)*?>/ig,"")};Xinha._removeClass=function(E,C){if(!(E&&E.className)){return}var A=E.className.split(" ");var B=[];for(var D=A.length;D>0;){if(A[--D]!=C){B[B.length]=A[D]}}E.className=B.join(" ")};Xinha._addClass=function(A,B){Xinha._removeClass(A,B);A.className+=" "+B};Xinha.addClasses=function(D,E){if(D!==null){var G=D.className.trim().split(" ");var C=E.split(" ");for(var A=0;A<C.length;A++){var F=false;for(var B=0;F===false&&B<G.length;B++){if(G[B]==C[A]){F=true}}if(F===false){G[G.length]=C[A]}}D.className=G.join(" ").trim()}};Xinha.removeClasses=function(F,D){var C=F.className.trim().split();var B=[];var H=D.trim().split();for(var E=0;E<C.length;E++){var G=false;for(var A=0;A<H.length&&!G;A++){if(C[E]==H[A]){G=true}}if(!G){B[B.length]=C[E]}}return B.join(" ")};Xinha.addClass=Xinha._addClass;Xinha.removeClass=Xinha._removeClass;Xinha._addClasses=Xinha.addClasses;Xinha._removeClasses=Xinha.removeClasses;Xinha._hasClass=function(D,C){if(!(D&&D.className)){return false}var A=D.className.split(" ");for(var B=A.length;B>0;){if(A[--B]==C){return true}}return false};Xinha._postback_send_charset=true;Xinha._postback=function(B,G,D){var E=null;E=Xinha.getXMLHTTPRequestObject();var A="";if(typeof G=="string"){A=G}else{if(typeof G=="object"){for(var C in G){A+=(A.length?"&":"")+C+"="+encodeURIComponent(G[C])}}}function F(){if(E.readyState==4){if(E.status==200||Xinha.isRunLocally&&E.status==0){if(typeof D=="function"){D(E.responseText,E)}}else{if(Xinha._postback_send_charset){Xinha._postback_send_charset=false;Xinha._postback(B,G,D)}else{alert("An error has occurred: "+E.statusText+"\nURL: "+B)}}}}E.onreadystatechange=F;E.open("POST",B,true);E.setRequestHeader("Content-Type","application/x-www-form-urlencoded"+(Xinha._postback_send_charset?"; charset=UTF-8":""));E.send(A)};Xinha._getback=function(B,A){var C=null;C=Xinha.getXMLHTTPRequestObject();function D(){if(C.readyState==4){if(C.status==200||Xinha.isRunLocally&&C.status==0){A(C.responseText,C)}else{alert("An error has occurred: "+C.statusText+"\nURL: "+B)}}}C.onreadystatechange=D;C.open("GET",B,true);C.send(null)};Xinha._geturlcontent=function(A){var B=null;B=Xinha.getXMLHTTPRequestObject();B.open("GET",A,false);B.send(null);if(B.status==200||Xinha.isRunLocally&&B.status==0){return B.responseText}else{return""}};if(typeof dumpValues=="undefined"){function dumpValues(C){var B="";for(var D in C){if(window.console&&typeof window.console.log=="function"){if(typeof console.firebug!="undefined"){console.log(C)}else{console.log(D+" = "+C[D]+"\n")}}else{B+=D+" = "+C[D]+"\n"}}if(B){if(document.getElementById("errors")){document.getElementById("errors").value+=B}else{var A=window.open("","debugger");A.document.write("<pre>"+B+"</pre>")}}}}if(!Array.prototype.contains){Array.prototype.contains=function(C){var B=this;for(var A=0;A<B.length;A++){if(C==B[A]){return true}}return false}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C){var B=this;for(var A=0;A<B.length;A++){if(C==B[A]){return A}}return null}}if(!Array.prototype.append){Array.prototype.append=function(A){for(var B=0;B<A.length;B++){this.push(A[B])}return this}}Xinha.arrayContainsArray=function(D,C){var E=true;for(var B=0;B<C.length;B++){var A=false;for(var F=0;F<D.length;F++){if(D[F]==C[B]){A=true;break}}if(!A){E=false;break}}return E};Xinha.arrayFilter=function(C,D){var B=[];for(var A=0;A<C.length;A++){if(D(C[A])){B[B.length]=C[A]}}return B};Xinha.collectionToArray=function(C){var B=[];for(var A=0;A<C.length;A++){B.push(C.item(A))}return B};Xinha.uniq_count=0;Xinha.uniq=function(A){return A+Xinha.uniq_count++};Xinha._loadlang=function(_230,url){var lang;if(typeof _editor_lcbackend=="string"){url=_editor_lcbackend;url=url.replace(/%lang%/,_editor_lang);url=url.replace(/%context%/,_230)}else{if(!url){if(_230!="Xinha"){url=Xinha.getPluginDir(_230)+"/lang/"+_editor_lang+".js"}else{Xinha.setLoadingMessage("Loading language");url=_editor_url+"lang/"+_editor_lang+".js"}}}var _233=Xinha._geturlcontent(url);if(_233!==""){try{eval("lang = "+_233)}catch(ex){alert("Error reading Language-File ("+url+"):\n"+Error.toString());lang={}}}else{lang={}}return lang};Xinha._lc=function(B,A,I){var C,G;if(typeof A=="object"&&A.url&&A.context){C=A.url+_editor_lang+".js";A=A.context}var E=null;if(typeof B=="string"){E=B.match(/\$(.*?)=(.*?)\$/g)}if(E){if(!I){I={}}for(var F=0;F<E.length;F++){var D=E[F].match(/\$(.*?)=(.*?)\$/);I[D[1]]=D[2];B=B.replace(D[0],"$"+D[1])}}if(_editor_lang=="en"){if(typeof B=="object"&&B.string){G=B.string}else{G=B}}else{if(typeof Xinha._lc_catalog=="undefined"){Xinha._lc_catalog=[]}if(typeof A=="undefined"){A="Xinha"}if(typeof Xinha._lc_catalog[A]=="undefined"){Xinha._lc_catalog[A]=Xinha._loadlang(A,C)}var H;if(typeof B=="object"&&B.key){H=B.key}else{if(typeof B=="object"&&B.string){H=B.string}else{H=B}}if(typeof Xinha._lc_catalog[A][H]=="undefined"){if(A=="Xinha"){if(typeof B=="object"&&B.string){G=B.string}else{G=B}}else{return Xinha._lc(B,"Xinha",I)}}else{G=Xinha._lc_catalog[A][H]}}if(typeof B=="object"&&B.replace){I=B.replace}if(typeof I!="undefined"){for(var F in I){G=G.replace("$"+F,I[F])}}return G};Xinha.hasDisplayedChildren=function(C){var A=C.childNodes;for(var B=0;B<A.length;B++){if(A[B].tagName){if(A[B].style.display!="none"){return true}}}return false};Xinha._loadback=function(A,F,E,D){if(document.getElementById(A)){return true}var B=!Xinha.is_ie?"onload":"onreadystatechange";var C=document.createElement("script");C.type="text/javascript";C.src=A;C.id=A;if(F){C[B]=function(){if(Xinha.is_ie&&(!(/loaded|complete/.test(window.event.srcElement.readyState)))){return}F.call(E?E:this,D);C[B]=null}}document.getElementsByTagName("head")[0].appendChild(C);return false};Xinha.makeEditors=function(G,F,D){if(!Xinha.isSupportedBrowser){return}if(typeof F=="function"){F=F()}var C={};var B;for(var A=0;A<G.length;A++){if(typeof G[A]=="string"){B=Xinha.getElementById("textarea",G[A]);if(!B){G[A]=null;continue}}else{if(typeof G[A]=="object"&&G[A].tagName&&G[A].tagName.toLowerCase()=="textarea"){B=G[A];if(!B.id){B.id="xinha_id_"+A}}}var E=new Xinha(B,Xinha.cloneObject(F));E.registerPlugins(D);C[B.id]=E}return C};Xinha.startEditors=function(A){if(!Xinha.isSupportedBrowser){return}for(var B in A){if(A[B].generate){A[B].generate()}}};Xinha.prototype.registerPlugins=function(A){if(!Xinha.isSupportedBrowser){return}if(A){for(var B=0;B<A.length;B++){this.setLoadingMessage(Xinha._lc("Register plugin $plugin","Xinha",{plugin:A[B]}));this.registerPlugin(A[B])}}};Xinha.base64_encode=function(D){var C="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var B="";var K,I,G;var J,H,F,E;var A=0;do{K=D.charCodeAt(A++);I=D.charCodeAt(A++);G=D.charCodeAt(A++);J=K>>2;H=((K&3)<<4)|(I>>4);F=((I&15)<<2)|(G>>6);E=G&63;if(isNaN(I)){F=E=64}else{if(isNaN(G)){E=64}}B=B+C.charAt(J)+C.charAt(H)+C.charAt(F)+C.charAt(E)}while(A<D.length);return B};Xinha.base64_decode=function(C){var B="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var A="";var K,I,G;var J,H,F,E;var D=0;C=C.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{J=B.indexOf(C.charAt(D++));H=B.indexOf(C.charAt(D++));F=B.indexOf(C.charAt(D++));E=B.indexOf(C.charAt(D++));K=(J<<2)|(H>>4);I=((H&15)<<4)|(F>>2);G=((F&3)<<6)|E;A=A+String.fromCharCode(K);if(F!=64){A=A+String.fromCharCode(I)}if(E!=64){A=A+String.fromCharCode(G)}}while(D<C.length);return A};Xinha.removeFromParent=function(B){if(!B.parentNode){return}var A=B.parentNode;A.removeChild(B);return B};Xinha.hasParentNode=function(A){if(A.parentNode){if(A.parentNode.nodeType==11){return false}return true}return false};Xinha.viewportSize=function(B){B=(B)?B:window;var A,C;if(B.innerHeight){A=B.innerWidth;C=B.innerHeight}else{if(B.document.documentElement&&B.document.documentElement.clientHeight){A=B.document.documentElement.clientWidth;C=B.document.documentElement.clientHeight}else{if(B.document.body){A=B.document.body.clientWidth;C=B.document.body.clientHeight}}}return{x:A,y:C}};Xinha.pageSize=function(C){C=(C)?C:window;var B,E;var A=C.document.body.scrollHeight;var D=C.document.documentElement.scrollHeight;if(A>D){B=C.document.body.scrollWidth;E=C.document.body.scrollHeight}else{B=C.document.documentElement.scrollWidth;E=C.document.documentElement.scrollHeight}return{x:B,y:E}};Xinha.prototype.scrollPos=function(B){B=(B)?B:window;var A,C;if(B.pageYOffset){A=B.pageXOffset;C=B.pageYOffset}else{if(B.document.documentElement&&document.documentElement.scrollTop){A=B.document.documentElement.scrollLeft;C=B.document.documentElement.scrollTop}else{if(B.document.body){A=B.document.body.scrollLeft;C=B.document.body.scrollTop}}}return{x:A,y:C}};Xinha.getElementTopLeft=function(B){var A=curtop=0;if(B.offsetParent){A=B.offsetLeft;curtop=B.offsetTop;while(B=B.offsetParent){A+=B.offsetLeft;curtop+=B.offsetTop}}return{top:curtop,left:A}};Xinha.findPosX=function(A){var B=0;if(A.offsetParent){return Xinha.getElementTopLeft(A).left}else{if(A.x){B+=A.x}}return B};Xinha.findPosY=function(B){var A=0;if(B.offsetParent){return Xinha.getElementTopLeft(B).top}else{if(B.y){A+=B.y}}return A};Xinha.createLoadingMessages=function(B){if(Xinha.loadingMessages||!Xinha.isSupportedBrowser){return}Xinha.loadingMessages=[];for(var A=0;A<B.length;A++){if(!document.getElementById(B[A])){continue}Xinha.loadingMessages.push(Xinha.createLoadingMessage(Xinha.getElementById("textarea",B[A])))}};Xinha.createLoadingMessage=function(D,E){if(document.getElementById("loading_"+D.id)||!Xinha.isSupportedBrowser){return}var C=document.createElement("div");C.id="loading_"+D.id;C.className="loading";C.style.left=(Xinha.findPosX(D)+D.offsetWidth/2)-106+"px";C.style.top=(Xinha.findPosY(D)+D.offsetHeight/2)-50+"px";var B=document.createElement("div");B.className="loading_main";B.id="loading_main_"+D.id;B.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!")));var A=document.createElement("div");A.className="loading_sub";A.id="loading_sub_"+D.id;E=E?E:Xinha._lc("Loading Core");A.appendChild(document.createTextNode(E));C.appendChild(B);C.appendChild(A);document.body.appendChild(C);Xinha.freeLater(C);Xinha.freeLater(B);Xinha.freeLater(A);return A};Xinha.prototype.setLoadingMessage=function(B,A){if(!document.getElementById("loading_sub_"+this._textArea.id)){return}document.getElementById("loading_main_"+this._textArea.id).innerHTML=A?A:Xinha._lc("Loading in progress. Please wait!");document.getElementById("loading_sub_"+this._textArea.id).innerHTML=B};Xinha.setLoadingMessage=function(B){if(!Xinha.loadingMessages){return}for(var A=0;A<Xinha.loadingMessages.length;A++){Xinha.loadingMessages[A].innerHTML=B}};Xinha.prototype.removeLoadingMessage=function(){if(document.getElementById("loading_"+this._textArea.id)){document.body.removeChild(document.getElementById("loading_"+this._textArea.id))}};Xinha.removeLoadingMessages=function(C){for(var B=0;B<C.length;B++){if(!document.getElementById(C[B])){continue}var A=document.getElementById("loading_"+document.getElementById(C[B]).id);A.parentNode.removeChild(A)}Xinha.loadingMessages=null};Xinha.toFree=[];Xinha.freeLater=function(A,B){Xinha.toFree.push({o:A,p:B})};Xinha.free=function(C,D){if(C&&!D){for(var B in C){Xinha.free(C,B)}}else{if(C){if(D.indexOf("src")==-1){try{C[D]=null}catch(A){}}}}};Xinha.collectGarbageForIE=function(){Xinha.flushEvents();for(var A=0;A<Xinha.toFree.length;A++){Xinha.free(Xinha.toFree[A].o,Xinha.toFree[A].p);Xinha.toFree[A].o=null}};Xinha.prototype.insertNodeAtSelection=function(A){Xinha.notImplemented("insertNodeAtSelection")};Xinha.prototype.getParentElement=function(A){Xinha.notImplemented("getParentElement")};Xinha.prototype.activeElement=function(A){Xinha.notImplemented("activeElement")};Xinha.prototype.selectionEmpty=function(A){Xinha.notImplemented("selectionEmpty")};Xinha.prototype.saveSelection=function(){Xinha.notImplemented("saveSelection")};Xinha.prototype.restoreSelection=function(A){Xinha.notImplemented("restoreSelection")};Xinha.prototype.selectNodeContents=function(A,B){Xinha.notImplemented("selectNodeContents")};Xinha.prototype.insertHTML=function(A){Xinha.notImplemented("insertHTML")};Xinha.prototype.getSelectedHTML=function(){Xinha.notImplemented("getSelectedHTML")};Xinha.prototype.getSelection=function(){Xinha.notImplemented("getSelection")};Xinha.prototype.createRange=function(A){Xinha.notImplemented("createRange")};Xinha.prototype.isKeyEvent=function(A){Xinha.notImplemented("isKeyEvent")};Xinha.prototype.isShortCut=function(A){if(A.ctrlKey&&!A.altKey){return true}return false};Xinha.prototype.getKey=function(A){Xinha.notImplemented("getKey")};Xinha.getOuterHTML=function(A){Xinha.notImplemented("getOuterHTML")};Xinha.getXMLHTTPRequestObject=function(){try{if(typeof XMLHttpRequest!="undefined"&&typeof XMLHttpRequest.constructor=="function"){return new XMLHttpRequest()}else{if(typeof ActiveXObject=="function"){return new ActiveXObject("Microsoft.XMLHTTP")}}}catch(A){Xinha.notImplemented("getXMLHTTPRequestObject")}};Xinha.prototype._activeElement=function(A){return this.activeElement(A)};Xinha.prototype._selectionEmpty=function(A){return this.selectionEmpty(A)};Xinha.prototype._getSelection=function(){return this.getSelection()};Xinha.prototype._createRange=function(A){return this.createRange(A)};HTMLArea=Xinha;Xinha.init();if(Xinha.ie_version<8){Xinha.addDom0Event(window,"unload",Xinha.collectGarbageForIE)}Xinha.notImplemented=function(A){throw new Error("Method Not Implemented","Part of Xinha has tried to call the "+A+" method which has not been implemented.")};
