// MyST Blogsite compressed Xinha script; for uncompressed sources, forum, and bug reports, go to xinha.org.
Xinha.version={"Release":"Trunk","Head":"$HeadURL: http://svn.xinha.webfactional.com/trunk/XinhaCore.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),"Date":"$LastChangedDate: 2009-03-19 17:40:09 -0400 (Thu, 19 Mar 2009) $".replace(/^[^:]*:\s*([0-9\-]*) ([0-9:]*) ([+0-9]*) \((.*)\)\s*\$/,"$4 $2 $3"),"Revision":"$LastChangedRevision: 1170 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),"RevisionBy":"$LastChangedBy: ray $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1")};
Xinha._resolveRelativeUrl=function(_1,_2){
if(_2.match(/^([^:]+\:)?\/\//)){
return _2;
}else{
var b=_1.split("/");
if(b[b.length-1]===""){
b.pop();
}
var p=_2.split("/");
if(p[0]=="."){
p.shift();
}
while(p[0]==".."){
b.pop();
p.shift();
}
return b.join("/")+"/"+p.join("/");
}
};
if(typeof _editor_url=="string"){
_editor_url=_editor_url.replace(/\x2f*$/,"/");
if(!_editor_url.match(/^([^:]+\:)?\//)){
(function(){
var _5=window.location.toString().replace(/\?.*$/,"").split("/");
_5.pop();
_editor_url=Xinha._resolveRelativeUrl(_5.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_ff3=Xinha.is_real_gecko&&parseInt(navigator.productSub,10)>=2007121016;
Xinha.is_ff2=Xinha.is_real_gecko&&parseInt(navigator.productSub,10)<2007121016;
Xinha.isRunLocally=document.URL.toLowerCase().search(/^file:/)!=-1;
Xinha.is_designMode=(typeof document.designMode!="undefined"&&!Xinha.is_ie);
Xinha.checkSupportedBrowser=function(){
return Xinha.is_real_gecko||(Xinha.is_opera&&Xinha.opera_version>=9.2)||Xinha.ie_version>=5.5||Xinha.webkit_version>=522;
};
Xinha.isSupportedBrowser=Xinha.checkSupportedBrowser();
if(Xinha.isRunLocally&&Xinha.isSupportedBrowser){
alert("Xinha *must* be installed on a web server. Locally opened files (those that use the \"file://\" protocol) cannot properly function. Xinha will try to initialize but may not be correctly loaded.");
}
function Xinha(_6,_7){
if(!Xinha.isSupportedBrowser){
return;
}
if(!_6){
throw new Error("Tried to create Xinha without textarea specified.");
}
if(typeof _7=="undefined"){
this.config=new Xinha.Config();
}else{
this.config=_7;
}
if(typeof _6!="object"){
_6=Xinha.getElementById("textarea",_6);
}
this._textArea=_6;
this._textArea.spellcheck=false;
Xinha.freeLater(this,"_textArea");
this._initial_ta_size={w:_6.style.width?_6.style.width:(_6.offsetWidth?(_6.offsetWidth+"px"):(_6.cols+"em")),h:_6.style.height?_6.style.height:(_6.offsetHeight?(_6.offsetHeight+"px"):(_6.rows+"em"))};
if(document.getElementById("loading_"+_6.id)||this.config.showLoading){
if(!document.getElementById("loading_"+_6.id)){
Xinha.createLoadingMessage(_6);
}
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 _8={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 i in _8){
if(!_8[i].container){
continue;
}
_8[i].div=_8[i].container;
_8[i].container.className="panels panels_"+i;
Xinha.freeLater(_8[i],"container");
Xinha.freeLater(_8[i],"div");
}
this._panels=_8;
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:_7.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(_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(_b){
return _b;
};
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.showLoading=false;
this.stripScripts=true;
this.convertUrlsToLinks=true;
this.colorPickerCellSize="6px";
this.colorPickerGranularity=18;
this.colorPickerPosition="bottom,right";
this.colorPickerWebSafe=false;
this.colorPickerSaveColors=20;
this.fullScreen=false;
this.fullScreenMargins=[0,0,0,0];
this.toolbar=[["popupeditor"],["separator","formatblock","fontname","fontsize","bold","italic","underline","strikethrough"],["separator","forecolor","hilitecolor","textindicator"],["separator","subscript","superscript"],["linebreak","separator","justifyleft","justifycenter","justifyright","justifyfull"],["separator","insertorderedlist","insertunorderedlist","outdent","indent"],["separator","inserthorizontalrule","createlink","insertimage","inserttable"],["linebreak","separator","undo","redo","selectall","print"],(Xinha.is_gecko?[]:["cut","copy","paste","overwrite","saveas"]),["separator","killword","clearfonts","removeformat","toggleborders","splitblock","lefttoright","righttoleft"],["separator","htmlmode","showhelp","about"]];
this.fontname={"&mdash; font &mdash;":"","Arial":"arial,helvetica,sans-serif","Courier New":"courier new,courier,monospace","Georgia":"georgia,times new roman,times,serif","Tahoma":"tahoma,arial,helvetica,sans-serif","Times New Roman":"times new roman,times,serif","Verdana":"verdana,arial,helvetica,sans-serif","impact":"impact","WingDings":"wingdings"};
this.fontsize={"&mdash; size &mdash;":"","1 (8 pt)":"1","2 (10 pt)":"2","3 (12 pt)":"3","4 (14 pt)":"4","5 (18 pt)":"5","6 (24 pt)":"6","7 (36 pt)":"7"};
this.formatblock={"&mdash; format &mdash;":"","Heading 1":"h1","Heading 2":"h2","Heading 3":"h3","Heading 4":"h4","Heading 5":"h5","Heading 6":"h6","Normal":"p","Address":"address","Formatted":"pre"};
this.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(e){
e.execCommand("bold");
}],italic:["Italic",Xinha._lc({key:"button_italic",string:["ed_buttons_main.png",2,2]},"Xinha"),false,function(e){
e.execCommand("italic");
}],underline:["Underline",Xinha._lc({key:"button_underline",string:["ed_buttons_main.png",2,0]},"Xinha"),false,function(e){
e.execCommand("underline");
}],strikethrough:["Strikethrough",Xinha._lc({key:"button_strikethrough",string:["ed_buttons_main.png",3,0]},"Xinha"),false,function(e){
e.execCommand("strikethrough");
}],subscript:["Subscript",Xinha._lc({key:"button_subscript",string:["ed_buttons_main.png",3,1]},"Xinha"),false,function(e){
e.execCommand("subscript");
}],superscript:["Superscript",Xinha._lc({key:"button_superscript",string:["ed_buttons_main.png",2,1]},"Xinha"),false,function(e){
e.execCommand("superscript");
}],justifyleft:["Justify Left",["ed_buttons_main.png",0,0],false,function(e){
e.execCommand("justifyleft");
}],justifycenter:["Justify Center",["ed_buttons_main.png",1,1],false,function(e){
e.execCommand("justifycenter");
}],justifyright:["Justify Right",["ed_buttons_main.png",1,0],false,function(e){
e.execCommand("justifyright");
}],justifyfull:["Justify Full",["ed_buttons_main.png",0,1],false,function(e){
e.execCommand("justifyfull");
}],orderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(e){
e.execCommand("insertorderedlist");
}],unorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(e){
e.execCommand("insertunorderedlist");
}],insertorderedlist:["Ordered List",["ed_buttons_main.png",0,3],false,function(e){
e.execCommand("insertorderedlist");
}],insertunorderedlist:["Bulleted List",["ed_buttons_main.png",1,3],false,function(e){
e.execCommand("insertunorderedlist");
}],outdent:["Decrease Indent",["ed_buttons_main.png",1,2],false,function(e){
e.execCommand("outdent");
}],indent:["Increase Indent",["ed_buttons_main.png",0,2],false,function(e){
e.execCommand("indent");
}],forecolor:["Font Color",["ed_buttons_main.png",3,3],false,function(e){
e.execCommand("forecolor");
}],hilitecolor:["Background Color",["ed_buttons_main.png",2,3],false,function(e){
e.execCommand("hilitecolor");
}],undo:["Undoes your last action",["ed_buttons_main.png",4,2],false,function(e){
e.execCommand("undo");
}],redo:["Redoes your last action",["ed_buttons_main.png",5,2],false,function(e){
e.execCommand("redo");
}],cut:["Cut selection",["ed_buttons_main.png",5,0],false,function(e,cmd){
e.execCommand(cmd);
}],copy:["Copy selection",["ed_buttons_main.png",4,0],false,function(e,cmd){
e.execCommand(cmd);
}],paste:["Paste from clipboard",["ed_buttons_main.png",4,1],false,function(e,cmd){
e.execCommand(cmd);
}],selectall:["Select all",["ed_buttons_main.png",3,5],false,function(e){
e.execCommand("selectall");
}],inserthorizontalrule:["Horizontal Rule",["ed_buttons_main.png",6,0],false,function(e){
e.execCommand("inserthorizontalrule");
}],createlink:["Insert Web Link",["ed_buttons_main.png",6,1],false,function(e){
e._createLink();
}],insertimage:["Insert/Modify Image",["ed_buttons_main.png",6,3],false,function(e){
e.execCommand("insertimage");
}],inserttable:["Insert Table",["ed_buttons_main.png",6,2],false,function(e){
e.execCommand("inserttable");
}],htmlmode:["Toggle HTML Source",["ed_buttons_main.png",7,0],true,function(e){
e.execCommand("htmlmode");
}],toggleborders:["Toggle Borders",["ed_buttons_main.png",7,2],false,function(e){
e._toggleBorders();
}],print:["Print document",["ed_buttons_main.png",8,1],false,function(e){
if(Xinha.is_gecko){
e._iframe.contentWindow.print();
}else{
e.focusEditor();
print();
}
}],saveas:["Save as",["ed_buttons_main.png",9,1],false,function(e){
e.execCommand("saveas",false,"noname.htm");
}],about:["About this editor",["ed_buttons_main.png",8,2],true,function(e){
e.getPluginInstance("AboutBox").show();
}],showhelp:["Help using editor",["ed_buttons_main.png",9,2],true,function(e){
e.execCommand("showhelp");
}],splitblock:["Split Block","ed_splitblock.gif",false,function(e){
e._splitBlock();
}],lefttoright:["Direction left to right",["ed_buttons_main.png",0,2],false,function(e){
e.execCommand("lefttoright");
}],righttoleft:["Direction right to left",["ed_buttons_main.png",1,2],false,function(e){
e.execCommand("righttoleft");
}],overwrite:["Insert/Overwrite","ed_overwrite.gif",false,function(e){
e.execCommand("overwrite");
}],wordclean:["MS Word Cleaner",["ed_buttons_main.png",5,3],false,function(e){
e._wordClean();
}],clearfonts:["Clear Inline Font Specifications",["ed_buttons_main.png",5,4],true,function(e){
e._clearFonts();
}],removeformat:["Remove formatting",["ed_buttons_main.png",4,4],false,function(e){
e.execCommand("removeformat");
}],killword:["Clear MSOffice tags",["ed_buttons_main.png",4,3],false,function(e){
e.execCommand("killword");
}]};
this.iconList={dialogCaption:_editor_url+"images/xinha-small-icon.gif",wysiwygmode:[_editor_url+"images/ed_buttons_main.png",7,1]};
for(var i in this.btnList){
var btn=this.btnList[i];
if(typeof btn!="object"){
continue;
}
if(typeof btn[1]!="string"){
btn[1][0]=_editor_url+this.imgURL+btn[1][0];
}else{
btn[1]=_editor_url+this.imgURL+btn[1];
}
btn[0]=Xinha._lc(btn[0]);
}
};
Xinha.Config.prototype.registerIcon=function(id,_3d){
this.iconList[id]=_3d;
};
Xinha.Config.prototype.registerButton=function(id,_3f,_40,_41,_42,_43){
if(typeof id=="string"){
this.btnList[id]=[_3f,_40,_41,_42,_43];
}else{
if(typeof id=="object"){
this.btnList[id.id]=[id.tooltip,id.image,id.textMode,id.action,id.context];
}else{
alert("ERROR [Xinha.Config::registerButton]:\ninvalid arguments");
return false;
}
}
};
Xinha.prototype.registerPanel=function(_44,_45){
if(!_44){
_44="right";
}
this.setLoadingMessage("Register "+_44+" panel ");
var _46=this.addPanel(_44);
if(_45){
_45.drawPanelIn(_46);
}
};
Xinha.Config.prototype.registerDropdown=function(_47){
this.customSelects[_47.id]=_47;
};
Xinha.Config.prototype.hideSomeButtons=function(_48){
var _49=this.toolbar;
for(var i=_49.length;--i>=0;){
var _4b=_49[i];
for(var j=_4b.length;--j>=0;){
if(_48.indexOf(" "+_4b[j]+" ")>=0){
var len=1;
if(/separator|space/.test(_4b[j+1])){
len=2;
}
_4b.splice(j,len);
}
}
}
};
Xinha.Config.prototype.addToolbarElement=function(id,_4f,_50){
var _51=this.toolbar;
var a,i,j,o,sid;
var _57=false;
var _58=false;
var _59=0;
var _5a=0;
var _5b=0;
var _5c=false;
var _5d=false;
if((id&&typeof id=="object")&&(id.constructor==Array)){
_57=true;
}
if((_4f&&typeof _4f=="object")&&(_4f.constructor==Array)){
_58=true;
_59=_4f.length;
}
if(_57){
for(i=0;i<id.length;++i){
if((id[i]!="separator")&&(id[i].indexOf("T[")!==0)){
sid=id[i];
}
}
}else{
sid=id;
}
for(i=0;i<_51.length;++i){
a=_51[i];
for(j=0;j<a.length;++j){
if(a[j]==sid){
return;
}
}
}
for(i=0;!_5d&&i<_51.length;++i){
a=_51[i];
for(j=0;!_5d&&j<a.length;++j){
if(_58){
for(o=0;o<_59;++o){
if(a[j]==_4f[o]){
if(o===0){
_5d=true;
j--;
break;
}else{
_5b=i;
_5a=j;
_59=o;
}
}
}
}else{
if(a[j]==_4f){
_5d=true;
break;
}
}
}
}
if(!_5d&&_58){
if(_4f.length!=_59){
j=_5a;
a=_51[_5b];
_5d=true;
}
}
if(_5d){
if(_50===0){
if(_57){
a[j]=id[id.length-1];
for(i=id.length-1;--i>=0;){
a.splice(j,0,id[i]);
}
}else{
a[j]=id;
}
}else{
if(_50<0){
j=j+_50+1;
}else{
if(_50>0){
j=j+_50;
}
}
if(_57){
for(i=id.length;--i>=0;){
a.splice(j,0,id[i]);
}
}else{
a.splice(j,0,id);
}
}
}else{
_51[0].splice(0,0,"separator");
if(_57){
for(i=id.length;--i>=0;){
_51[0].splice(0,0,id[i]);
}
}else{
_51[0].splice(0,0,id);
}
}
};
Xinha.Config.prototype.removeToolbarElement=Xinha.Config.prototype.hideSomeButtons;
Xinha.replaceAll=function(_5e){
var tas=document.getElementsByTagName("textarea");
for(var i=tas.length;i>0;new Xinha(tas[--i],_5e).generate()){
}
};
Xinha.replace=function(id,_62){
var ta=Xinha.getElementById("textarea",id);
return ta?new Xinha(ta,_62).generate():null;
};
Xinha.prototype._createToolbar=function(){
this.setLoadingMessage(Xinha._lc("Create Toolbar"));
var _64=this;
var _65=document.createElement("div");
this._toolBar=this._toolbar=_65;
_65.className="toolbar";
_65.unselectable="1";
_65.align=this.config.toolbarAlign;
Xinha.freeLater(this,"_toolBar");
Xinha.freeLater(this,"_toolbar");
var _66=null;
var _67={};
this._toolbarObjects=_67;
this._createToolbar1(_64,_65,_67);
this._htmlArea.appendChild(_65);
return _65;
};
Xinha.prototype._setConfig=function(_68){
this.config=_68;
};
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 brk=document.createElement("div");
brk.style.height="1px";
brk.style.width="1px";
brk.style.lineHeight="1px";
brk.style.fontSize="1px";
brk.style.clear="both";
return brk;
};
Xinha.prototype._createToolbar1=function(_6a,_6b,_6c){
while(_6b.lastChild){
_6b.removeChild(_6b.lastChild);
}
var _6d;
if(_6a.config.flowToolbars){
_6b.appendChild(Xinha._createToolbarBreakingElement());
}
function newLine(){
if(typeof _6d!="undefined"&&_6d.childNodes.length===0){
return;
}
var _6e=document.createElement("table");
_6e.border="0px";
_6e.cellSpacing="0px";
_6e.cellPadding="0px";
if(_6a.config.flowToolbars){
if(Xinha.is_ie){
_6e.style.styleFloat="left";
}else{
_6e.style.cssFloat="left";
}
}
_6b.appendChild(_6e);
var _6f=document.createElement("tbody");
_6e.appendChild(_6f);
_6d=document.createElement("tr");
_6f.appendChild(_6d);
_6e.className="toolbarRow";
};
newLine();
function setButtonStatus(id,_71){
var _72=this[id];
var el=this.element;
if(_72!=_71){
switch(id){
case "enabled":
if(_71){
Xinha._removeClass(el,"buttonDisabled");
el.disabled=false;
}else{
Xinha._addClass(el,"buttonDisabled");
el.disabled=true;
}
break;
case "active":
if(_71){
Xinha._addClass(el,"buttonPressed");
}else{
Xinha._removeClass(el,"buttonPressed");
}
break;
}
this[id]=_71;
}
};
function createSelect(txt){
var _75=null;
var el=null;
var cmd=null;
var _78=_6a.config.customSelects;
var _79=null;
var _7a="";
switch(txt){
case "fontsize":
case "fontname":
case "formatblock":
_75=_6a.config[txt];
cmd=txt;
break;
default:
cmd=txt;
var _7b=_78[cmd];
if(typeof _7b!="undefined"){
_75=_7b.options;
_79=_7b.context;
if(typeof _7b.tooltip!="undefined"){
_7a=_7b.tooltip;
}
}else{
alert("ERROR [createSelect]:\nCan't find the requested dropdown definition");
}
break;
}
if(_75){
el=document.createElement("select");
el.title=_7a;
el.style.width="auto";
el.name=txt;
var obj={name:txt,element:el,enabled:true,text:false,cmd:cmd,state:setButtonStatus,context:_79};
Xinha.freeLater(obj);
_6c[txt]=obj;
for(var i in _75){
if(typeof _75[i]!="string"){
continue;
}
var op=document.createElement("option");
op.innerHTML=Xinha._lc(i);
op.value=_75[i];
el.appendChild(op);
}
Xinha._addEvent(el,"change",function(){
_6a._comboSelected(el,txt);
});
}
return el;
};
function createButton(txt){
var el,btn,obj=null;
switch(txt){
case "separator":
if(_6a.config.flowToolbars){
newLine();
}
el=document.createElement("div");
el.className="separator";
break;
case "space":
el=document.createElement("div");
el.className="space";
break;
case "linebreak":
newLine();
return false;
case "textindicator":
el=document.createElement("div");
el.appendChild(document.createTextNode("A"));
el.className="indicator";
el.title=Xinha._lc("Current style");
obj={name:txt,element:el,enabled:true,active:false,text:false,cmd:"textindicator",state:setButtonStatus};
Xinha.freeLater(obj);
_6c[txt]=obj;
break;
default:
btn=_6a.config.btnList[txt];
}
if(!el&&btn){
el=document.createElement("a");
el.style.display="block";
el.href="javascript:void(0)";
el.style.textDecoration="none";
el.title=btn[0];
el.className="button";
el.style.direction="ltr";
obj={name:txt,element:el,enabled:true,active:false,text:btn[2],cmd:btn[3],state:setButtonStatus,context:btn[4]||null};
Xinha.freeLater(el);
Xinha.freeLater(obj);
_6c[txt]=obj;
el.ondrag=function(){
return false;
};
Xinha._addEvent(el,"mouseout",function(ev){
if(obj.enabled){
Xinha._removeClass(el,"buttonActive");
if(obj.active){
Xinha._addClass(el,"buttonPressed");
}
}
});
Xinha._addEvent(el,"mousedown",function(ev){
if(obj.enabled){
Xinha._addClass(el,"buttonActive");
Xinha._removeClass(el,"buttonPressed");
Xinha._stopEvent(Xinha.is_ie?window.event:ev);
}
});
Xinha._addEvent(el,"click",function(ev){
ev=ev||window.event;
_6a.btnClickEvent={clientX:ev.clientX,clientY:ev.clientY};
if(obj.enabled){
Xinha._removeClass(el,"buttonActive");
if(Xinha.is_gecko){
_6a.activateEditor();
}
obj.cmd(_6a,obj.name,obj,ev);
Xinha._stopEvent(ev);
}
});
var _86=Xinha.makeBtnImg(btn[1]);
var img=_86.firstChild;
Xinha.freeLater(_86);
Xinha.freeLater(img);
el.appendChild(_86);
obj.imgel=img;
obj.swapImage=function(_88){
if(typeof _88!="string"){
img.src=_88[0];
img.style.position="relative";
img.style.top=_88[2]?("-"+(18*(_88[2]+1))+"px"):"-18px";
img.style.left=_88[1]?("-"+(18*(_88[1]+1))+"px"):"-18px";
}else{
obj.imgel.src=_88;
img.style.top="0px";
img.style.left="0px";
}
};
}else{
if(!el){
el=createSelect(txt);
}
}
return el;
};
var _89=true;
for(var i=0;i<this.config.toolbar.length;++i){
if(!_89){
}else{
_89=false;
}
if(this.config.toolbar[i]===null){
this.config.toolbar[i]=["separator"];
}
var _8b=this.config.toolbar[i];
for(var j=0;j<_8b.length;++j){
var _8d=_8b[j];
var _8e;
if(/^([IT])\[(.*?)\]/.test(_8d)){
var _8f=RegExp.$1=="I";
var _90=RegExp.$2;
if(_8f){
_90=Xinha._lc(_90);
}
_8e=document.createElement("td");
_6d.appendChild(_8e);
_8e.className="label";
_8e.innerHTML=_90;
}else{
if(typeof _8d!="function"){
var _91=createButton(_8d);
if(_91){
_8e=document.createElement("td");
_8e.className="toolbarElement";
_6d.appendChild(_8e);
_8e.appendChild(_91);
}else{
if(_91===null){
alert("FIXME: Unknown toolbar item: "+_8d);
}
}
}
}
}
}
if(_6a.config.flowToolbars){
_6b.appendChild(Xinha._createToolbarBreakingElement());
}
return _6b;
};
Xinha.makeBtnImg=function(_92,doc){
if(!doc){
doc=document;
}
if(!doc._xinhaImgCache){
doc._xinhaImgCache={};
Xinha.freeLater(doc._xinhaImgCache);
}
var _94=null;
if(Xinha.is_ie&&((!doc.compatMode)||(doc.compatMode&&doc.compatMode=="BackCompat"))){
_94=doc.createElement("span");
}else{
_94=doc.createElement("div");
_94.style.position="relative";
}
_94.style.overflow="hidden";
_94.style.width="18px";
_94.style.height="18px";
_94.className="buttonImageContainer";
var img=null;
if(typeof _92=="string"){
if(doc._xinhaImgCache[_92]){
img=doc._xinhaImgCache[_92].cloneNode();
}else{
if(Xinha.ie_version<7&&/\.png$/.test(_92[0])){
img=doc.createElement("span");
img.style.display="block";
img.style.width="18px";
img.style.height="18px";
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+_92+"\")";
img.unselectable="on";
}else{
img=doc.createElement("img");
img.src=_92;
}
}
}else{
if(doc._xinhaImgCache[_92[0]]){
img=doc._xinhaImgCache[_92[0]].cloneNode();
}else{
if(Xinha.ie_version<7&&/\.png$/.test(_92[0])){
img=doc.createElement("span");
img.style.display="block";
img.style.width="18px";
img.style.height="18px";
img.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\""+_92[0]+"\")";
img.unselectable="on";
}else{
img=doc.createElement("img");
img.src=_92[0];
}
img.style.position="relative";
}
img.style.top=_92[2]?("-"+(18*(_92[2]+1))+"px"):"-18px";
img.style.left=_92[1]?("-"+(18*(_92[1]+1))+"px"):"-18px";
}
_94.appendChild(img);
return _94;
};
Xinha.prototype._createStatusBar=function(){
this.setLoadingMessage(Xinha._lc("Create Statusbar"));
var _96=document.createElement("div");
_96.style.position="relative";
_96.className="statusBar";
_96.style.width="100%";
Xinha.freeLater(this,"_statusBar");
var _97=document.createElement("div");
_97.className="statusBarWidgetContainer";
_97.style.position="absolute";
_97.style.right="0";
_97.style.top="0";
_97.style.padding="3px 3px 3px 10px";
_96.appendChild(_97);
var _98=document.createElement("span");
_98.className="statusBarTree";
_98.innerHTML=Xinha._lc("Path")+": ";
this._statusBarTree=_98;
Xinha.freeLater(this,"_statusBarTree");
_96.appendChild(_98);
var _99=document.createElement("span");
_99.innerHTML=Xinha._lc("You are in TEXT MODE.  Use the [<>] button to switch back to WYSIWYG.");
_99.style.display="none";
this._statusBarTextMode=_99;
Xinha.freeLater(this,"_statusBarTextMode");
_96.appendChild(_99);
_96.style.whiteSpace="nowrap";
var _9a=this;
this.notifyOn("before_resize",function(evt,_9c){
_9a._statusBar.style.width=null;
});
this.notifyOn("resize",function(evt,_9e){
if(Xinha.is_ie&&Xinha.ie_version==6){
_9a._statusBar.style.width="100%";
}else{
var _9f=_9e["width"];
_9a._statusBar.style.width=_9f+"px";
}
});
this.notifyOn("modechange",function(evt,_a1){
for(var i in _9a._statusWidgets){
var _a3=_9a._statusWidgets[i];
for(var _a4=0;_a4<_a3.modes.length;_a4++){
if(_a3.modes[_a4]==_a1.mode){
var _a5=true;
}
}
if(typeof _a5=="undefined"){
_a3.block.style.display="none";
}else{
_a3.block.style.display="";
}
}
});
if(!this.config.statusBar){
_96.style.display="none";
}
return _96;
};
Xinha.prototype.registerStatusWidget=function(id,_a7){
_a7=_a7||["wysiwyg"];
if(!this._statusWidgets){
this._statusWidgets={};
}
var _a8=document.createElement("div");
_a8.className="statusBarWidget";
_a8=this._statusBar.firstChild.appendChild(_a8);
var _a9=false;
for(var i=0;i<_a7.length;i++){
if(_a7[i]==this._editMode){
_a9=true;
}
}
_a8.style.display=_a9==true?"":"none";
this._statusWidgets[id]={block:_a8,modes:_a7};
return _a8;
};
Xinha.prototype.generate=function(){
if(!Xinha.isSupportedBrowser){
return;
}
var i;
var _ac=this;
var url;
var _ae=false;
var _af=document.getElementsByTagName("link");
if(!document.getElementById("XinhaCoreDesign")){
_editor_css=(typeof _editor_css=="string")?_editor_css:"Xinha.css";
for(i=0;i<_af.length;i++){
if((_af[i].rel=="stylesheet")&&(_af[i].href==_editor_url+_editor_css)){
_ae=true;
}
}
if(!_ae){
Xinha.loadStyle(_editor_css,null,"XinhaCoreDesign",true);
}
}
if(_editor_skin!==""&&!document.getElementById("XinhaSkin")){
_ae=false;
for(i=0;i<_af.length;i++){
if((_af[i].rel=="stylesheet")&&(_af[i].href==_editor_url+"skins/"+_editor_skin+"/skin.css")){
_ae=true;
}
}
if(!_ae){
Xinha.loadStyle("skins/"+_editor_skin+"/skin.css",null,"XinhaSkin");
}
}
var _b0=function(){
_ac.generate();
};
if(Xinha.is_ie){
url=_editor_url+"modules/InternetExplorer/InternetExplorer.js";
if(!Xinha.loadPlugins([{plugin:"InternetExplorer",url:url}],_b0)){
return false;
}
if(!this.plugins.InternetExplorer){
_ac._browserSpecificPlugin=_ac.registerPlugin("InternetExplorer");
}
}else{
if(Xinha.is_webkit){
url=_editor_url+"modules/WebKit/WebKit.js";
if(!Xinha.loadPlugins([{plugin:"WebKit",url:url}],_b0)){
return false;
}
if(!this.plugins.Webkit){
_ac._browserSpecificPlugin=_ac.registerPlugin("WebKit");
}
}else{
if(Xinha.is_opera){
url=_editor_url+"modules/Opera/Opera.js";
if(!Xinha.loadPlugins([{plugin:"Opera",url:url}],_b0)){
return false;
}
if(!this.plugins.Opera){
_ac._browserSpecificPlugin=_ac.registerPlugin("Opera");
}
}else{
if(Xinha.is_gecko){
url=_editor_url+"modules/Gecko/Gecko.js";
if(!Xinha.loadPlugins([{plugin:"Gecko",url:url}],_b0)){
return false;
}
if(!this.plugins.Gecko){
_ac._browserSpecificPlugin=_ac.registerPlugin("Gecko");
}
}
}
}
}
if(typeof Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/dialog.js",_b0,this)){
return false;
}
if(typeof Xinha.Dialog=="undefined"&&!Xinha._loadback(_editor_url+"modules/Dialogs/XinhaDialog.js",_b0,this)){
return false;
}
url=_editor_url+"modules/FullScreen/full-screen.js";
if(!Xinha.loadPlugins([{plugin:"FullScreen",url:url}],_b0)){
return false;
}
url=_editor_url+"modules/ColorPicker/ColorPicker.js";
if(!Xinha.loadPlugins([{plugin:"ColorPicker",url:url}],_b0)){
return false;
}else{
if(typeof Xinha.getPluginConstructor("ColorPicker")!="undefined"&&!this.plugins.colorPicker){
_ac.registerPlugin("ColorPicker");
}
}
var _b1=_ac.config.toolbar;
for(i=_b1.length;--i>=0;){
for(var j=_b1[i].length;--j>=0;){
switch(_b1[i][j]){
case "popupeditor":
if(!this.plugins.FullScreen){
_ac.registerPlugin("FullScreen");
}
break;
case "insertimage":
url=_editor_url+"modules/InsertImage/insert_image.js";
if(typeof Xinha.prototype._insertImage=="undefined"&&!Xinha.loadPlugins([{plugin:"InsertImage",url:url}],_b0)){
return false;
}else{
if(typeof Xinha.getPluginConstructor("InsertImage")!="undefined"&&!this.plugins.InsertImage){
_ac.registerPlugin("InsertImage");
}
}
break;
case "createlink":
url=_editor_url+"modules/CreateLink/link.js";
if(typeof Xinha.getPluginConstructor("Linker")=="undefined"&&!Xinha.loadPlugins([{plugin:"CreateLink",url:url}],_b0)){
return false;
}else{
if(typeof Xinha.getPluginConstructor("CreateLink")!="undefined"&&!this.plugins.CreateLink){
_ac.registerPlugin("CreateLink");
}
}
break;
case "inserttable":
url=_editor_url+"modules/InsertTable/insert_table.js";
if(!Xinha.loadPlugins([{plugin:"InsertTable",url:url}],_b0)){
return false;
}else{
if(typeof Xinha.getPluginConstructor("InsertTable")!="undefined"&&!this.plugins.InsertTable){
_ac.registerPlugin("InsertTable");
}
}
break;
case "about":
url=_editor_url+"modules/AboutBox/AboutBox.js";
if(!Xinha.loadPlugins([{plugin:"AboutBox",url:url}],_b0)){
return false;
}else{
if(typeof Xinha.getPluginConstructor("AboutBox")!="undefined"&&!this.plugins.AboutBox){
_ac.registerPlugin("AboutBox");
}
}
break;
}
}
}
if(Xinha.is_gecko&&_ac.config.mozParaHandler!="built-in"){
if(!Xinha.loadPlugins([{plugin:"EnterParagraphs",url:_editor_url+"modules/Gecko/paraHandlerBest.js"}],_b0)){
return false;
}
if(!this.plugins.EnterParagraphs){
_ac.registerPlugin("EnterParagraphs");
}
}
var _b3=this.config.getHtmlMethod=="TransformInnerHTML"?_editor_url+"modules/GetHtml/TransformInnerHTML.js":_editor_url+"modules/GetHtml/DOMwalk.js";
if(!Xinha.loadPlugins([{plugin:"GetHtmlImplementation",url:_b3}],_b0)){
return false;
}else{
if(!this.plugins.GetHtmlImplementation){
_ac.registerPlugin("GetHtmlImplementation");
}
}
function getTextContent(_b4){
return _b4.textContent||_b4.text;
};
if(_editor_skin){
this.skinInfo={};
var _b5=Xinha._geturlcontent(_editor_url+"skins/"+_editor_skin+"/skin.xml",true);
if(_b5){
var _b6=_b5.getElementsByTagName("meta");
for(i=0;i<_b6.length;i++){
this.skinInfo[_b6[i].getAttribute("name")]=_b6[i].getAttribute("value");
}
var _b7=_b5.getElementsByTagName("recommendedIcons");
if(!_editor_icons&&_b7.length&&getTextContent(_b7[0])){
_editor_icons=getTextContent(_b7[0]);
}
}
}
if(_editor_icons){
var _b8=Xinha._geturlcontent(_editor_url+"iconsets/"+_editor_icons+"/iconset.xml",true);
if(_b8){
var _b9=_b8.getElementsByTagName("icon");
var _ba,id,_bc,_bd,x,y;
for(i=0;i<_b9.length;i++){
_ba=_b9[i];
id=_ba.getAttribute("id");
if(_ba.getElementsByTagName(_editor_lang).length){
_ba=_ba.getElementsByTagName(_editor_lang)[0];
}else{
_ba=_ba.getElementsByTagName("default")[0];
}
_bc=getTextContent(_ba.getElementsByTagName("path")[0]);
_bc=(!/^\//.test(_bc)?_editor_url:"")+_bc;
_bd=_ba.getAttribute("type");
if(_bd=="map"){
x=parseInt(getTextContent(_ba.getElementsByTagName("x")[0]),10);
y=parseInt(getTextContent(_ba.getElementsByTagName("y")[0]),10);
if(this.config.btnList[id]){
this.config.btnList[id][1]=[_bc,x,y];
}
if(this.config.iconList[id]){
this.config.iconList[id]=[_bc,x,y];
}
}else{
if(this.config.btnList[id]){
this.config.btnList[id][1]=_bc;
}
if(this.config.iconList[id]){
this.config.iconList[id]=_bc;
}
}
}
}
}
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 fw=this._framework;
fw.table.border="0";
fw.table.cellPadding="0";
fw.table.cellSpacing="0";
fw.tb_row.style.verticalAlign="top";
fw.tp_row.style.verticalAlign="top";
fw.ler_row.style.verticalAlign="top";
fw.bp_row.style.verticalAlign="top";
fw.sb_row.style.verticalAlign="top";
fw.ed_cell.style.position="relative";
fw.tb_row.appendChild(fw.tb_cell);
fw.tb_cell.colSpan=3;
fw.tp_row.appendChild(fw.tp_cell);
fw.tp_cell.colSpan=3;
fw.ler_row.appendChild(fw.lp_cell);
fw.ler_row.appendChild(fw.ed_cell);
fw.ler_row.appendChild(fw.rp_cell);
fw.bp_row.appendChild(fw.bp_cell);
fw.bp_cell.colSpan=3;
fw.sb_row.appendChild(fw.sb_cell);
fw.sb_cell.colSpan=3;
fw.tbody.appendChild(fw.tb_row);
fw.tbody.appendChild(fw.tp_row);
fw.tbody.appendChild(fw.ler_row);
fw.tbody.appendChild(fw.bp_row);
fw.tbody.appendChild(fw.sb_row);
fw.table.appendChild(fw.tbody);
var _c1=fw.table;
this._htmlArea=_c1;
Xinha.freeLater(this,"_htmlArea");
_c1.className="htmlarea";
fw.tb_cell.appendChild(this._createToolbar());
var _c2=document.createElement("iframe");
_c2.src=this.popupURL(_ac.config.URIs.blank);
_c2.id="XinhaIFrame_"+this._textArea.id;
fw.ed_cell.appendChild(_c2);
this._iframe=_c2;
this._iframe.className="xinha_iframe";
Xinha.freeLater(this,"_iframe");
var _c3=this._createStatusBar();
this._statusBar=fw.sb_cell.appendChild(_c3);
var _c4=this._textArea;
_c4.parentNode.insertBefore(_c1,_c4);
_c4.className="xinha_textarea";
Xinha.removeFromParent(_c4);
fw.ed_cell.appendChild(_c4);
Xinha.addDom0Event(this._textArea,"click",function(){
if(Xinha._currentlyActiveEditor!=this){
_ac.updateToolbar();
}
return true;
});
if(_c4.form){
Xinha.prependDom0Event(this._textArea.form,"submit",function(){
_ac.firePluginEvent("onBeforeSubmit");
_ac._textArea.value=_ac.outwardHtml(_ac.getHTML());
return true;
});
var _c5=_c4.value;
Xinha.prependDom0Event(this._textArea.form,"reset",function(){
_ac.setHTML(_ac.inwardHtml(_c5));
_ac.updateToolbar();
return true;
});
if(!_c4.form.xinha_submit){
try{
_c4.form.xinha_submit=_c4.form.submit;
_c4.form.submit=function(){
this.onsubmit();
this.xinha_submit();
};
}
catch(ex){
}
}
}
Xinha.prependDom0Event(window,"unload",function(){
_ac.firePluginEvent("onBeforeUnload");
_c4.value=_ac.outwardHtml(_ac.getHTML());
if(!Xinha.is_ie){
_c1.parentNode.replaceChild(_c4,_c1);
}
return true;
});
_c4.style.display="none";
_ac.initSize();
this.setLoadingMessage(Xinha._lc("Finishing"));
_ac._iframeLoadDone=false;
if(Xinha.is_opera){
_ac.initIframe();
}else{
Xinha._addEvent(this._iframe,"load",function(e){
if(!_ac._iframeLoadDone){
_ac._iframeLoadDone=true;
_ac.initIframe();
}
return true;
});
}
};
Xinha.prototype.initSize=function(){
this.setLoadingMessage(Xinha._lc("Init editor size"));
var _c7=this;
var _c8=null;
var _c9=null;
switch(this.config.width){
case "auto":
_c8=this._initial_ta_size.w;
break;
case "toolbar":
_c8=this._toolBar.offsetWidth+"px";
break;
default:
_c8=/[^0-9]/.test(this.config.width)?this.config.width:this.config.width+"px";
break;
}
_c9=this.config.height=="auto"?this._initial_ta_size.h:/[^0-9]/.test(this.config.height)?this.config.height:this.config.height+"px";
this.sizeEditor(_c8,_c9,this.config.sizeIncludesBars,this.config.sizeIncludesPanels);
this.notifyOn("panel_change",function(){
return _c7.sizeEditor();
});
};
Xinha.prototype.sizeEditor=function(_ca,_cb,_cc,_cd){
if(this._risizing){
return false;
}
this._risizing=true;
var _ce=this._framework;
this.notifyOf("before_resize",{width:_ca,height:_cb});
this.firePluginEvent("onBeforeResize",_ca,_cb);
this._iframe.style.height="100%";
this._textArea.style.height="1px";
this._iframe.style.width="";
this._textArea.style.width="";
if(_cc!==null){
this._htmlArea.sizeIncludesToolbars=_cc;
}
if(_cd!==null){
this._htmlArea.sizeIncludesPanels=_cd;
}
if(_ca){
this._htmlArea.style.width=_ca;
if(!this._htmlArea.sizeIncludesPanels){
var _cf=this._panels.right;
if(_cf.on&&_cf.panels.length&&Xinha.hasDisplayedChildren(_cf.div)){
this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.right,10))+"px";
}
var _d0=this._panels.left;
if(_d0.on&&_d0.panels.length&&Xinha.hasDisplayedChildren(_d0.div)){
this._htmlArea.style.width=(this._htmlArea.offsetWidth+parseInt(this.config.panel_dimensions.left,10))+"px";
}
}
}
if(_cb){
this._htmlArea.style.height=_cb;
if(!this._htmlArea.sizeIncludesToolbars){
this._htmlArea.style.height=(this._htmlArea.offsetHeight+this._toolbar.offsetHeight+this._statusBar.offsetHeight)+"px";
}
if(!this._htmlArea.sizeIncludesPanels){
var _d1=this._panels.top;
if(_d1.on&&_d1.panels.length&&Xinha.hasDisplayedChildren(_d1.div)){
this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.top,10))+"px";
}
var _d2=this._panels.bottom;
if(_d2.on&&_d2.panels.length&&Xinha.hasDisplayedChildren(_d2.div)){
this._htmlArea.style.height=(this._htmlArea.offsetHeight+parseInt(this.config.panel_dimensions.bottom,10))+"px";
}
}
}
_ca=this._htmlArea.offsetWidth;
_cb=this._htmlArea.offsetHeight;
var _d3=this._panels;
var _d4=this;
var _d5=1;
function panel_is_alive(pan){
if(_d3[pan].on&&_d3[pan].panels.length&&Xinha.hasDisplayedChildren(_d3[pan].container)){
_d3[pan].container.style.display="";
return true;
}else{
_d3[pan].container.style.display="none";
return false;
}
};
if(panel_is_alive("left")){
_d5+=1;
}
if(panel_is_alive("right")){
_d5+=1;
}
_ce.tb_cell.colSpan=_d5;
_ce.tp_cell.colSpan=_d5;
_ce.bp_cell.colSpan=_d5;
_ce.sb_cell.colSpan=_d5;
if(!_ce.tp_row.childNodes.length){
Xinha.removeFromParent(_ce.tp_row);
}else{
if(!Xinha.hasParentNode(_ce.tp_row)){
_ce.tbody.insertBefore(_ce.tp_row,_ce.ler_row);
}
}
if(!_ce.bp_row.childNodes.length){
Xinha.removeFromParent(_ce.bp_row);
}else{
if(!Xinha.hasParentNode(_ce.bp_row)){
_ce.tbody.insertBefore(_ce.bp_row,_ce.ler_row.nextSibling);
}
}
if(!this.config.statusBar){
Xinha.removeFromParent(_ce.sb_row);
}else{
if(!Xinha.hasParentNode(_ce.sb_row)){
_ce.table.appendChild(_ce.sb_row);
}
}
_ce.lp_cell.style.width=this.config.panel_dimensions.left;
_ce.rp_cell.style.width=this.config.panel_dimensions.right;
_ce.tp_cell.style.height=this.config.panel_dimensions.top;
_ce.bp_cell.style.height=this.config.panel_dimensions.bottom;
_ce.tb_cell.style.height=this._toolBar.offsetHeight+"px";
_ce.sb_cell.style.height=this._statusBar.offsetHeight+"px";
var _d7=_cb-this._toolBar.offsetHeight-this._statusBar.offsetHeight;
if(panel_is_alive("top")){
_d7-=parseInt(this.config.panel_dimensions.top,10);
}
if(panel_is_alive("bottom")){
_d7-=parseInt(this.config.panel_dimensions.bottom,10);
}
this._iframe.style.height=_d7+"px";
var _d8=_ca;
if(panel_is_alive("left")){
_d8-=parseInt(this.config.panel_dimensions.left,10);
}
if(panel_is_alive("right")){
_d8-=parseInt(this.config.panel_dimensions.right,10);
}
var _d9=this.config.iframeWidth?parseInt(this.config.iframeWidth,10):null;
this._iframe.style.width=(_d9&&_d9<_d8)?_d9+"px":_d8+"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;
return true;
};
Xinha.prototype.registerPanel=function(_da,_db){
if(!_da){
_da="right";
}
this.setLoadingMessage("Register "+_da+" panel ");
var _dc=this.addPanel(_da);
if(_db){
_db.drawPanelIn(_dc);
}
};
Xinha.prototype.addPanel=function(_dd){
var div=document.createElement("div");
div.side=_dd;
if(_dd=="left"||_dd=="right"){
div.style.width=this.config.panel_dimensions[_dd];
if(this._iframe){
div.style.height=this._iframe.style.height;
}
}
Xinha.addClasses(div,"panel");
this._panels[_dd].panels.push(div);
this._panels[_dd].div.appendChild(div);
this.notifyOf("panel_change",{"action":"add","panel":div});
this.firePluginEvent("onPanelChange","add",div);
return div;
};
Xinha.prototype.removePanel=function(_df){
this._panels[_df.side].div.removeChild(_df);
var _e0=[];
for(var i=0;i<this._panels[_df.side].panels.length;i++){
if(this._panels[_df.side].panels[i]!=_df){
_e0.push(this._panels[_df.side].panels[i]);
}
}
this._panels[_df.side].panels=_e0;
this.notifyOf("panel_change",{"action":"remove","panel":_df});
this.firePluginEvent("onPanelChange","remove",_df);
};
Xinha.prototype.hidePanel=function(_e2){
if(_e2&&_e2.style.display!="none"){
try{
var pos=this.scrollPos(this._iframe.contentWindow);
}
catch(e){
}
_e2.style.display="none";
this.notifyOf("panel_change",{"action":"hide","panel":_e2});
this.firePluginEvent("onPanelChange","hide",_e2);
try{
this._iframe.contentWindow.scrollTo(pos.x,pos.y);
}
catch(e){
}
}
};
Xinha.prototype.showPanel=function(_e4){
if(_e4&&_e4.style.display=="none"){
try{
var pos=this.scrollPos(this._iframe.contentWindow);
}
catch(e){
}
_e4.style.display="";
this.notifyOf("panel_change",{"action":"show","panel":_e4});
this.firePluginEvent("onPanelChange","show",_e4);
try{
this._iframe.contentWindow.scrollTo(pos.x,pos.y);
}
catch(e){
}
}
};
Xinha.prototype.hidePanels=function(_e6){
if(typeof _e6=="undefined"){
_e6=["left","right","top","bottom"];
}
var _e7=[];
for(var i=0;i<_e6.length;i++){
if(this._panels[_e6[i]].on){
_e7.push(_e6[i]);
this._panels[_e6[i]].on=false;
}
}
this.notifyOf("panel_change",{"action":"multi_hide","sides":_e6});
this.firePluginEvent("onPanelChange","multi_hide",_e6);
};
Xinha.prototype.showPanels=function(_e9){
if(typeof _e9=="undefined"){
_e9=["left","right","top","bottom"];
}
var _ea=[];
for(var i=0;i<_e9.length;i++){
if(!this._panels[_e9[i]].on){
_ea.push(_e9[i]);
this._panels[_e9[i]].on=true;
}
}
this.notifyOf("panel_change",{"action":"multi_show","sides":_e9});
this.firePluginEvent("onPanelChange","multi_show",_e9);
};
Xinha.objectProperties=function(obj){
var _ed=[];
for(var x in obj){
_ed[_ed.length]=x;
}
return _ed;
};
Xinha.prototype.editorIsActivated=function(){
try{
return Xinha.is_designMode?this._doc.designMode=="on":this._doc.body.contentEditable;
}
catch(ex){
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";
}
}
catch(ex){
}
}else{
if(Xinha.is_ie&&this._doc.body.contentEditable!==true){
this._doc.body.contentEditable=true;
}
}
Xinha._someEditorHasBeenActivated=true;
Xinha._currentlyActiveEditor=this;
var _ef=this;
this.enableToolbar();
};
Xinha.prototype.deactivateEditor=function(){
this.disableToolbar();
if(Xinha.is_designMode&&this._doc.designMode!="off"){
try{
this._doc.designMode="off";
}
catch(ex){
}
}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 doc=null;
var _f1=this;
try{
if(_f1._iframe.contentDocument){
this._doc=_f1._iframe.contentDocument;
}else{
this._doc=_f1._iframe.contentWindow.document;
}
doc=this._doc;
if(!doc){
if(Xinha.is_gecko){
setTimeout(function(){
_f1.initIframe();
},50);
return;
}else{
alert("ERROR: IFRAME can't be initialized.");
}
}
}
catch(ex){
setTimeout(function(){
_f1.initIframe();
},50);
return;
}
Xinha.freeLater(this,"_doc");
doc.open("text/html","replace");
var _f2="",_f3;
if(_f1.config.browserQuirksMode===false){
_f3="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">";
}else{
if(_f1.config.browserQuirksMode===true){
_f3="";
}else{
_f3=Xinha.getDoctype(document);
}
}
if(!_f1.config.fullPage){
_f2+=_f3+"\n";
_f2+="<html>\n";
_f2+="<head>\n";
_f2+="<meta http-equiv=\"Content-Type\" content=\"text/html; charset="+_f1.config.charSet+"\">\n";
if(typeof _f1.config.baseHref!="undefined"&&_f1.config.baseHref!==null){
_f2+="<base href=\""+_f1.config.baseHref+"\"/>\n";
}
_f2+=Xinha.addCoreCSS();
if(typeof _f1.config.pageStyleSheets!=="undefined"){
for(var i=0;i<_f1.config.pageStyleSheets.length;i++){
if(_f1.config.pageStyleSheets[i].length>0){
_f2+="<link rel=\"stylesheet\" type=\"text/css\" href=\""+_f1.config.pageStyleSheets[i]+"\">";
}
}
}
if(_f1.config.pageStyle){
_f2+="<style type=\"text/css\">\n"+_f1.config.pageStyle+"\n</style>";
}
_f2+="</head>\n";
_f2+="<body"+(_f1.config.bodyID?(" id=\""+_f1.config.bodyID+"\""):"")+(_f1.config.bodyClass?(" class=\""+_f1.config.bodyClass+"\""):"")+">\n";
_f2+=_f1.inwardHtml(_f1._textArea.value);
_f2+="</body>\n";
_f2+="</html>";
}else{
_f2=_f1.inwardHtml(_f1._textArea.value);
if(_f2.match(Xinha.RE_doctype)){
_f1.setDoctype(RegExp.$1);
}
var _f5=_f2.match(/<link\s+[\s\S]*?["']\s*\/?>/gi);
_f2=_f2.replace(/<link\s+[\s\S]*?["']\s*\/?>\s*/gi,"");
if(_f5){
_f2=_f2.replace(/<\/head>/i,_f5.join("\n")+"\n</head>");
}
}
doc.write(_f2);
doc.close();
if(this.config.fullScreen){
this._fullScreen();
}
this.setEditorEvents();
if((typeof _f1.config.autofocus!="undefined")&&((_f1.config.autofocus==_f1._textArea.id)||_f1.config.autofocus==true)){
_f1.activateEditor();
_f1.focusEditor();
}
};
Xinha.prototype.whenDocReady=function(f){
var e=this;
if(this._doc&&this._doc.body){
f();
}else{
setTimeout(function(){
e.whenDocReady(f);
},50);
}
};
Xinha.prototype.setMode=function(_f8){
var _f9;
if(typeof _f8=="undefined"){
_f8=this._editMode=="textmode"?"wysiwyg":"textmode";
}
switch(_f8){
case "textmode":
this.firePluginEvent("onBeforeMode","textmode");
this._toolbarObjects.htmlmode.swapImage(this.config.iconList.wysiwygmode);
this.setCC("iframe");
_f9=this.outwardHtml(this.getHTML());
this.setHTML(_f9);
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");
_f9=this.inwardHtml(this.getHTML());
this.deactivateEditor();
this.setHTML(_f9);
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 <"+_f8+"> not defined!");
return false;
}
this._editMode=_f8;
};
Xinha.prototype.setFullHTML=function(_fa){
var _fb=RegExp.multiline;
RegExp.multiline=true;
if(_fa.match(Xinha.RE_doctype)){
this.setDoctype(RegExp.$1);
}
RegExp.multiline=_fb;
if(0){
if(_fa.match(Xinha.RE_head)){
this._doc.getElementsByTagName("head")[0].innerHTML=RegExp.$1;
}
if(_fa.match(Xinha.RE_body)){
this._doc.getElementsByTagName("body")[0].innerHTML=RegExp.$1;
}
}else{
var _fc=this.editorIsActivated();
if(_fc){
this.deactivateEditor();
}
var _fd=/<html>((.|\n)*?)<\/html>/i;
_fa=_fa.replace(_fd,"$1");
this._doc.open("text/html","replace");
this._doc.write(_fa);
this._doc.close();
if(_fc){
this.activateEditor();
}
this.setEditorEvents();
return true;
}
};
Xinha.prototype.setEditorEvents=function(){
var _fe=this;
var doc=this._doc;
_fe.whenDocReady(function(){
Xinha._addEvents(doc,["mousedown"],function(){
_fe.activateEditor();
return true;
});
if(Xinha.is_ie){
Xinha._addEvent(_fe._doc.getElementsByTagName("html")[0],"click",function(){
if(_fe._iframe.contentWindow.event.srcElement.tagName.toLowerCase()=="html"){
var r=_fe._doc.body.createTextRange();
r.collapse();
r.select();
}
return true;
});
}
Xinha._addEvents(doc,["keydown","keypress","mousedown","mouseup","drag"],function(_101){
return _fe._editorEvent(Xinha.is_ie?_fe._iframe.contentWindow.event:_101);
});
for(var i in _fe.plugins){
var _103=_fe.plugins[i].instance;
Xinha.refreshPlugin(_103);
}
if(typeof _fe._onGenerate=="function"){
_fe._onGenerate();
}
Xinha.addDom0Event(window,"resize",function(e){
if(Xinha.ie_version>7&&!window.parent){
if(_fe.execResize){
_fe.sizeEditor();
_fe.execResize=false;
}else{
_fe.execResize=true;
}
}else{
_fe.sizeEditor();
}
});
_fe.removeLoadingMessage();
});
};
Xinha.getPluginConstructor=function(_105){
return Xinha.plugins[_105]||window[_105];
};
Xinha.prototype.registerPlugin=function(){
if(!Xinha.isSupportedBrowser){
return;
}
var _106=arguments[0];
if(_106===null||typeof _106=="undefined"||(typeof _106=="string"&&Xinha.getPluginConstructor(_106)=="undefined")){
return false;
}
var args=[];
for(var i=1;i<arguments.length;++i){
args.push(arguments[i]);
}
return this.registerPlugin2(_106,args);
};
Xinha.prototype.registerPlugin2=function(_109,args){
if(typeof _109=="string"&&typeof Xinha.getPluginConstructor(_109)=="function"){
var _10b=_109;
_109=Xinha.getPluginConstructor(_109);
}
if(typeof _109=="undefined"){
return false;
}
if(!_109._pluginInfo){
_109._pluginInfo={name:_10b};
}
var obj=new _109(this,args);
if(obj){
var _10d={};
var info=_109._pluginInfo;
for(var i in info){
_10d[i]=info[i];
}
_10d.instance=obj;
_10d.args=args;
this.plugins[_109._pluginInfo.name]=_10d;
return obj;
}else{
Xinha.debugMsg("Can't register plugin "+_109.toString()+".","warn");
}
};
Xinha.getPluginDir=function(_110,_111){
if(Xinha.externalPlugins[_110]){
return Xinha.externalPlugins[_110][0];
}
if(_111||(Xinha.getPluginConstructor(_110)&&(typeof Xinha.getPluginConstructor(_110).supported!="undefined")&&!Xinha.getPluginConstructor(_110).supported)){
return _editor_url+"unsupported_plugins/"+_110;
}
return _editor_url+"plugins/"+_110;
};
Xinha.loadPlugin=function(_112,_113,url){
if(!Xinha.isSupportedBrowser){
return;
}
Xinha.setLoadingMessage(Xinha._lc("Loading plugin $plugin="+_112+"$"));
if(typeof Xinha.getPluginConstructor(_112)!="undefined"){
if(_113){
_113(_112);
}
return true;
}
Xinha._pluginLoadStatus[_112]="loading";
function multiStageLoader(_115,_116){
var _117,dir,file,_11a;
switch(_115){
case "start":
_117="old_naming";
dir=Xinha.getPluginDir(_116);
file=_116+".js";
break;
case "old_naming":
_117="unsupported";
dir=Xinha.getPluginDir(_116);
file=_116.replace(/([a-z])([A-Z])([a-z])/g,function(str,l1,l2,l3){
return l1+"-"+l2.toLowerCase()+l3;
}).toLowerCase()+".js";
_11a="You are using an obsolete naming scheme for the Xinha plugin "+_116+". Please rename "+file+" to "+_116+".js";
break;
case "unsupported":
_117="unsupported_old_name";
dir=Xinha.getPluginDir(_116,true);
file=_116+".js";
_11a="You are using the unsupported Xinha plugin "+_116+". If you wish continued support, please see http://trac.xinha.org/ticket/1297";
break;
case "unsupported_old_name":
_117="";
dir=Xinha.getPluginDir(_116,true);
file=_116.replace(/([a-z])([A-Z])([a-z])/g,function(str,l1,l2,l3){
return l1+"-"+l2.toLowerCase()+l3;
}).toLowerCase()+".js";
_11a="You are using the unsupported Xinha plugin "+_116+". If you wish continued support, please see http://trac.xinha.org/ticket/1297";
break;
default:
Xinha._pluginLoadStatus[_116]="failed";
Xinha.debugMsg("Xinha was not able to find the plugin "+_116+". Please make sure the plugin exists.","warn");
return;
}
var url=dir+"/"+file;
function statusCallback(_124){
Xinha.getPluginConstructor(_124).supported=_115.indexOf("unsupported")!==0;
_113(_124);
};
Xinha._loadback(url,statusCallback,this,_116);
Xinha.ping(url,function(){
if(_11a){
Xinha.debugMsg(_11a);
}
},function(){
Xinha.removeFromParent(document.getElementById(url));
multiStageLoader(_117,_116);
});
};
if(!url){
if(Xinha.externalPlugins[_112]){
Xinha._loadback(Xinha.externalPlugins[_112][0]+Xinha.externalPlugins[_112][1],_113,this,_112);
}else{
var _125=this;
multiStageLoader("start",_112);
}
}else{
Xinha._loadback(url,_113,this,_112);
}
return false;
};
Xinha._pluginLoadStatus={};
Xinha.externalPlugins={};
Xinha.plugins={};
Xinha.loadPlugins=function(_126,_127,url){
if(!Xinha.isSupportedBrowser){
return;
}
var m,i;
for(i=0;i<_126.length;i++){
if(typeof _126[i]=="object"){
m=_126[i].url.match(/(.*)(\/[^\/]*)$/);
Xinha.externalPlugins[_126[i].plugin]=[m[1],m[2]];
_126[i]=_126[i].plugin;
}
}
var _12b=true;
var _12c=Xinha.cloneObject(_126);
for(i=0;i<_12c.length;i++){
var p=_12c[i];
if(p=="FullScreen"&&!Xinha.externalPlugins.FullScreen){
continue;
}
if(typeof Xinha._pluginLoadStatus[p]=="undefined"){
Xinha.loadPlugin(p,function(_12e){
Xinha.setLoadingMessage(Xinha._lc("Finishing"));
if(typeof Xinha.getPluginConstructor(_12e)!="undefined"){
Xinha._pluginLoadStatus[_12e]="ready";
}else{
Xinha._pluginLoadStatus[_12e]="failed";
}
},url);
_12b=false;
}else{
if(Xinha._pluginLoadStatus[p]=="loading"){
_12b=false;
}
}
}
if(_12b){
return true;
}
if(_127){
setTimeout(function(){
if(Xinha.loadPlugins(_126,_127)){
_127();
}
},50);
}
return _12b;
};
Xinha.refreshPlugin=function(_12f){
if(_12f&&typeof _12f.onGenerate=="function"){
_12f.onGenerate();
}
if(_12f&&typeof _12f.onGenerateOnce=="function"){
_12f._ongenerateOnce=_12f.onGenerateOnce;
delete (_12f.onGenerateOnce);
_12f._ongenerateOnce();
delete (_12f._ongenerateOnce);
}
};
Xinha.prototype.firePluginEvent=function(_130){
var _131=[];
for(var i=1;i<arguments.length;i++){
_131[i-1]=arguments[i];
}
for(i in this.plugins){
var _133=this.plugins[i].instance;
if(_133==this._browserSpecificPlugin){
continue;
}
if(_133&&typeof _133[_130]=="function"){
var _134=(i=="Events")?this:_133;
if(_133[_130].apply(_134,_131)){
return true;
}
}
}
_133=this._browserSpecificPlugin;
if(_133&&typeof _133[_130]=="function"){
if(_133[_130].apply(_133,_131)){
return true;
}
}
return false;
};
Xinha.loadStyle=function(_135,_136,id,_138){
var url=_editor_url||"";
if(_136){
url=Xinha.getPluginDir(_136)+"/";
}
url+=_135;
if(/^\//.test(_135)){
url=_135;
}
var head=document.getElementsByTagName("head")[0];
var link=document.createElement("link");
link.rel="stylesheet";
link.href=url;
link.type="text/css";
if(id){
link.id=id;
}
if(_138&&head.getElementsByTagName("link")[0]){
head.insertBefore(link,head.getElementsByTagName("link")[0]);
}else{
head.appendChild(link);
}
};
Xinha.prototype.debugTree=function(){
var ta=document.createElement("textarea");
ta.style.width="100%";
ta.style.height="20em";
ta.value="";
function debug(_13d,str){
for(;--_13d>=0;){
ta.value+=" ";
}
ta.value+=str+"\n";
};
function _dt(root,_140){
var tag=root.tagName.toLowerCase(),i;
var ns=Xinha.is_ie?root.scopeName:root.prefix;
debug(_140,"- "+tag+" ["+ns+"]");
for(i=root.firstChild;i;i=i.nextSibling){
if(i.nodeType==1){
_dt(i,_140+2);
}
}
};
_dt(this._doc.body,0);
document.body.appendChild(ta);
};
Xinha.getInnerText=function(el){
var txt="",i;
for(i=el.firstChild;i;i=i.nextSibling){
if(i.nodeType==3){
txt+=i.data;
}else{
if(i.nodeType==1){
txt+=Xinha.getInnerText(i);
}
}
}
return txt;
};
Xinha.prototype._wordClean=function(){
if(typeof myst_ei!="undefined"&&typeof myst_ei.msCleanup=="function"){
myst_ei.msCleanup();
return;
}
var _147=this;
var _148={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 _149={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 showStats(){
var txt="Xinha word cleaner stats: \n\n";
for(var i in _148){
if(_149[i]){
txt+=_149[i]+_148[i]+"\n";
}
}
txt+="\nInitial document length: "+_148.orig_len+"\n";
txt+="Final document length: "+_147._doc.body.innerHTML.length+"\n";
txt+="Clean-up took "+((new Date().getTime()-_148.T)/1000)+" seconds";
alert(txt);
};
function clearClass(node){
var newc=node.className.replace(/(^|\s)mso.*?(\s|$)/ig," ");
if(newc!=node.className){
node.className=newc;
if(!/\S/.test(node.className)){
node.removeAttribute("className");
++_148.mso_class;
}
}
};
function clearStyle(node){
var _14f=node.style.cssText.split(/\s*;\s*/);
for(var i=_14f.length;--i>=0;){
if(/^mso|^tab-stops/i.test(_14f[i])||/^margin\s*:\s*0..\s+0..\s+0../i.test(_14f[i])){
++_148.mso_style;
_14f.splice(i,1);
}
}
node.style.cssText=_14f.join("; ");
};
function removeElements(el){
if(("link"==el.tagName.toLowerCase()&&(el.attributes&&/File-List|Edit-Time-Data|themeData|colorSchemeMapping/.test(el.attributes.rel.nodeValue)))||/^(style|meta)$/i.test(el.tagName)){
Xinha.removeFromParent(el);
++_148.mso_elmts;
return true;
}
return false;
};
function checkEmpty(el){
if(/^(a|span|b|strong|i|em|font|div|p)$/i.test(el.tagName)&&!el.firstChild){
Xinha.removeFromParent(el);
++_148.empty_tags;
return true;
}
return false;
};
function parseTree(root){
clearClass(root);
clearStyle(root);
var next;
for(var i=root.firstChild;i;i=next){
next=i.nextSibling;
if(i.nodeType==1&&parseTree(i)){
if((Xinha.is_ie&&root.scopeName!="HTML")||(!Xinha.is_ie&&/:/.test(i.tagName))){
for(var _156=i.childNodes&&i.childNodes.length-1;i.childNodes&&i.childNodes.length&&i.childNodes[_156];--_156){
if(i.nextSibling){
i.parentNode.insertBefore(i.childNodes[_156],i.nextSibling);
}else{
i.parentNode.appendChild(i.childNodes[_156]);
}
}
Xinha.removeFromParent(i);
continue;
}
if(checkEmpty(i)){
continue;
}
if(removeElements(i)){
continue;
}
}else{
if(i.nodeType==8){
if(/(\s*\[\s*if\s*(([gl]te?|!)\s*)?(IE|mso)\s*(\d+(\.\d+)?\s*)?\]>)/.test(i.nodeValue)){
Xinha.removeFromParent(i);
++_148.cond_comm;
}
}
}
}
return true;
};
parseTree(this._doc.body);
this.updateToolbar();
};
Xinha.prototype._clearFonts=function(){
var D=this.getInnerHTML();
if(confirm(Xinha._lc("Would you like to clear font typefaces?"))){
D=D.replace(/face="[^"]*"/gi,"");
D=D.replace(/font-family:[^;}"']+;?/gi,"");
}
if(confirm(Xinha._lc("Would you like to clear font sizes?"))){
D=D.replace(/size="[^"]*"/gi,"");
D=D.replace(/font-size:[^;}"']+;?/gi,"");
}
if(confirm(Xinha._lc("Would you like to clear font colours?"))){
D=D.replace(/color="[^"]*"/gi,"");
D=D.replace(/([^\-])color:[^;}"']+;?/gi,"$1");
}
D=D.replace(/(style|class)="\s*"/gi,"");
D=D.replace(/<(font|span)\s*>/gi,"");
this.setHTML(D);
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(ex){
}
break;
case "textmode":
try{
this._textArea.focus();
}
catch(e){
}
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 take=true;
var txt=this.getInnerHTML();
if(this._undoPos>0){
take=(this._undoQueue[this._undoPos-1]!=txt);
}
if(take){
this._undoQueue[this._undoPos]=txt;
}else{
this._undoPos--;
}
};
Xinha.prototype.undo=function(){
if(this._undoPos>0){
var txt=this._undoQueue[--this._undoPos];
if(txt){
this.setHTML(txt);
}else{
++this._undoPos;
}
}
};
Xinha.prototype.redo=function(){
if(this._undoPos<this._undoQueue.length-1){
var txt=this._undoQueue[++this._undoPos];
if(txt){
this.setHTML(txt);
}else{
--this._undoPos;
}
}
};
Xinha.prototype.disableToolbar=function(_15c){
if(this._timerToolbar){
clearTimeout(this._timerToolbar);
}
if(typeof _15c=="undefined"){
_15c=[];
}else{
if(typeof _15c!="object"){
_15c=[_15c];
}
}
for(var i in this._toolbarObjects){
var btn=this._toolbarObjects[i];
if(_15c.contains(i)){
continue;
}
if(typeof btn.state!="function"){
continue;
}
btn.state("enabled",false);
}
};
Xinha.prototype.enableToolbar=function(){
this.updateToolbar();
};
Xinha.prototype.updateToolbar=function(_15f){
if(this.suspendUpdateToolbar){
return;
}
var doc=this._doc;
var text=(this._editMode=="textmode");
var _162=null;
if(!text){
_162=this.getAllAncestors();
if(this.config.statusBar&&!_15f){
while(this._statusBarItems.length){
var item=this._statusBarItems.pop();
item.el=null;
item.editor=null;
item.onclick=null;
item.oncontextmenu=null;
item._xinha_dom0Events.click=null;
item._xinha_dom0Events.contextmenu=null;
item=null;
}
this._statusBarTree.innerHTML=Xinha._lc("Path")+": ";
for(var i=_162.length;--i>=0;){
var el=_162[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 _16b=true;
if(typeof btn.state!="function"){
continue;
}
if(btn.context&&!text){
_16b=false;
var _16c=btn.context;
var _16d=[];
if(/(.*)\[(.*?)\]/.test(_16c)){
_16c=RegExp.$1;
_16d=RegExp.$2.split(",");
}
_16c=_16c.toLowerCase();
var _16e=(_16c=="*");
for(var k=0;k<_162.length;++k){
if(!_162[k]){
continue;
}
if(_16e||(_162[k].tagName.toLowerCase()==_16c)){
_16b=true;
var _170=null;
var att=null;
var comp=null;
var _173=null;
for(var ka=0;ka<_16d.length;++ka){
_170=_16d[ka].match(/(.*)(==|!=|===|!==|>|>=|<|<=)(.*)/);
att=_170[1];
comp=_170[2];
_173=_170[3];
if(!eval(_162[k][att]+comp+_173)){
_16b=false;
break;
}
}
if(_16b){
break;
}
}
}
}
btn.state("enabled",(!text||btn.text)&&_16b);
if(typeof cmd=="function"){
continue;
}
var _175=this.config.customSelects[cmd];
if((!text||btn.text)&&(typeof _175!="undefined")){
_175.refresh(this);
continue;
}
switch(cmd){
case "fontname":
case "fontsize":
if(!text){
try{
var _176=(""+doc.queryCommandValue(cmd)).toLowerCase();
if(!_176){
btn.element.selectedIndex=0;
break;
}
var _177=this.config[cmd];
var _178=0;
for(var j in _177){
if((j.toLowerCase()==_176)||(_177[j].substr(0,_176.length).toLowerCase()==_176)){
btn.element.selectedIndex=_178;
throw "ok";
}
++_178;
}
btn.element.selectedIndex=0;
}
catch(ex){
}
}
break;
case "formatblock":
var _17a=[];
for(var _17b in this.config.formatblock){
if(typeof this.config.formatblock[_17b]=="string"){
_17a[_17a.length]=this.config.formatblock[_17b];
}
}
var _17c=this._getFirstAncestor(this.getSelection(),_17a);
if(_17c){
for(var x=0;x<_17a.length;x++){
if(_17a[x].toLowerCase()==_17c.tagName.toLowerCase()){
btn.element.selectedIndex=x;
}
}
}else{
btn.element.selectedIndex=0;
}
break;
case "textindicator":
if(!text){
try{
var _17e=btn.element.style;
_17e.backgroundColor=Xinha._makeColor(doc.queryCommandValue(Xinha.is_ie?"backcolor":"hilitecolor"));
if(/transparent/i.test(_17e.backgroundColor)){
_17e.backgroundColor=Xinha._makeColor(doc.queryCommandValue("backcolor"));
}
_17e.color=Xinha._makeColor(doc.queryCommandValue("forecolor"));
_17e.fontFamily=doc.queryCommandValue("fontname");
_17e.fontWeight=doc.queryCommandState("bold")?"bold":"normal";
_17e.fontStyle=doc.queryCommandState("italic")?"italic":"normal";
}
catch(ex){
}
}
break;
case "htmlmode":
btn.state("active",text);
break;
case "lefttoright":
case "righttoleft":
var _17f=this.getParentElement();
while(_17f&&!Xinha.isBlockElement(_17f)){
_17f=_17f.parentNode;
}
if(_17f){
btn.state("active",(_17f.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 _180=this;
this._timerUndo=setTimeout(function(){
_180._timerUndo=null;
},this.config.undoTimeout);
}
this.firePluginEvent("onUpdateToolbar");
};
Xinha.getEditor=function(ref){
for(var i=__xinhas.length;i--;){
var _183=__xinhas[i];
if(_183&&(_183._textArea.id==ref||_183._textArea.name==ref||_183._textArea==ref)){
return _183;
}
}
return null;
};
Xinha.prototype.getPluginInstance=function(_184){
if(this.plugins[_184]){
return this.plugins[_184].instance;
}else{
return null;
}
};
Xinha.prototype.getAllAncestors=function(){
var p=this.getParentElement();
var a=[];
while(p&&(p.nodeType==1)&&(p.tagName.toLowerCase()!="body")){
a.push(p);
p=p.parentNode;
}
a.push(this._doc.body);
return a;
};
Xinha.prototype._getFirstAncestor=function(sel,_188){
var prnt=this.activeElement(sel);
if(prnt===null){
try{
prnt=(Xinha.is_ie?this.createRange(sel).parentElement():this.createRange(sel).commonAncestorContainer);
}
catch(ex){
return null;
}
}
if(typeof _188=="string"){
_188=[_188];
}
while(prnt){
if(prnt.nodeType==1){
if(_188===null){
return prnt;
}
for(var _18a=0;_18a<_188.length;++_18a){
if(typeof _188[_18a]=="string"&&_188[_18a]==prnt.tagName.toLowerCase()){
return prnt;
}else{
if(typeof _188[_18a]=="function"&&_188[_18a](this,prnt)){
return prnt;
}
}
}
if(prnt.tagName.toLowerCase()=="body"){
break;
}
if(prnt.tagName.toLowerCase()=="table"){
break;
}
}
prnt=prnt.parentNode;
}
return null;
};
Xinha.prototype._getAncestorBlock=function(sel){
var prnt=(Xinha.is_ie?this.createRange(sel).parentElement:this.createRange(sel).commonAncestorContainer);
while(prnt&&(prnt.nodeType==1)){
switch(prnt.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 prnt;
case "body":
case "noframes":
case "dd":
case "li":
case "th":
case "td":
case "noscript":
return null;
default:
break;
}
}
return null;
};
Xinha.prototype._createImplicitBlock=function(type){
var sel=this.getSelection();
if(Xinha.is_ie){
sel.empty();
}else{
sel.collapseToStart();
}
var rng=this.createRange(sel);
};
Xinha.prototype.surroundHTML=function(_190,_191){
var html=this.getSelectedHTML();
this.insertHTML(_190+html+_191);
};
Xinha.prototype.hasSelectedText=function(){
return this.getSelectedHTML()!=="";
};
Xinha.prototype._comboSelected=function(el,txt){
this.focusEditor();
var _195=el.options[el.selectedIndex].value;
switch(txt){
case "fontname":
case "fontsize":
this.execCommand(txt,false,_195);
break;
case "formatblock":
if(!_195){
this.updateToolbar();
break;
}
if(!Xinha.is_gecko||_195!=="blockquote"){
_195="<"+_195+">";
}
this.execCommand(txt,false,_195);
break;
default:
var _196=this.config.customSelects[txt];
if(typeof _196!="undefined"){
_196.action(this);
}else{
alert("FIXME: combo box "+txt+" not implemented");
}
break;
}
};
Xinha.prototype._colorSelector=function(_197){
var _198=this;
if(Xinha.is_gecko){
try{
_198._doc.execCommand("useCSS",false,false);
_198._doc.execCommand("styleWithCSS",false,true);
}
catch(ex){
}
}
var btn=_198._toolbarObjects[_197].element;
var _19a;
if(_197=="hilitecolor"){
if(Xinha.is_ie){
_197="backcolor";
_19a=Xinha._colorToRgb(_198._doc.queryCommandValue("backcolor"));
}else{
_19a=Xinha._colorToRgb(_198._doc.queryCommandValue("hilitecolor"));
}
}else{
_19a=Xinha._colorToRgb(_198._doc.queryCommandValue("forecolor"));
}
var _19b=function(_19c){
_198._doc.execCommand(_197,false,_19c);
};
if(Xinha.is_ie){
var _19d=_198.createRange(_198.getSelection());
_19b=function(_19e){
_19d.select();
_198._doc.execCommand(_197,false,_19e);
};
}
var _19f=new Xinha.colorPicker({cellsize:_198.config.colorPickerCellSize,callback:_19b,granularity:_198.config.colorPickerGranularity,websafe:_198.config.colorPickerWebSafe,savecolors:_198.config.colorPickerSaveColors});
_19f.open(_198.config.colorPickerPosition,btn,_19a);
};
Xinha.prototype.execCommand=function(_1a0,UI,_1a2){
var _1a3=this;
this.focusEditor();
_1a0=_1a0.toLowerCase();
if(this.firePluginEvent("onExecCommand",_1a0,UI,_1a2)){
this.updateToolbar();
return false;
}
switch(_1a0){
case "htmlmode":
this.setMode();
break;
case "hilitecolor":
case "forecolor":
this._colorSelector(_1a0);
break;
case "createlink":
this._createLink();
break;
case "undo":
case "redo":
if(this._customUndo){
this[_1a0]();
}else{
this._doc.execCommand(_1a0,UI,_1a2);
}
break;
case "inserttable":
this._insertTable();
break;
case "insertimage":
this._insertImage();
break;
case "showhelp":
this._popupDialog(_1a3.config.URIs.help,null,this);
break;
case "killword":
this._wordClean();
break;
case "cut":
case "copy":
case "paste":
this._doc.execCommand(_1a0,UI,_1a2);
if(this.config.killWordOnPaste){
this._wordClean();
}
break;
case "lefttoright":
case "righttoleft":
if(this.config.changeJustifyWithDirection){
this._doc.execCommand((_1a0=="righttoleft")?"justifyright":"justifyleft",UI,_1a2);
}
var dir=(_1a0=="righttoleft")?"rtl":"ltr";
var el=this.getParentElement();
while(el&&!Xinha.isBlockElement(el)){
el=el.parentNode;
}
if(el){
if(el.style.direction==dir){
el.style.direction="";
}else{
el.style.direction=dir;
}
}
break;
case "justifyleft":
case "justifyright":
_1a0.match(/^justify(.*)$/);
var ae=this.activeElement(this.getSelection());
if(ae&&ae.tagName.toLowerCase()=="img"){
ae.align=ae.align==RegExp.$1?"":RegExp.$1;
}else{
this._doc.execCommand(_1a0,UI,_1a2);
}
break;
default:
try{
this._doc.execCommand(_1a0,UI,_1a2);
}
catch(ex){
if(this.config.debug){
alert(ex+"\n\nby execCommand("+_1a0+");");
}
}
break;
}
this.updateToolbar();
return false;
};
Xinha.prototype._editorEvent=function(ev){
var _1a8=this;
if(typeof _1a8._textArea["on"+ev.type]=="function"){
_1a8._textArea["on"+ev.type](ev);
}
if(this.isKeyEvent(ev)){
if(_1a8.firePluginEvent("onKeyPress",ev)){
return false;
}
if(this.isShortCut(ev)){
this._shortCuts(ev);
}
}
if(ev.type=="mousedown"){
if(_1a8.firePluginEvent("onMouseDown",ev)){
return false;
}
}
if(_1a8._timerToolbar){
clearTimeout(_1a8._timerToolbar);
}
if(!this.suspendUpdateToolbar){
_1a8._timerToolbar=setTimeout(function(){
_1a8.updateToolbar();
_1a8._timerToolbar=null;
},250);
}
};
Xinha.prototype._shortCuts=function(ev){
var key=this.getKey(ev).toLowerCase();
var cmd=null;
var _1ac=null;
switch(key){
case "b":
cmd="bold";
break;
case "i":
cmd="italic";
break;
case "u":
cmd="underline";
break;
case "s":
cmd="strikethrough";
break;
case "l":
cmd="justifyleft";
break;
case "e":
cmd="justifycenter";
break;
case "r":
cmd="justifyright";
break;
case "j":
cmd="justifyfull";
break;
case "z":
cmd="undo";
break;
case "y":
cmd="redo";
break;
case "v":
cmd="paste";
break;
case "n":
cmd="formatblock";
_1ac="p";
break;
case "0":
cmd="killword";
break;
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
cmd="formatblock";
_1ac="h"+key;
break;
}
if(cmd){
this.execCommand(cmd,false,_1ac);
Xinha._stopEvent(ev);
}
};
Xinha.prototype.convertNode=function(el,_1ae){
var _1af=this._doc.createElement(_1ae);
while(el.firstChild){
_1af.appendChild(el.firstChild);
}
return _1af;
};
Xinha.prototype.scrollToElement=function(e){
if(!e){
e=this.getParentElement();
if(!e){
return;
}
}
var _1b1=Xinha.getElementTopLeft(e);
this._iframe.contentWindow.scrollTo(_1b1.left,_1b1.top);
};
Xinha.prototype.getEditorContent=function(){
return this.outwardHtml(this.getHTML());
};
Xinha.prototype.setEditorContent=function(html){
this.setHTML(this.inwardHtml(html));
};
Xinha.updateTextareas=function(){
var e;
for(var i=0;i<__xinhas.length;i++){
e=__xinhas[i];
e._textArea.value=e.getEditorContent();
}
};
Xinha.prototype.getHTML=function(){
var html="";
switch(this._editMode){
case "wysiwyg":
if(!this.config.fullPage){
html=Xinha.getHTML(this._doc.body,false,this).trim();
}else{
html=this.doctype+"\n"+Xinha.getHTML(this._doc.documentElement,true,this);
}
break;
case "textmode":
html=this._textArea.value;
break;
default:
alert("Mode <"+this._editMode+"> not defined!");
return false;
}
return html;
};
Xinha.prototype.outwardHtml=function(html){
for(var i in this.plugins){
var _1b8=this.plugins[i].instance;
if(_1b8&&typeof _1b8.outwardHtml=="function"){
html=_1b8.outwardHtml(html);
}
}
html=html.replace(/<(\/?)b(\s|>|\/)/ig,"<$1strong$2");
html=html.replace(/<(\/?)i(\s|>|\/)/ig,"<$1em$2");
html=html.replace(/<(\/?)strike(\s|>|\/)/ig,"<$1del$2");
html=html.replace(/(<[^>]*on(click|mouse(over|out|up|down))=['"])if\(window\.parent &amp;&amp; window\.parent\.Xinha\)\{return false\}/gi,"$1");
var _1b9=location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/";
html=html.replace(/https?:\/\/null\//g,_1b9);
html=html.replace(/((href|src|background)=[\'\"])\/+/ig,"$1"+_1b9);
html=this.outwardSpecialReplacements(html);
html=this.fixRelativeLinks(html);
if(this.config.sevenBitClean){
html=html.replace(/[^ -~\r\n\t]/g,function(c){
return (c!=Xinha.cc)?"&#"+c.charCodeAt(0)+";":c;
});
}
html=html.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(freezescript)/gi,"$1javascript");
if(this.config.fullPage){
html=Xinha.stripCoreCSS(html);
}
if(typeof this.config.outwardHtml=="function"){
html=this.config.outwardHtml(html);
}
return html;
};
Xinha.prototype.inwardHtml=function(html){
for(var i in this.plugins){
var _1bd=this.plugins[i].instance;
if(_1bd&&typeof _1bd.inwardHtml=="function"){
html=_1bd.inwardHtml(html);
}
}
html=html.replace(/<(\/?)del(\s|>|\/)/ig,"<$1strike$2");
html=html.replace(/(<[^>]*on(click|mouse(over|out|up|down))=["'])/gi,"$1if(window.parent &amp;&amp; window.parent.Xinha){return false}");
html=this.inwardSpecialReplacements(html);
html=html.replace(/(<script[^>]*((type=[\"\']text\/)|(language=[\"\'])))(javascript)/gi,"$1freezescript");
var _1be=new RegExp("((href|src|background)=['\"])/+","gi");
html=html.replace(_1be,"$1"+location.href.replace(/(https?:\/\/[^\/]*)\/.*/,"$1")+"/");
html=this.fixRelativeLinks(html);
if(this.config.fullPage){
html=Xinha.addCoreCSS(html);
}
if(typeof this.config.inwardHtml=="function"){
html=this.config.inwardHtml(html);
}
return html;
};
Xinha.prototype.outwardSpecialReplacements=function(html){
for(var i in this.config.specialReplacements){
var from=this.config.specialReplacements[i];
var to=i;
if(typeof from.replace!="function"||typeof to.replace!="function"){
continue;
}
var reg=new RegExp(Xinha.escapeStringForRegExp(from),"g");
html=html.replace(reg,to.replace(/\$/g,"$$$$"));
}
return html;
};
Xinha.prototype.inwardSpecialReplacements=function(html){
for(var i in this.config.specialReplacements){
var from=i;
var to=this.config.specialReplacements[i];
if(typeof from.replace!="function"||typeof to.replace!="function"){
continue;
}
var reg=new RegExp(Xinha.escapeStringForRegExp(from),"g");
html=html.replace(reg,to.replace(/\$/g,"$$$$"));
}
return html;
};
Xinha.prototype.fixRelativeLinks=function(html){
if(typeof this.config.expandRelativeUrl!="undefined"&&this.config.expandRelativeUrl){
if(html==null){
return "";
}
var src=html.match(/(src|href)="([^"]*)"/gi);
var b=document.location.href;
if(src){
var url,_1cd,_1ce,_1cf,_1d0;
for(var i=0;i<src.length;++i){
url=src[i].match(/(src|href)="([^"]*)"/i);
_1cd=url[2].match(/\.\.\//g);
if(_1cd){
_1ce=new RegExp("(.*?)(([^/]*/){"+_1cd.length+"})[^/]*$");
_1cf=b.match(_1ce);
_1d0=url[2].replace(/(\.\.\/)*/,_1cf[1]);
html=html.replace(new RegExp(Xinha.escapeStringForRegExp(url[2])),_1d0);
}
}
}
}
if(typeof this.config.stripSelfNamedAnchors!="undefined"&&this.config.stripSelfNamedAnchors){
var _1d2=new RegExp("((href|src|background)=\")("+Xinha.escapeStringForRegExp(window.unescape(document.location.href.replace(/&/g,"&amp;")))+")([#?][^'\" ]*)","g");
html=html.replace(_1d2,"$1$4");
}
if(typeof this.config.stripBaseHref!="undefined"&&this.config.stripBaseHref){
var _1d3=null;
if(typeof this.config.baseHref!="undefined"&&this.config.baseHref!==null){
_1d3=new RegExp("((href|src|background|action)=\")("+Xinha.escapeStringForRegExp(this.config.baseHref.replace(/([^\/]\/)(?=.+\.)[^\/]*$/,"$1"))+")","g");
html=html.replace(_1d3,"$1");
}
_1d3=new RegExp("((href|src|background|action)=\")("+Xinha.escapeStringForRegExp(document.location.href.replace(/^(https?:\/\/[^\/]*)(.*)/,"$1"))+")","g");
html=html.replace(_1d3,"$1");
}
return html;
};
Xinha.prototype.getInnerHTML=function(){
if(!this._doc.body){
return "";
}
var html="";
switch(this._editMode){
case "wysiwyg":
if(!this.config.fullPage){
html=this._doc.body.innerHTML;
}else{
html=this.doctype+"\n"+this._doc.documentElement.innerHTML;
}
break;
case "textmode":
html=this._textArea.value;
break;
default:
alert("Mode <"+this._editMode+"> not defined!");
return false;
}
return html;
};
Xinha.prototype.setHTML=function(html){
if(!this.config.fullPage){
this._doc.body.innerHTML=html;
}else{
this.setFullHTML(html);
}
this._textArea.value=html;
};
Xinha.prototype.setDoctype=function(_1d6){
this.doctype=_1d6;
};
Xinha._object=null;
Array.prototype.isArray=true;
RegExp.prototype.isRegExp=true;
Xinha.cloneObject=function(obj){
if(!obj){
return null;
}
var _1d8=obj.isArray?[]:{};
if(obj.constructor.toString().match(/\s*function Function\(/)||typeof obj=="function"){
_1d8=obj;
}else{
if(obj.isRegExp){
_1d8=eval(obj.toString());
}else{
for(var n in obj){
var node=obj[n];
if(typeof node=="object"){
_1d8[n]=Xinha.cloneObject(node);
}else{
_1d8[n]=node;
}
}
}
}
return _1d8;
};
Xinha.flushEvents=function(){
var x=0;
var e=Xinha._eventFlushers.pop();
while(e){
try{
if(e.length==3){
Xinha._removeEvent(e[0],e[1],e[2]);
x++;
}else{
if(e.length==2){
e[0]["on"+e[1]]=null;
e[0]._xinha_dom0Events[e[1]]=null;
x++;
}
}
}
catch(ex){
}
e=Xinha._eventFlushers.pop();
}
};
Xinha._eventFlushers=[];
if(document.addEventListener){
Xinha._addEvent=function(el,_1de,func){
el.addEventListener(_1de,func,false);
Xinha._eventFlushers.push([el,_1de,func]);
};
Xinha._removeEvent=function(el,_1e1,func){
el.removeEventListener(_1e1,func,false);
};
Xinha._stopEvent=function(ev){
ev.preventDefault();
ev.stopPropagation();
};
}else{
if(document.attachEvent){
Xinha._addEvent=function(el,_1e5,func){
el.attachEvent("on"+_1e5,func);
Xinha._eventFlushers.push([el,_1e5,func]);
};
Xinha._removeEvent=function(el,_1e8,func){
el.detachEvent("on"+_1e8,func);
};
Xinha._stopEvent=function(ev){
try{
ev.cancelBubble=true;
ev.returnValue=false;
}
catch(ex){
}
};
}else{
Xinha._addEvent=function(el,_1ec,func){
alert("_addEvent is not supported");
};
Xinha._removeEvent=function(el,_1ef,func){
alert("_removeEvent is not supported");
};
Xinha._stopEvent=function(ev){
alert("_stopEvent is not supported");
};
}
}
Xinha._addEvents=function(el,evs,func){
for(var i=evs.length;--i>=0;){
Xinha._addEvent(el,evs[i],func);
}
};
Xinha._removeEvents=function(el,evs,func){
for(var i=evs.length;--i>=0;){
Xinha._removeEvent(el,evs[i],func);
}
};
Xinha.addOnloadHandler=function(func,_1fb){
_1fb=_1fb?_1fb:window;
var init=function(){
if(arguments.callee.done){
return;
}
arguments.callee.done=true;
if(Xinha.onloadTimer){
clearInterval(Xinha.onloadTimer);
}
func();
};
if(Xinha.is_ie){
document.attachEvent("onreadystatechange",function(){
if(document.readyState==="complete"){
document.detachEvent("onreadystatechange",arguments.callee);
init();
}
});
if(document.documentElement.doScroll&&typeof window.frameElement==="undefined"){
(function(){
if(arguments.callee.done){
return;
}
try{
document.documentElement.doScroll("left");
}
catch(error){
setTimeout(arguments.callee,0);
return;
}
init();
})();
}
}else{
if(/applewebkit|KHTML/i.test(navigator.userAgent)){
Xinha.onloadTimer=_1fb.setInterval(function(){
if(/loaded|complete/.test(_1fb.document.readyState)){
init();
}
},10);
}else{
_1fb.document.addEventListener("DOMContentLoaded",init,false);
}
}
Xinha._addEvent(_1fb,"load",init);
};
Xinha.addDom0Event=function(el,ev,fn){
Xinha._prepareForDom0Events(el,ev);
el._xinha_dom0Events[ev].unshift(fn);
};
Xinha.prependDom0Event=function(el,ev,fn){
Xinha._prepareForDom0Events(el,ev);
el._xinha_dom0Events[ev].push(fn);
};
Xinha.getEvent=function(ev){
return ev||window.event;
};
Xinha._prepareForDom0Events=function(el,ev){
if(typeof el._xinha_dom0Events=="undefined"){
el._xinha_dom0Events={};
Xinha.freeLater(el,"_xinha_dom0Events");
}
if(typeof el._xinha_dom0Events[ev]=="undefined"){
el._xinha_dom0Events[ev]=[];
if(typeof el["on"+ev]=="function"){
el._xinha_dom0Events[ev].push(el["on"+ev]);
}
el["on"+ev]=function(_206){
var a=el._xinha_dom0Events[ev];
var _208=true;
for(var i=a.length;--i>=0;){
el._xinha_tempEventHandler=a[i];
if(el._xinha_tempEventHandler(_206)===false){
el._xinha_tempEventHandler=null;
_208=false;
break;
}
el._xinha_tempEventHandler=null;
}
return _208;
};
Xinha._eventFlushers.push([el,ev]);
}
};
Xinha.prototype.notifyOn=function(ev,fn){
if(typeof this._notifyListeners[ev]=="undefined"){
this._notifyListeners[ev]=[];
Xinha.freeLater(this,"_notifyListeners");
}
this._notifyListeners[ev].push(fn);
};
Xinha.prototype.notifyOf=function(ev,args){
if(this._notifyListeners[ev]){
for(var i=0;i<this._notifyListeners[ev].length;i++){
this._notifyListeners[ev][i](ev,args);
}
}
};
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(el){
return el&&el.nodeType==1&&(Xinha._blockTags.indexOf(" "+el.tagName.toLowerCase()+" ")!=-1);
};
Xinha._paraContainerTags=" body td th caption fieldset div ";
Xinha.isParaContainer=function(el){
return el&&el.nodeType==1&&(Xinha._paraContainerTags.indexOf(" "+el.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(el){
return el&&el.nodeType==1&&(Xinha._closingTags.indexOf(" "+el.tagName.toLowerCase()+" ")!=-1);
};
Xinha.htmlEncode=function(str){
if(!str){
return "";
}
if(typeof str.replace=="undefined"){
str=str.toString();
}
str=str.replace(/&/ig,"&amp;");
str=str.replace(/</ig,"&lt;");
str=str.replace(/>/ig,"&gt;");
str=str.replace(/\xA0/g,"&nbsp;");
str=str.replace(/\x22/g,"&quot;");
return str;
};
Xinha.prototype.stripBaseURL=function(_213){
if(this.config.baseHref===null||!this.config.stripBaseHref){
return _213;
}
var _214=this.config.baseHref.replace(/^(https?:\/\/[^\/]+)(.*)$/,"$1");
var _215=new RegExp(_214);
return _213.replace(_215,"");
};
if(typeof String.prototype.trim!="function"){
String.prototype.trim=function(){
return this.replace(/^\s+/,"").replace(/\s+$/,"");
};
}
Xinha._makeColor=function(v){
if(typeof v!="number"){
return v;
}
var r=v&255;
var g=(v>>8)&255;
var b=(v>>16)&255;
return "rgb("+r+","+g+","+b+")";
};
Xinha._colorToRgb=function(v){
if(!v){
return "";
}
var r,g,b;
function hex(d){
return (d<16)?("0"+d.toString(16)):d.toString(16);
};
if(typeof v=="number"){
r=v&255;
g=(v>>8)&255;
b=(v>>16)&255;
return "#"+hex(r)+hex(g)+hex(b);
}
if(v.substr(0,3)=="rgb"){
var re=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;
if(v.match(re)){
r=parseInt(RegExp.$1,10);
g=parseInt(RegExp.$2,10);
b=parseInt(RegExp.$3,10);
return "#"+hex(r)+hex(g)+hex(b);
}
return null;
}
if(v.substr(0,1)=="#"){
return v;
}
return null;
};
Xinha.prototype._popupDialog=function(url,_221,init){
Dialog(this.popupURL(url),_221,init);
};
Xinha.prototype.imgURL=function(file,_224){
if(typeof _224=="undefined"){
return _editor_url+file;
}else{
return Xinha.getPluginDir(_224)+"/img/"+file;
}
};
Xinha.prototype.popupURL=function(file){
var url="";
if(file.match(/^plugin:\/\/(.*?)\/(.*)/)){
var _227=RegExp.$1;
var _228=RegExp.$2;
if(!/\.(html?|php)$/.test(_228)){
_228+=".html";
}
url=Xinha.getPluginDir(_227)+"/popups/"+_228;
}else{
if(file.match(/^\/.*?/)||file.match(/^https?:\/\//)){
url=file;
}else{
url=_editor_url+this.config.popupURL+file;
}
}
return url;
};
Xinha.getElementById=function(tag,id){
var el,i,objs=document.getElementsByTagName(tag);
for(i=objs.length;--i>=0&&(el=objs[i]);){
if(el.id==id){
return el;
}
}
return null;
};
Xinha.prototype._toggleBorders=function(){
var _22e=this._doc.getElementsByTagName("TABLE");
if(_22e.length!==0){
if(!this.borders){
this.borders=true;
}else{
this.borders=false;
}
for(var i=0;i<_22e.length;i++){
if(this.borders){
Xinha._addClass(_22e[i],"htmtableborders");
}else{
Xinha._removeClass(_22e[i],"htmtableborders");
}
}
}
return true;
};
Xinha.addCoreCSS=function(html){
var _231="<style title=\"XinhaInternalCSS\" type=\"text/css\">"+".htmtableborders, .htmtableborders td, .htmtableborders th {border : 1px dashed lightgrey ! important;}\n"+"html, body { border: 0px; } \n"+"body { background-color: #ffffff; } \n"+"img, hr { cursor: default } \n"+"</style>\n";
if(html&&/<head>/i.test(html)){
return html.replace(/<head>/i,"<head>"+_231);
}else{
if(html){
return _231+html;
}else{
return _231;
}
}
};
Xinha.prototype.addEditorStylesheet=function(_232){
var _233=this._doc.createElement("link");
_233.rel="stylesheet";
_233.type="text/css";
_233.title="XinhaInternalCSS";
_233.href=_232;
this._doc.getElementsByTagName("HEAD")[0].appendChild(_233);
};
Xinha.stripCoreCSS=function(html){
return html.replace(/<style[^>]+title="XinhaInternalCSS"(.|\n)*?<\/style>/ig,"").replace(/<link[^>]+title="XinhaInternalCSS"(.|\n)*?>/ig,"");
};
Xinha._removeClass=function(el,_236){
if(!(el&&el.className)){
return;
}
var cls=el.className.split(" ");
var ar=[];
for(var i=cls.length;i>0;){
if(cls[--i]!=_236){
ar[ar.length]=cls[i];
}
}
el.className=ar.join(" ");
};
Xinha._addClass=function(el,_23b){
Xinha._removeClass(el,_23b);
el.className+=" "+_23b;
};
Xinha.addClasses=function(el,_23d){
if(el!==null){
var _23e=el.className.trim().split(" ");
var ours=_23d.split(" ");
for(var x=0;x<ours.length;x++){
var _241=false;
for(var i=0;_241===false&&i<_23e.length;i++){
if(_23e[i]==ours[x]){
_241=true;
}
}
if(_241===false){
_23e[_23e.length]=ours[x];
}
}
el.className=_23e.join(" ").trim();
}
};
Xinha.removeClasses=function(el,_244){
var _245=el.className.trim().split();
var _246=[];
var _247=_244.trim().split();
for(var i=0;i<_245.length;i++){
var _249=false;
for(var x=0;x<_247.length&&!_249;x++){
if(_245[i]==_247[x]){
_249=true;
}
}
if(!_249){
_246[_246.length]=_245[i];
}
}
return _246.join(" ");
};
Xinha.addClass=Xinha._addClass;
Xinha.removeClass=Xinha._removeClass;
Xinha._addClasses=Xinha.addClasses;
Xinha._removeClasses=Xinha.removeClasses;
Xinha._hasClass=function(el,_24c){
if(!(el&&el.className)){
return false;
}
var cls=el.className.split(" ");
for(var i=cls.length;i>0;){
if(cls[--i]==_24c){
return true;
}
}
return false;
};
Xinha._postback_send_charset=true;
Xinha._postback=function(url,data,_251,_252){
var req=null;
req=Xinha.getXMLHTTPRequestObject();
var _254="";
if(typeof data=="string"){
_254=data;
}else{
if(typeof data=="object"){
for(var i in data){
_254+=(_254.length?"&":"")+i+"="+encodeURIComponent(data[i]);
}
}
}
function callBack(){
if(req.readyState==4){
if(((req.status/100)==2)||Xinha.isRunLocally&&req.status===0){
if(typeof _251=="function"){
_251(req.responseText,req);
}
}else{
if(Xinha._postback_send_charset){
Xinha._postback_send_charset=false;
Xinha._postback(url,data,_251,_252);
}else{
if(typeof _252=="function"){
_252(req);
}else{
alert("An error has occurred: "+req.statusText+"\nURL: "+url);
}
}
}
}
};
req.onreadystatechange=callBack;
req.open("POST",url,true);
req.setRequestHeader("Content-Type","application/x-www-form-urlencoded"+(Xinha._postback_send_charset?"; charset=UTF-8":""));
req.send(_254);
};
Xinha._getback=function(url,_257,_258){
var req=null;
req=Xinha.getXMLHTTPRequestObject();
function callBack(){
if(req.readyState==4){
if(((req.status/100)==2)||Xinha.isRunLocally&&req.status===0){
_257(req.responseText,req);
}else{
if(typeof _258=="function"){
_258(req);
}else{
alert("An error has occurred: "+req.statusText+"\nURL: "+url);
}
}
}
};
req.onreadystatechange=callBack;
req.open("GET",url,true);
req.send(null);
};
Xinha.ping=function(url,_25b,_25c){
var req=null;
req=Xinha.getXMLHTTPRequestObject();
function callBack(){
if(req.readyState==4){
if(((req.status/100)==2)||Xinha.isRunLocally&&req.status===0){
if(_25b){
_25b(req);
}
}else{
if(_25c){
_25c(req);
}
}
}
};
var _25e=(Xinha.is_opera||Xinha.is_ie)?"GET":"HEAD";
req.onreadystatechange=callBack;
req.open(_25e,url,true);
req.send(null);
};
Xinha._geturlcontent=function(url,_260){
var req=null;
req=Xinha.getXMLHTTPRequestObject();
req.open("GET",url,false);
req.send(null);
if(((req.status/100)==2)||Xinha.isRunLocally&&req.status===0){
return (_260)?req.responseXML:req.responseText;
}else{
return "";
}
};
if(typeof dumpValues=="undefined"){
dumpValues=function(o){
var s="";
for(var prop in o){
if(window.console&&typeof window.console.log=="function"){
if(typeof console.firebug!="undefined"){
console.log(o);
}else{
console.log(prop+" = "+o[prop]+"\n");
}
}else{
s+=prop+" = "+o[prop]+"\n";
}
}
if(s){
if(document.getElementById("errors")){
document.getElementById("errors").value+=s;
}else{
var x=window.open("","debugger");
x.document.write("<pre>"+s+"</pre>");
}
}
};
}
if(!Array.prototype.contains){
Array.prototype.contains=function(_266){
var _267=this;
for(var i=0;i<_267.length;i++){
if(_266==_267[i]){
return true;
}
}
return false;
};
}
if(!Array.prototype.indexOf){
Array.prototype.indexOf=function(_269){
var _26a=this;
for(var i=0;i<_26a.length;i++){
if(_269==_26a[i]){
return i;
}
}
return null;
};
}
if(!Array.prototype.append){
Array.prototype.append=function(a){
for(var i=0;i<a.length;i++){
this.push(a[i]);
}
return this;
};
}
if(!Array.prototype.forEach){
Array.prototype.forEach=function(fn){
var len=this.length;
if(typeof fn!="function"){
throw new TypeError();
}
var _270=arguments[1];
for(var i=0;i<len;i++){
if(i in this){
fn.call(_270,this[i],i,this);
}
}
};
}
Xinha.getElementsByClassName=function(el,_273){
if(el.getElementsByClassName){
return Array.prototype.slice.call(el.getElementsByClassName(_273));
}else{
var els=el.getElementsByTagName("*");
var _275=[];
var _276;
for(var i=0;i<els.length;i++){
_276=els[i].className.split(" ");
if(_276.contains(_273)){
_275.push(els[i]);
}
}
return _275;
}
};
Xinha.arrayContainsArray=function(a1,a2){
var _27a=true;
for(var x=0;x<a2.length;x++){
var _27c=false;
for(var i=0;i<a1.length;i++){
if(a1[i]==a2[x]){
_27c=true;
break;
}
}
if(!_27c){
_27a=false;
break;
}
}
return _27a;
};
Xinha.arrayFilter=function(a1,_27f){
var _280=[];
for(var x=0;x<a1.length;x++){
if(_27f(a1[x])){
_280[_280.length]=a1[x];
}
}
return _280;
};
Xinha.collectionToArray=function(_282){
try{
return _282.length?Array.prototype.slice.call(_282):[];
}
catch(e){
}
var _283=[];
for(var i=0;i<_282.length;i++){
_283.push(_282.item(i));
}
return _283;
};
Xinha.uniq_count=0;
Xinha.uniq=function(_285){
return _285+Xinha.uniq_count++;
};
Xinha._loadlang=function(_286,url){
var lang;
if(typeof _editor_lcbackend=="string"){
url=_editor_lcbackend;
url=url.replace(/%lang%/,_editor_lang);
url=url.replace(/%context%/,_286);
}else{
if(!url){
if(_286!="Xinha"){
url=Xinha.getPluginDir(_286)+"/lang/"+_editor_lang+".js";
}else{
Xinha.setLoadingMessage("Loading language");
url=_editor_url+"lang/"+_editor_lang+".js";
}
}
}
var _289=Xinha._geturlcontent(url);
if(_289!==""){
try{
eval("lang = "+_289);
}
catch(ex){
alert("Error reading Language-File ("+url+"):\n"+Error.toString());
lang={};
}
}else{
lang={};
}
return lang;
};
Xinha._lc=function(_28a,_28b,_28c){
var url,ret;
if(typeof _28b=="object"&&_28b.url&&_28b.context){
url=_28b.url+_editor_lang+".js";
_28b=_28b.context;
}
var m=null;
if(typeof _28a=="string"){
m=_28a.match(/\$(.*?)=(.*?)\$/g);
}
if(m){
if(!_28c){
_28c={};
}
for(var i=0;i<m.length;i++){
var n=m[i].match(/\$(.*?)=(.*?)\$/);
_28c[n[1]]=n[2];
_28a=_28a.replace(n[0],"$"+n[1]);
}
}
if(_editor_lang=="en"){
if(typeof _28a=="object"&&_28a.string){
ret=_28a.string;
}else{
ret=_28a;
}
}else{
if(typeof Xinha._lc_catalog=="undefined"){
Xinha._lc_catalog=[];
}
if(typeof _28b=="undefined"){
_28b="Xinha";
}
if(typeof Xinha._lc_catalog[_28b]=="undefined"){
Xinha._lc_catalog[_28b]=Xinha._loadlang(_28b,url);
}
var key;
if(typeof _28a=="object"&&_28a.key){
key=_28a.key;
}else{
if(typeof _28a=="object"&&_28a.string){
key=_28a.string;
}else{
key=_28a;
}
}
if(typeof Xinha._lc_catalog[_28b][key]=="undefined"){
if(_28b=="Xinha"){
if(typeof _28a=="object"&&_28a.string){
ret=_28a.string;
}else{
ret=_28a;
}
}else{
return Xinha._lc(_28a,"Xinha",_28c);
}
}else{
ret=Xinha._lc_catalog[_28b][key];
}
}
if(typeof _28a=="object"&&_28a.replace){
_28c=_28a.replace;
}
if(typeof _28c!="undefined"){
for(i in _28c){
ret=ret.replace("$"+i,_28c[i]);
}
}
return ret;
};
Xinha.hasDisplayedChildren=function(el){
var _294=el.childNodes;
for(var i=0;i<_294.length;i++){
if(_294[i].tagName){
if(_294[i].style.display!="none"){
return true;
}
}
}
return false;
};
Xinha._loadback=function(url,_297,_298,_299){
if(document.getElementById(url)){
return true;
}
var t=!Xinha.is_ie?"onload":"onreadystatechange";
var s=document.createElement("script");
s.type="text/javascript";
s.src=url;
s.id=url;
if(_297){
s[t]=function(){
if(Xinha.is_ie&&(!/loaded|complete/.test(window.event.srcElement.readyState))){
return;
}
_297.call(_298?_298:this,_299);
s[t]=null;
};
}
document.getElementsByTagName("head")[0].appendChild(s);
return false;
};
Xinha.makeEditors=function(_29c,_29d,_29e){
if(!Xinha.isSupportedBrowser){
return;
}
if(typeof _29d=="function"){
_29d=_29d();
}
var _29f={};
var _2a0;
for(var x=0;x<_29c.length;x++){
if(typeof _29c[x]=="string"){
_2a0=Xinha.getElementById("textarea",_29c[x]);
if(!_2a0){
_29c[x]=null;
continue;
}
}else{
if(typeof _29c[x]=="object"&&_29c[x].tagName&&_29c[x].tagName.toLowerCase()=="textarea"){
_2a0=_29c[x];
if(!_2a0.id){
_2a0.id="xinha_id_"+x;
}
}
}
var _2a2=new Xinha(_2a0,Xinha.cloneObject(_29d));
_2a2.registerPlugins(_29e);
_29f[_2a0.id]=_2a2;
}
return _29f;
};
Xinha.startEditors=function(_2a3){
if(!Xinha.isSupportedBrowser){
return;
}
for(var i in _2a3){
if(_2a3[i].generate){
_2a3[i].generate();
}
}
};
Xinha.prototype.registerPlugins=function(_2a5){
if(!Xinha.isSupportedBrowser){
return;
}
if(_2a5){
for(var i=0;i<_2a5.length;i++){
this.setLoadingMessage(Xinha._lc("Register plugin $plugin","Xinha",{"plugin":_2a5[i]}));
this.registerPlugin(_2a5[i]);
}
}
};
Xinha.base64_encode=function(_2a7){
var _2a8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _2a9="";
var chr1,chr2,chr3;
var enc1,enc2,enc3,enc4;
var i=0;
do{
chr1=_2a7.charCodeAt(i++);
chr2=_2a7.charCodeAt(i++);
chr3=_2a7.charCodeAt(i++);
enc1=chr1>>2;
enc2=((chr1&3)<<4)|(chr2>>4);
enc3=((chr2&15)<<2)|(chr3>>6);
enc4=chr3&63;
if(isNaN(chr2)){
enc3=enc4=64;
}else{
if(isNaN(chr3)){
enc4=64;
}
}
_2a9=_2a9+_2a8.charAt(enc1)+_2a8.charAt(enc2)+_2a8.charAt(enc3)+_2a8.charAt(enc4);
}while(i<_2a7.length);
return _2a9;
};
Xinha.base64_decode=function(_2b2){
var _2b3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var _2b4="";
var chr1,chr2,chr3;
var enc1,enc2,enc3,enc4;
var i=0;
_2b2=_2b2.replace(/[^A-Za-z0-9\+\/\=]/g,"");
do{
enc1=_2b3.indexOf(_2b2.charAt(i++));
enc2=_2b3.indexOf(_2b2.charAt(i++));
enc3=_2b3.indexOf(_2b2.charAt(i++));
enc4=_2b3.indexOf(_2b2.charAt(i++));
chr1=(enc1<<2)|(enc2>>4);
chr2=((enc2&15)<<4)|(enc3>>2);
chr3=((enc3&3)<<6)|enc4;
_2b4=_2b4+String.fromCharCode(chr1);
if(enc3!=64){
_2b4=_2b4+String.fromCharCode(chr2);
}
if(enc4!=64){
_2b4=_2b4+String.fromCharCode(chr3);
}
}while(i<_2b2.length);
return _2b4;
};
Xinha.removeFromParent=function(el){
if(!el.parentNode){
return;
}
var pN=el.parentNode;
return pN.removeChild(el);
};
Xinha.hasParentNode=function(el){
if(el.parentNode){
if(el.parentNode.nodeType==11){
return false;
}
return true;
}
return false;
};
Xinha.viewportSize=function(_2c0){
_2c0=(_2c0)?_2c0:window;
var x,y;
if(_2c0.innerHeight){
x=_2c0.innerWidth;
y=_2c0.innerHeight;
}else{
if(_2c0.document.documentElement&&_2c0.document.documentElement.clientHeight){
x=_2c0.document.documentElement.clientWidth;
y=_2c0.document.documentElement.clientHeight;
}else{
if(_2c0.document.body){
x=_2c0.document.body.clientWidth;
y=_2c0.document.body.clientHeight;
}
}
}
return {"x":x,"y":y};
};
Xinha.pageSize=function(_2c3){
_2c3=(_2c3)?_2c3:window;
var x,y;
var _2c6=_2c3.document.body.scrollHeight;
var _2c7=_2c3.document.documentElement.scrollHeight;
if(_2c6>_2c7){
x=_2c3.document.body.scrollWidth;
y=_2c3.document.body.scrollHeight;
}else{
x=_2c3.document.documentElement.scrollWidth;
y=_2c3.document.documentElement.scrollHeight;
}
return {"x":x,"y":y};
};
Xinha.prototype.scrollPos=function(_2c8){
_2c8=(_2c8)?_2c8:window;
var x,y;
if(typeof _2c8.pageYOffset!="undefined"){
x=_2c8.pageXOffset;
y=_2c8.pageYOffset;
}else{
if(_2c8.document.documentElement&&typeof document.documentElement.scrollTop!="undefined"){
x=_2c8.document.documentElement.scrollLeft;
y=_2c8.document.documentElement.scrollTop;
}else{
if(_2c8.document.body){
x=_2c8.document.body.scrollLeft;
y=_2c8.document.body.scrollTop;
}
}
}
return {"x":x,"y":y};
};
Xinha.getElementTopLeft=function(_2cb){
var _2cc=0;
var _2cd=0;
if(_2cb.offsetParent){
_2cc=_2cb.offsetLeft;
_2cd=_2cb.offsetTop;
while(_2cb=_2cb.offsetParent){
_2cc+=_2cb.offsetLeft;
_2cd+=_2cb.offsetTop;
}
}
return {top:_2cd,left:_2cc};
};
Xinha.findPosX=function(obj){
var _2cf=0;
if(obj.offsetParent){
return Xinha.getElementTopLeft(obj).left;
}else{
if(obj.x){
_2cf+=obj.x;
}
}
return _2cf;
};
Xinha.findPosY=function(obj){
var _2d1=0;
if(obj.offsetParent){
return Xinha.getElementTopLeft(obj).top;
}else{
if(obj.y){
_2d1+=obj.y;
}
}
return _2d1;
};
Xinha.createLoadingMessages=function(_2d2){
if(Xinha.loadingMessages||!Xinha.isSupportedBrowser){
return;
}
Xinha.loadingMessages=[];
for(var i=0;i<_2d2.length;i++){
if(!document.getElementById(_2d2[i])){
continue;
}
Xinha.loadingMessages.push(Xinha.createLoadingMessage(Xinha.getElementById("textarea",_2d2[i])));
}
};
Xinha.createLoadingMessage=function(_2d4,text){
if(document.getElementById("loading_"+_2d4.id)||!Xinha.isSupportedBrowser){
return;
}
var _2d6=document.createElement("div");
_2d6.id="loading_"+_2d4.id;
_2d6.className="loading";
_2d6.style.left=(Xinha.findPosX(_2d4)+_2d4.offsetWidth/2)-106+"px";
_2d6.style.top=(Xinha.findPosY(_2d4)+_2d4.offsetHeight/2)-50+"px";
var _2d7=document.createElement("div");
_2d7.className="loading_main";
_2d7.id="loading_main_"+_2d4.id;
_2d7.appendChild(document.createTextNode(Xinha._lc("Loading in progress. Please wait!")));
var _2d8=document.createElement("div");
_2d8.className="loading_sub";
_2d8.id="loading_sub_"+_2d4.id;
text=text?text:Xinha._lc("Loading Core");
_2d8.appendChild(document.createTextNode(text));
_2d6.appendChild(_2d7);
_2d6.appendChild(_2d8);
document.body.appendChild(_2d6);
Xinha.freeLater(_2d6);
Xinha.freeLater(_2d7);
Xinha.freeLater(_2d8);
return _2d8;
};
Xinha.prototype.setLoadingMessage=function(_2d9,_2da){
if(!document.getElementById("loading_sub_"+this._textArea.id)){
return;
}
document.getElementById("loading_main_"+this._textArea.id).innerHTML=_2da?_2da:Xinha._lc("Loading in progress. Please wait!");
document.getElementById("loading_sub_"+this._textArea.id).innerHTML=_2d9;
};
Xinha.setLoadingMessage=function(_2db){
if(!Xinha.loadingMessages){
return;
}
for(var i=0;i<Xinha.loadingMessages.length;i++){
Xinha.loadingMessages[i].innerHTML=_2db;
}
};
Xinha.prototype.removeLoadingMessage=function(){
if(document.getElementById("loading_"+this._textArea.id)){
document.body.removeChild(document.getElementById("loading_"+this._textArea.id));
}
};
Xinha.removeLoadingMessages=function(_2dd){
for(var i=0;i<_2dd.length;i++){
if(!document.getElementById(_2dd[i])){
continue;
}
var main=document.getElementById("loading_"+document.getElementById(_2dd[i]).id);
main.parentNode.removeChild(main);
}
Xinha.loadingMessages=null;
};
Xinha.toFree=[];
Xinha.freeLater=function(obj,prop){
Xinha.toFree.push({o:obj,p:prop});
};
Xinha.free=function(obj,prop){
if(obj&&!prop){
for(var p in obj){
Xinha.free(obj,p);
}
}else{
if(obj){
if(prop.indexOf("src")==-1){
try{
obj[prop]=null;
}
catch(x){
}
}
}
}
};
Xinha.collectGarbageForIE=function(){
Xinha.flushEvents();
for(var x=0;x<Xinha.toFree.length;x++){
Xinha.free(Xinha.toFree[x].o,Xinha.toFree[x].p);
Xinha.toFree[x].o=null;
}
};
Xinha.prototype.insertNodeAtSelection=function(_2e6){
Xinha.notImplemented("insertNodeAtSelection");
};
Xinha.prototype.getParentElement=function(sel){
Xinha.notImplemented("getParentElement");
};
Xinha.prototype.activeElement=function(sel){
Xinha.notImplemented("activeElement");
};
Xinha.prototype.selectionEmpty=function(sel){
Xinha.notImplemented("selectionEmpty");
};
Xinha.prototype.saveSelection=function(){
Xinha.notImplemented("saveSelection");
};
Xinha.prototype.restoreSelection=function(_2ea){
Xinha.notImplemented("restoreSelection");
};
Xinha.prototype.selectNodeContents=function(node,pos){
Xinha.notImplemented("selectNodeContents");
};
Xinha.prototype.insertHTML=function(html){
Xinha.notImplemented("insertHTML");
};
Xinha.prototype.getSelectedHTML=function(){
Xinha.notImplemented("getSelectedHTML");
};
Xinha.prototype.getSelection=function(){
Xinha.notImplemented("getSelection");
};
Xinha.prototype.createRange=function(sel){
Xinha.notImplemented("createRange");
};
Xinha.prototype.isKeyEvent=function(_2ef){
Xinha.notImplemented("isKeyEvent");
};
Xinha.prototype.isShortCut=function(_2f0){
if(_2f0.ctrlKey&&!_2f0.altKey){
return true;
}
return false;
};
Xinha.prototype.getKey=function(_2f1){
Xinha.notImplemented("getKey");
};
Xinha.getOuterHTML=function(_2f2){
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(e){
Xinha.notImplemented("getXMLHTTPRequestObject");
}
};
Xinha.prototype._activeElement=function(sel){
return this.activeElement(sel);
};
Xinha.prototype._selectionEmpty=function(sel){
return this.selectionEmpty(sel);
};
Xinha.prototype._getSelection=function(){
return this.getSelection();
};
Xinha.prototype._createRange=function(sel){
return this.createRange(sel);
};
HTMLArea=Xinha;
Xinha.init();
if(Xinha.ie_version<8){
Xinha.addDom0Event(window,"unload",Xinha.collectGarbageForIE);
}
Xinha.debugMsg=function(text,_2f7){
if(typeof console!="undefined"&&typeof console.log=="function"){
if(_2f7&&_2f7=="warn"&&typeof console.warn=="function"){
console.warn(text);
}else{
if(_2f7&&_2f7=="info"&&typeof console.info=="function"){
console.info(text);
}else{
console.log(text);
}
}
}else{
if(typeof opera!="undefined"&&typeof opera.postError=="function"){
opera.postError(text);
}
}
};
Xinha.notImplemented=function(_2f8){
throw new Error("Method Not Implemented","Part of Xinha has tried to call the "+_2f8+" method which has not been implemented.");
};


