/* 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-2010 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(d,c){if(c.match(/^([^:]+\:)?\/\//)){return c}else{var a=d.split("/");if(a[a.length-1]===""){a.pop()}var e=c.split("/");if(e[0]=="."){e.shift()}while(e[0]==".."){a.pop();e.shift()}return a.join("/")+"/"+e.join("/")}};if(typeof _editor_url=="string"){_editor_url=_editor_url.replace(/\x2f*$/,"/");if(!_editor_url.match(/^([^:]+\:)?\//)){(function(){var a=window.location.toString().replace(/\?.*$/,"").split("/");a.pop();_editor_url=Xinha._resolveRelativeUrl(a.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(d,c){if(!Xinha.isSupportedBrowser){return}if(!d){throw new Error("Tried to create Xinha without textarea specified.")}if(typeof c=="undefined"){this.config=new Xinha.Config()}else{this.config=c}if(typeof d!="object"){d=Xinha.getElementById("textarea",d)}this._textArea=d;this._textArea.spellcheck=false;Xinha.freeLater(this,"_textArea");this._initial_ta_size={w:d.style.width?d.style.width:(d.offsetWidth?(d.offsetWidth+"px"):(d.cols+"em")),h:d.style.height?d.style.height:(d.offsetHeight?(d.offsetHeight+"px"):(d.rows+"em"))};if(document.getElementById("loading_"+d.id)||this.config.showLoading){if(!document.getElementById("loading_"+d.id)){Xinha.createLoadingMessage(d)}this.setLoadingMessage(Xinha._lc("Constructing object"))}this._editMode="wysiwyg";this.plugins={};this._timerToolbar=null;this._timerUndo=null;this._undoQueue=[this.config.undoSteps];this._undoPos=-1;this._customUndo=true;this._mdoc=document;this.doctype="";this.__htmlarea_id_num=__xinhas.length;__xinhas[this.__htmlarea_id_num]=this;this._notifyListeners={};var b={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 a in b){if(!b[a].container){continue}b[a].div=b[a].container;b[a].container.className="panels panels_"+a;Xinha.freeLater(b[a],"container");Xinha.freeLater(b[a],"div")}this._panels=b;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:c.Events}}Xinha.onload=function(){};Xinha.init=function(){Xinha.onload()};Xinha.RE_tagName=/(<\/|<)\s*([^ \t\n>]+)/ig;Xinha.RE_doctype=/()\n?/i;Xinha.RE_head=/((.|\n)*?)<\/head>/i;Xinha.RE_body=/]*>((.|\n|\r|\t)*?)<\/body>/i;Xinha.RE_Specials=/([\/\^$*+?.()|{}\[\]])/g;Xinha.escapeStringForRegExp=function(a){return a.replace(Xinha.RE_Specials,"\\$1")};Xinha.RE_email=/^[_a-z\d\-\.]{3,}@[_a-z\d\-]{2,}(\.[_a-z\d\-]{2,})+$/i;Xinha.RE_url=/(https?:\/\/)?(([a-z0-9_]+:[a-z0-9_]+@)?[a-z0-9_\-]{2,}(\.[a-z0-9_\-]{2,}){2,}(:[0-9]+)?(\/\S+)*)/i;Xinha.Config=function(){this.version=Xinha.version.Revision;this.width="auto";this.height="auto";this.sizeIncludesBars=true;this.sizeIncludesPanels=true;this.panel_dimensions={left:"200px",right:"200px",top:"100px",bottom:"100px"};this.iframeWidth=null;this.statusBar=true;this.htmlareaPaste=false;this.mozParaHandler="best";this.getHtmlMethod="DOMwalk";this.undoSteps=20;this.undoTimeout=500;this.changeJustifyWithDirection=false;this.fullPage=false;this.pageStyle="";this.pageStyleSheets=[];this.baseHref=null;this.expandRelativeUrl=true;this.stripBaseHref=true;this.stripSelfNamedAnchors=true;this.only7BitPrintablesInURLs=true;this.sevenBitClean=false;this.specialReplacements={};this.inwardHtml=function(c){return c};this.outwardHtml=function(c){return c};this.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={"— font —":"",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={"— size —":"","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={"— format —":"","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(c){c.execCommand("bold")}],italic:["Italic",Xinha._lc({key:"button_italic",string:["ed_buttons_main.png",2,2]},"Xinha"),false,function(c){c.execCommand("italic")}],underline:["Underline",Xinha._lc({key:"button_underline",string:["ed_buttons_main.png",2,0]},"Xinha"),false,function(c){c.execCommand("underline")}],strikethrough:["Strikethrough",Xinha._lc({key:"button_strikethrough",string:["ed_buttons_main.png",3,0]},"Xinha"),false,function(c){c.execCommand("strikethrough")}],subscript:["Subscript",Xinha._lc({key:"button_subscript",string:["ed_buttons_main.png",3,1]},"Xinha"),false,function(c){c.execCommand("subscript")}],superscript:["Superscript",Xinha._lc({key:"button_superscript",string:["ed_buttons_main.png",2,1]},"Xinha"),false,function(c){c.execCommand("superscript")}],justifyleft:["Justify Left",["ed_buttons_main.png",0,0],false,function(c){c.execCommand("justifyleft")}],justifycenter:["Justify Center",["ed_buttons_main.png",1,1],false,function(c){c.execCommand("justifycenter")}],justifyright:["Justify Right",["ed_buttons_main.png",1,0],false,function(c){c.execCommand("justifyright")}],justifyfull:["Justify Full",["ed_buttons_main.png",0,1],false,function(c){c.execCommand("justifyfull")}],orderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(c){c.execCommand("insertorderedlist")}],unorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(c){c.execCommand("insertunorderedlist")}],insertorderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(c){c.execCommand("insertorderedlist")}],insertunorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(c){c.execCommand("insertunorderedlist")}],outdent:["Decrease Indent",["ed_buttons_main.png",1,2],false,function(c){c.execCommand("outdent")}],indent:["Increase Indent",["ed_buttons_main.png",0,2],false,function(c){c.execCommand("indent")}],forecolor:["Font Color",["ed_buttons_main.png",3,3],false,function(c){c.execCommand("forecolor")}],hilitecolor:["Background Color",["ed_buttons_main.png",2,3],false,function(c){c.execCommand("hilitecolor")}],undo:["Undoes your last action",["ed_buttons_main.png",4,2],false,function(c){c.execCommand("undo")}],redo:["Redoes your last action",["ed_buttons_main.png",5,2],false,function(c){c.execCommand("redo")}],cut:["Cut selection",["ed_buttons_main.png",5,0],false,function(d,c){d.execCommand(c)}],copy:["Copy selection",["ed_buttons_main.png",4,0],false,function(d,c){d.execCommand(c)}],paste:["Paste from clipboard",["ed_buttons_main.png",4,1],false,function(d,c){d.execCommand(c)}],selectall:["Select all",["ed_buttons_main.png",3,5],false,function(c){c.execCommand("selectall")}],inserthorizontalrule:["Horizontal Rule",["ed_buttons_main.png",6,0],false,function(c){c.execCommand("inserthorizontalrule")}],createlink:["Insert Web Link",["ed_buttons_main.png",6,1],false,function(c){c._createLink()}],insertimage:["Insert/Modify Image",["ed_buttons_main.png",6,3],false,function(c){c.execCommand("insertimage")}],inserttable:["Insert Table",["ed_buttons_main.png",6,2],false,function(c){c.execCommand("inserttable")}],htmlmode:["Toggle HTML Source",["ed_buttons_main.png",7,0],true,function(c){c.execCommand("htmlmode")}],toggleborders:["Toggle Borders",["ed_buttons_main.png",7,2],false,function(c){c._toggleBorders()}],print:["Print document",["ed_buttons_main.png",8,1],false,function(c){if(Xinha.is_gecko){c._iframe.contentWindow.print()}else{c.focusEditor();print()}}],saveas:["Save as",["ed_buttons_main.png",9,1],false,function(c){c.execCommand("saveas",false,"noname.htm")}],about:["About this editor",["ed_buttons_main.png",8,2],true,function(c){c.getPluginInstance("AboutBox").show()}],showhelp:["Help using editor",["ed_buttons_main.png",9,2],true,function(c){c.execCommand("showhelp")}],splitblock:["Split Block","ed_splitblock.gif",false,function(c){c._splitBlock()}],lefttoright:["Direction left to right",["ed_buttons_main.png",0,2],false,function(c){c.execCommand("lefttoright")}],righttoleft:["Direction right to left",["ed_buttons_main.png",1,2],false,function(c){c.execCommand("righttoleft")}],overwrite:["Insert/Overwrite","ed_overwrite.gif",false,function(c){c.execCommand("overwrite")}],wordclean:["MS Word Cleaner",["ed_buttons_main.png",5,3],false,function(c){c._wordClean()}],clearfonts:["Clear Inline Font Specifications",["ed_buttons_main.png",5,4],true,function(c){c._clearFonts()}],removeformat:["Remove formatting",["ed_buttons_main.png",4,4],false,function(c){c.execCommand("removeformat")}],killword:["Clear MSOffice tags",["ed_buttons_main.png",4,3],false,function(c){c.execCommand("killword")}]};this.dblclickList={a:[function(c,d){c._createLink(d)}],img:[function(c,d){c._insertImage(d)}]};this.iconList={dialogCaption:_editor_url+"images/xinha-small-icon.gif",wysiwygmode:[_editor_url+"images/ed_buttons_main.png",7,1]};for(var b in this.btnList){var a=this.btnList[b];if(typeof a!="object"){continue}if(typeof a[1]!="string"){a[1][0]=_editor_url+this.imgURL+a[1][0]}else{a[1]=_editor_url+this.imgURL+a[1]}a[0]=Xinha._lc(a[0])}};Xinha.Config.prototype.registerIcon=function(b,a){this.iconList[b]=a};Xinha.Config.prototype.registerButton=function(f,b,e,d,a,c){if(typeof f=="string"){this.btnList[f]=[b,e,d,a,c]}else{if(typeof f=="object"){this.btnList[f.id]=[f.tooltip,f.image,f.textMode,f.action,f.context]}else{alert("ERROR [Xinha.Config::registerButton]:\ninvalid arguments");return false}}};Xinha.prototype.registerPanel=function(c,b){if(!c){c="right"}this.setLoadingMessage("Register "+c+" panel ");var a=this.addPanel(c);if(b){b.drawPanelIn(a)}};Xinha.Config.prototype.registerDropdown=function(a){this.customSelects[a.id]=a};Xinha.Config.prototype.hideSomeButtons=function(f){var c=this.toolbar;for(var e=c.length;--e>=0;){var b=c[e];for(var d=b.length;--d>=0;){if(f.indexOf(" "+b[d]+" ")>=0){var a=1;if(/separator|space/.test(b[d+1])){a=2}b.splice(d,a)}}}};Xinha.Config.prototype.addToolbarElement=function(d,k,m){var s=this.toolbar;var q,l,h,f,c;var p=false;var b=false;var n=0;var g=0;var e=0;var r=false;var t=false;if((d&&typeof d=="object")&&(d.constructor==Array)){p=true}if((k&&typeof k=="object")&&(k.constructor==Array)){b=true;n=k.length}if(p){for(l=0;l=0;){q.splice(h,0,d[l])}}else{q[h]=d}}else{if(m<0){h=h+m+1}else{if(m>0){h=h+m}}if(p){for(l=d.length;--l>=0;){q.splice(h,0,d[l])}}else{q.splice(h,0,d)}}}else{s[0].splice(0,0,"separator");if(p){for(l=d.length;--l>=0;){s[0].splice(0,0,d[l])}}else{s[0].splice(0,0,d)}}};Xinha.Config.prototype.removeToolbarElement=Xinha.Config.prototype.hideSomeButtons;Xinha.replaceAll=function(b){var c=document.getElementsByTagName("textarea");for(var a=c.length;a>0;new Xinha(c[--a],b).generate()){}};Xinha.replace=function(c,b){var a=Xinha.getElementById("textarea",c);return a?new Xinha(a,b).generate():null};Xinha.prototype._createToolbar=function(){this.setLoadingMessage(Xinha._lc("Create Toolbar"));var b=this;var a=document.createElement("div");this._toolBar=this._toolbar=a;a.className="toolbar";a.align=this.config.toolbarAlign;Xinha.freeLater(this,"_toolBar");Xinha.freeLater(this,"_toolbar");var c=null;var e={};this._toolbarObjects=e;this._createToolbar1(b,a,e);function d(g){if(g.tagName){g.unselectable="on"}if(g.childNodes){for(var f=0;f] button to switch back to WYSIWYG."));c.style.display="none";this._statusBarTextMode=c;Xinha.freeLater(this,"_statusBarTextMode");b.appendChild(c);b.style.whiteSpace="nowrap";var a=this;this.notifyOn("before_resize",function(f,g){a._statusBar.style.width=null});this.notifyOn("resize",function(f,g){if(Xinha.is_ie&&Xinha.ie_version==6){a._statusBar.style.width="100%"}else{var h=g.width;a._statusBar.style.width=h+"px"}});this.notifyOn("modechange",function(g,l){for(var j in a._statusWidgets){var f=a._statusWidgets[j];for(var h=0;h=0;){for(var v=a[w].length;--v>=0;){switch(a[w][v]){case"popupeditor":if(!this.plugins.FullScreen){k.registerPlugin("FullScreen")}break;case"insertimage":g=_editor_url+"modules/InsertImage/insert_image.js";if(typeof Xinha.prototype._insertImage=="undefined"&&!Xinha.loadPlugins([{plugin:"InsertImage",url:g}],h)){return false}else{if(typeof Xinha.getPluginConstructor("InsertImage")!="undefined"&&!this.plugins.InsertImage){k.registerPlugin("InsertImage")}}break;case"createlink":g=_editor_url+"modules/CreateLink/link.js";if(typeof Xinha.getPluginConstructor("Linker")=="undefined"&&!Xinha.loadPlugins([{plugin:"CreateLink",url:g}],h)){return false}else{if(typeof Xinha.getPluginConstructor("CreateLink")!="undefined"&&!this.plugins.CreateLink){k.registerPlugin("CreateLink")}}break;case"inserttable":g=_editor_url+"modules/InsertTable/insert_table.js";if(!Xinha.loadPlugins([{plugin:"InsertTable",url:g}],h)){return false}else{if(typeof Xinha.getPluginConstructor("InsertTable")!="undefined"&&!this.plugins.InsertTable){k.registerPlugin("InsertTable")}}break;case"about":g=_editor_url+"modules/AboutBox/AboutBox.js";if(!Xinha.loadPlugins([{plugin:"AboutBox",url:g}],h)){return false}else{if(typeof Xinha.getPluginConstructor("AboutBox")!="undefined"&&!this.plugins.AboutBox){k.registerPlugin("AboutBox")}}break}}}if(Xinha.is_gecko&&k.config.mozParaHandler!="built-in"){if(!Xinha.loadPlugins([{plugin:"EnterParagraphs",url:_editor_url+"modules/Gecko/paraHandlerBest.js"}],h)){return false}if(!this.plugins.EnterParagraphs){k.registerPlugin("EnterParagraphs")}}var C=this.config.getHtmlMethod=="TransformInnerHTML"?_editor_url+"modules/GetHtml/TransformInnerHTML.js":_editor_url+"modules/GetHtml/DOMwalk.js";if(!Xinha.loadPlugins([{plugin:"GetHtmlImplementation",url:C}],h)){return false}else{if(!this.plugins.GetHtmlImplementation){k.registerPlugin("GetHtmlImplementation")}}function D(i){return i.textContent||i.text}if(_editor_skin){this.skinInfo={};var s=Xinha._geturlcontent(_editor_url+"skins/"+_editor_skin+"/skin.xml",true);if(s){var p=s.getElementsByTagName("meta");for(w=0;w'}else{if(b.config.browserQuirksMode===true){a=""}else{a=Xinha.getDoctype(document)}}if(!b.config.fullPage){e+=a+"\n";e+="\n";e+="\n";e+='\n';if(typeof b.config.baseHref!="undefined"&&b.config.baseHref!==null){e+='\n'}e+=Xinha.addCoreCSS();if(typeof b.config.pageStyleSheets!=="undefined"){for(var d=0;d0){e+=''}}}if(b.config.pageStyle){e+='"}e+="\n";e+="\n";e+=b.inwardHtml(b._textArea.value);e+="\n";e+=""}else{e=b.inwardHtml(b._textArea.value);if(e.match(Xinha.RE_doctype)){b.setDoctype(RegExp.$1)}var c=e.match(//gi);e=e.replace(/\s*/gi,"");if(c){e=e.replace(/<\/head>/i,c.join("\n")+"\n")}}g.write(e);g.close();if(this.config.fullScreen){this._fullScreen()}this.setEditorEvents();if((typeof b.config.autofocus!="undefined")&&b.config.autofocus!==false&&((b.config.autofocus==b._textArea.id)||b.config.autofocus==true)){b.activateEditor();b.focusEditor()}};Xinha.prototype.whenDocReady=function(a){var b=this;if(this._doc&&this._doc.body){a()}else{setTimeout(function(){b.whenDocReady(a)},50)}};Xinha.prototype.setMode=function(b){var a;if(typeof b=="undefined"){b=this._editMode=="textmode"?"wysiwyg":"textmode"}switch(b){case"textmode":this.firePluginEvent("onBeforeMode","textmode");this._toolbarObjects.htmlmode.swapImage(this.config.iconList.wysiwygmode);this.setCC("iframe");a=this.outwardHtml(this.getHTML());this.setHTML(a);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");a=this.inwardHtml(this.getHTML());this.deactivateEditor();this.setHTML(a);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 <"+b+"> not defined!");return false}this._editMode=b};Xinha.prototype.setFullHTML=function(c){var a=RegExp.multiline;RegExp.multiline=true;if(c.match(Xinha.RE_doctype)){this.setDoctype(RegExp.$1)}RegExp.multiline=a;if(0){if(c.match(Xinha.RE_head)){this._doc.getElementsByTagName("head")[0].innerHTML=RegExp.$1}if(c.match(Xinha.RE_body)){this._doc.getElementsByTagName("body")[0].innerHTML=RegExp.$1}}else{var d=this.editorIsActivated();if(d){this.deactivateEditor()}var b=/((.|\n)*?)<\/html>/i;c=c.replace(b,"$1");this._doc.open("text/html","replace");this._doc.write(c);this._doc.close();if(d){this.activateEditor()}this.setEditorEvents();return true}};Xinha.prototype.setEditorEvents=function(c){var a=this;var b=this._doc;a.whenDocReady(function(){if(!c){Xinha._addEvents(b,["mousedown"],function(){a.activateEditor();return true});if(Xinha.is_ie){Xinha._addEvent(a._doc.getElementsByTagName("html")[0],"click",function(){if(a._iframe.contentWindow.event.srcElement.tagName.toLowerCase()=="html"){var f=a._doc.body.createTextRange();f.collapse();f.select()}return true})}}Xinha._addEvents(b,["keydown","keypress","mousedown","mouseup","drag"],function(f){return a._editorEvent(Xinha.is_ie?a._iframe.contentWindow.event:f)});Xinha._addEvents(b,["dblclick"],function(f){return a._onDoubleClick(Xinha.is_ie?a._iframe.contentWindow.event:f)});if(c){return}for(var e in a.plugins){var d=a.plugins[e].instance;Xinha.refreshPlugin(d)}if(typeof a._onGenerate=="function"){a._onGenerate()}Xinha.addDom0Event(window,"resize",function(f){if(Xinha.ie_version>7&&!window.parent){if(a.execResize){a.sizeEditor();a.execResize=false}else{a.execResize=true}}else{a.sizeEditor()}});a.removeLoadingMessage()})};Xinha.getPluginConstructor=function(a){return Xinha.plugins[a]||window[a]};Xinha.prototype.registerPlugin=function(){if(!Xinha.isSupportedBrowser){return}var a=arguments[0];if(a===null||typeof a=="undefined"||(typeof a=="string"&&Xinha.getPluginConstructor(a)=="undefined")){return false}var b=[];for(var c=1;c=1){if(arguments[a][0].match(/\.css$/i)){b.loadStyle(arguments[a][0],arguments[a][1])}else{b.loadScript(arguments[a][0],arguments[a][1])}}}}}return b};Xinha.prototype.debugTree=function(){var c=document.createElement("textarea");c.style.width="100%";c.style.height="20em";c.value="";function b(d,e){for(;--d>=0;){c.value+=" "}c.value+=e+"\n"}function a(e,h){var d=e.tagName.toLowerCase(),f;var g=Xinha.is_ie?e.scopeName:e.prefix;b(h,"- "+d+" ["+g+"]");for(f=e.firstChild;f;f=f.nextSibling){if(f.nodeType==1){a(f,h+2)}}}a(this._doc.body,0);document.body.appendChild(c)};Xinha.getInnerText=function(c){var a="",b;for(b=c.firstChild;b;b=b.nextSibling){if(b.nodeType==3){a+=b.data}else{if(b.nodeType==1){a+=Xinha.getInnerText(b)}}}return a};Xinha.prototype._wordClean=function(){var b=this;var e={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 g={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 f(){var j="Xinha word cleaner stats: \n\n";for(var k in e){if(g[k]){j+=g[k]+e[k]+"\n"}}j+="\nInitial document length: "+e.orig_len+"\n";j+="Final document length: "+b._doc.body.innerHTML.length+"\n";j+="Clean-up took "+((new Date().getTime()-e.T)/1000)+" seconds";alert(j)}function h(j){var k=j.className.replace(/(^|\s)mso.*?(\s|$)/ig," ");if(k!=j.className){j.className=k;if(!/\S/.test(j.className)){j.removeAttribute("className");++e.mso_class}}}function a(k){var l=k.style.cssText.split(/\s*;\s*/);for(var j=l.length;--j>=0;){if(/^mso|^tab-stops/i.test(l[j])||/^margin\s*:\s*0..\s+0..\s+0../i.test(l[j])){++e.mso_style;l.splice(j,1)}}k.style.cssText=l.join("; ")}function c(j){if(("link"==j.tagName.toLowerCase()&&(j.attributes&&/File-List|Edit-Time-Data|themeData|colorSchemeMapping/.test(j.attributes.rel.nodeValue)))||/^(style|meta)$/i.test(j.tagName)){Xinha.removeFromParent(j);++e.mso_elmts;return true}return false}function d(j){if(/^(a|span|b|strong|i|em|font|div|p)$/i.test(j.tagName)&&!j.firstChild){Xinha.removeFromParent(j);++e.empty_tags;return true}return false}function i(j){h(j);a(j);var m;for(var l=j.firstChild;l;l=m){m=l.nextSibling;if(l.nodeType==1&&i(l)){if((Xinha.is_ie&&j.scopeName!="HTML")||(!Xinha.is_ie&&/:/.test(l.tagName))){for(var k=l.childNodes&&l.childNodes.length-1;l.childNodes&&l.childNodes.length&&l.childNodes[k];--k){if(l.nextSibling){l.parentNode.insertBefore(l.childNodes[k],l.nextSibling)}else{l.parentNode.appendChild(l.childNodes[k])}}Xinha.removeFromParent(l);continue}if(d(l)){continue}if(c(l)){continue}}else{if(l.nodeType==8){if(/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(l.nodeValue)){Xinha.removeFromParent(l);++e.cond_comm}}}}return true}i(this._doc.body);this.updateToolbar()};Xinha.prototype._clearFonts=function(){var a=this.getInnerHTML();if(confirm(Xinha._lc("Would you like to clear font typefaces?"))){a=a.replace(/face="[^"]*"/gi,"");a=a.replace(/font-family:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font sizes?"))){a=a.replace(/size="[^"]*"/gi,"");a=a.replace(/font-size:[^;}"']+;?/gi,"")}if(confirm(Xinha._lc("Would you like to clear font colours?"))){a=a.replace(/color="[^"]*"/gi,"");a=a.replace(/([^\-])color:[^;}"']+;?/gi,"$1")}a=a.replace(/(style|class)="\s*"/gi,"");a=a.replace(/<(font|span)\s*>/gi,"");this.setHTML(a);this.updateToolbar()};Xinha.prototype._splitBlock=function(){this._doc.execCommand("formatblock",false,"div")};Xinha.prototype.forceRedraw=function(){this._doc.body.style.visibility="hidden";this._doc.body.style.visibility=""};Xinha.prototype.focusEditor=function(){switch(this._editMode){case"wysiwyg":try{if(Xinha._someEditorHasBeenActivated){this.activateEditor();this._iframe.contentWindow.focus()}}catch(a){}break;case"textmode":try{this._textArea.focus()}catch(b){}break;default:alert("ERROR: mode "+this._editMode+" is not defined")}return this._doc};Xinha.prototype._undoTakeSnapshot=function(){++this._undoPos;if(this._undoPos>=this.config.undoSteps){this._undoQueue.shift();--this._undoPos}var b=true;var a=this.getInnerHTML();if(this._undoPos>0){b=(this._undoQueue[this._undoPos-1]!=a)}if(b){this._undoQueue[this._undoPos]=a}else{this._undoPos--}};Xinha.prototype.undo=function(){if(this._undoPos>0){var a=this._undoQueue[--this._undoPos];if(a){this.setHTML(a)}else{++this._undoPos}}};Xinha.prototype.redo=function(){if(this._undoPos=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|>=|<|<=)(.*)/);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"}this.execCommand(a,false,c);break;default:var d=this.config.customSelects[a];if(typeof d!="undefined"){d.action(this,c,b,a)}else{alert("FIXME: combo box "+a+" not implemented")}break}};Xinha.prototype._colorSelector=function(h){var d=this;if(Xinha.is_gecko){try{d._doc.execCommand("useCSS",false,false);d._doc.execCommand("styleWithCSS",false,true)}catch(g){}}var f=d._toolbarObjects[h].element;var c;if(h=="hilitecolor"){if(Xinha.is_ie){h="backcolor";c=Xinha._colorToRgb(d._doc.queryCommandValue("backcolor"))}else{c=Xinha._colorToRgb(d._doc.queryCommandValue("hilitecolor"))}}else{c=Xinha._colorToRgb(d._doc.queryCommandValue("forecolor"))}var b=function(i){d._doc.execCommand(h,false,i)};if(Xinha.is_ie){var a=d.createRange(d.getSelection());b=function(i){a.select();d._doc.execCommand(h,false,i)}}var e=new Xinha.colorPicker({cellsize:d.config.colorPickerCellSize,callback:b,granularity:d.config.colorPickerGranularity,websafe:d.config.colorPickerWebSafe,savecolors:d.config.colorPickerSaveColors});e.open(d.config.colorPickerPosition,f,c)};Xinha.prototype.execCommand=function(h,f,g){var a=this;this.focusEditor();h=h.toLowerCase();if(this.firePluginEvent("onExecCommand",h,f,g)){this.updateToolbar();return false}switch(h){case"htmlmode":this.setMode();break;case"hilitecolor":case"forecolor":this._colorSelector(h);break;case"createlink":this._createLink();break;case"undo":case"redo":if(this._customUndo){this[h]()}else{this._doc.execCommand(h,f,g)}break;case"inserttable":this._insertTable();break;case"insertimage":this._insertImage();break;case"showhelp":this._popupDialog(a.config.URIs.help,null,this);break;case"killword":this._wordClean();break;case"cut":case"copy":case"paste":this._doc.execCommand(h,f,g);if(this.config.killWordOnPaste){this._wordClean()}break;case"lefttoright":case"righttoleft":if(this.config.changeJustifyWithDirection){this._doc.execCommand((h=="righttoleft")?"justifyright":"justifyleft",f,g)}var b=(h=="righttoleft")?"rtl":"ltr";var e=this.getParentElement();while(e&&!Xinha.isBlockElement(e)){e=e.parentNode}if(e){if(e.style.direction==b){e.style.direction=""}else{e.style.direction=b}}break;case"justifyleft":case"justifyright":h.match(/^justify(.*)$/);var d=this.activeElement(this.getSelection());if(d&&d.tagName.toLowerCase()=="img"){d.align=d.align==RegExp.$1?"":RegExp.$1}else{this._doc.execCommand(h,f,g)}break;default:try{this._doc.execCommand(h,f,g)}catch(c){if(this.config.debug){alert(c+"\n\nby execCommand("+h+");")}}break}this.updateToolbar();return false};Xinha.prototype._editorEvent=function(b){var a=this;if(typeof a._textArea["on"+b.type]=="function"){a._textArea["on"+b.type](b)}if(this.isKeyEvent(b)){if(a.firePluginEvent("onKeyPress",b)){return false}if(this.isShortCut(b)){this._shortCuts(b)}}if(b.type=="mousedown"){if(a.firePluginEvent("onMouseDown",b)){return false}}if(a._timerToolbar){clearTimeout(a._timerToolbar)}if(!this.suspendUpdateToolbar){a._timerToolbar=setTimeout(function(){a.updateToolbar();a._timerToolbar=null},250)}};Xinha.prototype._onDoubleClick=function(d){var c=this;var e=Xinha.is_ie?d.srcElement:d.target;var a=e.tagName;var b=e.className;if(a){a=a.toLowerCase();if(b&&(this.config.dblclickList[a+"."+b]!=undefined)){this.config.dblclickList[a+"."+b][0](c,e)}else{if(this.config.dblclickList[a]!=undefined){this.config.dblclickList[a][0](c,e)}}}};Xinha.prototype._shortCuts=function(b){var a=this.getKey(b).toLowerCase();var d=null;var c=null;switch(a){case"b":d="bold";break;case"i":d="italic";break;case"u":d="underline";break;case"s":d="strikethrough";break;case"l":d="justifyleft";break;case"e":d="justifycenter";break;case"r":d="justifyright";break;case"j":d="justifyfull";break;case"z":d="undo";break;case"y":d="redo";break;case"v":d="paste";break;case"n":d="formatblock";c="p";break;case"0":d="killword";break;case"1":case"2":case"3":case"4":case"5":case"6":d="formatblock";c="h"+a;break}if(d){this.execCommand(d,false,c);Xinha._stopEvent(b)}};Xinha.prototype.convertNode=function(a,c){var b=this._doc.createElement(c);while(a.firstChild){b.appendChild(a.firstChild)}return b};Xinha.prototype.scrollToElement=function(b){if(!b){b=this.getParentElement();if(!b){return}}var a=Xinha.getElementTopLeft(b);this._iframe.contentWindow.scrollTo(a.left,a.top)};Xinha.prototype.getEditorContent=function(){return this.outwardHtml(this.getHTML())};Xinha.prototype.setEditorContent=function(a){this.setHTML(this.inwardHtml(a))};Xinha.updateTextareas=function(){var b;for(var a=0;a<__xinhas.length;a++){b=__xinhas[a];b._textArea.value=b.getEditorContent()}};Xinha.prototype.getHTML=function(){var a="";switch(this._editMode){case"wysiwyg":if(!this.config.fullPage){a=Xinha.getHTML(this._doc.body,false,this).trim()}else{a=this.doctype+"\n"+Xinha.getHTML(this._doc.documentElement,true,this)}break;case"textmode":a=this._textArea.value;break;default:alert("Mode <"+this._editMode+"> not defined!");return false}return a};Xinha.prototype.outwardHtml=function(d){for(var c in this.plugins){var a=this.plugins[c].instance;if(a&&typeof a.outwardHtml=="function"){d=a.outwardHtml(d)}}d=d.replace(/<(\/?)b(\s|>|\/)/ig,"<$1strong$2");d=d.replace(/<(\/?)i(\s|>|\/)/ig,"<$1em$2");d=d.replace(/<(\/?)strike(\s|>|\/)/ig,"<$1del$2");d=d.replace(/(<[^>]*on(click|mouse(over|out|up|down))=['"])if\(window\.parent && window\.parent\.Xinha\)\{return false\}/gi,"$1");var b=location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/";d=d.replace(/https?:\/\/null\//g,b);d=d.replace(/((href|src|background)=[\'\"])\/+/ig,"$1"+b);d=this.outwardSpecialReplacements(d);d=this.fixRelativeLinks(d);if(this.config.sevenBitClean){d=d.replace(/[^ -~\r\n\t]/g,function(e){return(e!=Xinha.cc)?"&#"+e.charCodeAt(0)+";":e})}d=d.replace(/(]*((type=[\"\']text\/)|(language=[\"\'])))(freezescript)/gi,"$1javascript");if(this.config.fullPage){d=Xinha.stripCoreCSS(d)}if(typeof this.config.outwardHtml=="function"){d=this.config.outwardHtml(d)}return d};Xinha.prototype.inwardHtml=function(c){for(var b in this.plugins){var a=this.plugins[b].instance;if(a&&typeof a.inwardHtml=="function"){c=a.inwardHtml(c)}}c=c.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");c=c.replace(/(<[^>]*on(click|mouse(over|out|up|down))=["'])/gi,"$1if(window.parent && window.parent.Xinha){return false}");c=this.inwardSpecialReplacements(c);c=c.replace(/(]*((type=[\"\']text\/)|(language=[\"\'])))(javascript)/gi,"$1freezescript");var d=new RegExp("((href|src|background)=['\"])/+","gi");c=c.replace(d,"$1"+location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/");c=this.fixRelativeLinks(c);if(this.config.fullPage){c=Xinha.addCoreCSS(c)}if(typeof this.config.inwardHtml=="function"){c=this.config.inwardHtml(c)}return c};Xinha.prototype.outwardSpecialReplacements=function(b){for(var a in this.config.specialReplacements){var e=this.config.specialReplacements[a];var d=a;if(typeof e.replace!="function"||typeof d.replace!="function"){continue}var c=new RegExp(Xinha.escapeStringForRegExp(e),"g");b=b.replace(c,d.replace(/\$/g,"$$$$"))}return b};Xinha.prototype.inwardSpecialReplacements=function(b){for(var a in this.config.specialReplacements){var e=a;var d=this.config.specialReplacements[a];if(typeof e.replace!="function"||typeof d.replace!="function"){continue}var c=new RegExp(Xinha.escapeStringForRegExp(e),"g");b=b.replace(c,d.replace(/\$/g,"$$$$"))}return b};Xinha.prototype.fixRelativeLinks=function(f){if(typeof this.config.expandRelativeUrl!="undefined"&&this.config.expandRelativeUrl){if(f==null){return""}var c=f.match(/(src|href)="([^"]*)"/gi);var j=document.location.href;if(c){var d,l,k,m,h;for(var e=0;e not defined!");return false}return a};Xinha.prototype.setHTML=function(a){if(!this.config.fullPage){this._doc.body.innerHTML=a}else{this.setFullHTML(a)}this._textArea.value=a};Xinha.prototype.setDoctype=function(a){this.doctype=a};Xinha._object=null;Array.prototype.isArray=true;RegExp.prototype.isRegExp=true;Xinha.cloneObject=function(obj){if(!obj){return null}var 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(a,c){function b(){}b.prototype=c.prototype;a.prototype=new b();a.prototype.constructor=a;a.parentConstructor=c;a.superClass=c.prototype};Xinha.flushEvents=function(){var a=0;var c=Xinha._eventFlushers.pop();while(c){try{if(c.length==3){Xinha._removeEvent(c[0],c[1],c[2]);a++}else{if(c.length==2){c[0]["on"+c[1]]=null;c[0]._xinha_dom0Events[c[1]]=null;a++}}}catch(b){}c=Xinha._eventFlushers.pop()}};Xinha._eventFlushers=[];if(document.addEventListener){Xinha._addEvent=function(b,a,c){b.addEventListener(a,c,false);Xinha._eventFlushers.push([b,a,c])};Xinha._removeEvent=function(b,a,c){b.removeEventListener(a,c,false)};Xinha._stopEvent=function(a){a.preventDefault();a.stopPropagation()}}else{if(document.attachEvent){Xinha._addEvent=function(b,a,c){b.attachEvent("on"+a,c);Xinha._eventFlushers.push([b,a,c])};Xinha._removeEvent=function(b,a,c){b.detachEvent("on"+a,c)};Xinha._stopEvent=function(b){try{b.cancelBubble=true;b.returnValue=false}catch(a){}}}else{Xinha._addEvent=function(b,a,c){alert("_addEvent is not supported")};Xinha._removeEvent=function(b,a,c){alert("_removeEvent is not supported")};Xinha._stopEvent=function(a){alert("_stopEvent is not supported")}}}Xinha._addEvents=function(c,a,d){for(var b=a.length;--b>=0;){Xinha._addEvent(c,a[b],d)}};Xinha._removeEvents=function(c,a,d){for(var b=a.length;--b>=0;){Xinha._removeEvent(c,a[b],d)}};Xinha.addOnloadHandler=function(b,a){a=a?a:window;var c=function(){if(arguments.callee.done){return}arguments.callee.done=true;if(Xinha.onloadTimer){clearInterval(Xinha.onloadTimer)}b()};if(Xinha.is_ie){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);c()}});if(document.documentElement.doScroll&&typeof window.frameElement==="undefined"){(function(){if(arguments.callee.done){return}try{document.documentElement.doScroll("left")}catch(d){setTimeout(arguments.callee,0);return}c()})()}}else{if(/applewebkit|KHTML/i.test(navigator.userAgent)){Xinha.onloadTimer=a.setInterval(function(){if(/loaded|complete/.test(a.document.readyState)){c()}},10)}else{a.document.addEventListener("DOMContentLoaded",c,false)}}Xinha._addEvent(a,"load",c)};Xinha.addDom0Event=function(b,c,a){Xinha._prepareForDom0Events(b,c);b._xinha_dom0Events[c].unshift(a)};Xinha.prependDom0Event=function(b,c,a){Xinha._prepareForDom0Events(b,c);b._xinha_dom0Events[c].push(a)};Xinha.getEvent=function(a){return a||window.event};Xinha._prepareForDom0Events=function(a,b){if(typeof a._xinha_dom0Events=="undefined"){a._xinha_dom0Events={};Xinha.freeLater(a,"_xinha_dom0Events")}if(typeof a._xinha_dom0Events[b]=="undefined"){a._xinha_dom0Events[b]=[];if(typeof a["on"+b]=="function"){a._xinha_dom0Events[b].push(a["on"+b])}a["on"+b]=function(e){var c=a._xinha_dom0Events[b];var f=true;for(var d=c.length;--d>=0;){a._xinha_tempEventHandler=c[d];if(a._xinha_tempEventHandler(e)===false){a._xinha_tempEventHandler=null;f=false;break}a._xinha_tempEventHandler=null}return f};Xinha._eventFlushers.push([a,b])}};Xinha.prototype.notifyOn=function(b,a){if(typeof this._notifyListeners[b]=="undefined"){this._notifyListeners[b]=[];Xinha.freeLater(this,"_notifyListeners")}this._notifyListeners[b].push(a)};Xinha.prototype.notifyOf=function(c,a){if(this._notifyListeners[c]){for(var b=0;b/ig,">");a=a.replace(/\xA0/g," ");a=a.replace(/\x22/g,""");return a};Xinha.prototype.stripBaseURL=function(b){if(this.config.baseHref===null||!this.config.stripBaseHref){return b}var c=this.config.baseHref.replace(/^(https?:\/\/[^\/]+)(.*)$/,"$1");var a=new RegExp(c);return b.replace(a,"")};if(typeof String.prototype.trim!="function"){String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}}Xinha._makeColor=function(c){if(typeof c!="number"){return c}var e=c&255;var d=(c>>8)&255;var a=(c>>16)&255;return"rgb("+e+","+d+","+a+")"};Xinha._colorToRgb=function(c){if(!c){return""}var h,f,a;function e(b){return(b<16)?("0"+b.toString(16)):b.toString(16)}if(typeof c=="number"){h=c&255;f=(c>>8)&255;a=(c>>16)&255;return"#"+e(h)+e(f)+e(a)}if(c.substr(0,3)=="rgb"){var d=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;if(c.match(d)){h=parseInt(RegExp.$1,10);f=parseInt(RegExp.$2,10);a=parseInt(RegExp.$3,10);return"#"+e(h)+e(f)+e(a)}return null}if(c.substr(0,1)=="#"){return c}return null};Xinha.prototype._popupDialog=function(b,a,c){Dialog(this.popupURL(b),a,c)};Xinha.prototype.imgURL=function(b,a){if(typeof a=="undefined"){return _editor_url+b}else{return Xinha.getPluginDir(a)+"/img/"+b}};Xinha.prototype.popupURL=function(d){var c="";if(d.match(/^plugin:\/\/(.*?)\/(.*)/)){var b=RegExp.$1;var a=RegExp.$2;if(!/\.(html?|php)$/.test(a)){a+=".html"}c=Xinha.getPluginDir(b)+"/popups/"+a}else{if(d.match(/^\/.*?/)||d.match(/^https?:\/\//)){c=d}else{c=_editor_url+this.config.popupURL+d}}return c};Xinha.getElementById=function(a,e){var c,b,d=document.getElementsByTagName(a);for(b=d.length;--b>=0&&(c=d[b]);){if(c.id==e){return c}}return null};Xinha.prototype._toggleBorders=function(){var a=this._doc.getElementsByTagName("TABLE");if(a.length!==0){if(!this.borders){this.borders=true}else{this.borders=false}for(var b=0;b/i.test(b)){return b.replace(//i,""+a)}else{if(b){return a+b}else{return a}}};Xinha.prototype.addEditorStylesheet=function(a){var b=this._doc.createElement("link");b.rel="stylesheet";b.type="text/css";b.title="XinhaInternalCSS";b.href=a;this._doc.getElementsByTagName("HEAD")[0].appendChild(b)};Xinha.stripCoreCSS=function(a){return a.replace(/]+title="XinhaInternalCSS"(.|\n)*?<\/style>/ig,"").replace(/]+title="XinhaInternalCSS"(.|\n)*?>/ig,"")};Xinha._removeClass=function(e,c){if(!(e&&e.className)){return}var a=e.className.split(" ");var b=[];for(var d=a.length;d>0;){if(a[--d]!=c){b[b.length]=a[d]}}e.className=b.join(" ")};Xinha._addClass=function(b,a){Xinha._removeClass(b,a);b.className+=" "+a};Xinha.addClasses=function(g,e){if(g!==null){var f=g.className.trim().split(" ");var d=e.split(" ");for(var a=0;a0;){if(a[--c]==b){return true}}return false};Xinha._postback_send_charset=true;Xinha._postback=function(b,g,h,d){var f=null;f=Xinha.getXMLHTTPRequestObject();var e="";if(typeof g=="string"){e=g}else{if(typeof g=="object"){for(var c in g){e+=(e.length?"&":"")+c+"="+encodeURIComponent(g[c])}}}function a(){if(f.readyState==4){if(((f.status/100)==2)||Xinha.isRunLocally&&f.status===0){if(typeof h=="function"){h(f.responseText,f)}}else{if(Xinha._postback_send_charset){Xinha._postback_send_charset=false;Xinha._postback(b,g,h,d)}else{if(typeof d=="function"){d(f)}else{alert("An error has occurred: "+f.statusText+"\nURL: "+b)}}}}}f.onreadystatechange=a;f.open("POST",b,true);f.setRequestHeader("Content-Type","application/x-www-form-urlencoded"+(Xinha._postback_send_charset?"; charset=UTF-8":""));f.send(e)};Xinha._getback=function(b,e,c){var d=null;d=Xinha.getXMLHTTPRequestObject();function a(){if(d.readyState==4){if(((d.status/100)==2)||Xinha.isRunLocally&&d.status===0){e(d.responseText,d)}else{if(typeof c=="function"){c(d)}else{alert("An error has occurred: "+d.statusText+"\nURL: "+b)}}}}d.onreadystatechange=a;d.open("GET",b,true);d.send(null)};Xinha.ping=function(d,c,b){var e=null;e=Xinha.getXMLHTTPRequestObject();function a(){if(e.readyState==4){if(((e.status/100)==2)||Xinha.isRunLocally&&e.status===0){if(c){c(e)}}else{if(b){b(e)}}}}var f="GET";e.onreadystatechange=a;e.open(f,d,true);e.send(null)};Xinha._geturlcontent=function(a,c){var b=null;b=Xinha.getXMLHTTPRequestObject();b.open("GET",a,false);b.send(null);if(((b.status/100)==2)||Xinha.isRunLocally&&b.status===0){return(c)?b.responseXML:b.responseText}else{return""}};if(typeof dumpValues=="undefined"){dumpValues=function(c){var b="";for(var d in c){if(window.console&&typeof window.console.log=="function"){if(typeof console.firebug!="undefined"){console.log(c)}else{console.log(d+" = "+c[d]+"\n")}}else{b+=d+" = "+c[d]+"\n"}}if(b){if(document.getElementById("errors")){document.getElementById("errors").value+=b}else{var a=window.open("","debugger");a.document.write("
"+b+"
")}}}}if(!Array.prototype.contains){Array.prototype.contains=function(c){var b=this;for(var a=0;a>2;j=((k&3)<<4)|(h>>4);f=((h&15)<<2)|(g>>6);e=g&63;if(isNaN(h)){f=e=64}else{if(isNaN(g)){e=64}}b=b+c.charAt(l)+c.charAt(j)+c.charAt(f)+c.charAt(e)}while(a>4);h=((j&15)<<4)|(f>>2);g=((f&3)<<6)|e;b=b+String.fromCharCode(k);if(f!=64){b=b+String.fromCharCode(h)}if(e!=64){b=b+String.fromCharCode(g)}}while(ab){a=d.document.body.scrollWidth;e=d.document.body.scrollHeight}else{a=d.document.documentElement.scrollWidth;e=d.document.documentElement.scrollHeight}return{x:a,y:e}};Xinha.prototype.scrollPos=function(b){b=(b)?b:window;var a,c;if(typeof b.pageYOffset!="undefined"){a=b.pageXOffset;c=b.pageYOffset}else{if(b.document.documentElement&&typeof document.documentElement.scrollTop!="undefined"){a=b.document.documentElement.scrollLeft;c=b.document.documentElement.scrollTop}else{if(b.document.body){a=b.document.body.scrollLeft;c=b.document.body.scrollTop}}}return{x:a,y:c}};Xinha.getElementTopLeft=function(b){var c=0;var a=0;if(b.offsetParent){c=b.offsetLeft;a=b.offsetTop;while(b=b.offsetParent){c+=b.offsetLeft;a+=b.offsetTop}}return{top:a,left:c}};Xinha.findPosX=function(a){var b=0;if(a.offsetParent){return Xinha.getElementTopLeft(a).left}else{if(a.x){b+=a.x}}return b};Xinha.findPosY=function(b){var a=0;if(b.offsetParent){return Xinha.getElementTopLeft(b).top}else{if(b.y){a+=b.y}}return a};Xinha.createLoadingMessages=function(b){if(Xinha.loadingMessages||!Xinha.isSupportedBrowser){return}Xinha.loadingMessages=[];for(var a=0;a