/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* The URL of the most recent uncompressed version of this file is http://svn.xinha.org/trunk/XinhaCore.js */
  /*--------------------------------------------------------------------------
    --  Xinha (is not htmlArea) - http://xinha.org
    --
    --  Use of Xinha is granted by the terms of the htmlArea License (based on
    --  BSD license)  please read license.txt in this package for details.
    --
    --  Copyright (c) 2005-2012 Xinha Developer Team and contributors
    --  
    --  Xinha was originally based on work by Mihai Bazon which is:
    --      Copyright (c) 2003-2004 dynarch.com.
    --      Copyright (c) 2002-2003 interactivetools.com, inc.
    --      This copyright notice MUST stay intact for use.
    -------------------------------------------------------------------------*/

Xinha.version={Release:"Trunk",Head:"$HeadURL: http://svn.xinha.org/trunk/XinhaCore.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),Date:"$LastChangedDate: 2010-05-12 09:40:06 +1200 (Wed, 12 May 2010) $".replace(/^[^:]*:\s*([0-9\-]*) ([0-9:]*) ([+0-9]*) \((.*)\)\s*\$/,"$4 $2 $3"),Revision:"$LastChangedRevision: 1263 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),RevisionBy:"$LastChangedBy: gogo $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1")};Xinha._resolveRelativeUrl=function(g,h){if(h.match(/^([^:]+\:)?\/\//)){return h}else{var b=g.split("/");if(b[b.length-1]===""){b.pop()}var f=h.split("/");if(f[0]=="."){f.shift()}while(f[0]==".."){b.pop();f.shift()}return b.join("/")+"/"+f.join("/")}};if(typeof _editor_url=="string"){_editor_url=_editor_url.replace(/\x2f*$/,"/");if(!_editor_url.match(/^([^:]+\:)?\//)){(function(){var b=window.location.toString().replace(/\?.*$/,"").split("/");b.pop();_editor_url=Xinha._resolveRelativeUrl(b.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 '/xinha/', 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=""}if(typeof _editor_icons!=="string"){_editor_icons=""}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"),10);Xinha.is_safari=(Xinha.agt.indexOf("safari")!=-1);Xinha.is_chrome=(Xinha.agt.indexOf("chrome")!=-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_ff2=Xinha.is_real_gecko&&parseInt(navigator.productSub.substr(0,10),10)<20071210;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(g,h){if(!Xinha.isSupportedBrowser){return}if(!g){throw new Error("Tried to create Xinha without textarea specified.")}if(typeof h=="undefined"){this.config=new Xinha.Config()}else{this.config=h}if(typeof g!="object"){g=Xinha.getElementById("textarea",g)}this._textArea=g;this._textArea.spellcheck=false;Xinha.freeLater(this,"_textArea");this._initial_ta_size={w:g.style.width?g.style.width:(g.offsetWidth?(g.offsetWidth+"px"):(g.cols+"em")),h:g.style.height?g.style.height:(g.offsetHeight?(g.offsetHeight+"px"):(g.rows+"em"))};if(document.getElementById("loading_"+g.id)||this.config.showLoading){if(!document.getElementById("loading_"+g.id)){Xinha.createLoadingMessage(g)}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 e={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 f in e){if(!e[f].container){continue}e[f].div=e[f].container;e[f].container.className="panels panels_"+f;Xinha.freeLater(e[f],"container");Xinha.freeLater(e[f],"div")}this._panels=e;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={};this.plugins.Events={name:"Events",developer:"The Xinha Core Developer Team",instance:h.Events}}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(b){return b.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(a){return a};this.outwardHtml=function(a){return a};this.autofocus=false;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.showFontStylesInToolbar=false;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.fullScreenSizeDownMethod="initSize";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={"&#8212; font &#8212;":"",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={"&#8212; size &#8212;":"","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={"&#8212; format &#8212;":"","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.dialogOptions={centered:true,greyout:true,closeOnEscape:true};this.Events={};this.customSelects={};this.debug=false;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",help:_editor_url+"popups/editor_help.html"};this.btnList={bold:["Bold",Xinha._lc({key:"button_bold",string:["ed_buttons_main.png",3,2]},"Xinha"),false,function(a){a.execCommand("bold")}],italic:["Italic",Xinha._lc({key:"button_italic",string:["ed_buttons_main.png",2,2]},"Xinha"),false,function(a){a.execCommand("italic")}],underline:["Underline",Xinha._lc({key:"button_underline",string:["ed_buttons_main.png",2,0]},"Xinha"),false,function(a){a.execCommand("underline")}],strikethrough:["Strikethrough",Xinha._lc({key:"button_strikethrough",string:["ed_buttons_main.png",3,0]},"Xinha"),false,function(a){a.execCommand("strikethrough")}],subscript:["Subscript",Xinha._lc({key:"button_subscript",string:["ed_buttons_main.png",3,1]},"Xinha"),false,function(a){a.execCommand("subscript")}],superscript:["Superscript",Xinha._lc({key:"button_superscript",string:["ed_buttons_main.png",2,1]},"Xinha"),false,function(a){a.execCommand("superscript")}],justifyleft:["Justify Left",["ed_buttons_main.png",0,0],false,function(a){a.execCommand("justifyleft")}],justifycenter:["Justify Center",["ed_buttons_main.png",1,1],false,function(a){a.execCommand("justifycenter")}],justifyright:["Justify Right",["ed_buttons_main.png",1,0],false,function(a){a.execCommand("justifyright")}],justifyfull:["Justify Full",["ed_buttons_main.png",0,1],false,function(a){a.execCommand("justifyfull")}],orderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(a){a.execCommand("insertorderedlist")}],unorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(a){a.execCommand("insertunorderedlist")}],insertorderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(a){a.execCommand("insertorderedlist")}],insertunorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(a){a.execCommand("insertunorderedlist")}],outdent:["Decrease Indent",["ed_buttons_main.png",1,2],false,function(a){a.execCommand("outdent")}],indent:["Increase Indent",["ed_buttons_main.png",0,2],false,function(a){a.execCommand("indent")}],forecolor:["Font Color",["ed_buttons_main.png",3,3],false,function(a){a.execCommand("forecolor")}],hilitecolor:["Background Color",["ed_buttons_main.png",2,3],false,function(a){a.execCommand("hilitecolor")}],undo:["Undoes your last action",["ed_buttons_main.png",4,2],false,function(a){a.execCommand("undo")}],redo:["Redoes your last action",["ed_buttons_main.png",5,2],false,function(a){a.execCommand("redo")}],cut:["Cut selection",["ed_buttons_main.png",5,0],false,function(a,b){a.execCommand(b)}],copy:["Copy selection",["ed_buttons_main.png",4,0],false,function(a,b){a.execCommand(b)}],paste:["Paste from clipboard",["ed_buttons_main.png",4,1],false,function(a,b){a.execCommand(b)}],selectall:["Select all",["ed_buttons_main.png",3,5],false,function(a){a.execCommand("selectall")}],inserthorizontalrule:["Horizontal Rule",["ed_buttons_main.png",6,0],false,function(a){a.execCommand("inserthorizontalrule")}],createlink:["Insert Web Link",["ed_buttons_main.png",6,1],false,function(a){a._createLink()}],insertimage:["Insert/Modify Image",["ed_buttons_main.png",6,3],false,function(a){a.execCommand("insertimage")}],inserttable:["Insert Table",["ed_buttons_main.png",6,2],false,function(a){a.execCommand("inserttable")}],htmlmode:["Toggle HTML Source",["ed_buttons_main.png",7,0],true,function(a){a.execCommand("htmlmode")}],toggleborders:["Toggle Borders",["ed_buttons_main.png",7,2],false,function(a){a._toggleBorders()}],print:["Print document",["ed_buttons_main.png",8,1],false,function(a){if(Xinha.is_gecko){a._iframe.contentWindow.print()}else{a.focusEditor();print()}}],saveas:["Save as",["ed_buttons_main.png",9,1],false,function(a){a.execCommand("saveas",false,"noname.htm")}],about:["About this editor",["ed_buttons_main.png",8,2],true,function(a){a.getPluginInstance("AboutBox").show()}],showhelp:["Help using editor",["ed_buttons_main.png",9,2],true,function(a){a.execCommand("showhelp")}],splitblock:["Split Block","ed_splitblock.gif",false,function(a){a._splitBlock()}],lefttoright:["Direction left to right",["ed_buttons_main.png",0,2],false,function(a){a.execCommand("lefttoright")}],righttoleft:["Direction right to left",["ed_buttons_main.png",1,2],false,function(a){a.execCommand("righttoleft")}],overwrite:["Insert/Overwrite","ed_overwrite.gif",false,function(a){a.execCommand("overwrite")}],wordclean:["MS Word Cleaner",["ed_buttons_main.png",5,3],false,function(a){a._wordClean()}],clearfonts:["Clear Inline Font Specifications",["ed_buttons_main.png",5,4],true,function(a){a._clearFonts()}],removeformat:["Remove formatting",["ed_buttons_main.png",4,4],false,function(a){a.execCommand("removeformat")}],killword:["Clear MSOffice tags",["ed_buttons_main.png",4,3],false,function(a){a.execCommand("killword")}]};this.dblclickList={a:[function(b,a){b._createLink(a)}],img:[function(b,a){b._insertImage(a)}]};this.iconList={dialogCaption:_editor_url+"images/xinha-small-icon.gif",wysiwygmode:[_editor_url+"images/ed_buttons_main.png",7,1]};for(var c in this.btnList){var d=this.btnList[c];if(typeof d!="object"){continue}if(typeof d[1]!="string"){d[1][0]=_editor_url+this.imgURL+d[1][0]}else{d[1]=_editor_url+this.imgURL+d[1]}d[0]=Xinha._lc(d[0])}};Xinha.Config.prototype.registerIcon=function(c,d){this.iconList[c]=d};Xinha.Config.prototype.registerButton=function(g,k,h,i,l,j){if(typeof g=="string"){this.btnList[g]=[k,h,i,l,j]}else{if(typeof g=="object"){this.btnList[g.id]=[g.tooltip,g.image,g.textMode,g.action,g.context]}else{alert("ERROR [Xinha.Config::registerButton]:\ninvalid arguments");return false}}};Xinha.prototype.registerPanel=function(d,e){if(!d){d="right"}this.setLoadingMessage("Register "+d+" panel ");var f=this.addPanel(d);if(e){e.drawPanelIn(f)}};Xinha.Config.prototype.registerDropdown=function(b){this.customSelects[b.id]=b};Xinha.Config.prototype.hideSomeButtons=function(g){var j=this.toolbar;for(var h=j.length;--h>=0;){var k=j[h];for(var i=k.length;--i>=0;){if(g.indexOf(" "+k[i]+" ")>=0){var l=1;if(/separator|space/.test(k[i+1])){l=2}k.splice(i,l)}}}};Xinha.Config.prototype.addToolbarElement=function(B,y,o){var F=this.toolbar;var u,x,z,j,C;var v=false;var D=false;var w=0;var i=0;var A=0;var a=false;var E=false;if((B&&typeof B=="object")&&(B.constructor==Array)){v=true}if((y&&typeof y=="object")&&(y.constructor==Array)){D=true;w=y.length}if(v){for(x=0;x<B.length;++x){if((B[x]!="separator")&&(B[x].indexOf("T[")!==0)){C=B[x]}}}else{C=B}for(x=0;x<F.length;++x){u=F[x];for(z=0;z<u.length;++z){if(u[z]==C){return}}}for(x=0;!E&&x<F.length;++x){u=F[x];for(z=0;!E&&z<u.length;++z){if(D){for(j=0;j<w;++j){if(u[z]==y[j]){if(j===0){E=true;z--;break}else{A=x;i=z;w=j}}}}else{if(u[z]==y){E=true;break}}}}if(!E&&D){if(y.length!=w){z=i;u=F[A];E=true}}if(E){if(o===0){if(v){u[z]=B[B.length-1];for(x=B.length-1;--x>=0;){u.splice(z,0,B[x])}}else{u[z]=B}}else{if(o<0){z=z+o+1}else{if(o>0){z=z+o}}if(v){for(x=B.length;--x>=0;){u.splice(z,0,B[x])}}else{u.splice(z,0,B)}}}else{F[0].splice(0,0,"separator");if(v){for(x=B.length;--x>=0;){F[0].splice(0,0,B[x])}}else{F[0].splice(0,0,B)}}};Xinha.Config.prototype.removeToolbarElement=Xinha.Config.prototype.hideSomeButtons;Xinha.replaceAll=function(e){var d=document.getElementsByTagName("textarea");for(var f=d.length;f>0;new Xinha(d[--f],e).generate()){}};Xinha.replace=function(d,e){var f=Xinha.getElementById("textarea",d);return f?new Xinha(f,e).generate():null};Xinha.prototype._createToolbar=function(){this.setLoadingMessage(Xinha._lc("Create Toolbar"));var j=this;var f=document.createElement("div");this._toolBar=this._toolbar=f;f.className="toolbar";f.align=this.config.toolbarAlign;Xinha.freeLater(this,"_toolBar");Xinha.freeLater(this,"_toolbar");var i=null;var g={};this._toolbarObjects=g;this._createToolbar1(j,f,g);function h(a){if(a.tagName){a.unselectable="on"}if(a.childNodes){for(var b=0;b<a.childNodes.length;b++){if(a.tagName){h(a.childNodes(b))}}}}if(Xinha.is_ie){h(f)}this._htmlArea.appendChild(f);return f};Xinha.prototype._setConfig=function(b){this.config=b};Xinha.prototype._rebuildToolbar=function(){this._createToolbar1(this,this._toolbar,this._toolbarObjects);if(Xinha._currentlyActiveEditor){if(Xinha._currentlyActiveEditor==this){this.activateEditor()}}else{this.disableToolbar()}};Xinha._createToolbarBreakingElement=function(){var b=document.createElement("div");b.style.height="1px";b.style.width="1px";b.style.lineHeight="1px";b.style.fontSize="1px";b.style.clear="both";return b};Xinha.prototype._createToolbar1=function(t,w,B){while(w.lastChild){w.removeChild(w.lastChild)}var z;if(t.config.flowToolbars){w.appendChild(Xinha._createToolbarBreakingElement())}function x(){if(typeof z!="undefined"&&z.childNodes.length===0){return}var b=document.createElement("table");b.border="0px";b.cellSpacing="0px";b.cellPadding="0px";if(t.config.flowToolbars){if(Xinha.is_ie){b.style.styleFloat="left"}else{b.style.cssFloat="left"}}w.appendChild(b);var a=document.createElement("tbody");b.appendChild(a);z=document.createElement("tr");a.appendChild(z);b.className="toolbarRow"}x();function y(d,b){var c=this[d];var a=this.element;if(c!=b){switch(d){case"enabled":if(b){Xinha._removeClass(a,"buttonDisabled");a.disabled=false}else{Xinha._addClass(a,"buttonDisabled");a.disabled=true}break;case"active":if(b){Xinha._addClass(a,"buttonPressed")}else{Xinha._removeClass(a,"buttonPressed")}break}this[d]=b}}function v(m){var g=null;var f=null;var e=null;var a=t.config.customSelects;var h=null;var k="";switch(m){case"fontsize":case"fontname":case"formatblock":g=t.config[m];e=m;break;default:e=m;var b=a[e];if(typeof b!="undefined"){g=b.options;h=b.context;if(typeof b.tooltip!="undefined"){k=b.tooltip}}else{alert("ERROR [createSelect]:\nCan't find the requested dropdown definition")}break}if(g){f=document.createElement("select");f.title=k;f.style.width="auto";f.name=m;var c={name:m,element:f,enabled:true,text:false,cmd:e,state:y,context:h};Xinha.freeLater(c);B[m]=c;for(var d in g){if(typeof g[d]!="string"){continue}var l=document.createElement("option");l.innerHTML=Xinha._lc(d);l.value=g[d];if(m=="fontname"&&t.config.showFontStylesInToolbar){l.style.fontFamily=g[d]}f.appendChild(l)}Xinha._addEvent(f,"change",function(){t._comboSelected(f,m)})}return f}function F(f){var e,b,a=null;switch(f){case"separator":if(t.config.flowToolbars){x()}e=document.createElement("div");e.className="separator";break;case"space":e=document.createElement("div");e.className="space";break;case"linebreak":x();return false;case"textindicator":e=document.createElement("div");e.appendChild(document.createTextNode("A"));e.className="indicator";e.title=Xinha._lc("Current style");a={name:f,element:e,enabled:true,active:false,text:false,cmd:"textindicator",state:y};Xinha.freeLater(a);B[f]=a;break;default:b=t.config.btnList[f]}if(!e&&b){e=document.createElement("a");e.style.display="block";e.href="javascript:void(0)";e.style.textDecoration="none";e.title=b[0];e.className="button";e.style.direction="ltr";a={name:f,element:e,enabled:true,active:false,text:b[2],cmd:b[3],state:y,context:b[4]||null};Xinha.freeLater(e);Xinha.freeLater(a);B[f]=a;e.ondrag=function(){return false};Xinha._addEvent(e,"mouseout",function(g){if(a.enabled){Xinha._removeClass(e,"buttonActive");if(a.active){Xinha._addClass(e,"buttonPressed")}}});Xinha._addEvent(e,"mousedown",function(g){if(a.enabled){Xinha._addClass(e,"buttonActive");Xinha._removeClass(e,"buttonPressed");Xinha._stopEvent(Xinha.is_ie?window.event:g)}});Xinha._addEvent(e,"click",function(g){g=g||window.event;t.btnClickEvent={clientX:g.clientX,clientY:g.clientY};if(a.enabled){Xinha._removeClass(e,"buttonActive");if(Xinha.is_gecko){t.activateEditor()}a.cmd(t,a.name,a,g);Xinha._stopEvent(g)}});var d=Xinha.makeBtnImg(b[1]);var c=d.firstChild;Xinha.freeLater(d);Xinha.freeLater(c);e.appendChild(d);a.imgel=c;a.swapImage=function(g){if(typeof g!="string"){c.src=g[0];c.style.position="relative";c.style.top=g[2]?("-"+(18*(g[2]+1))+"px"):"-18px";c.style.left=g[1]?("-"+(18*(g[1]+1))+"px"):"-18px"}else{a.imgel.src=g;c.style.top="0px";c.style.left="0px"}}}else{if(!e){e=v(f)}}return e}var A=true;for(var D=0;D<this.config.toolbar.length;++D){if(!A){}else{A=false}if(this.config.toolbar[D]===null){this.config.toolbar[D]=["separator"]}var E=this.config.toolbar[D];for(var G=0;G<E.length;++G){var C=E[G];var i;if(/^([IT])\[(.*?)\]/.test(C)){var H=RegExp.$1=="I";var u=RegExp.$2;if(H){u=Xinha._lc(u)}i=document.createElement("td");z.appendChild(i);i.className="label";i.innerHTML=u}else{if(typeof C!="function"){var j=F(C);if(j){i=document.createElement("td");i.className="toolbarElement";z.appendChild(i);i.appendChild(j)}else{if(j===null){alert("FIXME: Unknown toolbar item: "+C)}}}}}}if(t.config.flowToolbars){w.appendChild(Xinha._createToolbarBreakingElement())}return w};Xinha.makeBtnImg=function(e,g){if(!g){g=document}if(!g._xinhaImgCache){g._xinhaImgCache={};Xinha.freeLater(g._xinhaImgCache)}var h=null;if(Xinha.is_ie&&((!g.compatMode)||(g.compatMode&&g.compatMode=="BackCompat"))){h=g.createElement("span")}else{h=g.createElement("div");h.style.position="relative"}h.style.overflow="hidden";h.style.width="18px";h.style.height="18px";h.className="buttonImageContainer";var f=null;if(typeof e=="string"){if(g._xinhaImgCache[e]){f=g._xinhaImgCache[e].cloneNode()}else{if(Xinha.ie_version<7&&/\.png$/.test(e[0])){f=g.createElement("span");f.style.display="block";f.style.width="18px";f.style.height="18px";f.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+e+'")';f.unselectable="on"}else{f=g.createElement("img");f.src=e}}}else{if(g._xinhaImgCache[e[0]]){f=g._xinhaImgCache[e[0]].cloneNode()}else{if(Xinha.ie_version<7&&/\.png$/.test(e[0])){f=g.createElement("span");f.style.display="block";f.style.width="18px";f.style.height="18px";f.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+e[0]+'")';f.unselectable="on"}else{f=g.createElement("img");f.src=e[0]}f.style.position="relative"}f.style.top=e[2]?("-"+(18*(e[2]+1))+"px"):"-18px";f.style.left=e[1]?("-"+(18*(e[1]+1))+"px"):"-18px"}h.appendChild(f);return h};Xinha.prototype._createStatusBar=function(){this.setLoadingMessage(Xinha._lc("Create Statusbar"));var j=document.createElement("div");j.style.position="relative";j.className="statusBar";j.style.width="100%";Xinha.freeLater(this,"_statusBar");var h=document.createElement("div");h.className="statusBarWidgetContainer";h.style.position="absolute";h.style.right="0";h.style.top="0";h.style.padding="3px 3px 3px 10px";j.appendChild(h);var g=document.createElement("span");g.className="statusBarTree";g.innerHTML=Xinha._lc("Path")+": ";this._statusBarTree=g;Xinha.freeLater(this,"_statusBarTree");j.appendChild(g);var i=document.createElement("span");i.innerHTML=Xinha.htmlEncode(Xinha._lc("You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG."));i.style.display="none";this._statusBarTextMode=i;Xinha.freeLater(this,"_statusBarTextMode");j.appendChild(i);j.style.whiteSpace="nowrap";var f=this;this.notifyOn("before_resize",function(b,a){f._statusBar.style.width=null});this.notifyOn("resize",function(b,a){if(Xinha.is_ie&&Xinha.ie_version==6){f._statusBar.style.width="100%"}else{var c=a.width;f._statusBar.style.width=c+"px"}});this.notifyOn("modechange",function(a,b){for(var d in f._statusWidgets){var c=f._statusWidgets[d];for(var l=0;l<c.modes.length;l++){if(c.modes[l]==b.mode){var e=true}}if(typeof e=="undefined"){c.block.style.display="none"}else{c.block.style.display=""}}});if(!this.config.statusBar){j.style.display="none"}return j};Xinha.prototype.registerStatusWidget=function(g,i){i=i||["wysiwyg"];if(!this._statusWidgets){this._statusWidgets={}}var h=document.createElement("div");h.className="statusBarWidget";h=this._statusBar.firstChild.appendChild(h);var j=false;for(var f=0;f<i.length;f++){if(i[f]==this._editMode){j=true}}h.style.display=j==true?"":"none";this._statusWidgets[g]={block:h,modes:i};return h};Xinha.prototype.generate=function(){if(!Xinha.isSupportedBrowser){return}var U;var ad=this;var I;var Z=false;var x=document.getElementsByTagName("link");if(!document.getElementById("XinhaCoreDesign")){_editor_css=(typeof _editor_css=="string")?_editor_css:"Xinha.css";for(U=0;U<x.length;U++){if((x[U].rel=="stylesheet")&&(x[U].href==_editor_url+_editor_css)){Z=true}}if(!Z){Xinha.loadStyle(_editor_css,null,"XinhaCoreDesign",true)}}if(_editor_skin!==""&&!document.getElementById("XinhaSkin")){Z=false;for(U=0;U<x.length;U++){if((x[U].rel=="stylesheet")&&(x[U].href==_editor_url+"skins/"+_editor_skin+"/skin.css")){Z=true}}if(!Z){Xinha.loadStyle("skins/"+_editor_skin+"/skin.css",null,"XinhaSkin")}}var G=function(){ad.generate()};if(Xinha.is_ie){I=_editor_url+"modules/InternetExplorer/InternetExplorer.js";if(!Xinha.loadPlugins([{plugin:"InternetExplorer",url:I}],G)){return false}if(!this.plugins.InternetExplorer){ad._browserSpecificPlugin=ad.registerPlugin("InternetExplorer")}}else{if(Xinha.is_webkit){I=_editor_url+"modules/WebKit/WebKit.js";if(!Xinha.loadPlugins([{plugin:"WebKit",url:I}],G)){return false}if(!this.plugins.Webkit){ad._browserSpecificPlugin=ad.registerPlugin("WebKit")}}else{if(Xinha.is_opera){I=_editor_url+"modules/Opera/Opera.js";if(!Xinha.loadPlugins([{plugin:"Opera",url:I}],G)){return false}if(!this.plugins.Opera){ad._browserSpecificPlugin=ad.registerPlugin("Opera")}}else{if(Xinha.is_gecko){I=_editor_url+"modules/Gecko/Gecko.js";if(!Xinha.loadPlugins([{plugin:"Gecko",url:I}],G)){return false}if(!this.plugins.Gecko){ad._browserSpecificPlugin=ad.registerPlugin("Gecko")}}}}}if(typeof Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/dialog.js",G,this)){return false}if(typeof Xinha.Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/XinhaDialog.js",G,this)){return false}I=_editor_url+"modules/FullScreen/full-screen.js";if(!Xinha.loadPlugins([{plugin:"FullScreen",url:I}],G)){return false}I=_editor_url+"modules/ColorPicker/ColorPicker.js";if(!Xinha.loadPlugins([{plugin:"ColorPicker",url:I}],G)){return false}else{if(typeof Xinha.getPluginConstructor("ColorPicker")!="undefined"&&!this.plugins.colorPicker){ad.registerPlugin("ColorPicker")}}var P=ad.config.toolbar;for(U=P.length;--U>=0;){for(var i=P[U].length;--i>=0;){switch(P[U][i]){case"popupeditor":if(!this.plugins.FullScreen){ad.registerPlugin("FullScreen")}break;case"insertimage":I=_editor_url+"modules/InsertImage/insert_image.js";if(typeof Xinha.prototype._insertImage=="undefined"&&!Xinha.loadPlugins([{plugin:"InsertImage",url:I}],G)){return false}else{if(typeof Xinha.getPluginConstructor("InsertImage")!="undefined"&&!this.plugins.InsertImage){ad.registerPlugin("InsertImage")}}break;case"createlink":I=_editor_url+"modules/CreateLink/link.js";if(typeof Xinha.getPluginConstructor("Linker")=="undefined"&&!Xinha.loadPlugins([{plugin:"CreateLink",url:I}],G)){return false}else{if(typeof Xinha.getPluginConstructor("CreateLink")!="undefined"&&!this.plugins.CreateLink){ad.registerPlugin("CreateLink")}}break;case"inserttable":I=_editor_url+"modules/InsertTable/insert_table.js";if(!Xinha.loadPlugins([{plugin:"InsertTable",url:I}],G)){return false}else{if(typeof Xinha.getPluginConstructor("InsertTable")!="undefined"&&!this.plugins.InsertTable){ad.registerPlugin("InsertTable")}}break;case"about":I=_editor_url+"modules/AboutBox/AboutBox.js";if(!Xinha.loadPlugins([{plugin:"AboutBox",url:I}],G)){return false}else{if(typeof Xinha.getPluginConstructor("AboutBox")!="undefined"&&!this.plugins.AboutBox){ad.registerPlugin("AboutBox")}}break}}}if(Xinha.is_gecko&&ad.config.mozParaHandler!="built-in"){if(!Xinha.loadPlugins([{plugin:"EnterParagraphs",url:_editor_url+"modules/Gecko/paraHandlerBest.js"}],G)){return false}if(!this.plugins.EnterParagraphs){ad.registerPlugin("EnterParagraphs")}}var T=this.config.getHtmlMethod=="TransformInnerHTML"?_editor_url+"modules/GetHtml/TransformInnerHTML.js":_editor_url+"modules/GetHtml/DOMwalk.js";if(!Xinha.loadPlugins([{plugin:"GetHtmlImplementation",url:T}],G)){return false}else{if(!this.plugins.GetHtmlImplementation){ad.registerPlugin("GetHtmlImplementation")}}function j(a){return a.textContent||a.text}if(_editor_skin){this.skinInfo={};var O=Xinha._geturlcontent(_editor_url+"skins/"+_editor_skin+"/skin.xml",true);if(O){var X=O.getElementsByTagName("meta");for(U=0;U<X.length;U++){this.skinInfo[X[U].getAttribute("name")]=X[U].getAttribute("value")}var Q=O.getElementsByTagName("recommendedIcons");if(!_editor_icons&&Q.length&&j(Q[0])){_editor_icons=j(Q[0])}}}if(_editor_icons){var M=Xinha._geturlcontent(_editor_url+"iconsets/"+_editor_icons+"/iconset.xml",true);if(M){var y=M.getElementsByTagName("icon");var Y,S,W,K,aa,ab;for(U=0;U<y.length;U++){Y=y[U];S=Y.getAttribute("id");if(Y.getElementsByTagName(_editor_lang).length){Y=Y.getElementsByTagName(_editor_lang)[0]}else{Y=Y.getElementsByTagName("default")[0]}W=j(Y.getElementsByTagName("path")[0]);W=(!/^\//.test(W)?_editor_url:"")+W;K=Y.getAttribute("type");if(K=="map"){aa=parseInt(j(Y.getElementsByTagName("x")[0]),10);ab=parseInt(j(Y.getElementsByTagName("y")[0]),10);if(this.config.btnList[S]){this.config.btnList[S][1]=[W,aa,ab]}if(this.config.iconList[S]){this.config.iconList[S]=[W,aa,ab]}}else{if(this.config.btnList[S]){this.config.btnList[S][1]=W}if(this.config.iconList[S]){this.config.iconList[S]=W}}}}}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 L=this._framework;L.table.border="0";L.table.cellPadding="0";L.table.cellSpacing="0";L.tb_row.style.verticalAlign="top";L.tp_row.style.verticalAlign="top";L.ler_row.style.verticalAlign="top";L.bp_row.style.verticalAlign="top";L.sb_row.style.verticalAlign="top";L.ed_cell.style.position="relative";L.tb_row.appendChild(L.tb_cell);L.tb_cell.colSpan=3;L.tp_row.appendChild(L.tp_cell);L.tp_cell.colSpan=3;L.ler_row.appendChild(L.lp_cell);L.ler_row.appendChild(L.ed_cell);L.ler_row.appendChild(L.rp_cell);L.bp_row.appendChild(L.bp_cell);L.bp_cell.colSpan=3;L.sb_row.appendChild(L.sb_cell);L.sb_cell.colSpan=3;L.tbody.appendChild(L.tb_row);L.tbody.appendChild(L.tp_row);L.tbody.appendChild(L.ler_row);L.tbody.appendChild(L.bp_row);L.tbody.appendChild(L.sb_row);L.table.appendChild(L.tbody);var V=L.table;this._htmlArea=V;Xinha.freeLater(this,"_htmlArea");V.className="htmlarea";L.tb_cell.appendChild(this._createToolbar());var H=document.createElement("iframe");H.src=this.popupURL(ad.config.URIs.blank);H.id="XinhaIFrame_"+this._textArea.id;L.ed_cell.appendChild(H);this._iframe=H;this._iframe.className="xinha_iframe";Xinha.freeLater(this,"_iframe");var N=this._createStatusBar();this._statusBar=L.sb_cell.appendChild(N);var J=this._textArea;J.parentNode.insertBefore(V,J);J.className="xinha_textarea";Xinha.removeFromParent(J);L.ed_cell.appendChild(J);Xinha.addDom0Event(this._textArea,"click",function(){if(Xinha._currentlyActiveEditor!=this){ad.updateToolbar()}return true});if(J.form){Xinha.prependDom0Event(this._textArea.form,"submit",function(){ad.firePluginEvent("onBeforeSubmit");ad._textArea.value=ad.outwardHtml(ad.getHTML());return true});var ac=J.value;Xinha.prependDom0Event(this._textArea.form,"reset",function(){ad.setHTML(ad.inwardHtml(ac));ad.updateToolbar();return true});if(!J.form.xinha_submit){try{J.form.xinha_submit=J.form.submit;J.form.submit=function(){this.onsubmit();this.xinha_submit()}}catch(R){}}}Xinha.prependDom0Event(window,"unload",function(){ad.firePluginEvent("onBeforeUnload");J.value=ad.outwardHtml(ad.getHTML());if(!Xinha.is_ie){V.parentNode.replaceChild(J,V)}return true});J.style.display="none";ad.initSize();this.setLoadingMessage(Xinha._lc("Finishing"));ad._iframeLoadDone=false;if(Xinha.is_opera){ad.initIframe()}else{Xinha._addEvent(this._iframe,"load",function(a){if(!ad._iframeLoadDone){ad._iframeLoadDone=true;ad.initIframe()}return true})}};Xinha.prototype.initSize=function(){this.setLoadingMessage(Xinha._lc("Init editor size"));var f=this;var e=null;var d=null;switch(this.config.width){case"auto":e=this._initial_ta_size.w;break;case"toolbar":e=this._toolBar.offsetWidth+"px";break;default:e=/[^0-9]/.test(this.config.width)?this.config.width:this.config.width+"px";break}d=this.config.height=="auto"?this._initial_ta_size.h:/[^0-9]/.test(this.config.height)?this.config.height:this.config.height+"px";this.sizeEditor(e,d,this.config.sizeIncludesBars,this.config.sizeIncludesPanels);this.notifyOn("panel_change",function(){f.sizeEditor()})};Xinha.prototype.sizeEditor=function(q,s,w,r){if(this._risizing){return}this._risizing=true;var v=this._framework;this.notifyOf("before_resize",{width:q,height:s});this.firePluginEvent("onBeforeResize",q,s);this._iframe.style.height="100%";this._textArea.style.height="1px";this._iframe.style.width="0px";this._textArea.style.width="0px";if(w!==null){this._htmlArea.sizeIncludesToolbars=w}if(r!==null){this._htmlArea.sizeIncludesPanels=r}if(q){this._htmlArea.style.width=q;if(!this._htmlArea.sizeIncludesPanels){var C=this._panels.right;if(C.on&&C.panels.length&&Xinha.hasDisplayedChildren(C.div)){this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.right,10))+"px"}var u=this._panels.left;if(u.on&&u.panels.length&&Xinha.hasDisplayedChildren(u.div)){this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.left,10))+"px"}}}if(s){this._htmlArea.style.height=s;if(!this._htmlArea.sizeIncludesToolbars){this._htmlArea.style.height=(this._htmlArea.offsetHeight+this._toolbar.offsetHeight+this._statusBar.offsetHeight)+"px"}if(!this._htmlArea.sizeIncludesPanels){var B=this._panels.top;if(B.on&&B.panels.length&&Xinha.hasDisplayedChildren(B.div)){this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.top,10))+"px"}var D=this._panels.bottom;if(D.on&&D.panels.length&&Xinha.hasDisplayedChildren(D.div)){this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.bottom,10))+"px"}}}q=this._htmlArea.offsetWidth;s=this._htmlArea.offsetHeight;var E=this._panels;var F=this;var x=1;function y(a){if(E[a].on&&E[a].panels.length&&Xinha.hasDisplayedChildren(E[a].container)){E[a].container.style.display="";return true}else{E[a].container.style.display="none";return false}}if(y("left")){x+=1}if(y("right")){x+=1}v.tb_cell.colSpan=x;v.tp_cell.colSpan=x;v.bp_cell.colSpan=x;v.sb_cell.colSpan=x;if(!v.tp_row.childNodes.length){Xinha.removeFromParent(v.tp_row)}else{if(!Xinha.hasParentNode(v.tp_row)){v.tbody.insertBefore(v.tp_row,v.ler_row)}}if(!v.bp_row.childNodes.length){Xinha.removeFromParent(v.bp_row)}else{if(!Xinha.hasParentNode(v.bp_row)){v.tbody.insertBefore(v.bp_row,v.ler_row.nextSibling)}}if(!this.config.statusBar){Xinha.removeFromParent(v.sb_row)}else{if(!Xinha.hasParentNode(v.sb_row)){v.table.appendChild(v.sb_row)}}v.lp_cell.style.width=this.config.panel_dimensions.left;v.rp_cell.style.width=this.config.panel_dimensions.right;v.tp_cell.style.height=this.config.panel_dimensions.top;v.bp_cell.style.height=this.config.panel_dimensions.bottom;v.tb_cell.style.height=this._toolBar.offsetHeight+"px";v.sb_cell.style.height=this._statusBar.offsetHeight+"px";var t=s-this._toolBar.offsetHeight-this._statusBar.offsetHeight;if(y("top")){t-=parseInt(this.config.panel_dimensions.top,10)}if(y("bottom")){t-=parseInt(this.config.panel_dimensions.bottom,10)}this._iframe.style.height=t+"px";var A=q;if(y("left")){A-=parseInt(this.config.panel_dimensions.left,10)}if(y("right")){A-=parseInt(this.config.panel_dimensions.right,10)}var z=this.config.iframeWidth?parseInt(this.config.iframeWidth,10):null;this._iframe.style.width=(z&&z<A)?z+"px":A+"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(d,e){if(!d){d="right"}this.setLoadingMessage("Register "+d+" panel ");var f=this.addPanel(d);if(e){e.drawPanelIn(f)}};Xinha.prototype.addPanel=function(d){var c=document.createElement("div");c.side=d;if(d=="left"||d=="right"){c.style.width=this.config.panel_dimensions[d];if(this._iframe){c.style.height=this._iframe.style.height}}Xinha.addClasses(c,"panel");this._panels[d].panels.push(c);this._panels[d].div.appendChild(c);this.notifyOf("panel_change",{action:"add",panel:c});this.firePluginEvent("onPanelChange","add",c);return c};Xinha.prototype.removePanel=function(f){this._panels[f.side].div.removeChild(f);var d=[];for(var e=0;e<this._panels[f.side].panels.length;e++){if(this._panels[f.side].panels[e]!=f){d.push(this._panels[f.side].panels[e])}}this._panels[f.side].panels=d;this.notifyOf("panel_change",{action:"remove",panel:f});this.firePluginEvent("onPanelChange","remove",f)};Xinha.prototype.hidePanel=function(f){if(f&&f.style.display!="none"){try{var d=this.scrollPos(this._iframe.contentWindow)}catch(e){}f.style.display="none";this.notifyOf("panel_change",{action:"hide",panel:f});this.firePluginEvent("onPanelChange","hide",f);try{this._iframe.contentWindow.scrollTo(d.x,d.y)}catch(e){}}};Xinha.prototype.showPanel=function(f){if(f&&f.style.display=="none"){try{var d=this.scrollPos(this._iframe.contentWindow)}catch(e){}f.style.display="";this.notifyOf("panel_change",{action:"show",panel:f});this.firePluginEvent("onPanelChange","show",f);try{this._iframe.contentWindow.scrollTo(d.x,d.y)}catch(e){}}};Xinha.prototype.hidePanels=function(e){if(typeof e=="undefined"){e=["left","right","top","bottom"]}var d=[];for(var f=0;f<e.length;f++){if(this._panels[e[f]].on){d.push(e[f]);this._panels[e[f]].on=false}}this.notifyOf("panel_change",{action:"multi_hide",sides:e});this.firePluginEvent("onPanelChange","multi_hide",e)};Xinha.prototype.showPanels=function(e){if(typeof e=="undefined"){e=["left","right","top","bottom"]}var d=[];for(var f=0;f<e.length;f++){if(!this._panels[e[f]].on){d.push(e[f]);this._panels[e[f]].on=true}}this.notifyOf("panel_change",{action:"multi_show",sides:e});this.firePluginEvent("onPanelChange","multi_show",e)};Xinha.objectProperties=function(d){var e=[];for(var f in d){e[e.length]=f}return e};Xinha.prototype.editorIsActivated=function(){try{return Xinha.is_designMode?this._doc.designMode=="on":this._doc.body.contentEditable}catch(b){return false}};Xinha._someEditorHasBeenActivated=false;Xinha._currentlyActiveEditor=null;Xinha.prototype.activateEditor=function(){if(this.currentModal){return}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"}if(Xinha.is_opera){this.setEditorEvents(true)}}catch(c){}}else{if(Xinha.is_ie&&this._doc.body.contentEditable!==true){this._doc.body.contentEditable=true}}Xinha._someEditorHasBeenActivated=true;Xinha._currentlyActiveEditor=this;var d=this;this.enableToolbar()};Xinha.prototype.deactivateEditor=function(){this.disableToolbar();if(Xinha.is_designMode&&this._doc.designMode!="off"){try{this._doc.designMode="off"}catch(b){}}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 i=null;var n=this;try{if(n._iframe.contentDocument){this._doc=n._iframe.contentDocument}else{this._doc=n._iframe.contentWindow.document}i=this._doc;if(!i){if(Xinha.is_gecko){setTimeout(function(){n.initIframe()},50);return false}else{alert("ERROR: IFRAME can't be initialized.")}}}catch(j){setTimeout(function(){n.initIframe()},50);return false}Xinha.freeLater(this,"_doc");i.open("text/html","replace");var k="",h;if(n.config.browserQuirksMode===false){h='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">'}else{if(n.config.browserQuirksMode===true){h=""}else{h=Xinha.getDoctype(document)}}if(!n.config.fullPage){k+=h+"\n";k+="<html>\n";k+="<head>\n";k+='<meta http-equiv="Content-Type" content="text/html; charset='+n.config.charSet+'">\n';if(typeof n.config.baseHref!="undefined"&&n.config.baseHref!==null){k+='<base href="'+n.config.baseHref+'"/>\n'}k+=Xinha.addCoreCSS();if(typeof n.config.pageStyleSheets!=="undefined"){for(var l=0;l<n.config.pageStyleSheets.length;l++){if(n.config.pageStyleSheets[l].length>0){k+='<link rel="stylesheet" type="text/css" href="'+n.config.pageStyleSheets[l]+'">'}}}if(n.config.pageStyle){k+='<style type="text/css">\n'+n.config.pageStyle+"\n</style>"}k+="</head>\n";k+="<body"+(n.config.bodyID?(' id="'+n.config.bodyID+'"'):"")+(n.config.bodyClass?(' class="'+n.config.bodyClass+'"'):"")+">\n";k+=n.inwardHtml(n._textArea.value);k+="</body>\n";k+="</html>"}else{k=n.inwardHtml(n._textArea.value);if(k.match(Xinha.RE_doctype)){n.setDoctype(RegExp.$1)}var m=k.match(/<link\s+[\s\S]*?["']\s*\/?>/gi);k=k.replace(/<link\s+[\s\S]*?["']\s*\/?>\s*/gi,"");if(m){k=k.replace(/<\/head>/i,m.join("\n")+"\n</head>")}}i.write(k);i.close();if(this.config.fullScreen){this._fullScreen()}this.setEditorEvents();if((typeof n.config.autofocus!="undefined")&&n.config.autofocus!==false&&((n.config.autofocus==n._textArea.id)||n.config.autofocus==true)){n.activateEditor();n.focusEditor()}};Xinha.prototype.whenDocReady=function(d){var c=this;if(this._doc&&this._doc.body){d()}else{setTimeout(function(){c.whenDocReady(d)},50)}};Xinha.prototype.setMode=function(c){var d;if(typeof c=="undefined"){c=this._editMode=="textmode"?"wysiwyg":"textmode"}switch(c){case"textmode":this.firePluginEvent("onBeforeMode","textmode");this._toolbarObjects.htmlmode.swapImage(this.config.iconList.wysiwygmode);this.setCC("iframe");d=this.outwardHtml(this.getHTML());this.setHTML(d);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._toolbarObjects.htmlmode.swapImage([this.imgURL("images/ed_buttons_main.png"),7,0]);this.setCC("textarea");d=this.inwardHtml(this.getHTML());this.deactivateEditor();this.setHTML(d);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 <"+c+"> not defined!");return false}this._editMode=c};Xinha.prototype.setFullHTML=function(h){var f=RegExp.multiline;RegExp.multiline=true;if(h.match(Xinha.RE_doctype)){this.setDoctype(RegExp.$1)}RegExp.multiline=f;if(0){if(h.match(Xinha.RE_head)){this._doc.getElementsByTagName("head")[0].innerHTML=RegExp.$1}if(h.match(Xinha.RE_body)){this._doc.getElementsByTagName("body")[0].innerHTML=RegExp.$1}}else{var g=this.editorIsActivated();if(g){this.deactivateEditor()}var e=/<html>((.|\n)*?)<\/html>/i;h=h.replace(e,"$1");this._doc.open("text/html","replace");this._doc.write(h);this._doc.close();if(g){this.activateEditor()}this.setEditorEvents();return true}};Xinha.prototype.setEditorEvents=function(d){var f=this;var e=this._doc;f.whenDocReady(function(){if(!d){Xinha._addEvents(e,["mousedown"],function(){f.activateEditor();return true});if(Xinha.is_ie){Xinha._addEvent(f._doc.getElementsByTagName("html")[0],"click",function(){if(f._iframe.contentWindow.event.srcElement.tagName.toLowerCase()=="html"){var c=f._doc.body.createTextRange();c.collapse();c.select()}return true})}}Xinha._addEvents(e,["keydown","keypress","mousedown","mouseup","drag"],function(c){return f._editorEvent(Xinha.is_ie?f._iframe.contentWindow.event:c)});Xinha._addEvents(e,["dblclick"],function(c){return f._onDoubleClick(Xinha.is_ie?f._iframe.contentWindow.event:c)});if(d){return}for(var a in f.plugins){var b=f.plugins[a].instance;Xinha.refreshPlugin(b)}if(typeof f._onGenerate=="function"){f._onGenerate()}Xinha.addDom0Event(window,"resize",function(c){if(Xinha.ie_version>7&&!window.parent){if(f.execResize){f.sizeEditor();f.execResize=false}else{f.execResize=true}}else{f.sizeEditor()}});f.removeLoadingMessage()})};Xinha.getPluginConstructor=function(b){return Xinha.plugins[b]||window[b]};Xinha.prototype.registerPlugin=function(){if(!Xinha.isSupportedBrowser){return}var f=arguments[0];if(f===null||typeof f=="undefined"||(typeof f=="string"&&Xinha.getPluginConstructor(f)=="undefined")){return false}var e=[];for(var d=1;d<arguments.length;++d){e.push(arguments[d])}return this.registerPlugin2(f,e)};Xinha.prototype.registerPlugin2=function(n,m){if(typeof n=="string"&&typeof Xinha.getPluginConstructor(n)=="function"){var h=n;n=Xinha.getPluginConstructor(n)}if(typeof n=="undefined"){return false}if(!n._pluginInfo){n._pluginInfo={name:h}}var j=new n(this,m);if(j){var i={};var k=n._pluginInfo;for(var l in k){i[l]=k[l]}i.instance=j;i.args=m;this.plugins[n._pluginInfo.name]=i;return j}else{Xinha.debugMsg("Can't register plugin "+n.toString()+".","warn")}};Xinha.getPluginDir=function(d,c){if(Xinha.externalPlugins[d]){return Xinha.externalPlugins[d][0]}if(c||(Xinha.getPluginConstructor(d)&&(typeof Xinha.getPluginConstructor(d).supported!="undefined")&&!Xinha.getPluginConstructor(d).supported)){return _editor_url+"unsupported_plugins/"+d}return _editor_url+"plugins/"+d};Xinha.loadPlugin=function(j,g,h){if(!Xinha.isSupportedBrowser){return}Xinha.setLoadingMessage(Xinha._lc("Loading plugin $plugin="+j+"$"));if(typeof Xinha.getPluginConstructor(j)!="undefined"){if(g){g(j)}return true}Xinha._pluginLoadStatus[j]="loading";function f(a,e){var c,b,n,o;switch(a){case"start":c="old_naming";b=Xinha.getPluginDir(e);n=e+".js";break;case"old_naming":c="unsupported";b=Xinha.getPluginDir(e);n=e.replace(/([a-z])([A-Z])([a-z])/g,function(r,k,l,m){return k+"-"+l.toLowerCase()+m}).toLowerCase()+".js";o="You are using an obsolete naming scheme for the Xinha plugin "+e+". Please rename "+n+" to "+e+".js";break;case"unsupported":c="unsupported_old_name";b=Xinha.getPluginDir(e,true);n=e+".js";o="You are using the unsupported Xinha plugin "+e+". If you wish continued support, please see http://trac.xinha.org/ticket/1297";break;case"unsupported_old_name":c="";b=Xinha.getPluginDir(e,true);n=e.replace(/([a-z])([A-Z])([a-z])/g,function(r,k,l,m){return k+"-"+l.toLowerCase()+m}).toLowerCase()+".js";o="You are using the unsupported Xinha plugin "+e+". If you wish continued support, please see http://trac.xinha.org/ticket/1297";break;default:Xinha._pluginLoadStatus[e]="failed";Xinha.debugMsg("Xinha was not able to find the plugin "+e+". Please make sure the plugin exists.","warn");return}var p=b+"/"+n;function d(k){Xinha.getPluginConstructor(k).supported=a.indexOf("unsupported")!==0;g(k)}Xinha._loadback(p,d,this,e);Xinha.ping(p,function(){if(o){Xinha.debugMsg(o)}},function(){Xinha.removeFromParent(document.getElementById(p));f(c,e)})}if(!h){if(Xinha.externalPlugins[j]){Xinha._loadback(Xinha.externalPlugins[j][0]+Xinha.externalPlugins[j][1],g,this,j)}else{var i=this;f("start",j)}}else{Xinha._loadback(h,g,this,j)}return false};Xinha._pluginLoadStatus={};Xinha.externalPlugins={};Xinha.plugins={};Xinha.loadPlugins=function(o,j,i){if(!Xinha.isSupportedBrowser){return}var k,p;for(p=0;p<o.length;p++){if(typeof o[p]=="object"){k=o[p].url.match(/(.*)(\/[^\/]*)$/);Xinha.externalPlugins[o[p].plugin]=[k[1],k[2]];o[p]=o[p].plugin}}var m=true;var l=Xinha.cloneObject(o);for(p=0;p<l.length;p++){var n=l[p];if(n=="FullScreen"&&!Xinha.externalPlugins.FullScreen){continue}if(typeof Xinha._pluginLoadStatus[n]=="undefined"){Xinha.loadPlugin(n,function(a){Xinha.setLoadingMessage(Xinha._lc("Finishing"));if(typeof Xinha.getPluginConstructor(a)!="undefined"){Xinha._pluginLoadStatus[a]="ready"}else{Xinha._pluginLoadStatus[a]="failed"}},i);m=false}else{if(Xinha._pluginLoadStatus[n]=="loading"){m=false}}}if(m){return true}if(j){setTimeout(function(){if(Xinha.loadPlugins(o,j)){j()}},50)}return m};Xinha.refreshPlugin=function(b){if(b&&typeof b.onGenerate=="function"){b.onGenerate()}if(b&&typeof b.onGenerateOnce=="function"){b._ongenerateOnce=b.onGenerateOnce;delete (b.onGenerateOnce);b._ongenerateOnce();delete (b._ongenerateOnce)}};Xinha.prototype.firePluginEvent=function(i){var g=[];for(var j=1;j<arguments.length;j++){g[j-1]=arguments[j]}for(j in this.plugins){var f=this.plugins[j].instance;if(f==this._browserSpecificPlugin){continue}if(f&&typeof f[i]=="function"){var h=(j=="Events")?this:f;if(f[i].apply(h,g)){return true}}}f=this._browserSpecificPlugin;if(f&&typeof f[i]=="function"){if(f[i].apply(f,g)){return true}}return false};Xinha.loadStyle=function(k,h,i,l){var n=_editor_url||"";if(h){n=Xinha.getPluginDir(h)+"/"}n+=k;if(/^\//.test(k)){n=k}var m=document.getElementsByTagName("head")[0];var j=document.createElement("link");j.rel="stylesheet";j.href=n;j.type="text/css";if(i){j.id=i}if(l&&m.getElementsByTagName("link")[0]){m.insertBefore(j,m.getElementsByTagName("link")[0])}else{m.appendChild(j)}};Xinha.loadScript=function(h,f,g){var e=_editor_url||"";if(f){e=Xinha.getPluginDir(f)+"/"}e+=h;if(/^\//.test(h)){e=h}Xinha._loadback(e,g)};Xinha.includeAssets=function(){var c={pendingAssets:[],loaderRunning:false,loadedScripts:[]};c.callbacks=[];c.loadNext=function(){var a=this;this.loaderRunning=true;if(this.pendingAssets.length){var b=this.pendingAssets[0];this.pendingAssets.splice(0,1);switch(b.type){case"text/css":Xinha.loadStyle(b.url,b.plugin);return this.loadNext();case"text/javascript":Xinha.loadScript(b.url,b.plugin,function(){a.loadNext()})}}else{this.loaderRunning=false;this.runCallback()}};c.loadScript=function(f,b){var a=this;this.pendingAssets.push({type:"text/javascript",url:f,plugin:b});if(!this.loaderRunning){this.loadNext()}return this};c.loadScriptOnce=function(a,b){for(var f=0;f<this.loadedScripts.length;f++){if(this.loadedScripts[f].url==a&&this.loadedScripts[f].plugin==b){return this}}return this.loadScript(a,b)};c.loadStyle=function(f,b){var a=this;this.pendingAssets.push({type:"text/css",url:f,plugin:b});if(!this.loaderRunning){this.loadNext()}return this};c.whenReady=function(a){this.callbacks.push(a);if(!this.loaderRunning){this.loadNext()}return this};c.runCallback=function(){while(this.callbacks.length){var a=this.callbacks.splice(0,1);a[0]();a=null}return this};for(var d=0;d<arguments.length;d++){if(typeof arguments[d]=="string"){if(arguments[d].match(/\.css$/i)){c.loadStyle(arguments[d])}else{c.loadScript(arguments[d])}}else{if(arguments[d].type){if(arguments[d].type.match(/text\/css/i)){c.loadStyle(arguments[d].url,arguments[d].plugin)}else{if(arguments[d].type.match(/text\/javascript/i)){c.loadScript(arguments[d].url,arguments[d].plugin)}}}else{if(arguments[d].length>=1){if(arguments[d][0].match(/\.css$/i)){c.loadStyle(arguments[d][0],arguments[d][1])}else{c.loadScript(arguments[d][0],arguments[d][1])}}}}}return c};Xinha.prototype.debugTree=function(){var d=document.createElement("textarea");d.style.width="100%";d.style.height="20em";d.value="";function e(b,a){for(;--b>=0;){d.value+=" "}d.value+=a+"\n"}function f(j,b){var a=j.tagName.toLowerCase(),i;var c=Xinha.is_ie?j.scopeName:j.prefix;e(b,"- "+a+" ["+c+"]");for(i=j.firstChild;i;i=i.nextSibling){if(i.nodeType==1){f(i,b+2)}}}f(this._doc.body,0);document.body.appendChild(d)};Xinha.getInnerText=function(d){var f="",e;for(e=d.firstChild;e;e=e.nextSibling){if(e.nodeType==3){f+=e.data}else{if(e.nodeType==1){f+=Xinha.getInnerText(e)}}}return f};Xinha.prototype._wordClean=function(){var q=this;var n={empty_tags:0,cond_comm:0,mso_elmts:0,mso_class:0,mso_style:0,mso_xmlel:0,orig_len:this._doc.body.innerHTML.length,T:new Date().getTime()};var l={empty_tags:"Empty tags removed: ",cond_comm:"Conditional comments removed",mso_elmts:"MSO invalid elements removed",mso_class:"MSO class names removed: ",mso_style:"MSO inline style removed: ",mso_xmlel:"MSO XML elements stripped: "};function m(){var b="Xinha word cleaner stats: \n\n";for(var a in n){if(l[a]){b+=l[a]+n[a]+"\n"}}b+="\nInitial document length: "+n.orig_len+"\n";b+="Final document length: "+q._doc.body.innerHTML.length+"\n";b+="Clean-up took "+((new Date().getTime()-n.T)/1000)+" seconds";alert(b)}function k(b){var a=b.className.replace(/(^|\s)mso.*?(\s|$)/ig," ");if(a!=b.className){b.className=a;if(!/\S/.test(b.className)){b.removeAttribute("className");++n.mso_class}}}function r(a){var c=a.style.cssText.split(/\s*;\s*/);for(var b=c.length;--b>=0;){if(/^mso|^tab-stops/i.test(c[b])||/^margin\s*:\s*0..\s+0..\s+0../i.test(c[b])){++n.mso_style;c.splice(b,1)}}a.style.cssText=c.join("; ")}function p(a){if(("link"==a.tagName.toLowerCase()&&(a.attributes&&/File-List|Edit-Time-Data|themeData|colorSchemeMapping/.test(a.attributes.rel.nodeValue)))||/^(style|meta)$/i.test(a.tagName)){Xinha.removeFromParent(a);++n.mso_elmts;return true}return false}function o(a){if(/^(a|span|b|strong|i|em|font|div|p)$/i.test(a.tagName)&&!a.firstChild){Xinha.removeFromParent(a);++n.empty_tags;return true}return false}function j(d){k(d);r(d);var a;for(var b=d.firstChild;b;b=a){a=b.nextSibling;if(b.nodeType==1&&j(b)){if((Xinha.is_ie&&d.scopeName!="HTML")||(!Xinha.is_ie&&/:/.test(b.tagName))){for(var c=b.childNodes&&b.childNodes.length-1;b.childNodes&&b.childNodes.length&&b.childNodes[c];--c){if(b.nextSibling){b.parentNode.insertBefore(b.childNodes[c],b.nextSibling)}else{b.parentNode.appendChild(b.childNodes[c])}}Xinha.removeFromParent(b);continue}if(o(b)){continue}if(p(b)){continue}}else{if(b.nodeType==8){if(/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(b.nodeValue)){Xinha.removeFromParent(b);++n.cond_comm}}}}return true}j(this._doc.body);this.updateToolbar()};Xinha.prototype._clearFonts=function(){var b=this.getInnerHTML();if(confirm(Xinha._lc("Would you like to clear font typefaces?"))){b=b.replace(/face="[^"]*"/gi,"");b=b.replace(/font-family:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font sizes?"))){b=b.replace(/size="[^"]*"/gi,"");b=b.replace(/font-size:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font colours?"))){b=b.replace(/color="[^"]*"/gi,"");b=b.replace(/([^\-])color:[^;}"']+;?/gi,"$1")}b=b.replace(/(style|class)="\s*"/gi,"");b=b.replace(/<(font|span)\s*>/gi,"");this.setHTML(b);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(d){}break;case"textmode":try{this._textArea.focus()}catch(c){}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 c=true;var d=this.getInnerHTML();if(this._undoPos>0){c=(this._undoQueue[this._undoPos-1]!=d)}if(c){this._undoQueue[this._undoPos]=d}else{this._undoPos--}};Xinha.prototype.undo=function(){if(this._undoPos>0){var b=this._undoQueue[--this._undoPos];if(b){this.setHTML(b)}else{++this._undoPos}}};Xinha.prototype.redo=function(){if(this._undoPos<this._undoQueue.length-1){var b=this._undoQueue[++this._undoPos];if(b){this.setHTML(b)}else{--this._undoPos}}};Xinha.prototype.disableToolbar=function(f){if(this._timerToolbar){clearTimeout(this._timerToolbar)}if(typeof f=="undefined"){f=[]}else{if(typeof f!="object"){f=[f]}}for(var d in this._toolbarObjects){var e=this._toolbarObjects[d];if(f.contains(d)){continue}if(typeof e.state!="function"){continue}e.state("enabled",false)}};Xinha.prototype.enableToolbar=function(){this.updateToolbar()};Xinha.prototype.updateToolbar=function(noStatus){if(this.suspendUpdateToolbar){return}var doc=this._doc;var text=(this._editMode=="textmode");var ancestors=null;if(!text){ancestors=this.getAllAncestors();if(this.config.statusBar&&!noStatus){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=" ";this._statusBarTree.appendChild(document.createTextNode(Xinha._lc("Path")+": "));for(var i=ancestors.length;--i>=0;){var el=ancestors[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();switch(txt){case"b":txt="strong";break;case"i":txt="em";break;case"strike":txt="del";break}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 inContext=true;if(typeof btn.state!="function"){continue}if(btn.context&&!text){inContext=false;var context=btn.context;var attrs=[];if(/(.*)\[(.*?)\]/.test(context)){context=RegExp.$1;attrs=RegExp.$2.split(",")}context=context.toLowerCase();var match=(context=="*");for(var k=0;k<ancestors.length;++k){if(!ancestors[k]){continue}if(match||(ancestors[k].tagName.toLowerCase()==context)){inContext=true;var contextSplit=null;var att=null;var comp=null;var attVal=null;for(var ka=0;ka<attrs.length;++ka){contextSplit=attrs[ka].match(/(.*)(==|!=|===|!==|>|>=|<|<=)(.*)/);att=contextSplit[1];comp=contextSplit[2];attVal=contextSplit[3];if(!eval(ancestors[k][att]+comp+attVal)){inContext=false;break}}if(inContext){break}}}}btn.state("enabled",(!text||btn.text)&&inContext);if(typeof cmd=="function"){continue}var dropdown=this.config.customSelects[cmd];if((!text||btn.text)&&(typeof dropdown!="undefined")){dropdown.refresh(this);continue}switch(cmd){case"fontname":case"fontsize":if(!text){try{var value=(""+doc.queryCommandValue(cmd)).toLowerCase();if(!value){btn.element.selectedIndex=0;break}var options=this.config[cmd];var sIndex=0;for(var j in options){if((j.toLowerCase()==value)||(options[j].substr(0,value.length).toLowerCase()==value)){btn.element.selectedIndex=sIndex;throw"ok"}++sIndex}btn.element.selectedIndex=0}catch(ex){}}break;case"formatblock":var blocks=[];for(var indexBlock in this.config.formatblock){if(typeof this.config.formatblock[indexBlock]=="string"){blocks[blocks.length]=this.config.formatblock[indexBlock]}}var deepestAncestor=this._getFirstAncestor(this.getSelection(),blocks);if(deepestAncestor){for(var x=0;x<blocks.length;x++){if(blocks[x].toLowerCase()==deepestAncestor.tagName.toLowerCase()){btn.element.selectedIndex=x}}}else{btn.element.selectedIndex=0}break;case"textindicator":if(!text){try{var style=btn.element.style;style.backgroundColor=Xinha._makeColor(doc.queryCommandValue(Xinha.is_ie?"backcolor":"hilitecolor"));if(/transparent/i.test(style.backgroundColor)){style.backgroundColor=Xinha._makeColor(doc.queryCommandValue("backcolor"))}style.color=Xinha._makeColor(doc.queryCommandValue("forecolor"));style.fontFamily=doc.queryCommandValue("fontname");style.fontWeight=doc.queryCommandState("bold")?"bold":"normal";style.fontStyle=doc.queryCommandState("italic")?"italic":"normal"}catch(ex){}}break;case"htmlmode":btn.state("active",text);break;case"lefttoright":case"righttoleft":var eltBlock=this.getParentElement();while(eltBlock&&!Xinha.isBlockElement(eltBlock)){eltBlock=eltBlock.parentNode}if(eltBlock){btn.state("active",(eltBlock.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 editor=this;this._timerUndo=setTimeout(function(){editor._timerUndo=null},this.config.undoTimeout)}this.firePluginEvent("onUpdateToolbar")};Xinha.getEditor=function(d){for(var e=__xinhas.length;e--;){var f=__xinhas[e];if(f&&(f._textArea.id==d||f._textArea.name==d||f._textArea==d)){return f}}return null};Xinha.prototype.getPluginInstance=function(b){if(this.plugins[b]){return this.plugins[b].instance}else{return null}};Xinha.prototype.getAllAncestors=function(){var d=this.getParentElement();var a=[];while(d&&(d.nodeType==1)&&(d.tagName.toLowerCase()!="body")){a.push(d);d=d.parentNode}a.push(this._doc.body);return a};Xinha.prototype._getFirstAncestor=function(g,h){var i=this.activeElement(g);if(i===null){try{i=(Xinha.is_ie?this.createRange(g).parentElement():this.createRange(g).commonAncestorContainer)}catch(j){return null}}if(typeof h=="string"){h=[h]}while(i){if(i.nodeType==1){if(h===null){return i}for(var f=0;f<h.length;++f){if(typeof h[f]=="string"&&h[f]==i.tagName.toLowerCase()){return i}else{if(typeof h[f]=="function"&&h[f](this,i)){return i}}}if(i.tagName.toLowerCase()=="body"){break}if(i.tagName.toLowerCase()=="table"){break}}i=i.parentNode}return null};Xinha.prototype._getAncestorBlock=function(c){var d=(Xinha.is_ie?this.createRange(c).parentElement:this.createRange(c).commonAncestorContainer);while(d&&(d.nodeType==1)){switch(d.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 d;case"body":case"noframes":case"dd":case"li":case"th":case"td":case"noscript":return null;default:break}}return null};Xinha.prototype._createImplicitBlock=function(e){var d=this.getSelection();if(Xinha.is_ie){d.empty()}else{d.collapseToStart()}var f=this.createRange(d)};Xinha.prototype.surroundHTML=function(d,f){var e=this.getSelectedHTML();this.insertHTML(d+e+f)};Xinha.prototype.hasSelectedText=function(){return this.getSelectedHTML()!==""};Xinha.prototype._comboSelected=function(e,f){this.focusEditor();var h=e.options[e.selectedIndex].value;switch(f){case"fontname":case"fontsize":this.execCommand(f,false,h);break;case"formatblock":if(!h){this.updateToolbar();break}if(!Xinha.is_gecko||h!=="blockquote"){h="<"+h+">"}this.execCommand(f,false,h);break;default:var g=this.config.customSelects[f];if(typeof g!="undefined"){g.action(this,h,e,f)}else{alert("FIXME: combo box "+f+" not implemented")}break}};Xinha.prototype._colorSelector=function(m){var i=this;if(Xinha.is_gecko){try{i._doc.execCommand("useCSS",false,false);i._doc.execCommand("styleWithCSS",false,true)}catch(n){}}var o=i._toolbarObjects[m].element;var j;if(m=="hilitecolor"){if(Xinha.is_ie){m="backcolor";j=Xinha._colorToRgb(i._doc.queryCommandValue("backcolor"))}else{j=Xinha._colorToRgb(i._doc.queryCommandValue("hilitecolor"))}}else{j=Xinha._colorToRgb(i._doc.queryCommandValue("forecolor"))}var k=function(a){i._doc.execCommand(m,false,a)};if(Xinha.is_ie){var l=i.createRange(i.getSelection());k=function(a){l.select();i._doc.execCommand(m,false,a)}}var p=new Xinha.colorPicker({cellsize:i.config.colorPickerCellSize,callback:k,granularity:i.config.colorPickerGranularity,websafe:i.config.colorPickerWebSafe,savecolors:i.config.colorPickerSaveColors});p.open(i.config.colorPickerPosition,o,j)};Xinha.prototype.execCommand=function(m,o,n){var l=this;this.focusEditor();m=m.toLowerCase();if(this.firePluginEvent("onExecCommand",m,o,n)){this.updateToolbar();return false}switch(m){case"htmlmode":this.setMode();break;case"hilitecolor":case"forecolor":this._colorSelector(m);break;case"createlink":this._createLink();break;case"undo":case"redo":if(this._customUndo){this[m]()}else{this._doc.execCommand(m,o,n)}break;case"inserttable":this._insertTable();break;case"insertimage":this._insertImage();break;case"showhelp":this._popupDialog(l.config.URIs.help,null,this);break;case"killword":this._wordClean();break;case"cut":case"copy":case"paste":this._doc.execCommand(m,o,n);if(this.config.killWordOnPaste){this._wordClean()}break;case"lefttoright":case"righttoleft":if(this.config.changeJustifyWithDirection){this._doc.execCommand((m=="righttoleft")?"justifyright":"justifyleft",o,n)}var k=(m=="righttoleft")?"rtl":"ltr";var p=this.getParentElement();while(p&&!Xinha.isBlockElement(p)){p=p.parentNode}if(p){if(p.style.direction==k){p.style.direction=""}else{p.style.direction=k}}break;case"justifyleft":case"justifyright":m.match(/^justify(.*)$/);var i=this.activeElement(this.getSelection());if(i&&i.tagName.toLowerCase()=="img"){i.align=i.align==RegExp.$1?"":RegExp.$1}else{this._doc.execCommand(m,o,n)}break;default:try{this._doc.execCommand(m,o,n)}catch(j){if(this.config.debug){alert(j+"\n\nby execCommand("+m+");")}}break}this.updateToolbar();return false};Xinha.prototype._editorEvent=function(c){var d=this;if(typeof d._textArea["on"+c.type]=="function"){d._textArea["on"+c.type](c)}if(this.isKeyEvent(c)){if(d.firePluginEvent("onKeyPress",c)){return false}if(this.isShortCut(c)){this._shortCuts(c)}}if(c.type=="mousedown"){if(d.firePluginEvent("onMouseDown",c)){return false}}if(d._timerToolbar){clearTimeout(d._timerToolbar)}if(!this.suspendUpdateToolbar){d._timerToolbar=setTimeout(function(){d.updateToolbar();d._timerToolbar=null},250)}};Xinha.prototype._onDoubleClick=function(h){var i=this;var g=Xinha.is_ie?h.srcElement:h.target;var f=g.tagName;var j=g.className;if(f){f=f.toLowerCase();if(j&&(this.config.dblclickList[f+"."+j]!=undefined)){this.config.dblclickList[f+"."+j][0](i,g)}else{if(this.config.dblclickList[f]!=undefined){this.config.dblclickList[f][0](i,g)}}}};Xinha.prototype._shortCuts=function(e){var f=this.getKey(e).toLowerCase();var g=null;var h=null;switch(f){case"b":g="bold";break;case"i":g="italic";break;case"u":g="underline";break;case"s":g="strikethrough";break;case"l":g="justifyleft";break;case"e":g="justifycenter";break;case"r":g="justifyright";break;case"j":g="justifyfull";break;case"z":g="undo";break;case"y":g="redo";break;case"v":g="paste";break;case"n":g="formatblock";h="p";break;case"0":g="killword";break;case"1":case"2":case"3":case"4":case"5":case"6":g="formatblock";h="h"+f;break}if(g){this.execCommand(g,false,h);Xinha._stopEvent(e)}};Xinha.prototype.convertNode=function(f,d){var e=this._doc.createElement(d);while(f.firstChild){e.appendChild(f.firstChild)}return e};Xinha.prototype.scrollToElement=function(c){if(!c){c=this.getParentElement();if(!c){return}}var d=Xinha.getElementTopLeft(c);this._iframe.contentWindow.scrollTo(d.left,d.top)};Xinha.prototype.getEditorContent=function(){return this.outwardHtml(this.getHTML())};Xinha.prototype.setEditorContent=function(b){this.setHTML(this.inwardHtml(b))};Xinha.updateTextareas=function(){var c;for(var d=0;d<__xinhas.length;d++){c=__xinhas[d];c._textArea.value=c.getEditorContent()}};Xinha.prototype.getHTML=function(){var b="";switch(this._editMode){case"wysiwyg":if(!this.config.fullPage){b=Xinha.getHTML(this._doc.body,false,this).trim()}else{b=this.doctype+"\n"+Xinha.getHTML(this._doc.documentElement,true,this)}break;case"textmode":b=this._textArea.value;break;default:alert("Mode <"+this._editMode+"> not defined!");return false}return b};Xinha.prototype.outwardHtml=function(g){for(var h in this.plugins){var f=this.plugins[h].instance;if(f&&typeof f.outwardHtml=="function"){g=f.outwardHtml(g)}}g=g.replace(/<(\/?)b(\s|>|\/)/ig,"<$1strong$2");g=g.replace(/<(\/?)i(\s|>|\/)/ig,"<$1em$2");g=g.replace(/<(\/?)strike(\s|>|\/)/ig,"<$1del$2");g=g.replace(/(<[^>]*on(click|mouse(over|out|up|down))=['"])if\(window\.parent &amp;&amp; window\.parent\.Xinha\)\{return false\}/gi,"$1");var e=location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/";g=g.replace(/https?:\/\/null\//g,e);g=g.replace(/((href|src|background)=[\'\"])\/+/ig,"$1"+e);g=this.outwardSpecialReplacements(g);g=this.fixRelativeLinks(g);if(this.config.sevenBitClean){g=g.replace(/[^ -~\r\n\t]/g,function(a){return(a!=Xinha.cc)?"&#"+a.charCodeAt(0)+";":a})}g=g.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(freezescript)/gi,"$1javascript");if(this.config.fullPage){g=Xinha.stripCoreCSS(g)}if(typeof this.config.outwardHtml=="function"){g=this.config.outwardHtml(g)}return g};Xinha.prototype.inwardHtml=function(h){for(var e in this.plugins){var f=this.plugins[e].instance;if(f&&typeof f.inwardHtml=="function"){h=f.inwardHtml(h)}}h=h.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");h=h.replace(/(<[^>]*on(click|mouse(over|out|up|down))=["'])/gi,"$1if(window.parent &amp;&amp; window.parent.Xinha){return false}");h=this.inwardSpecialReplacements(h);h=h.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(javascript)/gi,"$1freezescript");var g=new RegExp("((href|src|background)=['\"])/+","gi");h=h.replace(g,"$1"+location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/");h=this.fixRelativeLinks(h);if(this.config.fullPage){h=Xinha.addCoreCSS(h)}if(typeof this.config.inwardHtml=="function"){h=this.config.inwardHtml(h)}return h};Xinha.prototype.outwardSpecialReplacements=function(j){for(var f in this.config.specialReplacements){var g=this.config.specialReplacements[f];var h=f;if(typeof g.replace!="function"||typeof h.replace!="function"){continue}var i=new RegExp(Xinha.escapeStringForRegExp(g),"g");j=j.replace(i,h.replace(/\$/g,"$$$$"))}return j};Xinha.prototype.inwardSpecialReplacements=function(j){for(var f in this.config.specialReplacements){var g=f;var h=this.config.specialReplacements[f];if(typeof g.replace!="function"||typeof h.replace!="function"){continue}var i=new RegExp(Xinha.escapeStringForRegExp(g),"g");j=j.replace(i,h.replace(/\$/g,"$$$$"))}return j};Xinha.prototype.fixRelativeLinks=function(o){if(typeof this.config.expandRelativeUrl!="undefined"&&this.config.expandRelativeUrl){if(o==null){return""}var r=o.match(/(src|href)="([^"]*)"/gi);var b=document.location.href;if(r){var q,u,v,t,i;for(var p=0;p<r.length;++p){q=r[p].match(/(src|href)="([^"]*)"/i);u=q[2].match(/\.\.\//g);if(u){v=new RegExp("(.*?)(([^/]*/){"+u.length+"})[^/]*$");t=b.match(v);i=q[2].replace(/(\.\.\/)*/,t[1]);o=o.replace(new RegExp(Xinha.escapeStringForRegExp(q[2])),i)}}}}if(typeof this.config.stripSelfNamedAnchors!="undefined"&&this.config.stripSelfNamedAnchors){var n=new RegExp('((href|src|background)=")('+Xinha.escapeStringForRegExp(window.unescape(document.location.href.replace(/&/g,"&amp;")))+")([#?][^'\" ]*)","g");o=o.replace(n,"$1$4")}if(typeof this.config.stripBaseHref!="undefined"&&this.config.stripBaseHref){var s=null;if(typeof this.config.baseHref!="undefined"&&this.config.baseHref!==null){s=new RegExp('((href|src|background|action)=")('+Xinha.escapeStringForRegExp(this.config.baseHref.replace(/([^\/]\/)(?=.+\.)[^\/]*$/,"$1"))+")","g");o=o.replace(s,"$1")}s=new RegExp('((href|src|background|action)=")('+Xinha.escapeStringForRegExp(document.location.href.replace(/^(https?:\/\/[^\/]*)(.*)/,"$1"))+")","g");o=o.replace(s,"$1")}return o};Xinha.prototype.getInnerHTML=function(){if(!this._doc.body){return""}var b="";switch(this._editMode){case"wysiwyg":if(!this.config.fullPage){b=this._doc.body.innerHTML}else{b=this.doctype+"\n"+this._doc.documentElement.innerHTML}break;case"textmode":b=this._textArea.value;break;default:alert("Mode <"+this._editMode+"> not defined!");return false}return b};Xinha.prototype.setHTML=function(b){if(!this.config.fullPage){this._doc.body.innerHTML=b}else{this.setFullHTML(b)}this._textArea.value=b};Xinha.prototype.setDoctype=function(b){this.doctype=b};Xinha._object=null;Array.prototype.isArray=true;RegExp.prototype.isRegExp=true;Xinha.cloneObject=function(obj){if(!obj){return null}var newObj=obj.isArray?[]:{};if(obj.constructor.toString().match(/\s*function Function\(/)||typeof obj=="function"){newObj=obj}else{if(obj.isRegExp){newObj=eval(obj.toString())}else{for(var n in obj){var node=obj[n];if(typeof node=="object"){newObj[n]=Xinha.cloneObject(node)}else{newObj[n]=node}}}}return newObj};Xinha.extend=function(f,d){function e(){}e.prototype=d.prototype;f.prototype=new e();f.prototype.constructor=f;f.parentConstructor=d;f.superClass=d.prototype};Xinha.flushEvents=function(){var f=0;var d=Xinha._eventFlushers.pop();while(d){try{if(d.length==3){Xinha._removeEvent(d[0],d[1],d[2]);f++}else{if(d.length==2){d[0]["on"+d[1]]=null;d[0]._xinha_dom0Events[d[1]]=null;f++}}}catch(e){}d=Xinha._eventFlushers.pop()}};Xinha._eventFlushers=[];if(document.addEventListener){Xinha._addEvent=function(e,f,d){e.addEventListener(f,d,false);Xinha._eventFlushers.push([e,f,d])};Xinha._removeEvent=function(e,f,d){e.removeEventListener(f,d,false)};Xinha._stopEvent=function(b){b.preventDefault();b.stopPropagation()}}else{if(document.attachEvent){Xinha._addEvent=function(e,f,d){e.attachEvent("on"+f,d);Xinha._eventFlushers.push([e,f,d])};Xinha._removeEvent=function(e,f,d){e.detachEvent("on"+f,d)};Xinha._stopEvent=function(c){try{c.cancelBubble=true;c.returnValue=false}catch(d){}}}else{Xinha._addEvent=function(e,f,d){alert("_addEvent is not supported")};Xinha._removeEvent=function(e,f,d){alert("_removeEvent is not supported")};Xinha._stopEvent=function(b){alert("_stopEvent is not supported")}}}Xinha._addEvents=function(h,f,g){for(var e=f.length;--e>=0;){Xinha._addEvent(h,f[e],g)}};Xinha._removeEvents=function(h,f,g){for(var e=f.length;--e>=0;){Xinha._removeEvent(h,f[e],g)}};Xinha.addOnloadHandler=function(e,f){f=f?f:window;var d=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(Xinha.onloadTimer){clearInterval(Xinha.onloadTimer)}e()};if(Xinha.is_ie){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);d()}});if(document.documentElement.doScroll&&typeof window.frameElement==="undefined"){(function(){if(arguments.callee.done){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}d()})()}}else{if(/applewebkit|KHTML/i.test(navigator.userAgent)){Xinha.onloadTimer=f.setInterval(function(){if(/loaded|complete/.test(f.document.readyState)){d()}},10)}else{f.document.addEventListener("DOMContentLoaded",d,false)}}Xinha._addEvent(f,"load",d)};Xinha.addDom0Event=function(e,d,f){Xinha._prepareForDom0Events(e,d);e._xinha_dom0Events[d].unshift(f)};Xinha.prependDom0Event=function(e,d,f){Xinha._prepareForDom0Events(e,d);e._xinha_dom0Events[d].push(f)};Xinha.getEvent=function(b){return b||window.event};Xinha._prepareForDom0Events=function(d,c){if(typeof d._xinha_dom0Events=="undefined"){d._xinha_dom0Events={};Xinha.freeLater(d,"_xinha_dom0Events")}if(typeof d._xinha_dom0Events[c]=="undefined"){d._xinha_dom0Events[c]=[];if(typeof d["on"+c]=="function"){d._xinha_dom0Events[c].push(d["on"+c])}d["on"+c]=function(b){var h=d._xinha_dom0Events[c];var a=true;for(var g=h.length;--g>=0;){d._xinha_tempEventHandler=h[g];if(d._xinha_tempEventHandler(b)===false){d._xinha_tempEventHandler=null;a=false;break}d._xinha_tempEventHandler=null}return a};Xinha._eventFlushers.push([d,c])}};Xinha.prototype.notifyOn=function(c,d){if(typeof this._notifyListeners[c]=="undefined"){this._notifyListeners[c]=[];Xinha.freeLater(this,"_notifyListeners")}this._notifyListeners[c].push(d)};Xinha.prototype.notifyOf=function(d,f){if(this._notifyListeners[d]){for(var e=0;e<this._notifyListeners[d].length;e++){this._notifyListeners[d][e](d,f)}}};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 title meta link style head ";Xinha.isBlockElement=function(b){return b&&b.nodeType==1&&(Xinha._blockTags.indexOf(" "+b.tagName.toLowerCase()+" ")!=-1)};Xinha._paraContainerTags=" body td th caption fieldset div ";Xinha.isParaContainer=function(b){return b&&b.nodeType==1&&(Xinha._paraContainerTags.indexOf(" "+b.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(b){return b&&b.nodeType==1&&(Xinha._closingTags.indexOf(" "+b.tagName.toLowerCase()+" ")!=-1)};Xinha.htmlEncode=function(b){if(!b){return""}if(typeof b.replace=="undefined"){b=b.toString()}b=b.replace(/&/ig,"&amp;");b=b.replace(/</ig,"&lt;");b=b.replace(/>/ig,"&gt;");b=b.replace(/\xA0/g,"&nbsp;");b=b.replace(/\x22/g,"&quot;");return b};Xinha.prototype.stripBaseURL=function(e){if(this.config.baseHref===null||!this.config.stripBaseHref){return e}var d=this.config.baseHref.replace(/^(https?:\/\/[^\/]+)(.*)$/,"$1");var f=new RegExp(d);return e.replace(f,"")};if(typeof String.prototype.trim!="function"){String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}}Xinha._makeColor=function(h){if(typeof h!="number"){return h}var f=h&255;var g=(h>>8)&255;var b=(h>>16)&255;return"rgb("+f+","+g+","+b+")"};Xinha._colorToRgb=function(l){if(!l){return""}var g,i,b;function j(a){return(a<16)?("0"+a.toString(16)):a.toString(16)}if(typeof l=="number"){g=l&255;i=(l>>8)&255;b=(l>>16)&255;return"#"+j(g)+j(i)+j(b)}if(l.substr(0,3)=="rgb"){var k=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;if(l.match(k)){g=parseInt(RegExp.$1,10);i=parseInt(RegExp.$2,10);b=parseInt(RegExp.$3,10);return"#"+j(g)+j(i)+j(b)}return null}if(l.substr(0,1)=="#"){return l}return null};Xinha.prototype._popupDialog=function(e,f,d){Dialog(this.popupURL(e),f,d)};Xinha.prototype.imgURL=function(c,d){if(typeof d=="undefined"){return _editor_url+c}else{return Xinha.getPluginDir(d)+"/img/"+c}};Xinha.prototype.popupURL=function(g){var h="";if(g.match(/^plugin:\/\/(.*?)\/(.*)/)){var e=RegExp.$1;var f=RegExp.$2;if(!/\.(html?|php)$/.test(f)){f+=".html"}h=Xinha.getPluginDir(e)+"/popups/"+f}else{if(g.match(/^\/.*?/)||g.match(/^https?:\/\//)){h=g}else{h=_editor_url+this.config.popupURL+g}}return h};Xinha.getElementById=function(f,g){var i,j,h=document.getElementsByTagName(f);for(j=h.length;--j>=0&&(i=h[j]);){if(i.id==g){return i}}return null};Xinha.prototype._toggleBorders=function(){var d=this._doc.getElementsByTagName("TABLE");if(d.length!==0){if(!this.borders){this.borders=true}else{this.borders=false}for(var c=0;c<d.length;c++){if(this.borders){Xinha._addClass(d[c],"htmtableborders")}else{Xinha._removeClass(d[c],"htmtableborders")}}}return true};Xinha.addCoreCSS=function(c){var d='<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(c&&/<head>/i.test(c)){return c.replace(/<head>/i,"<head>"+d)}else{if(c){return d+c}else{return d}}};Xinha.prototype.addEditorStylesheet=function(d){var c=this._doc.createElement("link");c.rel="stylesheet";c.type="text/css";c.title="XinhaInternalCSS";c.href=d;this._doc.getElementsByTagName("HEAD")[0].appendChild(c)};Xinha.stripCoreCSS=function(b){return b.replace(/<style[^>]+title="XinhaInternalCSS"(.|\n)*?<\/style>/ig,"").replace(/<link[^>]+title="XinhaInternalCSS"(.|\n)*?>/ig,"")};Xinha._removeClass=function(g,i){if(!(g&&g.className)){return}var f=g.className.split(" ");var j=[];for(var h=f.length;h>0;){if(f[--h]!=i){j[j.length]=f[h]}}g.className=j.join(" ")};Xinha._addClass=function(c,d){Xinha._removeClass(c,d);c.className+=" "+d};Xinha.addClasses=function(i,k){if(i!==null){var j=i.className.trim().split(" ");var l=k.split(" ");for(var h=0;h<l.length;h++){var n=false;for(var m=0;n===false&&m<j.length;m++){if(j[m]==l[h]){n=true}}if(n===false){j[j.length]=l[h]}}i.className=j.join(" ").trim()}};Xinha.removeClasses=function(p,i){var k=p.className.trim().split();var o=[];var m=i.trim().split();for(var j=0;j<k.length;j++){var n=false;for(var l=0;l<m.length&&!n;l++){if(k[j]==m[l]){n=true}}if(!n){o[o.length]=k[j]}}return o.join(" ")};Xinha.addClass=Xinha._addClass;Xinha.removeClass=Xinha._removeClass;Xinha._addClasses=Xinha.addClasses;Xinha._removeClasses=Xinha.removeClasses;Xinha._hasClass=function(g,e){if(!(g&&g.className)){return false}var f=g.className.split(" ");for(var h=f.length;h>0;){if(f[--h]==e){return true}}return false};Xinha._postback_send_charset=true;Xinha._postback=function(k,n,m,i){var o=null;o=Xinha.getXMLHTTPRequestObject();var p="";if(typeof n=="string"){p=n}else{if(typeof n=="object"){for(var j in n){p+=(p.length?"&":"")+j+"="+encodeURIComponent(n[j])}}}function l(){if(o.readyState==4){if(((o.status/100)==2)||Xinha.isRunLocally&&o.status===0){if(typeof m=="function"){m(o.responseText,o)}}else{if(Xinha._postback_send_charset){Xinha._postback_send_charset=false;Xinha._postback(k,n,m,i)}else{if(typeof i=="function"){i(o)}else{alert("An error has occurred: "+o.statusText+"\nURL: "+k)}}}}}o.onreadystatechange=l;o.open("POST",k,true);o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"+(Xinha._postback_send_charset?"; charset=UTF-8":""));o.send(p)};Xinha._getback=function(j,g,i){var h=null;h=Xinha.getXMLHTTPRequestObject();function f(){if(h.readyState==4){if(((h.status/100)==2)||Xinha.isRunLocally&&h.status===0){g(h.responseText,h)}else{if(typeof i=="function"){i(h)}else{alert("An error has occurred: "+h.statusText+"\nURL: "+j)}}}}h.onreadystatechange=f;h.open("GET",j,true);h.send(null)};Xinha.ping=function(i,j,k){var h=null;h=Xinha.getXMLHTTPRequestObject();function l(){if(h.readyState==4){if(((h.status/100)==2)||Xinha.isRunLocally&&h.status===0){if(j){j(h)}}else{if(k){k(h)}}}}var g="GET";h.onreadystatechange=l;h.open(g,i,true);h.send(null)};Xinha._geturlcontent=function(f,d){var e=null;e=Xinha.getXMLHTTPRequestObject();e.open("GET",f,false);e.send(null);if(((e.status/100)==2)||Xinha.isRunLocally&&e.status===0){return(d)?e.responseXML:e.responseText}else{return""}};if(typeof dumpValues=="undefined"){dumpValues=function(h){var e="";for(var g in h){if(window.console&&typeof window.console.log=="function"){if(typeof console.firebug!="undefined"){console.log(h)}else{console.log(g+" = "+h[g]+"\n")}}else{e+=g+" = "+h[g]+"\n"}}if(e){if(document.getElementById("errors")){document.getElementById("errors").value+=e}else{var f=window.open("","debugger");f.document.write("<pre>"+e+"</pre>")}}}}if(!Array.prototype.contains){Array.prototype.contains=function(d){var e=this;for(var f=0;f<e.length;f++){if(d==e[f]){return true}}return false}}if(!Array.prototype.indexOf){Array.prototype.indexOf=function(d){var e=this;for(var f=0;f<e.length;f++){if(d==e[f]){return f}}return null}}if(!Array.prototype.append){Array.prototype.append=function(a){for(var d=0;d<a.length;d++){this.push(a[d])}return this}}if(!Array.prototype.forEach){Array.prototype.forEach=function(g){var f=this.length;if(typeof g!="function"){throw new TypeError()}var h=arguments[1];for(var e=0;e<f;e++){if(e in this){g.call(h,this[e],e,this)}}}}Xinha.getElementsByClassName=function(i,l){if(i.getElementsByClassName){return Array.prototype.slice.call(i.getElementsByClassName(l))}else{var j=i.getElementsByTagName("*");var h=[];var g;for(var k=0;k<j.length;k++){g=j[k].className.split(" ");if(g.contains(l)){h.push(j[k])}}return h}};Xinha.arrayContainsArray=function(j,k){var h=true;for(var l=0;l<k.length;l++){var g=false;for(var i=0;i<j.length;i++){if(j[i]==k[l]){g=true;break}}if(!g){h=false;break}}return h};Xinha.arrayFilter=function(h,e){var g=[];for(var f=0;f<h.length;f++){if(e(h[f])){g[g.length]=h[f]}}return g};Xinha.collectionToArray=function(h){try{return h.length?Array.prototype.slice.call(h):[]}catch(e){}var g=[];for(var f=0;f<h.length;f++){g.push(h.item(f))}return g};Xinha.uniq_count=0;Xinha.uniq=function(b){return b+Xinha.uniq_count++};Xinha._loadlang=function(context,url){var lang;if(typeof _editor_lcbackend=="string"){url=_editor_lcbackend;url=url.replace(/%lang%/,_editor_lang);url=url.replace(/%context%/,context)}else{if(!url){if(context!="Xinha"){url=Xinha.getPluginDir(context)+"/lang/"+_editor_lang+".js"}else{Xinha.setLoadingMessage("Loading language");url=_editor_url+"lang/"+_editor_lang+".js"}}}var langData=Xinha._geturlcontent(url);if(langData!==""){try{eval("lang = "+langData)}catch(ex){alert("Error reading Language-File ("+url+"):\n"+Error.toString());lang={}}}else{lang={}}return lang};Xinha._lc=function(o,q,p){var r,k;if(typeof q=="object"&&q.url&&q.context){r=q.url+_editor_lang+".js";q=q.context}var m=null;if(typeof o=="string"){m=o.match(/\$(.*?)=(.*?)\$/g)}if(m){if(!p){p={}}for(var l=0;l<m.length;l++){var n=m[l].match(/\$(.*?)=(.*?)\$/);p[n[1]]=n[2];o=o.replace(n[0],"$"+n[1])}}if(_editor_lang=="en"){if(typeof o=="object"&&o.string){k=o.string}else{k=o}}else{if(typeof Xinha._lc_catalog=="undefined"){Xinha._lc_catalog=[]}if(typeof q=="undefined"){q="Xinha"}if(typeof Xinha._lc_catalog[q]=="undefined"){Xinha._lc_catalog[q]=Xinha._loadlang(q,r)}var i;if(typeof o=="object"&&o.key){i=o.key}else{if(typeof o=="object"&&o.string){i=o.string}else{i=o}}if(typeof Xinha._lc_catalog[q][i]=="undefined"){if(q=="Xinha"){if(typeof o=="object"&&o.string){k=o.string}else{k=o}}else{return Xinha._lc(o,"Xinha",p)}}else{k=Xinha._lc_catalog[q][i]}}if(typeof o=="object"&&o.replace){p=o.replace}if(typeof p!="undefined"){for(l in p){k=k.replace("$"+l,p[l])}}return k};Xinha.hasDisplayedChildren=function(d){var e=d.childNodes;for(var f=0;f<e.length;f++){if(e[f].tagName){if(e[f].style.display!="none"){return true}}}return false};Xinha._loadback=function(l,h,i,g){if(document.getElementById(l)){return true}var k=!Xinha.is_ie?"onload":"onreadystatechange";var j=document.createElement("script");j.type="text/javascript";j.src=l;j.id=l;if(h){j[k]=function(){if(Xinha.is_ie&&(!/loaded|complete/.test(window.event.srcElement.readyState))){return}h.call(i?i:this,g);j[k]=null}}document.getElementsByTagName("head")[0].appendChild(j);return false};Xinha.makeEditors=function(l,j,i){if(!Xinha.isSupportedBrowser){return}if(typeof j=="function"){j=j()}var n={};var k;for(var h=0;h<l.length;h++){if(typeof l[h]=="string"){k=Xinha.getElementById("textarea",l[h]);if(!k){l[h]=null;continue}}else{if(typeof l[h]=="object"&&l[h].tagName&&l[h].tagName.toLowerCase()=="textarea"){k=l[h];if(!k.id){k.id="xinha_id_"+h}}}var m=new Xinha(k,Xinha.cloneObject(j));m.registerPlugins(i);n[k.id]=m}return n};Xinha.startEditors=function(d){if(!Xinha.isSupportedBrowser){return}for(var c in d){if(d[c].generate){d[c].generate()}}};Xinha.prototype.registerPlugins=function(c){if(!Xinha.isSupportedBrowser){return}if(c){for(var d=0;d<c.length;d++){this.setLoadingMessage(Xinha._lc("Register plugin $plugin","Xinha",{plugin:c[d]}));this.registerPlugin(c[d])}}};Xinha.base64_encode=function(p){var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var r="";var u,i,m;var t,v,n,o;var s=0;do{u=p.charCodeAt(s++);i=p.charCodeAt(s++);m=p.charCodeAt(s++);t=u>>2;v=((u&3)<<4)|(i>>4);n=((i&15)<<2)|(m>>6);o=m&63;if(isNaN(i)){n=o=64}else{if(isNaN(m)){o=64}}r=r+q.charAt(t)+q.charAt(v)+q.charAt(n)+q.charAt(o)}while(s<p.length);return r};Xinha.base64_decode=function(p){var q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var r="";var u,i,m;var t,v,n,o;var s=0;p=p.replace(/[^A-Za-z0-9\+\/\=]/g,"");do{t=q.indexOf(p.charAt(s++));v=q.indexOf(p.charAt(s++));n=q.indexOf(p.charAt(s++));o=q.indexOf(p.charAt(s++));u=(t<<2)|(v>>4);i=((v&15)<<4)|(n>>2);m=((n&3)<<6)|o;r=r+String.fromCharCode(u);if(n!=64){r=r+String.fromCharCode(i)}if(o!=64){r=r+String.fromCharCode(m)}}while(s<p.length);return r};Xinha.removeFromParent=function(c){if(!c.parentNode){return}var d=c.parentNode;return d.removeChild(c)};Xinha.hasParentNode=function(b){if(b.parentNode){if(b.parentNode.nodeType==11){return false}return true}return false};Xinha.viewportSize=function(e){e=(e)?e:window;var f,d;if(e.innerHeight){f=e.innerWidth;d=e.innerHeight}else{if(e.document.documentElement&&e.document.documentElement.clientHeight){f=e.document.documentElement.clientWidth;d=e.document.documentElement.clientHeight}else{if(e.document.body){f=e.document.body.clientWidth;d=e.document.body.clientHeight}}}return{x:f,y:d}};Xinha.pageSize=function(h){h=(h)?h:window;var f,g;var i=h.document.body.scrollHeight;var j=h.document.documentElement.scrollHeight;if(i>j){f=h.document.body.scrollWidth;g=h.document.body.scrollHeight}else{f=h.document.documentElement.scrollWidth;g=h.document.documentElement.scrollHeight}return{x:f,y:g}};Xinha.prototype.scrollPos=function(e){e=(e)?e:window;var f,d;if(typeof e.pageYOffset!="undefined"){f=e.pageXOffset;d=e.pageYOffset}else{if(e.document.documentElement&&typeof document.documentElement.scrollTop!="undefined"){f=e.document.documentElement.scrollLeft;d=e.document.documentElement.scrollTop}else{if(e.document.body){f=e.document.body.scrollLeft;d=e.document.body.scrollTop}}}return{x:f,y:d}};Xinha.getElementTopLeft=function(e){var d=0;var f=0;if(e.offsetParent){d=e.offsetLeft;f=e.offsetTop;while(e=e.offsetParent){d+=e.offsetLeft;f+=e.offsetTop}}return{top:f,left:d}};Xinha.findPosX=function(d){var c=0;if(d.offsetParent){return Xinha.getElementTopLeft(d).left}else{if(d.x){c+=d.x}}return c};Xinha.findPosY=function(c){var d=0;if(c.offsetParent){return Xinha.getElementTopLeft(c).top}else{if(c.y){d+=c.y}}return d};Xinha.createLoadingMessages=function(c){if(Xinha.loadingMessages||!Xinha.isSupportedBrowser){return}Xinha.loadingMessages=[];for(var d=0;d<c.length;d++){if(!document.getElementById(c[d])){continue}Xinha.loadingMessages.push(Xinha.createLoadingMessage(Xinha.getElementById("textarea",c[d])))}};Xinha.createLoadingMessage=function(h,g){if(document.getElementById("loading_"+h.id)||!Xinha.isSupportedBrowser){return}var f=document.createElement("div");f.id="loading_"+h.id;f.className="loading";f.style.left=(Xinha.findPosX(h)+h.offsetWidth/2)-106+"px";f.style.top=(Xinha.findPosY(h)+h.offsetHeight/2)-50+"px";var j=document.createElement("div");j.className="loading_main";j.id="loading_main_"+h.id;j.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!")));var i=document.createElement("div");i.className="loading_sub";i.id="loading_sub_"+h.id;g=g?g:Xinha._lc("Loading Core");i.appendChild(document.createTextNode(g));f.appendChild(j);f.appendChild(i);document.body.appendChild(f);Xinha.freeLater(f);Xinha.freeLater(j);Xinha.freeLater(i);return i};Xinha.prototype.setLoadingMessage=function(c,d){if(!document.getElementById("loading_sub_"+this._textArea.id)){return}document.getElementById("loading_main_"+this._textArea.id).innerHTML=d?d:Xinha._lc("Loading in progress. Please wait!");document.getElementById("loading_sub_"+this._textArea.id).innerHTML=c};Xinha.setLoadingMessage=function(c){if(!Xinha.loadingMessages){return}for(var d=0;d<Xinha.loadingMessages.length;d++){Xinha.loadingMessages[d].innerHTML=c}};Xinha.prototype.removeLoadingMessage=function(){if(document.getElementById("loading_"+this._textArea.id)){document.body.removeChild(document.getElementById("loading_"+this._textArea.id))}};Xinha.removeLoadingMessages=function(d){for(var e=0;e<d.length;e++){if(!document.getElementById(d[e])){continue}var f=document.getElementById("loading_"+document.getElementById(d[e]).id);f.parentNode.removeChild(f)}Xinha.loadingMessages=null};Xinha.toFree=[];Xinha.freeLater=function(d,c){Xinha.toFree.push({o:d,p:c})};Xinha.free=function(h,g){if(h&&!g){for(var e in h){Xinha.free(h,e)}}else{if(h){if(g.indexOf("src")==-1){try{h[g]=null}catch(f){}}}}};Xinha.collectGarbageForIE=function(){Xinha.flushEvents();for(var b=0;b<Xinha.toFree.length;b++){Xinha.free(Xinha.toFree[b].o,Xinha.toFree[b].p);Xinha.toFree[b].o=null}};Xinha.prototype.insertNodeAtSelection=function(b){Xinha.notImplemented("insertNodeAtSelection")};Xinha.prototype.getParentElement=function(b){Xinha.notImplemented("getParentElement")};Xinha.prototype.activeElement=function(b){Xinha.notImplemented("activeElement")};Xinha.prototype.selectionEmpty=function(b){Xinha.notImplemented("selectionEmpty")};Xinha.prototype.saveSelection=function(){Xinha.notImplemented("saveSelection")};Xinha.prototype.restoreSelection=function(b){Xinha.notImplemented("restoreSelection")};Xinha.prototype.selectNodeContents=function(d,c){Xinha.notImplemented("selectNodeContents")};Xinha.prototype.insertHTML=function(b){Xinha.notImplemented("insertHTML")};Xinha.prototype.getSelectedHTML=function(){Xinha.notImplemented("getSelectedHTML")};Xinha.prototype.getSelection=function(){Xinha.notImplemented("getSelection")};Xinha.prototype.createRange=function(b){Xinha.notImplemented("createRange")};Xinha.prototype.isKeyEvent=function(b){Xinha.notImplemented("isKeyEvent")};Xinha.prototype.isShortCut=function(b){if(b.ctrlKey&&!b.altKey){return true}return false};Xinha.prototype.getKey=function(b){Xinha.notImplemented("getKey")};Xinha.getOuterHTML=function(b){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(b){Xinha.notImplemented("getXMLHTTPRequestObject")}};Xinha.prototype._activeElement=function(b){return this.activeElement(b)};Xinha.prototype._selectionEmpty=function(b){return this.selectionEmpty(b)};Xinha.prototype._getSelection=function(){return this.getSelection()};Xinha.prototype._createRange=function(b){return this.createRange(b)};HTMLArea=Xinha;Xinha.init();if(Xinha.ie_version<8){Xinha.addDom0Event(window,"unload",Xinha.collectGarbageForIE)}Xinha.debugMsg=function(d,c){if(typeof console!="undefined"&&typeof console.log=="function"){if(c&&c=="warn"&&typeof console.warn=="function"){console.warn(d)}else{if(c&&c=="info"&&typeof console.info=="function"){console.info(d)}else{console.log(d)}}}else{if(typeof opera!="undefined"&&typeof opera.postError=="function"){opera.postError(d)}}};Xinha.notImplemented=function(b){throw new Error("Method Not Implemented","Part of Xinha has tried to call the "+b+" method which has not been implemented.")};
