function TinyMCE_Engine(){
    var a;
    this.majorVersion="2";
    this.minorVersion="1.0";
    this.releaseDate="2007-02-13";
    this.instances=new Array();
    this.switchClassCache=new Array();
    this.windowArgs=new Array();
    this.loadedFiles=new Array();
    this.pendingFiles=new Array();
    this.loadingIndex=0;
    this.configs=new Array();
    this.currentConfig=0;
    this.eventHandlers=new Array();
    this.log=new Array();
    this.undoLevels=[];
    this.undoIndex=0;
    this.typingUndoIndex=-1;
    a=navigator.userAgent;
    this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");
    this.isMSIE5=this.isMSIE&&(a.indexOf("MSIE 5")!=-1);
    this.isMSIE5_0=this.isMSIE&&(a.indexOf("MSIE 5.0")!=-1);
    this.isMSIE7=this.isMSIE&&(a.indexOf("MSIE 7")!=-1);
    this.isGecko=a.indexOf("Gecko")!=-1;
    this.isSafari=a.indexOf("Safari")!=-1;
    this.isOpera=a.indexOf("Opera")!=-1;
    this.isMac=a.indexOf("Mac")!=-1;
    this.isNS7=a.indexOf("Netscape/7")!=-1;
    this.isNS71=a.indexOf("Netscape/7.1")!=-1;
    this.dialogCounter=0;
    this.plugins=new Array();
    this.themes=new Array();
    this.menus=new Array();
    this.loadedPlugins=new Array();
    this.buttonMap=new Array();
    this.isLoaded=false;
    if(this.isOpera){
        this.isMSIE=true;
        this.isGecko=false;
        this.isSafari=false
        }
        this.isIE=this.isMSIE;
    this.isRealIE=this.isMSIE&&!this.isOpera;
    this.idCounter=0
    }
    TinyMCE_Engine.prototype={
    init:function(l){
        var o,f,v="",q;
        if(this.isMSIE5_0){
            return
        }
        this.settings=l;
        if(typeof(document.execCommand)=="undefined"){
            return
        }
        if(!tinyMCE.baseURL){
            var d=document.getElementsByTagName("script");
            f=document.getElementsByTagName("base");
            for(q=0;q<f.length;q++){
                if(f[q].href){
                    v=f[q].href
                    }
                }
            for(var q=0;q<d.length;q++){
            if(d[q].src&&(d[q].src.indexOf("tiny_mce.js")!=-1||d[q].src.indexOf("tiny_mce_dev.js")!=-1||d[q].src.indexOf("tiny_mce_src.js")!=-1||d[q].src.indexOf("tiny_mce_gzip")!=-1)){
                var a=d[q].src;
                tinyMCE.srcMode=(a.indexOf("_src")!=-1||a.indexOf("_dev")!=-1)?"_src":"";
                tinyMCE.gzipMode=a.indexOf("_gzip")!=-1;
                a=a.substring(0,a.lastIndexOf("/"));
                if(l.exec_mode=="src"||l.exec_mode=="normal"){
                    tinyMCE.srcMode=l.exec_mode=="src"?"_src":""
                    }
                    if(v!=""&&a.indexOf("://")==-1){
                    tinyMCE.baseURL=v+a
                    }else{
                    tinyMCE.baseURL=a
                    }
                    break
            }
        }
        }
    this.documentBasePath=document.location.href;
if(this.documentBasePath.indexOf("?")!=-1){
    this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf("?"))
    }
    this.documentURL=this.documentBasePath;
this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf("/"));
if(tinyMCE.baseURL.indexOf("://")==-1&&tinyMCE.baseURL.charAt(0)!="/"){
    tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL
    }
    this._def("mode","none");
this._def("theme","advanced");
this._def("plugins","",true);
this._def("language","it");
this._def("docs_language",this.settings.language);
this._def("elements","");
this._def("textarea_trigger","mce_editable");
this._def("editor_selector","");
this._def("editor_deselector","mceNoEditor");
this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");
this._def("extended_valid_elements","");
this._def("invalid_elements","");
this._def("encoding","");
this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));
this._def("save_callback","");
this._def("debug",false);
this._def("force_br_newlines",false);
this._def("force_p_newlines",true);
this._def("add_form_submit_trigger",true);
this._def("relative_urls",true);
this._def("remove_script_host",true);
this._def("focus_alert",true);
this._def("document_base_url",this.documentURL);
this._def("visual",true);
this._def("visual_table_class","mceVisualAid");
this._def("setupcontent_callback","");
this._def("fix_content_duplication",true);
this._def("custom_undo_redo",true);
this._def("custom_undo_redo_levels",-1);
this._def("custom_undo_redo_keyboard_shortcuts",true);
this._def("custom_undo_redo_restore_selection",true);
this._def("custom_undo_redo_global",false);
this._def("verify_html",true);
this._def("apply_source_formatting",false);
this._def("directionality","ltr");
this._def("cleanup_on_startup",false);
this._def("inline_styles",false);
this._def("convert_newlines_to_brs",false);
this._def("auto_reset_designmode",true);
this._def("entities","39,#39,160,nbsp,161,iexcl,162,cent,163,pound,164,curren,165,yen,166,brvbar,167,sect,168,uml,169,copy,170,ordf,171,laquo,172,not,173,shy,174,reg,175,macr,176,deg,177,plusmn,178,sup2,179,sup3,180,acute,181,micro,182,para,183,middot,184,cedil,185,sup1,186,ordm,187,raquo,188,frac14,189,frac12,190,frac34,191,iquest,192,Agrave,193,Aacute,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,201,Eacute,202,Ecirc,203,Euml,204,Igrave,205,Iacute,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,211,Oacute,212,Ocirc,213,Otilde,214,Ouml,215,times,216,Oslash,217,Ugrave,218,Uacute,219,Ucirc,220,Uuml,221,Yacute,222,THORN,223,szlig,224,agrave,225,aacute,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,233,eacute,234,ecirc,235,euml,236,igrave,237,iacute,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,243,oacute,244,ocirc,245,otilde,246,ouml,247,divide,248,oslash,249,ugrave,250,uacute,251,ucirc,252,uuml,253,yacute,254,thorn,255,yuml,402,fnof,913,Alpha,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,977,thetasym,978,upsih,982,piv,8226,bull,8230,hellip,8242,prime,8243,Prime,8254,oline,8260,frasl,8472,weierp,8465,image,8476,real,8482,trade,8501,alefsym,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8704,forall,8706,part,8707,exist,8709,empty,8711,nabla,8712,isin,8713,notin,8715,ni,8719,prod,8721,sum,8722,minus,8727,lowast,8730,radic,8733,prop,8734,infin,8736,ang,8743,and,8744,or,8745,cap,8746,cup,8747,int,8756,there4,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8804,le,8805,ge,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,34,quot,38,amp,60,lt,62,gt,338,OElig,339,oelig,352,Scaron,353,scaron,376,Yuml,710,circ,732,tilde,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,8211,ndash,8212,mdash,8216,lsquo,8217,rsquo,8218,sbquo,8220,ldquo,8221,rdquo,8222,bdquo,8224,dagger,8225,Dagger,8240,permil,8249,lsaquo,8250,rsaquo,8364,euro",true);
this._def("entity_encoding","named");
this._def("cleanup_callback","");
this._def("add_unload_trigger",true);
this._def("ask",false);
this._def("nowrap",false);
this._def("auto_resize",false);
this._def("auto_focus",false);
this._def("cleanup",true);
this._def("remove_linebreaks",true);
this._def("button_tile_map",false);
this._def("submit_patch",true);
this._def("browsers","msie,safari,gecko,opera",true);
this._def("dialog_type","window");
this._def("accessibility_warnings",true);
this._def("accessibility_focus",true);
this._def("merge_styles_invalid_parents","");
this._def("force_hex_style_colors",true);
this._def("trim_span_elements",true);
this._def("convert_fonts_to_spans",false);
this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
this._def("font_size_classes","");
this._def("font_size_style_values","xx-small,x-small,small,medium,large,x-large,xx-large",true);
this._def("event_elements","a,img",true);
this._def("convert_urls",true);
this._def("table_inline_editing",false);
this._def("object_resizing",true);
this._def("custom_shortcuts",true);
this._def("convert_on_click",false);
this._def("content_css","");
this._def("fix_list_elements",true);
this._def("fix_table_elements",false);
this._def("strict_loading_mode",document.contentType=="application/xhtml+xml");
this._def("hidden_tab_class","");
this._def("display_tab_class","");
this._def("gecko_spellcheck",false);
this._def("hide_selects_on_submit",true);
if(this.isMSIE&&!this.isOpera){
    this.settings.strict_loading_mode=false
    }
    if(this.isMSIE&&this.settings.browsers.indexOf("msie")==-1){
    return
}
if(this.isGecko&&this.settings.browsers.indexOf("gecko")==-1){
    return
}
if(this.isSafari&&this.settings.browsers.indexOf("safari")==-1){
    return
}
if(this.isOpera&&this.settings.browsers.indexOf("opera")==-1){
    return
}
v=tinyMCE.settings.document_base_url;
var s=document.location.href;
var j=s.indexOf("://");
if(j>0&&document.location.protocol!="file:"){
    j=s.indexOf("/",j+3);
    s=s.substring(0,j);
    if(v.indexOf("://")==-1){
        v=s+v
        }
        tinyMCE.settings.document_base_url=v;
    tinyMCE.settings.document_base_prefix=s
    }
    if(v.indexOf("?")!=-1){
    v=v.substring(0,v.indexOf("?"))
    }
    this.settings.base_href=v.substring(0,v.lastIndexOf("/"))+"/";
o=this.settings.theme;
this.inlineStrict="A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment";
this.inlineTransitional="A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment";
this.blockElms="H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP";
this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");
this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);
this.uniqueURL="javascript:void(091039730);";
this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';
this.callbacks=new Array("onInit","getInfo","getEditorTemplate","setupContent","onChange","onPageLoad","handleNodeChange","initInstance","execCommand","getControlHTML","handleEvent","cleanup","removeInstance");
this.settings.theme_href=tinyMCE.baseURL+"/themes/"+o;
if(!tinyMCE.isIE||tinyMCE.isOpera){
    this.settings.force_br_newlines=false
    }
    if(tinyMCE.getParam("popups_css",false)){
    var m=tinyMCE.getParam("popups_css","");
    if(m.indexOf("://")==-1&&m.charAt(0)!="/"){
        this.settings.popups_css=this.documentBasePath+"/"+m
        }else{
        this.settings.popups_css=m
        }
    }else{
    this.settings.popups_css=tinyMCE.baseURL+"/themes/"+o+"/css/editor_popup.css"
    }
    if(tinyMCE.getParam("editor_css",false)){
    var m=tinyMCE.getParam("editor_css","");
    if(m.indexOf("://")==-1&&m.charAt(0)!="/"){
        this.settings.editor_css=this.documentBasePath+"/"+m
        }else{
        this.settings.editor_css=m
        }
    }else{
    if(this.settings.editor_css!=""){
        this.settings.editor_css=tinyMCE.baseURL+"/themes/"+o+"/css/editor_ui.css"
        }
    }
if(tinyMCE.settings.debug){
    var k="Debug: \n";
    k+="baseURL: "+this.baseURL+"\n";
    k+="documentBasePath: "+this.documentBasePath+"\n";
    k+="content_css: "+this.settings.content_css+"\n";
    k+="popups_css: "+this.settings.popups_css+"\n";
    k+="editor_css: "+this.settings.editor_css+"\n";
    alert(k)
    }
    if(this.configs.length==0){
    if(typeof(TinyMCECompressed)=="undefined"){
        tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);
        if(tinyMCE.isRealIE){
            if(document.body){
                tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad)
                }else{
                tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)
                }
            }
        tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);
    tinyMCE._addUnloadEvents()
    }
}
this.loadScript(tinyMCE.baseURL+"/themes/"+this.settings.theme+"/editor_template"+tinyMCE.srcMode+".js");
this.loadScript(tinyMCE.baseURL+"/langs/"+this.settings.language+".js");
this.loadCSS(this.settings.editor_css);
var j=tinyMCE.getParam("plugins","",true,",");
if(j.length>0){
    for(var q=0;q<j.length;q++){
        if(j[q].charAt(0)!="-"){
            this.loadScript(tinyMCE.baseURL+"/plugins/"+j[q]+"/editor_plugin"+tinyMCE.srcMode+".js")
            }
        }
    }
if(tinyMCE.getParam("entity_encoding")=="named"){
    l.cleanup_entities=new Array();
    var t=tinyMCE.getParam("entities","",true,",");
    for(var q=0;q<t.length;q+=2){
        l.cleanup_entities["c"+t[q]]=t[q+1]
        }
    }
    l.index=this.configs.length;
this.configs[this.configs.length]=l;
this.loadNextScript();
if(this.isIE&&!this.isOpera){
    try{
        document.execCommand("BackgroundImageCache",false,true)
        }catch(u){}
}
this.xmlEncodeAposRe=new RegExp("[<>&\"']","g");
this.xmlEncodeRe=new RegExp('[<>&"]',"g")
},
_addUnloadEvents:function(){
    if(tinyMCE.isIE){
        if(tinyMCE.settings.add_unload_trigger){
            tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);
            tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)
            }
        }else{
    if(tinyMCE.settings.add_unload_trigger){
        tinyMCE.addEvent(window,"unload",function(){
            tinyMCE.triggerSave(true,true)
            })
        }
    }
},
_def:function(f,d,e){
    var a=tinyMCE.getParam(f,d);
    a=e?a.replace(/\s+/g,""):a;
    this.settings[f]=a
    },
hasPlugin:function(a){
    return typeof(this.plugins[a])!="undefined"&&this.plugins[a]!=null
    },
addPlugin:function(e,a){
    var d=this.plugins[e];
    a.baseURL=d?d.baseURL:tinyMCE.baseURL+"/plugins/"+e;
    this.plugins[e]=a;
    this.loadNextScript()
    },
setPluginBaseURL:function(e,a){
    var d=this.plugins[e];
    if(d){
        d.baseURL=a
        }else{
        this.plugins[e]={
            baseURL:a
        }
    }
},
loadPlugin:function(d,a){
    a=a.indexOf(".js")!=-1?a.substring(0,a.lastIndexOf("/")):a;
    a=a.charAt(a.length-1)=="/"?a.substring(0,a.length-1):a;
    this.plugins[d]={
        baseURL:a
    };

    this.loadScript(a+"/editor_plugin"+(tinyMCE.srcMode?"_src":"")+".js")
    },
hasTheme:function(a){
    return typeof(this.themes[a])!="undefined"&&this.themes[a]!=null
    },
addTheme:function(d,a){
    this.themes[d]=a;
    this.loadNextScript()
    },
addMenu:function(d,a){
    this.menus[d]=a
    },
hasMenu:function(a){
    return typeof(this.plugins[a])!="undefined"&&this.plugins[a]!=null
    },
loadScript:function(a){
    var d;
    for(d=0;d<this.loadedFiles.length;d++){
        if(this.loadedFiles[d]==a){
            return
        }
    }
    if(tinyMCE.settings.strict_loading_mode){
    this.pendingFiles[this.pendingFiles.length]=a
    }else{
    document.write('<script language="javascript" type="text/javascript" src="'+a+'"><\/script>')
    }
    this.loadedFiles[this.loadedFiles.length]=a
},
loadNextScript:function(){
    var e=document,a;
    if(!tinyMCE.settings.strict_loading_mode){
        return
    }
    if(this.loadingIndex<this.pendingFiles.length){
        a=e.createElementNS("http://www.w3.org/1999/xhtml","script");
        a.setAttribute("language","javascript");
        a.setAttribute("type","text/javascript");
        a.setAttribute("src",this.pendingFiles[this.loadingIndex++]);
        e.getElementsByTagName("head")[0].appendChild(a)
        }else{
        this.loadingIndex=-1
        }
    },
loadCSS:function(e){
    var f=e.replace(/\s+/,"").split(",");
    var j=0,m=0;
    var l=false;
    var k=0,h=0,d,a;
    for(k=0,m=f.length;k<m;k++){
        if(f[k]!=null&&f[k]!="null"&&f[k].length>0){
            for(h=0,j=this.loadedFiles.length;h<j;h++){
                if(this.loadedFiles[h]==f[k]){
                    l=true;
                    break
                }
            }
            if(!l){
            if(tinyMCE.settings.strict_loading_mode){
                d=document.getElementsByTagName("head");
                a=document.createElement("link");
                a.setAttribute("href",f[k]);
                a.setAttribute("rel","stylesheet");
                a.setAttribute("type","text/css");
                d[0].appendChild(a)
                }else{
                document.write('<link href="'+f[k]+'" rel="stylesheet" type="text/css" />')
                }
                this.loadedFiles[this.loadedFiles.length]=f[k]
            }
        }
    }
},
importCSS:function(j,h){
    var f=h.replace(/\s+/,"").split(",");
    var i,k,d,a,e;
    for(a=0,i=f.length;a<i;a++){
        e=f[a];
        if(e!=null&&e!="null"&&e.length>0){
            if(e.indexOf("://")==-1&&e.charAt(0)!="/"){
                e=this.documentBasePath+"/"+e
                }
                if(typeof(j.createStyleSheet)=="undefined"){
                k=j.createElement("link");
                k.rel="stylesheet";
                k.href=e;
                if((d=j.getElementsByTagName("head"))!=null&&d.length>0){
                    d[0].appendChild(k)
                    }
                }else{
            j.createStyleSheet(e)
            }
        }
    }
},
confirmAdd:function(f,d){
    var h=tinyMCE.isIE?event.srcElement:f.target;
    var a=h.name?h.name:h.id;
    tinyMCE.settings=d;
    if(tinyMCE.settings.convert_on_click||(!h.getAttribute("mce_noask")&&confirm(tinyMCELang.lang_edit_confirm))){
        tinyMCE.addMCEControl(h,a)
        }
        h.setAttribute("mce_noask","true")
    },
updateContent:function(a){
    var d=document.getElementById(a);
    for(var h in tinyMCE.instances){
        var e=tinyMCE.instances[h];
        if(!tinyMCE.isInstance(e)){
            continue
        }
        e.switchSettings();
        if(e.formElement==d){
            var f=e.getDoc();
            tinyMCE._setHTML(f,e.formElement.value);
            if(!tinyMCE.isIE){
                f.body.innerHTML=tinyMCE._cleanupHTML(e,f,this.settings,f.body,e.visualAid)
                }
            }
    }
    },
addMCEControl:function(f,a,d){
    var h="mce_editor_"+tinyMCE.idCounter++;
    var e=new TinyMCE_Control(tinyMCE.settings);
    e.editorId=h;
    this.instances[h]=e;
    e._onAdd(f,a,d)
    },
removeInstance:function(e){
    var d=[],f,a;
    for(f in tinyMCE.instances){
        a=tinyMCE.instances[f];
        if(tinyMCE.isInstance(a)&&e!=a){
            d[f]=a
            }
        }
    tinyMCE.instances=d;
f=[];
d=tinyMCE.undoLevels;
for(a=0;a<d.length;a++){
    if(d[a]!=e){
        f.push(d[a])
        }
    }
tinyMCE.undoLevels=f;
tinyMCE.undoIndex=f.length;
tinyMCE.dispatchCallback(e,"remove_instance_callback","removeInstance",e);
return e
},
removeMCEControl:function(j){
    var i=tinyMCE.getInstanceById(j),e,d,f,a;
    if(i){
        i.switchSettings();
        j=i.editorId;
        e=tinyMCE.getContent(j);
        this.removeInstance(i);
        tinyMCE.selectedElement=null;
        tinyMCE.selectedInstance=null;
        d=document.getElementById(j+"_parent");
        f=i.oldTargetElement;
        a=f.nodeName.toLowerCase();
        if(a=="textarea"||a=="input"){
            d.parentNode.removeChild(d);
            f.style.display="inline";
            f.value=e
            }else{
            f.innerHTML=e;
            f.style.display="block";
            d.parentNode.insertBefore(f,d);
            d.parentNode.removeChild(d)
            }
        }
},
triggerSave:function(d,a){
    var e,f;
    if(typeof(d)=="undefined"){
        d=false
        }
        if(typeof(a)=="undefined"){
        a=false
        }
        for(f in tinyMCE.instances){
        e=tinyMCE.instances[f];
        if(!tinyMCE.isInstance(e)){
            continue
        }
        e.triggerSave(d,a)
        }
    },
resetForm:function(f){
    var d,e,h,a=document.forms[f];
    for(h in tinyMCE.instances){
        e=tinyMCE.instances[h];
        if(!tinyMCE.isInstance(e)){
            continue
        }
        e.switchSettings();
        for(d=0;d<a.elements.length;d++){
            if(e.formTargetElementId==a.elements[d].name){
                e.getBody().innerHTML=e.startContent
                }
            }
        }
    },
execInstanceCommand:function(i,h,j,f,a){
    var e=tinyMCE.getInstanceById(i),d;
    if(e){
        d=e.selection.getRng();
        if(typeof(a)=="undefined"){
            a=true
            }
            if(a&&(!d||!d.item)){
            e.contentWindow.focus()
            }
            e.autoResetDesignMode();
        this.selectedElement=e.getFocusElement();
        e.select();
        tinyMCE.execCommand(h,j,f);
        if(tinyMCE.isIE&&window.event!=null){
            tinyMCE.cancelEvent(window.event)
            }
        }
},
execCommand:function(j,l,f){
    var d=tinyMCE.selectedInstance;
    l=l?l:false;
    f=f?f:null;
    if(d){
        d.switchSettings()
        }
        switch(j){
        case"Undo":
            if(this.getParam("custom_undo_redo_global")){
            if(this.undoIndex>0){
                tinyMCE.nextUndoRedoAction="Undo";
                d=this.undoLevels[--this.undoIndex];
                d.select();
                if(!tinyMCE.nextUndoRedoInstanceId){
                    d.execCommand("Undo")
                    }
                }
        }else{
        d.execCommand("Undo")
        }
        return true;
case"Redo":
    if(this.getParam("custom_undo_redo_global")){
    if(this.undoIndex<=this.undoLevels.length-1){
        tinyMCE.nextUndoRedoAction="Redo";
        d=this.undoLevels[this.undoIndex++];
        d.select();
        if(!tinyMCE.nextUndoRedoInstanceId){
            d.execCommand("Redo")
            }
        }
}else{
    d.execCommand("Redo")
    }
    return true;
case"mceFocus":
    var d=tinyMCE.getInstanceById(f);
    if(d){
    d.getWin().focus()
    }
    return;
case"mceAddControl":case"mceAddEditor":
    tinyMCE.addMCEControl(tinyMCE._getElementById(f),f);
    return;
case"mceAddFrameControl":
    tinyMCE.addMCEControl(tinyMCE._getElementById(f.element,f.document),f.element,f.document);
    return;
case"mceRemoveControl":case"mceRemoveEditor":
    tinyMCE.removeMCEControl(f);
    return;
case"mceToggleEditor":
    var d=tinyMCE.getInstanceById(f),a,i;
    if(d){
    a=document.getElementById(d.editorId+"_parent");
    i=d.oldTargetElement;
    if(typeof(d.enabled)=="undefined"){
        d.enabled=true
        }
        d.enabled=!d.enabled;
    if(!d.enabled){
        a.style.display="none";
        i.value=d.getHTML();
        i.style.display=d.oldTargetDisplay;
        tinyMCE.dispatchCallback(d,"hide_instance_callback","hideInstance",d)
        }else{
        a.style.display="block";
        i.style.display="none";
        d.setHTML(i.value);
        d.useCSS=false;
        tinyMCE.dispatchCallback(d,"show_instance_callback","showInstance",d)
        }
    }else{
    tinyMCE.addMCEControl(tinyMCE._getElementById(f),f)
    }
    return;
case"mceResetDesignMode":
    if(!tinyMCE.isIE){
    for(var k in tinyMCE.instances){
        if(!tinyMCE.isInstance(tinyMCE.instances[k])){
            continue
        }
        try{
            tinyMCE.instances[k].getDoc().designMode="on"
            }catch(h){}
    }
    }
    return
}
if(d){
    d.execCommand(j,l,f)
    }else{
    if(tinyMCE.settings.focus_alert){
        alert(tinyMCELang.lang_focus_alert)
        }
    }
},
_createIFrame:function(i,h,f){
    var d,j=i.getAttribute("id");
    var e,a;
    if(typeof(h)=="undefined"){
        h=document
        }
        if(typeof(f)=="undefined"){
        f=window
        }
        d=h.createElement("iframe");
    e=""+tinyMCE.settings.area_width;
    a=""+tinyMCE.settings.area_height;
    if(e.indexOf("%")==-1){
        e=parseInt(e);
        e=(isNaN(e)||e<0)?300:e;
        e=e+"px"
        }
        if(a.indexOf("%")==-1){
        a=parseInt(a);
        a=(isNaN(a)||a<0)?240:a;
        a=a+"px"
        }
        d.setAttribute("id",j);
    d.setAttribute("name",j);
    d.setAttribute("class","mceEditorIframe");
    d.setAttribute("border","0");
    d.setAttribute("frameBorder","0");
    d.setAttribute("marginWidth","0");
    d.setAttribute("marginHeight","0");
    d.setAttribute("leftMargin","0");
    d.setAttribute("topMargin","0");
    d.setAttribute("width",e);
    d.setAttribute("height",a);
    d.setAttribute("allowtransparency","true");
    d.className="mceEditorIframe";
    if(tinyMCE.settings.auto_resize){
        d.setAttribute("scrolling","no")
        }
        if(tinyMCE.isRealIE){
        d.setAttribute("src",this.settings.default_document)
        }
        d.style.width=e;
    d.style.height=a;
    if(tinyMCE.settings.strict_loading_mode){
        d.style.marginBottom="-5px"
        }
        if(tinyMCE.isRealIE){
        i.outerHTML=d.outerHTML
        }else{
        i.parentNode.replaceChild(d,i)
        }
        if(tinyMCE.isRealIE){
        return f.frames[j]
        }else{
        return d
        }
    },
setupContent:function(editor_id){
    var inst=tinyMCE.instances[editor_id],i;
    var doc=inst.getDoc();
    var head=doc.getElementsByTagName("head").item(0);
    var content=inst.startContent;
    if(tinyMCE.settings.strict_loading_mode){
        content=content.replace(/&lt;/g,"<");
        content=content.replace(/&gt;/g,">");
        content=content.replace(/&quot;/g,'"');
        content=content.replace(/&amp;/g,"&")
        }
        tinyMCE.selectedInstance=inst;
    inst.switchSettings();
    if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){
        try{
            doc.location.href=tinyMCE.baseURL+"/blank.htm"
            }catch(ex){}
        window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);
        return
    }
    if(!head){
        window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);
        return
    }
    tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");
    tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);
    tinyMCE.dispatchCallback(inst,"init_instance_callback","initInstance",inst);
    if(tinyMCE.getParam("custom_undo_redo_keyboard_shortcuts")){
        inst.addShortcut("ctrl","z","lang_undo_desc","Undo");
        inst.addShortcut("ctrl","y","lang_redo_desc","Redo")
        }
        for(i=1;i<=6;i++){
        inst.addShortcut("ctrl",""+i,"","FormatBlock",false,"<h"+i+">")
        }
        inst.addShortcut("ctrl","7","","FormatBlock",false,"<p>");
    inst.addShortcut("ctrl","8","","FormatBlock",false,"<div>");
    inst.addShortcut("ctrl","9","","FormatBlock",false,"<address>");
    if(tinyMCE.isGecko){
        inst.addShortcut("ctrl","b","lang_bold_desc","Bold");
        inst.addShortcut("ctrl","i","lang_italic_desc","Italic");
        inst.addShortcut("ctrl","u","lang_underline_desc","Underline")
        }
        if(tinyMCE.getParam("convert_fonts_to_spans")){
        inst.getBody().setAttribute("id","mceSpanFonts")
        }
        if(tinyMCE.settings.nowrap){
        doc.body.style.whiteSpace="nowrap"
        }
        doc.body.dir=this.settings.directionality;
    doc.editorId=editor_id;
    if(!tinyMCE.isIE){
        doc.documentElement.editorId=editor_id
        }
        inst.setBaseHREF(tinyMCE.settings.base_href);
    if(tinyMCE.settings.convert_newlines_to_brs){
        content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");
        content=tinyMCE.regexpReplace(content,"\r","<br />","gi");
        content=tinyMCE.regexpReplace(content,"\n","<br />","gi")
        }
        content=tinyMCE.storeAwayURLs(content);
    content=tinyMCE._customCleanup(inst,"insert_to_editor",content);
    if(tinyMCE.isIE){
        window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);
        if(tinyMCE.settings.force_br_newlines){
            doc.styleSheets[0].addRule("p","margin: 0;")
            }
            var body=inst.getBody();
        body.editorId=editor_id
        }
        content=tinyMCE.cleanupHTMLCode(content);
    if(!tinyMCE.isIE){
        var contentElement=inst.getDoc().createElement("body");
        var doc=inst.getDoc();
        contentElement.innerHTML=content;
        if(tinyMCE.isGecko&&tinyMCE.settings.remove_lt_gt){
            content=content.replace(new RegExp("&lt;&gt;","g"),"")
            }
            if(tinyMCE.settings.cleanup_on_startup){
            tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement))
            }else{
            tinyMCE.setInnerHTML(inst.getBody(),content)
            }
            tinyMCE.convertAllRelativeURLs(inst.getBody())
        }else{
        if(tinyMCE.settings.cleanup_on_startup){
            tinyMCE._setHTML(inst.getDoc(),content);
            eval("try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}")
            }else{
            tinyMCE._setHTML(inst.getDoc(),content)
            }
        }
    tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);
tinyMCE.dispatchCallback(inst,"setupcontent_callback","setupContent",editor_id,inst.getBody(),inst.getDoc());
if(!tinyMCE.isIE){
    tinyMCE.addEventHandlers(inst)
    }
    if(tinyMCE.isIE){
    tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);
    tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);
    if(!tinyMCE.isOpera){
        tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);
        tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);
        tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)
        }
    }
inst.select();
tinyMCE.selectedElement=inst.contentWindow.document.body;
tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());
tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());
tinyMCE._setEventsEnabled(inst.getBody(),false);
tinyMCE.cleanupAnchors(inst.getDoc());
if(tinyMCE.getParam("convert_fonts_to_spans")){
    tinyMCE.convertSpansToFonts(inst.getDoc())
    }
    inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);
inst.undoRedo.add({
    content:inst.startContent
    });
if(tinyMCE.isGecko){
    tinyMCE.selectNodes(inst.getBody(),function(n){
        if(n.nodeType==3||n.nodeType==8){
            n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)="[^"]*"',"gi"),"")
            }
            return false
        })
    }
    if(tinyMCE.isGecko){
    inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck")
    }
    tinyMCE._removeInternal(inst.getBody());
inst.select();
tinyMCE.triggerNodeChange(false,true)
},
storeAwayURLs:function(a){
    if(!a.match(/(mce_src|mce_href)/gi,a)){
        a=a.replace(new RegExp('src\\s*=\\s*"([^ >"]*)"',"gi"),'src="$1" mce_src="$1"');
        a=a.replace(new RegExp('href\\s*=\\s*"([^ >"]*)"',"gi"),'href="$1" mce_href="$1"')
        }
        return a
    },
_removeInternal:function(a){
    if(tinyMCE.isGecko){
        tinyMCE.selectNodes(a,function(d){
            if(d.nodeType==3||d.nodeType==8){
                d.nodeValue=d.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)="[^"]*"',"gi"),"")
                }
                return false
            })
        }
    },
removeTinyMCEFormElements:function(d){
    var e,a;
    if(!tinyMCE.getParam("hide_selects_on_submit")){
        return
    }
    if(typeof(d)=="undefined"||d==null){
        return
    }
    if(d.nodeName!="FORM"){
        if(d.form){
            d=d.form
            }else{
            d=tinyMCE.getParentElement(d,"form")
            }
        }
    if(d==null){
    return
}
for(e=0;e<d.elements.length;e++){
    a=d.elements[e].name?d.elements[e].name:d.elements[e].id;
    if(a.indexOf("mce_editor_")==0){
        d.elements[e].disabled=true
        }
    }
},
handleEvent:function(l){
    var h=tinyMCE.selectedInstance;
    if(typeof(tinyMCE)=="undefined"){
        return true
        }
        if(tinyMCE.executeCallback(tinyMCE.selectedInstance,"handle_event_callback","handleEvent",l)){
        return false
        }
        switch(l.type){
        case"beforedeactivate":case"blur":
            if(tinyMCE.selectedInstance){
            tinyMCE.selectedInstance.execCommand("mceEndTyping")
            }
            tinyMCE.hideMenus();
            return;
        case"drop":case"beforepaste":
            if(tinyMCE.selectedInstance){
            tinyMCE.selectedInstance.setBaseHREF(null)
            }
            if(tinyMCE.isRealIE){
            var u=tinyMCE.selectedInstance.iframeElement;
            if(u.style.height.indexOf("%")!=-1){
                u._oldHeight=u.style.height;
                u.style.height=u.clientHeight
                }
            }
        window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();",1);
        return;
    case"submit":
        tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:l.target);
        tinyMCE.triggerSave();
        tinyMCE.isNotDirty=true;
        return;
    case"reset":
        var j=tinyMCE.isIE?window.event.srcElement:l.target;
        for(var f=0;f<document.forms.length;f++){
        if(document.forms[f]==j){
            window.setTimeout("tinyMCE.resetForm("+f+");",10)
            }
        }
    return;
case"keypress":
    if(h&&h.handleShortcut(l)){
    return false
    }
    if(l.target.editorId){
    tinyMCE.instances[l.target.editorId].select()
    }else{
    if(l.target.ownerDocument.editorId){
        tinyMCE.instances[l.target.ownerDocument.editorId].select()
        }
    }
if(tinyMCE.selectedInstance){
    tinyMCE.selectedInstance.switchSettings()
    }
    if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&l.keyCode==13&&!l.shiftKey){
    if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,l)){
        tinyMCE.execCommand("mceAddUndoLevel");
        return tinyMCE.cancelEvent(l)
        }
    }
if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&(l.keyCode==8||l.keyCode==46)&&!l.shiftKey){
    if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,l.type)){
        tinyMCE.execCommand("mceAddUndoLevel");
        return tinyMCE.cancelEvent(l)
        }
    }
if(tinyMCE.isIE&&tinyMCE.settings.force_br_newlines&&l.keyCode==13){
    if(l.target.editorId){
        tinyMCE.instances[l.target.editorId].select()
        }
        if(tinyMCE.selectedInstance){
        var d=tinyMCE.selectedInstance.getDoc().selection;
        var a=d.createRange();
        if(tinyMCE.getParentElement(a.parentElement(),"li")!=null){
            return false
            }
            l.returnValue=false;
        l.cancelBubble=true;
        a.pasteHTML("<br />");
        a.collapse(false);
        a.select();
        tinyMCE.execCommand("mceAddUndoLevel");
        tinyMCE.triggerNodeChange(false);
        return false
        }
    }
if(l.keyCode==8||l.keyCode==46){
    tinyMCE.selectedElement=l.target;
    tinyMCE.linkElement=tinyMCE.getParentElement(l.target,"a");
    tinyMCE.imgElement=tinyMCE.getParentElement(l.target,"img");
    tinyMCE.triggerNodeChange(false)
    }
    return false;
break;
case"keyup":case"keydown":
    tinyMCE.hideMenus();
    tinyMCE.hasMouseMoved=false;
    if(h&&h.handleShortcut(l)){
    return false
    }
    if(l.target.editorId){
    tinyMCE.instances[l.target.editorId].select()
    }
    if(tinyMCE.selectedInstance){
    tinyMCE.selectedInstance.switchSettings()
    }
    var h=tinyMCE.selectedInstance;
if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(l.keyCode==8||l.keyCode==46)&&!l.shiftKey){
    if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,l.type)){
        tinyMCE.execCommand("mceAddUndoLevel");
        l.preventDefault();
        return false
        }
    }
tinyMCE.selectedElement=null;
tinyMCE.selectedNode=null;
var m=tinyMCE.selectedInstance.getFocusElement();
tinyMCE.linkElement=tinyMCE.getParentElement(m,"a");
tinyMCE.imgElement=tinyMCE.getParentElement(m,"img");
tinyMCE.selectedElement=m;
if(tinyMCE.isGecko&&l.type=="keyup"&&l.keyCode==9){
    tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings.visual,tinyMCE.selectedInstance)
    }
    if(tinyMCE.isIE&&l.type=="keydown"&&l.keyCode==13){
    tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement()
    }
    if(tinyMCE.isIE&&l.type=="keyup"&&l.keyCode==13){
    var m=tinyMCE.enterKeyElement;
    if(m){
        var t=new RegExp("^HR|IMG|BR$","g");
        var o=new RegExp("^H[1-6]$","g");
        if(!m.hasChildNodes()&&!t.test(m.nodeName)){
            if(o.test(m.nodeName)){
                m.innerHTML="&nbsp;&nbsp;"
                }else{
                m.innerHTML="&nbsp;"
                }
            }
    }
}
var s=tinyMCE.posKeyCodes;
var k=false;
for(var f=0;f<s.length;f++){
    if(s[f]==l.keyCode){
        k=true;
        break
    }
}
if(tinyMCE.isIE&&tinyMCE.settings.custom_undo_redo){
    var s=new Array(8,46);
    for(var f=0;f<s.length;f++){
        if(s[f]==l.keyCode){
            if(l.type=="keyup"){
                tinyMCE.triggerNodeChange(false)
                }
            }
    }
}
if(l.keyCode==17){
    return true
    }
    if(tinyMCE.isGecko){
    if(!k&&l.type=="keyup"&&!l.ctrlKey||(l.ctrlKey&&(l.keyCode==86||l.keyCode==88))){
        tinyMCE.execCommand("mceStartTyping")
        }
    }else{
    if(!k&&l.type=="keyup"){
        tinyMCE.execCommand("mceStartTyping")
        }
    }
if(l.type=="keydown"&&(k||l.ctrlKey)&&h){
    h.undoBookmark=h.selection.getBookmark()
    }
    if(l.type=="keyup"&&(k||l.ctrlKey)){
    tinyMCE.execCommand("mceEndTyping")
    }
    if(k&&l.type=="keyup"){
    tinyMCE.triggerNodeChange(false)
    }
    if(tinyMCE.isIE&&l.ctrlKey){
    window.setTimeout("tinyMCE.triggerNodeChange(false);",1)
    }
    break;
case"mousedown":case"mouseup":case"click":case"dblclick":case"focus":
    tinyMCE.hideMenus();
    if(tinyMCE.selectedInstance){
    tinyMCE.selectedInstance.switchSettings();
    tinyMCE.selectedInstance.isFocused=true
    }
    var q=tinyMCE.getParentElement(l.target,"html");
    for(var p in tinyMCE.instances){
    if(!tinyMCE.isInstance(tinyMCE.instances[p])){
        continue
    }
    var h=tinyMCE.instances[p];
    h.autoResetDesignMode();
    if(h.getBody().parentNode==q){
        h.select();
        tinyMCE.selectedElement=l.target;
        tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");
        tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");
        break
    }
}
if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(l.type=="mouseup"||l.type=="dblclick")){
    tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark()
    }
    if(l.type!="focus"){
    tinyMCE.selectedNode=null
    }
    tinyMCE.triggerNodeChange(false);
tinyMCE.execCommand("mceEndTyping");
if(l.type=="mouseup"){
    tinyMCE.execCommand("mceAddUndoLevel")
    }
    if(!tinyMCE.selectedInstance&&l.target.editorId){
    tinyMCE.instances[l.target.editorId].select()
    }
    return false;
break
}
},
getButtonHTML:function(a,d,j,f,o,e){
    var k="",i,p,l="";
    f="tinyMCE.execInstanceCommand('{$editor_id}','"+f+"'";
    if(typeof(o)!="undefined"&&o!=null){
        f+=","+o
        }
        if(typeof(e)!="undefined"&&e!=null){
        f+=",'"+e+"'"
        }
        f+=");";
    if(tinyMCE.isRealIE){
        l='onmouseover="tinyMCE.lastHover = this;"'
        }
        if(tinyMCE.getParam("button_tile_map")&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(i=this.buttonMap[a])!=null&&(tinyMCE.getParam("language")=="en"||j.indexOf("$lang")==-1)){
        p=0-(i*20)==0?"0":0-(i*20);
        k+='<a id="{$editor_id}_'+a+'" href="javascript:'+f+'" onclick="'+f+'return false;" onmousedown="return false;" '+l+' class="mceTiledButton mceButtonNormal" target="_self">';
        k+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+p+'px 0" title="{$'+d+'}" />';
        k+="</a>"
        }else{
        k+='<a id="{$editor_id}_'+a+'" href="javascript:'+f+'" onclick="'+f+'return false;" onmousedown="return false;" '+l+' class="mceButtonNormal" target="_self">';
        k+='<img src="'+j+'" title="{$'+d+'}" />';
        k+="</a>"
        }
        return k
    },
getMenuButtonHTML:function(a,d,j,p,i,l,e){
    var k="",f,o;
    p="tinyMCE.execInstanceCommand('{$editor_id}','"+p+"');";
    i="tinyMCE.execInstanceCommand('{$editor_id}','"+i+"'";
    if(typeof(l)!="undefined"&&l!=null){
        i+=","+l
        }
        if(typeof(e)!="undefined"&&e!=null){
        i+=",'"+e+"'"
        }
        i+=");";
    if(tinyMCE.getParam("button_tile_map")&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(f=tinyMCE.buttonMap[a])!=null&&(tinyMCE.getParam("language")=="en"||j.indexOf("$lang")==-1)){
        o=0-(f*20)==0?"0":0-(f*20);
        if(tinyMCE.isRealIE){
            k+='<span id="{$editor_id}_'+a+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">'
            }else{
            k+='<span id="{$editor_id}_'+a+'" class="mceMenuButton">'
            }
            k+='<a href="javascript:'+i+'" onclick="'+i+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';
        k+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+o+'px 0" title="{$'+d+'}" /></a>';
        k+='<a href="javascript:'+p+'" onclick="'+p+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+d+'}" class="mceMenuButton" />';
        k+="</a></span>"
        }else{
        if(tinyMCE.isRealIE){
            k+='<span id="{$editor_id}_'+a+'" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">'
            }else{
            k+='<span id="{$editor_id}_'+a+'" dir="ltr" class="mceMenuButton">'
            }
            k+='<a href="javascript:'+i+'" onclick="'+i+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
        k+='<img src="'+j+'" title="{$'+d+'}" /></a>';
        k+='<a href="javascript:'+p+'" onclick="'+p+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+d+'}" class="mceMenuButton" />';
        k+="</a></span>"
        }
        return k
    },
_menuButtonEvent:function(a,d){
    if(d.className=="mceMenuButtonFocus"){
        return
    }
    if(a=="over"){
        d.className=d.className+" mceMenuHover"
        }else{
        d.className=d.className.replace(/\s.*$/,"")
        }
    },
addButtonMap:function(d){
    var f,e=d.replace(/\s+/,"").split(",");
    for(f=0;f<e.length;f++){
        this.buttonMap[e[f]]=f
        }
    },
submitPatch:function(){
    tinyMCE.removeTinyMCEFormElements(this);
    tinyMCE.triggerSave();
    tinyMCE.isNotDirty=true;
    this.mceOldSubmit()
    },
onLoad:function(){
    var d;
    if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){
        window.setTimeout("tinyMCE.onLoad();",1);
        return
    }
    if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete"){
        return true
        }
        if(tinyMCE.isLoaded){
        return true
        }
        tinyMCE.isLoaded=true;
    if(tinyMCE.isRealIE&&document.body){
        d=document.body.createTextRange();
        d.collapse(true);
        d.select()
        }
        tinyMCE.dispatchCallback(null,"onpageload","onPageLoad");
    for(var v=0;v<tinyMCE.configs.length;v++){
        tinyMCE.settings=tinyMCE.configs[v];
        var m=tinyMCE.getParam("editor_selector");
        var h=tinyMCE.getParam("editor_deselector");
        var w=new Array();
        if(document.forms&&tinyMCE.settings.add_form_submit_trigger&&!tinyMCE.submitTriggers){
            for(var q=0;q<document.forms.length;q++){
                var f=document.forms[q];
                tinyMCE.addEvent(f,"submit",TinyMCE_Engine.prototype.handleEvent);
                tinyMCE.addEvent(f,"reset",TinyMCE_Engine.prototype.handleEvent);
                tinyMCE.submitTriggers=true;
                if(tinyMCE.settings.submit_patch){
                    try{
                        f.mceOldSubmit=f.submit;
                        f.submit=TinyMCE_Engine.prototype.submitPatch
                        }catch(t){}
                }
            }
        }
    var s=tinyMCE.settings.mode;
switch(s){
    case"exact":
        var a=tinyMCE.getParam("elements","",true,",");
        for(var q=0;q<a.length;q++){
        var p=tinyMCE._getElementById(a[q]);
        var j=p?p.getAttribute(tinyMCE.settings.textarea_trigger):"";
        if(new RegExp("\\b"+h+"\\b").test(tinyMCE.getAttrib(p,"class"))){
            continue
        }
        if(j=="false"){
            continue
        }
        if((tinyMCE.settings.ask||tinyMCE.settings.convert_on_click)&&p){
            w[w.length]=p;
            continue
        }
        if(p){
            tinyMCE.addMCEControl(p,a[q])
            }else{
            if(tinyMCE.settings.debug){
                alert("Error: Could not find element by id or name: "+a[q])
                }
            }
    }
    break;
case"specific_textareas":case"textareas":
    var l=document.getElementsByTagName("textarea");
    for(var q=0;q<l.length;q++){
    var u=l.item(q);
    var j=u.getAttribute(tinyMCE.settings.textarea_trigger);
    if(m!=""&&!new RegExp("\\b"+m+"\\b").test(tinyMCE.getAttrib(u,"class"))){
        continue
    }
    if(m!=""){
        j=m!=""?"true":""
        }
        if(new RegExp("\\b"+h+"\\b").test(tinyMCE.getAttrib(u,"class"))){
        continue
    }
    if((s=="specific_textareas"&&j=="true")||(s=="textareas"&&j!="false")){
        w[w.length]=u
        }
    }
break
}
for(var q=0;q<w.length;q++){
    var p=w[q];
    var o=p.name?p.name:p.id;
    if(tinyMCE.settings.ask||tinyMCE.settings.convert_on_click){
        if(tinyMCE.isGecko){
            var k=tinyMCE.settings;
            tinyMCE.addEvent(p,"focus",function(i){
                window.setTimeout(function(){
                    TinyMCE_Engine.prototype.confirmAdd(i,k)
                    },10)
                });
            if(p.nodeName!="TEXTAREA"&&p.nodeName!="INPUT"){
                tinyMCE.addEvent(p,"click",function(i){
                    window.setTimeout(function(){
                        TinyMCE_Engine.prototype.confirmAdd(i,k)
                        },10)
                    })
                }
            }else{
        var k=tinyMCE.settings;
        tinyMCE.addEvent(p,"focus",function(){
            TinyMCE_Engine.prototype.confirmAdd(null,k)
            });
        tinyMCE.addEvent(p,"click",function(){
            TinyMCE_Engine.prototype.confirmAdd(null,k)
            })
        }
    }else{
    tinyMCE.addMCEControl(p,o)
    }
}
if(tinyMCE.settings.auto_focus){
    window.setTimeout(function(){
        var e=tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);
        e.selection.selectNode(e.getBody(),true,true);
        e.contentWindow.focus()
        },100)
    }
    tinyMCE.dispatchCallback(null,"oninit","onInit")
}
},
isInstance:function(a){
    return a!=null&&typeof(a)=="object"&&a.isTinyMCE_Control
    },
getParam:function(e,a,k,d){
    var j=(typeof(this.settings[e])=="undefined")?a:this.settings[e];
    if(j=="true"||j=="false"){
        return(j=="true")
        }
        if(k){
        j=tinyMCE.regexpReplace(j,"[ \t\r\n]","")
        }
        if(typeof(d)!="undefined"&&d!=null){
        j=j.split(d);
        var h=new Array();
        for(var f=0;f<j.length;f++){
            if(j[f]&&j[f]!=""){
                h[h.length]=j[f]
                }
            }
        j=h
    }
    return j
},
getLang:function(f,a,e,h){
    var d=(typeof(tinyMCELang[f])=="undefined")?a:tinyMCELang[f],i;
    if(e){
        d=tinyMCE.entityDecode(d)
        }
        if(h){
        for(i in h){
            d=this.replaceVar(d,i,h[i])
            }
        }
        return d
},
entityDecode:function(a){
    var d=document.createElement("div");
    d.innerHTML=a;
    return d.firstChild.nodeValue
    },
addToLang:function(e,a){
    for(var d in a){
        if(typeof(a[d])=="function"){
            continue
        }
        tinyMCELang[(d.indexOf("lang_")==-1?"lang_":"")+(e!=""?(e+"_"):"")+d]=a[d]
        }
        this.loadNextScript()
    },
triggerNodeChange:function(m,j){
    var h,d,a,e=-1,l=-1,i,f=false,k;
    if(tinyMCE.selectedInstance){
        d=tinyMCE.selectedInstance;
        h=(typeof(j)!="undefined"&&j)?tinyMCE.selectedElement:d.getFocusElement();
        a=d.editorId;
        k=d.selection.getSelectedText();
        if(tinyMCE.settings.auto_resize){
            d.resizeToContent()
            }
            if(j&&tinyMCE.isGecko&&d.isHidden()){
            h=d.getBody()
            }
            d.switchSettings();
        if(tinyMCE.selectedElement){
            f=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(k&&k.length>0)
            }
            if(tinyMCE.settings.custom_undo_redo){
            e=d.undoRedo.undoIndex;
            l=d.undoRedo.undoLevels.length
            }
            tinyMCE.dispatchCallback(d,"handle_node_change_callback","handleNodeChange",a,h,e,l,d.visualAid,f,j)
        }
        if(this.selectedInstance&&(typeof(m)=="undefined"||m)){
        this.selectedInstance.contentWindow.focus()
        }
    },
_customCleanup:function(inst,type,content){
    var pl,po,i;
    var customCleanup=tinyMCE.settings.cleanup_callback;
    if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined"){
        content=eval(customCleanup+"(type, content, inst);")
        }
        po=tinyMCE.themes[tinyMCE.settings.theme];
    if(po&&po.cleanup){
        content=po.cleanup(type,content,inst)
        }
        pl=inst.plugins;
    for(i=0;i<pl.length;i++){
        po=tinyMCE.plugins[pl[i]];
        if(po&&po.cleanup){
            content=po.cleanup(type,content,inst)
            }
        }
    return content
},
setContent:function(a){
    if(tinyMCE.selectedInstance){
        tinyMCE.selectedInstance.execCommand("mceSetContent",false,a);
        tinyMCE.selectedInstance.repaint()
        }
    },
importThemeLanguagePack:function(a){
    if(typeof(a)=="undefined"){
        a=tinyMCE.settings.theme
        }
        tinyMCE.loadScript(tinyMCE.baseURL+"/themes/"+a+"/langs/"+tinyMCE.settings.language+".js")
    },
importPluginLanguagePack:function(d){
    var a=tinyMCE.baseURL+"/plugins/"+d;
    if(this.plugins[d]){
        a=this.plugins[d].baseURL
        }
        tinyMCE.loadScript(a+"/langs/"+tinyMCE.settings.language+".js")
    },
applyTemplate:function(d,a){
    return d.replace(new RegExp("\\{\\$([a-z0-9_]+)\\}","gi"),function(e,f){
        if(f.indexOf("lang_")==0&&tinyMCELang[f]){
            return tinyMCELang[f]
            }
            if(a&&a[f]){
            return a[f]
            }
            if(tinyMCE.settings[f]){
            return tinyMCE.settings[f]
            }
            if(e=="themeurl"){
            return tinyMCE.themeURL
            }
            return e
        })
    },
replaceVar:function(d,e,a){
    return d.replace(new RegExp("{\\$"+e+"}","g"),a)
    },
openWindow:function(template,args){
    var html,width,height,x,y,resizable,scrollbars,url;
    args=!args?{}:args;
    args.mce_template_file=template.file;
    args.mce_width=template.width;
    args.mce_height=template.height;
    tinyMCE.windowArgs=args;
    html=template.html;
    if(!(width=parseInt(template.width))){
        width=320
        }
        if(!(height=parseInt(template.height))){
        height=200
        }
        if(tinyMCE.isIE){
        height+=40
        }else{
        height+=20
        }
        x=parseInt(screen.width/2)-(width/2);
    y=parseInt(screen.height/2)-(height/2);
    resizable=(args&&args.resizable)?args.resizable:"no";
    scrollbars=(args&&args.scrollbars)?args.scrollbars:"no";
    if(template.file.charAt(0)!="/"&&template.file.indexOf("://")==-1){
        url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template.file
        }else{
        url=template.file
        }
        for(var name in args){
        if(typeof(args[name])=="function"){
            continue
        }
        url=tinyMCE.replaceVar(url,name,escape(args[name]))
        }
        if(html){
        html=tinyMCE.replaceVar(html,"css",this.settings.popups_css);
        html=tinyMCE.applyTemplate(html,args);
        var win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);
        if(win==null){
            alert(tinyMCELang.lang_popup_blocked);
            return
        }
        win.document.write(html);
        win.document.close();
        win.resizeTo(width,height);
        win.focus()
        }else{
        if((tinyMCE.isRealIE)&&resizable!="yes"&&tinyMCE.settings.dialog_type=="modal"){
            height+=10;
            var features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";
            window.showModalDialog(url,window,features)
            }else{
            var modal=(resizable=="yes")?"no":"yes";
            if(tinyMCE.isGecko&&tinyMCE.isMac){
                modal="no"
                }
                if(template.close_previous!="no"){
                try{
                    tinyMCE.lastWindow.close()
                    }catch(ex){}
            }
            var win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);
        if(win==null){
            alert(tinyMCELang.lang_popup_blocked);
            return
        }
        if(template.close_previous!="no"){
            tinyMCE.lastWindow=win
            }
            eval("try { win.resizeTo(width, height); } catch(e) { }");
        if(tinyMCE.isGecko){
            if(win.document.defaultView.statusbar.visible){
                win.resizeBy(0,tinyMCE.isMac?10:24)
                }
            }
        win.focus()
    }
}
},
closeWindow:function(a){
    a.close()
    },
getVisualAidClass:function(h,f){
    var k=tinyMCE.settings.visual_table_class;
    if(typeof(f)=="undefined"){
        f=tinyMCE.settings.visual
        }
        var j=new Array();
    var a=h.split(" ");
    for(var d=0;d<a.length;d++){
        if(a[d]==k){
            a[d]=""
            }
            if(a[d]!=""){
            j[j.length]=a[d]
            }
        }
    if(f){
    j[j.length]=k
    }
    var e="";
for(var d=0;d<j.length;d++){
    if(d>0){
        e+=" "
        }
        e+=j[d]
    }
    return e
},
handleVisualAid:function(f,s,e,j,m){
    if(!f){
        return
    }
    if(!m){
        tinyMCE.dispatchCallback(j,"handle_visual_aid_callback","handleVisualAid",f,s,e,j)
        }
        var a=null;
    switch(f.nodeName){
        case"TABLE":
            var t=f.style.width;
            var k=f.style.height;
            var d=tinyMCE.getAttrib(f,"border");
            d=d==""||d=="0"?true:false;
            tinyMCE.setAttrib(f,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(f,"class"),e&&d));
            f.style.width=t;
            f.style.height=k;
            for(var o=0;o<f.rows.length;o++){
            for(var q=0;q<f.rows[o].cells.length;q++){
                var p=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(f.rows[o].cells[q],"class"),e&&d);
                tinyMCE.setAttrib(f.rows[o].cells[q],"class",p)
                }
            }
            break;
    case"A":
        var l=tinyMCE.getAttrib(f,"name");
        if(l!=""&&e){
        f.title=l;
        tinyMCE.addCSSClass(f,"mceItemAnchor")
        }else{
        if(l!=""&&!e){
            f.className=""
            }
        }
    break
    }
    if(s&&f.hasChildNodes()){
    for(var h=0;h<f.childNodes.length;h++){
        tinyMCE.handleVisualAid(f.childNodes[h],s,e,j,true)
        }
    }
},
fixGeckoBaseHREFBug:function(a,j,f){
    var d,i;
    if(tinyMCE.isGecko){
        if(a==1){
            f=f.replace(/\ssrc=/gi," mce_tsrc=");
            f=f.replace(/\shref=/gi," mce_thref=");
            return f
            }else{
            if(!new RegExp("(src|href)=","g").test(f)){
                return f
                }
                tinyMCE.selectElements(j,"A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK",function(k){
                d=tinyMCE.getAttrib(k,"mce_tsrc");
                i=tinyMCE.getAttrib(k,"mce_thref");
                if(d!=""){
                    try{
                        k.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,d)
                        }catch(h){}
                    k.removeAttribute("mce_tsrc")
                    }
                    if(i!=""){
                    try{
                        k.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,i)
                        }catch(h){}
                    k.removeAttribute("mce_thref")
                    }
                    return false
                });
            tinyMCE.selectNodes(j,function(e){
                if(e.nodeType==3||e.nodeType==8){
                    e.nodeValue=e.nodeValue.replace(/\smce_tsrc=/gi," src=");
                    e.nodeValue=e.nodeValue.replace(/\smce_thref=/gi," href=")
                    }
                    return false
                })
            }
        }
    return f
},
_setHTML:function(l,j){
    j=tinyMCE.cleanupHTMLCode(j);
    try{
        tinyMCE.setInnerHTML(l.body,j)
        }catch(k){
        if(this.isMSIE){
            l.body.createTextRange().pasteHTML(j)
            }
        }
    if(tinyMCE.isIE&&tinyMCE.settings.fix_content_duplication){
    var a=l.getElementsByTagName("P");
    for(var f=0;f<a.length;f++){
        var h=a[f];
        while((h=h.parentNode)!=null){
            if(h.nodeName=="P"){
                h.outerHTML=h.innerHTML
                }
            }
    }
    var d=l.body.innerHTML;
tinyMCE.setInnerHTML(l.body,d)
}
tinyMCE.cleanupAnchors(l);
if(tinyMCE.getParam("convert_fonts_to_spans")){
    tinyMCE.convertSpansToFonts(l)
    }
},
getEditorId:function(a){
    var d=this.getInstanceById(a);
    if(!d){
        return null
        }
        return d.editorId
    },
getInstanceById:function(e){
    var d=this.instances[e];
    if(!d){
        for(var f in tinyMCE.instances){
            var a=tinyMCE.instances[f];
            if(!tinyMCE.isInstance(a)){
                continue
            }
            if(a.formTargetElementId==e){
                d=a;
                break
            }
        }
        }
        return d
},
queryInstanceCommandValue:function(e,d){
    var a=tinyMCE.getInstanceById(e);
    if(a){
        return a.queryCommandValue(d)
        }
        return false
    },
queryInstanceCommandState:function(e,d){
    var a=tinyMCE.getInstanceById(e);
    if(a){
        return a.queryCommandState(d)
        }
        return null
    },
setWindowArg:function(d,a){
    this.windowArgs[d]=a
    },
getWindowArg:function(e,a){
    return(typeof(this.windowArgs[e])=="undefined")?a:this.windowArgs[e]
    },
getCSSClasses:function(editor_id,doc){
    var inst=tinyMCE.getInstanceById(editor_id);
    if(inst&&inst.cssClasses.length>0){
        return inst.cssClasses
        }
        if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){
        var instance;
        for(var instanceName in tinyMCE.instances){
            instance=tinyMCE.instances[instanceName];
            if(!tinyMCE.isInstance(instance)){
                continue
            }
            break
        }
        doc=instance.getDoc()
        }
        if(typeof(doc)=="undefined"){
        var instance=tinyMCE.getInstanceById(editor_id);
        doc=instance.getDoc()
        }
        if(doc){
        var styles=doc.styleSheets;
        if(styles&&styles.length>0){
            for(var x=0;x<styles.length;x++){
                var csses=null;
                eval("try {var csses = tinyMCE.isIE ? doc.styleSheets("+x+").rules : styles["+x+"].cssRules;} catch(e) {}");
                if(!csses){
                    return new Array()
                    }
                    for(var i=0;i<csses.length;i++){
                    var selectorText=csses[i].selectorText;
                    if(selectorText){
                        var rules=selectorText.split(",");
                        for(var c=0;c<rules.length;c++){
                            var rule=rules[c];
                            while(rule.indexOf(" ")==0){
                                rule=rule.substring(1)
                                }
                                if(rule.indexOf(" ")!=-1||rule.indexOf(":")!=-1||rule.indexOf("mceItem")!=-1){
                                continue
                            }
                            if(rule.indexOf(tinyMCE.settings.visual_table_class)!=-1||rule.indexOf("mceEditable")!=-1||rule.indexOf("mceNonEditable")!=-1){
                                continue
                            }
                            if(rule.indexOf(".")!=-1){
                                var cssClass=rule.substring(rule.indexOf(".")+1);
                                var addClass=true;
                                for(var p=0;p<inst.cssClasses.length&&addClass;p++){
                                    if(inst.cssClasses[p]==cssClass){
                                        addClass=false
                                        }
                                    }
                                if(addClass){
                                inst.cssClasses[inst.cssClasses.length]=cssClass
                                }
                            }
                        }
                }
            }
    }
}
}
return inst.cssClasses
},
regexpReplace:function(h,a,e,f){
    if(h==null){
        return h
        }
        if(typeof(f)=="undefined"){
        f="g"
        }
        var d=new RegExp(a,f);
    return h.replace(d,e)
    },
trim:function(a){
    return a.replace(/^\s*|\s*$/g,"")
    },
cleanupEventStr:function(a){
    a=""+a;
    a=a.replace("function anonymous()\n{\n","");
    a=a.replace("\n}","");
    a=a.replace(/^return true;/gi,"");
    return a
    },
getControlHTML:function(k){
    var e,a,j,h,d,f=tinyMCE.getLang("lang_dir")=="rtl";
    a=tinyMCE.plugins;
    for(j in a){
        h=a[j];
        if(h.getControlHTML&&(d=h.getControlHTML(k))!=""){
            if(f){
                return'<span dir="rtl">'+tinyMCE.replaceVar(d,"pluginurl",h.baseURL)+"</span>"
                }
                return tinyMCE.replaceVar(d,"pluginurl",h.baseURL)
            }
        }
    h=tinyMCE.themes[tinyMCE.settings.theme];
if(h.getControlHTML&&(d=h.getControlHTML(k))!=""){
    if(f){
        return'<span dir="rtl">'+d+"</span>"
        }
        return d
    }
    return""
},
evalFunc:function(h,d,e,i){
    i=!i?window:i;
    h=typeof(h)=="function"?h:i[h];
    return h.apply(i,Array.prototype.slice.call(e,d))
    },
dispatchCallback:function(a,d,e){
    return this.callFunc(a,d,e,0,this.dispatchCallback.arguments)
    },
executeCallback:function(a,d,e){
    return this.callFunc(a,d,e,1,this.executeCallback.arguments)
    },
execCommandCallback:function(a,d,e){
    return this.callFunc(a,d,e,2,this.execCommandCallback.arguments)
    },
callFunc:function(q,d,f,h,u){
    var j,k,t,e,x,w;
    x=h==2;
    j=tinyMCE.getParam(d,"");
    if(j!=""&&(w=tinyMCE.evalFunc(j,3,u))==x&&h>0){
        return true
        }
        if(q!=null){
        for(k=0,j=q.plugins;k<j.length;k++){
            e=tinyMCE.plugins[j[k]];
            if(e[f]&&(w=tinyMCE.evalFunc(f,3,u,e))==x&&h>0){
                return true
                }
            }
        }
    j=tinyMCE.themes;
for(t in j){
    e=j[t];
    if(e[f]&&(w=tinyMCE.evalFunc(f,3,u,e))==x&&h>0){
        return true
        }
    }
return false
},
xmlEncode:function(d,a){
    return d?(""+d).replace(!a?this.xmlEncodeAposRe:this.xmlEncodeRe,function(f,e){
        switch(f){
            case"&":
                return"&amp;";
            case'"':
                return"&quot;";
            case"'":
                return"&#39;";
            case"<":
                return"&lt;";
            case">":
                return"&gt;"
                }
                return f
        }):d
    },
extend:function(d,a){
    var e={};

    e.parent=d;
    for(n in d){
        e[n]=d[n]
        }
        for(n in a){
        e[n]=a[n]
        }
        return e
    },
hideMenus:function(){
    var a=tinyMCE.lastSelectedMenuBtn;
    if(tinyMCE.lastMenu){
        tinyMCE.lastMenu.hide();
        tinyMCE.lastMenu=null
        }
        if(a){
        tinyMCE.switchClass(a,tinyMCE.lastMenuBtnClass);
        tinyMCE.lastSelectedMenuBtn=null
        }
    }
};

var TinyMCE=TinyMCE_Engine;
var tinyMCE=new TinyMCE_Engine();
var tinyMCELang={};

function TinyMCE_Control(e){
    var m,h,l,f,a,k,j,f,d,o=e;
    this.undoRedoLevel=true;
    this.isTinyMCE_Control=true;
    this.settings=o;
    this.settings.theme=tinyMCE.getParam("theme","default");
    this.settings.width=tinyMCE.getParam("width",-1);
    this.settings.height=tinyMCE.getParam("height",-1);
    this.selection=new TinyMCE_Selection(this);
    this.undoRedo=new TinyMCE_UndoRedo(this);
    this.cleanup=new TinyMCE_Cleanup();
    this.shortcuts=new Array();
    this.hasMouseMoved=false;
    this.foreColor=this.backColor="#999999";
    this.data={};

    this.cssClasses=[];
    this.cleanup.init({
        valid_elements:o.valid_elements,
        extended_valid_elements:o.extended_valid_elements,
        valid_child_elements:o.valid_child_elements,
        entities:o.entities,
        entity_encoding:o.entity_encoding,
        debug:o.cleanup_debug,
        indent:o.apply_source_formatting,
        invalid_elements:o.invalid_elements,
        verify_html:o.verify_html,
        fix_content_duplication:o.fix_content_duplication,
        convert_fonts_to_spans:o.convert_fonts_to_spans
        });
    m=this.settings.theme;
    if(!tinyMCE.hasTheme(m)){
        j=tinyMCE.callbacks;
        l={};

        for(h=0;h<j.length;h++){
            if((f=window["TinyMCE_"+m+"_"+j[h]])){
                l[j[h]]=f
                }
            }
        tinyMCE.addTheme(m,l)
    }
    this.plugins=new Array();
a=tinyMCE.getParam("plugins","",true,",");
if(a.length>0){
    for(h=0;h<a.length;h++){
        d=a[h];
        if(d.charAt(0)=="-"){
            d=d.substring(1)
            }
            if(!tinyMCE.hasPlugin(d)){
            j=tinyMCE.callbacks;
            l={};

            for(k=0;k<j.length;k++){
                if((f=window["TinyMCE_"+d+"_"+j[k]])){
                    l[j[k]]=f
                    }
                }
            tinyMCE.addPlugin(d,l)
        }
        this.plugins[this.plugins.length]=d
    }
    }
}
TinyMCE_Control.prototype={
    selection:null,
    settings:null,
    cleanup:null,
    getData:function(a){
        var d=this.data[a];
        if(!d){
            d=this.data[a]={}
        }
        return d
    },
hasPlugin:function(d){
    var a;
    for(a=0;a<this.plugins.length;a++){
        if(this.plugins[a]==d){
            return true
            }
        }
    return false
},
addPlugin:function(d,a){
    if(!this.hasPlugin(d)){
        tinyMCE.addPlugin(d,a);
        this.plugins[this.plugins.length]=d
        }
    },
repaint:function(){
    var e,a,d;
    if(tinyMCE.isRealIE){
        return
    }
    try{
        e=this.selection;
        a=e.getBookmark(true);
        this.getBody().style.display="none";
        this.getDoc().execCommand("selectall",false,null);
        this.getBody().style.display="block";
        this.getSel().collapseToStart();
        e.moveToBookmark(a)
        }catch(d){
            //alert("PARCELLE: " + d);
        }
},
switchSettings:function(){
    if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings.index){
        tinyMCE.settings=this.settings;
        tinyMCE.currentConfig=this.settings.index
        }
    },
select:function(){
    var a=tinyMCE.selectedInstance;
    if(a!=this){
        if(a){
            a.execCommand("mceEndTyping")
            }
            tinyMCE.dispatchCallback(this,"select_instance_callback","selectInstance",this,a);
        tinyMCE.selectedInstance=this
        }
    },
getBody:function(){
    return this.contentBody?this.contentBody:this.getDoc().body
    },
getDoc:function(){
    return this.contentWindow.document
    },
getWin:function(){
    return this.contentWindow
    },
getContainerWin:function(){
    return this.containerWindow?this.containerWindow:window
    },
getViewPort:function(){
    return tinyMCE.getViewPort(this.getWin())
    },
getParentNode:function(d,a){
    return tinyMCE.getParentNode(d,a,this.getBody())
    },
getParentElement:function(e,a,d){
    return tinyMCE.getParentElement(e,a,d,this.getBody())
    },
getParentBlockElement:function(a){
    return tinyMCE.getParentBlockElement(a,this.getBody())
    },
resizeToContent:function(){
    var e=this.getDoc(),a=e.body,f=e.documentElement;
    this.iframeElement.style.height=(tinyMCE.isRealIE)?a.scrollHeight:f.offsetHeight+"px"
    },
addShortcut:function(h,j,o,f,s,t){
    var e=typeof(j)=="number",a=tinyMCE.isIE,q,p,l,u=this.shortcuts;
    if(!tinyMCE.getParam("custom_shortcuts")){
        return false
        }
        h=h.toLowerCase();
    j=a&&!e?j.toUpperCase():j;
    q=e?null:j.charCodeAt(0);
    o=o&&o.indexOf("lang_")==0?tinyMCE.getLang(o):o;
    p={
        alt:h.indexOf("alt")!=-1,
        ctrl:h.indexOf("ctrl")!=-1,
        shift:h.indexOf("shift")!=-1,
        charCode:q,
        keyCode:e?j:(a?q:null),
        desc:o,
        cmd:f,
        ui:s,
        val:t
    };

    for(l=0;l<u.length;l++){
        if(p.alt==u[l].alt&&p.ctrl==u[l].ctrl&&p.shift==u[l].shift&&p.charCode==u[l].charCode&&p.keyCode==u[l].keyCode){
            return false
            }
        }
    u[u.length]=p;
return true
},
handleShortcut:function(f){
    var a,d,h;
    if(!f.altKey&&!f.ctrlKey){
        return false
        }
        d=this.shortcuts;
    for(a=0;a<d.length;a++){
        h=d[a];
        if(h.alt==f.altKey&&h.ctrl==f.ctrlKey&&(h.keyCode==f.keyCode||h.charCode==f.charCode)){
            if(h.cmd&&(f.type=="keydown"||(f.type=="keypress"&&!tinyMCE.isOpera))){
                tinyMCE.execCommand(h.cmd,h.ui,h.val)
                }
                tinyMCE.cancelEvent(f);
            return true
            }
        }
    return false
},
autoResetDesignMode:function(){
    if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam("auto_reset_designmode")){
        eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')
        }
    },
isHidden:function(){
    var a;
    if(tinyMCE.isIE){
        return false
        }
        a=this.getSel();
    return(!a||!a.rangeCount||a.rangeCount==0)
    },
isDirty:function(){
    return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty
    },
_mergeElements:function(e,j,i,f){
    if(e=="removeformat"){
        j.className="";
        j.style.cssText="";
        i.className="";
        i.style.cssText="";
        return
    }
    var d=tinyMCE.parseStyle(tinyMCE.getAttrib(j,"style"));
    var a=tinyMCE.parseStyle(tinyMCE.getAttrib(i,"style"));
    var h=tinyMCE.getAttrib(j,"class");
    h=tinyMCE.getAttrib(i,"class");
    if(f){
        for(var k in d){
            if(typeof(d[k])=="function"){
                continue
            }
            a[k]=d[k]
            }
        }else{
    for(var k in a){
        if(typeof(a[k])=="function"){
            continue
        }
        d[k]=a[k]
        }
    }
    tinyMCE.setAttrib(j,"style",tinyMCE.serializeStyle(d));
tinyMCE.setAttrib(j,"class",tinyMCE.trim(h));
i.className="";
i.style.cssText="";
i.removeAttribute("class");
i.removeAttribute("style")
},
_setUseCSS:function(a){
    var f=this.getDoc();
    try{
        f.execCommand("useCSS",false,!a)
        }catch(e){}
    try{
        f.execCommand("styleWithCSS",false,a)
        }catch(e){}
    if(!tinyMCE.getParam("table_inline_editing")){
        try{
            f.execCommand("enableInlineTableEditing",false,"false")
            }catch(e){}
    }
    if(!tinyMCE.getParam("object_resizing")){
    try{
        f.execCommand("enableObjectResizing",false,"false")
        }catch(e){}
}
},
execCommand:function(command,user_interface,value){
    var doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();
    if(!new RegExp("mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel","gi").test(command)){
        this.undoBookmark=null
        }
        if(!tinyMCE.isIE&&!this.useCSS){
        this._setUseCSS(false);
        this.useCSS=true
        }
        this.contentDocument=doc;
    if(!/mceStartTyping|mceEndTyping/.test(command)){
        if(tinyMCE.execCommandCallback(this,"execcommand_callback","execCommand",this.editorId,this.getBody(),command,user_interface,value)){
            return
        }
    }
    if(focusElm&&focusElm.nodeName=="IMG"){
    var align=focusElm.getAttribute("align");
    var img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;
    switch(command){
        case"JustifyLeft":
            if(align=="left"){
            img.removeAttribute("align")
            }else{
            img.setAttribute("align","left")
            }
            var div=focusElm.parentNode;
        if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode){
            div.parentNode.replaceChild(img,div)
            }
            this.selection.selectNode(img);
            this.repaint();
            tinyMCE.triggerNodeChange();
            return;
        case"JustifyCenter":
            img.removeAttribute("align");
            var div=tinyMCE.getParentElement(focusElm,"div");
            if(div&&div.style.textAlign=="center"){
            if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode){
                div.parentNode.replaceChild(img,div)
                }
            }else{
            var div=this.getDoc().createElement("div");
            div.style.textAlign="center";
            div.appendChild(img);
            focusElm.parentNode.replaceChild(div,focusElm)
            }
            this.selection.selectNode(img);
        this.repaint();
        tinyMCE.triggerNodeChange();
        return;
    case"JustifyRight":
        if(align=="right"){
        img.removeAttribute("align")
        }else{
        img.setAttribute("align","right")
        }
        var div=focusElm.parentNode;
    if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode){
        div.parentNode.replaceChild(img,div)
        }
        this.selection.selectNode(img);
        this.repaint();
        tinyMCE.triggerNodeChange();
        return
        }
    }
if(tinyMCE.settings.force_br_newlines){
    var alignValue="";
    if(doc.selection.type!="Control"){
        switch(command){
            case"JustifyLeft":
                alignValue="left";
                break;
            case"JustifyCenter":
                alignValue="center";
                break;
            case"JustifyFull":
                alignValue="justify";
                break;
            case"JustifyRight":
                alignValue="right";
                break
                }
                if(alignValue!=""){
            var rng=doc.selection.createRange();
            if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null){
                divElm.setAttribute("align",alignValue)
                }else{
                if(rng.pasteHTML&&rng.htmlText.length>0){
                    rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>")
                    }
                }
            tinyMCE.triggerNodeChange();
        return
    }
}
}
switch(command){
    case"mceRepaint":
        this.repaint();
        return true;
    case"unlink":
        if(tinyMCE.isGecko&&this.getSel().isCollapsed){
        focusElm=tinyMCE.getParentElement(focusElm,"A");
        if(focusElm){
            this.selection.selectNode(focusElm,false)
            }
        }
    this.getDoc().execCommand(command,user_interface,value);
    tinyMCE.isGecko&&this.getSel().collapseToEnd();
    tinyMCE.triggerNodeChange();
    return true;
case"InsertUnorderedList":case"InsertOrderedList":
    this.getDoc().execCommand(command,user_interface,value);
    tinyMCE.triggerNodeChange();
    break;
case"Strikethrough":
    this.getDoc().execCommand(command,user_interface,value);
    tinyMCE.triggerNodeChange();
    break;
case"mceSelectNode":
    this.selection.selectNode(value);
    tinyMCE.triggerNodeChange();
    tinyMCE.selectedNode=value;
    break;
case"FormatBlock":
    if(value==null||value==""){
    var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");
    if(elm){
        this.execCommand("mceRemoveNode",false,elm)
        }
    }else{
    if(!this.cleanup.isValid(value)){
        return true
        }
        if(tinyMCE.isGecko&&new RegExp("<(div|blockquote|code|dt|dd|dl|samp)>","gi").test(value)){
        value=value.replace(/[^a-z]/gi,"")
        }
        if(tinyMCE.isIE&&new RegExp("blockquote|code|samp","gi").test(value)){
        var b=this.selection.getBookmark();
        this.getDoc().execCommand("FormatBlock",false,"<p>");
        tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);
        this.selection.moveToBookmark(b)
        }else{
        this.getDoc().execCommand("FormatBlock",false,value)
        }
    }
tinyMCE.triggerNodeChange();
break;
case"mceRemoveNode":
    if(!value){
    value=tinyMCE.getParentElement(this.getFocusElement())
    }
    if(tinyMCE.isIE){
    value.outerHTML=value.innerHTML
    }else{
    var rng=value.ownerDocument.createRange();
    rng.setStartBefore(value);
    rng.setEndAfter(value);
    rng.deleteContents();
    rng.insertNode(rng.createContextualFragment(value.innerHTML))
    }
    tinyMCE.triggerNodeChange();
    break;
case"mceSelectNodeDepth":
    var parentNode=this.getFocusElement();
    for(var i=0;parentNode;i++){
    if(parentNode.nodeName.toLowerCase()=="body"){
        break
    }
    if(parentNode.nodeName.toLowerCase()=="#text"){
        i--;
        parentNode=parentNode.parentNode;
        continue
    }
    if(i==value){
        this.selection.selectNode(parentNode,false);
        tinyMCE.triggerNodeChange();
        tinyMCE.selectedNode=parentNode;
        return
    }
    parentNode=parentNode.parentNode
    }
    break;
case"mceSetStyleInfo":case"SetStyleInfo":
    var rng=this.getRng();
    var sel=this.getSel();
    var scmd=value.command;
    var sname=value.name;
    var svalue=value.value==null?"":value.value;
    var wrapper=value.wrapper?value.wrapper:"span";
    var parentElm=null;
    var invalidRe=new RegExp("^BODY|HTML$","g");
    var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!=""?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;
    if(tinyMCE.isIE){
    if(rng.item){
        parentElm=rng.item(0)
        }else{
        var pelm=rng.parentElement();
        var prng=doc.selection.createRange();
        prng.moveToElementText(pelm);
        if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){
            if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName)){
                parentElm=pelm
                }
            }
    }
}else{
    var felm=this.getFocusElement();
    if(sel.isCollapsed||(new RegExp("td|tr|tbody|table","gi").test(felm.nodeName)&&sel.anchorNode==felm.parentNode)){
        parentElm=felm
        }
    }
if(parentElm&&!invalidRe.test(parentElm.nodeName)){
    if(scmd=="setstyle"){
        tinyMCE.setStyleAttrib(parentElm,sname,svalue)
        }
        if(scmd=="setattrib"){
        tinyMCE.setAttrib(parentElm,sname,svalue)
        }
        if(scmd=="removeformat"){
        parentElm.style.cssText="";
        tinyMCE.setAttrib(parentElm,"class","")
        }
        var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);
    for(var z=0;z<ch.length;z++){
        if(ch[z]==parentElm){
            continue
        }
        if(scmd=="setstyle"){
            tinyMCE.setStyleAttrib(ch[z],sname,"")
            }
            if(scmd=="setattrib"){
            tinyMCE.setAttrib(ch[z],sname,"")
            }
            if(scmd=="removeformat"){
            ch[z].style.cssText="";
            tinyMCE.setAttrib(ch[z],"class","")
            }
        }
    }else{
    this._setUseCSS(false);
    doc.execCommand("FontName",false,"#mce_temp_font#");
    var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");
    for(var x=0;x<elementArray.length;x++){
        elm=elementArray[x];
        if(elm){
            var spanElm=doc.createElement(wrapper);
            if(scmd=="setstyle"){
                tinyMCE.setStyleAttrib(spanElm,sname,svalue)
                }
                if(scmd=="setattrib"){
                tinyMCE.setAttrib(spanElm,sname,svalue)
                }
                if(scmd=="removeformat"){
                spanElm.style.cssText="";
                tinyMCE.setAttrib(spanElm,"class","")
                }
                if(elm.hasChildNodes()){
                for(var i=0;i<elm.childNodes.length;i++){
                    spanElm.appendChild(elm.childNodes[i].cloneNode(true))
                    }
                }
                spanElm.setAttribute("mce_new","true");
        elm.parentNode.replaceChild(spanElm,elm);
        var ch=tinyMCE.getNodeTree(spanElm,new Array(),1);
        for(var z=0;z<ch.length;z++){
            if(ch[z]==spanElm){
                continue
            }
            if(scmd=="setstyle"){
                tinyMCE.setStyleAttrib(ch[z],sname,"")
                }
                if(scmd=="setattrib"){
                tinyMCE.setAttrib(ch[z],sname,"")
                }
                if(scmd=="removeformat"){
                ch[z].style.cssText="";
                tinyMCE.setAttrib(ch[z],"class","")
                }
            }
        }
    }
}
var nodes=doc.getElementsByTagName(wrapper);
for(var i=nodes.length-1;i>=0;i--){
    var elm=nodes[i];
    var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";
    elm.removeAttribute("mce_new");
    if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){
        this._mergeElements(scmd,elm,elm.childNodes[0],isNew);
        continue
    }
    if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){
        if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName)){
            this._mergeElements(scmd,elm.parentNode,elm,false)
            }
        }
}
var nodes=doc.getElementsByTagName(wrapper);
for(var i=nodes.length-1;i>=0;i--){
    var elm=nodes[i];
    var isEmpty=true;
    var tmp=doc.createElement("body");
    tmp.appendChild(elm.cloneNode(false));
    tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""',"gi"),"");
    if(new RegExp("<span>","gi").test(tmp.innerHTML)){
        for(var x=0;x<elm.childNodes.length;x++){
            if(elm.parentNode!=null){
                elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)
                }
            }
        elm.parentNode.removeChild(elm)
    }
}
if(scmd=="removeformat"){
    tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this)
    }
    tinyMCE.triggerNodeChange();
break;
case"FontName":
    if(value==null){
    var s=this.getSel();
    if(tinyMCE.isGecko&&s.isCollapsed){
        var f=tinyMCE.getParentElement(this.getFocusElement(),"font");
        if(f!=null){
            this.selection.selectNode(f,false)
            }
        }
    this.getDoc().execCommand("RemoveFormat",false,null);
    if(f!=null&&tinyMCE.isGecko){
    var r=this.getRng().cloneRange();
    r.collapse(true);
    s.removeAllRanges();
    s.addRange(r)
    }
}else{
    this.getDoc().execCommand("FontName",false,value)
    }
    if(tinyMCE.isGecko){
    window.setTimeout("tinyMCE.triggerNodeChange(false);",1)
    }
    return;
case"FontSize":
    this.getDoc().execCommand("FontSize",false,value);
    if(tinyMCE.isGecko){
    window.setTimeout("tinyMCE.triggerNodeChange(false);",1)
    }
    return;
case"forecolor":
    value=value==null?this.foreColor:value;
    value=tinyMCE.trim(value);
    value=value.charAt(0)!="#"?(isNaN("0x"+value)?value:"#"+value):value;
    this.foreColor=value;
    this.getDoc().execCommand("forecolor",false,value);
    break;
case"HiliteColor":
    value=value==null?this.backColor:value;
    value=tinyMCE.trim(value);
    value=value.charAt(0)!="#"?(isNaN("0x"+value)?value:"#"+value):value;
    this.backColor=value;
    if(tinyMCE.isGecko){
    this._setUseCSS(true);
    this.getDoc().execCommand("hilitecolor",false,value);
    this._setUseCSS(false)
    }else{
    this.getDoc().execCommand("BackColor",false,value)
    }
    break;
case"Cut":case"Copy":case"Paste":
    var cmdFailed=false;
    eval("try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}");
    if(tinyMCE.isOpera&&cmdFailed){
    alert("Currently not supported by your browser, use keyboard shortcuts instead.")
    }
    if(tinyMCE.isGecko&&cmdFailed){
    if(confirm(tinyMCE.entityDecode(tinyMCE.getLang("lang_clipboard_msg")))){
        window.open("http://www.mozilla.org/editor/midasdemo/securityprefs.html","mceExternal")
        }
        return
}else{
    tinyMCE.triggerNodeChange()
    }
    break;
case"mceSetContent":
    if(!value){
    value=""
    }
    value=tinyMCE.storeAwayURLs(value);
    value=tinyMCE._customCleanup(this,"insert_to_editor",value);
    if(this.getBody().nodeName=="BODY"){
    tinyMCE._setHTML(doc,value)
    }else{
    this.getBody().innerHTML=value
    }
    tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));
    tinyMCE.convertAllRelativeURLs(this.getBody());
    tinyMCE._removeInternal(this.getBody());
    if(tinyMCE.getParam("convert_fonts_to_spans")){
    tinyMCE.convertSpansToFonts(doc)
    }
    tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);
    tinyMCE._setEventsEnabled(this.getBody(),false);
    return true;
case"mceCleanup":
    var b=this.selection.getBookmark();
    tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);
    tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));
    tinyMCE.convertAllRelativeURLs(doc.body);
    if(tinyMCE.getParam("convert_fonts_to_spans")){
    tinyMCE.convertSpansToFonts(doc)
    }
    tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);
    tinyMCE._setEventsEnabled(this.getBody(),false);
    this.repaint();
    this.selection.moveToBookmark(b);
    tinyMCE.triggerNodeChange();
    break;
case"mceReplaceContent":
    if(!value){
    value=""
    }
    this.getWin().focus();
    var selectedText="";
    if(tinyMCE.isIE){
    var rng=doc.selection.createRange();
    selectedText=rng.text
    }else{
    selectedText=this.getSel().toString()
    }
    if(selectedText.length>0){
    value=tinyMCE.replaceVar(value,"selection",selectedText);
    tinyMCE.execCommand("mceInsertContent",false,value)
    }
    tinyMCE.triggerNodeChange();
    break;
case"mceSetAttribute":
    if(typeof(value)=="object"){
    var targetElms=(typeof(value.targets)=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value.targets;
    var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);
    if(targetNode){
        targetNode.setAttribute(value.name,value.value);
        tinyMCE.triggerNodeChange()
        }
    }
break;
case"mceSetCSSClass":
    this.execCommand("mceSetStyleInfo",false,{
    command:"setattrib",
    name:"class",
    value:value
});
break;
case"mceInsertRawHTML":
    var key="tiny_mce_marker";
    this.execCommand("mceBeginUndoLevel");
    this.execCommand("mceInsertContent",false,key);
    var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;
    var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;
    var html=this.getBody().innerHTML;
    if((pos=html.indexOf(key))!=-1){
    tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length))
    }
    this.contentWindow.scrollTo(scrollX,scrollY);
    this.execCommand("mceEndUndoLevel");
    break;
case"mceInsertContent":
    if(!value){
    value=""
    }
    var insertHTMLFailed=false;
if(tinyMCE.isGecko||tinyMCE.isOpera){
    try{
        if(value.indexOf("<")==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)){
            var r=this.getRng();
            var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));
            var s=this.getSel();
            var r2=r.cloneRange();
            s.removeAllRanges();
            r.deleteContents();
            r.insertNode(n);
            r2.selectNode(n);
            r2.collapse(false);
            s.removeAllRanges();
            s.addRange(r2)
            }else{
            value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);
            this.getDoc().execCommand("inserthtml",false,value);
            tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)
            }
        }catch(ex){
    insertHTMLFailed=true
    }
    if(!insertHTMLFailed){
    tinyMCE.triggerNodeChange();
    return
}
}
if(!tinyMCE.isIE){
    var isHTML=value.indexOf("<")!=-1;
    var sel=this.getSel();
    var rng=this.getRng();
    if(isHTML){
        if(tinyMCE.isSafari){
            var tmpRng=this.getDoc().createRange();
            tmpRng.setStart(this.getBody(),0);
            tmpRng.setEnd(this.getBody(),0);
            value=tmpRng.createContextualFragment(value)
            }else{
            value=rng.createContextualFragment(value)
            }
        }else{
    var el=document.createElement("div");
    el.innerHTML=value;
    value=el.firstChild.nodeValue;
    value=doc.createTextNode(value)
    }
    if(tinyMCE.isSafari&&!isHTML){
    this.execCommand("InsertText",false,value.nodeValue);
    tinyMCE.triggerNodeChange();
    return true
    }else{
    if(tinyMCE.isSafari&&isHTML){
        rng.deleteContents();
        rng.insertNode(value);
        tinyMCE.triggerNodeChange();
        return true
        }
    }
rng.deleteContents();
if(rng.startContainer.nodeType==3){
    var node=rng.startContainer.splitText(rng.startOffset);
    node.parentNode.insertBefore(value,node)
    }else{
    rng.insertNode(value)
    }
    if(!isHTML){
    sel.selectAllChildren(doc.body);
    sel.removeAllRanges();
    var rng=doc.createRange();
    rng.selectNode(value);
    rng.collapse(false);
    sel.addRange(rng)
    }else{
    rng.collapse(false)
    }
    tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)
}else{
    var rng=doc.selection.createRange(),tmpRng=null;
    var c=value.indexOf("<!--")!=-1;
    if(c){
        value=tinyMCE.uniqueTag+value
        }
        if(rng.item){
        rng.item(0).outerHTML=value
        }else{
        rng.pasteHTML(value)
        }
        if(c){
        var e=this.getDoc().getElementById("mceTMPElement");
        e.parentNode.removeChild(e)
        }
    }
tinyMCE.execCommand("mceAddUndoLevel");
tinyMCE.triggerNodeChange();
break;
case"mceStartTyping":
    if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex==-1){
    this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;
    tinyMCE.typingUndoIndex=tinyMCE.undoIndex;
    this.execCommand("mceAddUndoLevel")
    }
    break;
case"mceEndTyping":
    if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex!=-1){
    this.execCommand("mceAddUndoLevel");
    this.undoRedo.typingUndoIndex=-1
    }
    tinyMCE.typingUndoIndex=-1;
break;
case"mceBeginUndoLevel":
    this.undoRedoLevel=false;
    break;
case"mceEndUndoLevel":
    this.undoRedoLevel=true;
    this.execCommand("mceAddUndoLevel");
    break;
case"mceAddUndoLevel":
    if(tinyMCE.settings.custom_undo_redo&&this.undoRedoLevel){
    if(this.undoRedo.add()){
        tinyMCE.triggerNodeChange(false)
        }
    }
break;
case"Undo":
    if(tinyMCE.settings.custom_undo_redo){
    tinyMCE.execCommand("mceEndTyping");
    this.undoRedo.undo();
    tinyMCE.triggerNodeChange()
    }else{
    this.getDoc().execCommand(command,user_interface,value)
    }
    break;
case"Redo":
    if(tinyMCE.settings.custom_undo_redo){
    tinyMCE.execCommand("mceEndTyping");
    this.undoRedo.redo();
    tinyMCE.triggerNodeChange()
    }else{
    this.getDoc().execCommand(command,user_interface,value)
    }
    break;
case"mceToggleVisualAid":
    this.visualAid=!this.visualAid;
    tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);
    tinyMCE.triggerNodeChange();
    break;
case"Indent":
    this.getDoc().execCommand(command,user_interface,value);
    tinyMCE.triggerNodeChange();
    if(tinyMCE.isIE){
    var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");
    do{
        if(n&&n.nodeName=="BLOCKQUOTE"){
            n.removeAttribute("dir");
            n.removeAttribute("style")
            }
        }while(n!=null&&(n=n.parentNode)!=null)
}
break;
case"RemoveFormat":case"removeformat":
    var text=this.selection.getSelectedText();
    if(tinyMCE.isOpera){
    this.getDoc().execCommand("RemoveFormat",false,null);
    return
}
if(tinyMCE.isIE){
    try{
        var rng=doc.selection.createRange();
        rng.execCommand("RemoveFormat",false,null)
        }catch(e){}
    this.execCommand("mceSetStyleInfo",false,{
        command:"removeformat"
    })
    }else{
    this.getDoc().execCommand(command,user_interface,value);
    this.execCommand("mceSetStyleInfo",false,{
        command:"removeformat"
    })
    }
    if(text.length==0){
    this.execCommand("mceSetCSSClass",false,"")
    }
    tinyMCE.triggerNodeChange();
    break;
default:
    this.getDoc().execCommand(command,user_interface,value);
    if(tinyMCE.isGecko){
    window.setTimeout("tinyMCE.triggerNodeChange(false);",1)
    }else{
    tinyMCE.triggerNodeChange()
    }
}
if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping"){
    tinyMCE.execCommand("mceAddUndoLevel")
    }
},
queryCommandValue:function(d){
    try{
        return this.getDoc().queryCommandValue(d)
        }catch(a){
        return null
        }
    },
queryCommandState:function(a){
    return this.getDoc().queryCommandState(a)
    },
_onAdd:function(q,f,i){
    var l,k,h,o;
    k=this.settings.theme;
    h=tinyMCE.themes[k];
    var v=i?i:document;
    this.targetDoc=v;
    tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings.theme;
    this.settings.themeurl=tinyMCE.themeURL;
    if(!q){
        alert("Error: Could not find the target element.");
        return false
        }
        if(h.getEditorTemplate){
        o=h.getEditorTemplate(this.settings,this.editorId)
        }
        var s=o.delta_width?o.delta_width:0;
    var t=o.delta_height?o.delta_height:0;
    var p='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+o.html;
    p=tinyMCE.replaceVar(p,"editor_id",this.editorId);
    this.settings.default_document=tinyMCE.baseURL+"/blank.htm";
    this.settings.old_width=this.settings.width;
    this.settings.old_height=this.settings.height;
    if(this.settings.width==-1){
        this.settings.width=q.offsetWidth
        }
        if(this.settings.height==-1){
        this.settings.height=q.offsetHeight
        }
        if(this.settings.width==0){
        this.settings.width=q.style.width
        }
        if(this.settings.height==0){
        this.settings.height=q.style.height
        }
        if(this.settings.width==0){
        this.settings.width=320
        }
        if(this.settings.height==0){
        this.settings.height=240
        }
        this.settings.area_width=parseInt(this.settings.width);
    this.settings.area_height=parseInt(this.settings.height);
    this.settings.area_width+=s;
    this.settings.area_height+=t;
    this.settings.width_style=""+this.settings.width;
    this.settings.height_style=""+this.settings.height;
    if((""+this.settings.width).indexOf("%")!=-1){
        this.settings.area_width="100%"
        }else{
        this.settings.width_style+="px"
        }
        if((""+this.settings.height).indexOf("%")!=-1){
        this.settings.area_height="100%"
        }else{
        this.settings.height_style+="px"
        }
        if((""+q.style.width).indexOf("%")!=-1){
        this.settings.width=q.style.width;
        this.settings.area_width="100%";
        this.settings.width_style="100%"
        }
        if((""+q.style.height).indexOf("%")!=-1){
        this.settings.height=q.style.height;
        this.settings.area_height="100%";
        this.settings.height_style="100%"
        }
        p=tinyMCE.applyTemplate(p);
    this.settings.width=this.settings.old_width;
    this.settings.height=this.settings.old_height;
    this.visualAid=this.settings.visual;
    this.formTargetElementId=f;
    if(q.nodeName=="TEXTAREA"||q.nodeName=="INPUT"){
        this.startContent=q.value
        }else{
        this.startContent=q.innerHTML
        }
        if(q.nodeName!="TEXTAREA"&&q.nodeName!="INPUT"){
        this.oldTargetElement=q;
        if(tinyMCE.settings.debug){
            l='<textarea wrap="off" id="'+f+'" name="'+f+'" cols="100" rows="15"></textarea>'
            }else{
            l='<input type="hidden" id="'+f+'" name="'+f+'" />';
            this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,"display","inline");
            this.oldTargetElement.style.display="none"
            }
            p+="</span>";
        if(tinyMCE.isGecko){
            p=l+p
            }else{
            p+=l
            }
            if(tinyMCE.isGecko){
            var m=q.ownerDocument.createRange();
            m.setStartBefore(q);
            var a=m.createContextualFragment(p);
            tinyMCE.insertAfter(a,q)
            }else{
            q.insertAdjacentHTML("beforeBegin",p)
            }
        }else{
    p+="</span>";
    this.oldTargetElement=q;
    if(!tinyMCE.settings.debug){
        this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,"display","inline");
        this.oldTargetElement.style.display="none"
        }
        if(tinyMCE.isGecko){
        var m=q.ownerDocument.createRange();
        m.setStartBefore(q);
        var a=m.createContextualFragment(p);
        tinyMCE.insertAfter(a,q)
        }else{
        q.insertAdjacentHTML("beforeBegin",p)
        }
    }
var j=false;
var w=v.getElementById(this.editorId);
if(!tinyMCE.isIE){
    if(w&&(w.nodeName=="SPAN"||w.nodeName=="span")){
        w=tinyMCE._createIFrame(w,v);
        j=true
        }
        this.targetElement=w;
    this.iframeElement=w;
    this.contentDocument=w.contentDocument;
    this.contentWindow=w.contentWindow
    }else{
    if(w&&w.nodeName=="SPAN"){
        w=tinyMCE._createIFrame(w,v,v.parentWindow)
        }else{
        w=v.frames[this.editorId]
        }
        this.targetElement=w;
    this.iframeElement=v.getElementById(this.editorId);
    if(tinyMCE.isOpera){
        this.contentDocument=this.iframeElement.contentDocument;
        this.contentWindow=this.iframeElement.contentWindow;
        j=true
        }else{
        this.contentDocument=w.window.document;
        this.contentWindow=w.window
        }
        this.getDoc().designMode="on"
    }
    var x=this.contentDocument;
if(j){
    var p=tinyMCE.getParam("doctype")+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings.base_href+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
    try{
        if(!this.isHidden()){
            this.getDoc().designMode="on"
            }
            x.open();
        x.write(p);
        x.close()
        }catch(u){
        this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"
        }
    }
if(tinyMCE.isIE){
    window.setTimeout('tinyMCE.addEventHandlers(tinyMCE.instances["'+this.editorId+'"]);',1)
    }
    var d=this.targetDoc.getElementById(this.editorId+"_parent");
this.formElement=tinyMCE.isGecko?d.previousSibling:d.nextSibling;
tinyMCE.setupContent(this.editorId,true);
return true
},
setBaseHREF:function(f){
    var i,a,j,e;
    j=this.getDoc();
    e=j.getElementsByTagName("base");
    a=e.length>0?e[0]:null;
    if(!a){
        e=j.getElementsByTagName("head");
        i=e.length>0?e[0]:null;
        a=j.createElement("base");
        a.setAttribute("href",f);
        i.appendChild(a)
        }else{
        if(f==""||f==null){
            a.parentNode.removeChild(a)
            }else{
            a.setAttribute("href",f)
            }
        }
},
getHTML:function(f){
    var e,i=this.getDoc(),a=this.getBody();
    if(f){
        return a.innerHTML
        }
        e=tinyMCE._cleanupHTML(this,i,this.settings,a,false,true,false,true);
    if(tinyMCE.getParam("convert_fonts_to_spans")){
        tinyMCE.convertSpansToFonts(i)
        }
        return e
    },
setHTML:function(a){
    this.execCommand("mceSetContent",false,a);
    this.repaint()
    },
getFocusElement:function(){
    return this.selection.getFocusElement()
    },
getSel:function(){
    return this.selection.getSel()
    },
getRng:function(){
    return this.selection.getRng()
    },
triggerSave:function(skip_cleanup,skip_callback){
    var e,nl=[],i,s;
    this.switchSettings();
    s=tinyMCE.settings;
    if(tinyMCE.isRealIE){
        e=this.iframeElement;
        do{
            if(e.style&&e.style.display=="none"){
                e.style.display="block";
                nl[nl.length]={
                    elm:e,
                    type:"style"
                }
            }
            if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){
            e.className=s.display_tab_class;
            nl[nl.length]={
                elm:e,
                type:"class"
            }
        }
    }while((e=e.parentNode)!=null)
}
tinyMCE.settings.preformatted=false;
if(typeof(skip_cleanup)=="undefined"){
    skip_cleanup=false
    }
    if(typeof(skip_callback)=="undefined"){
    skip_callback=false
    }
    tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);
if(this.settings.cleanup==false){
    tinyMCE.handleVisualAid(this.getBody(),true,false,this);
    tinyMCE._setEventsEnabled(this.getBody(),true)
    }
    tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);
var htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,true);
htm=tinyMCE._customCleanup(this,"submit_content",htm);
if(!skip_callback&&tinyMCE.settings.save_callback!=""){
    var content=eval(tinyMCE.settings.save_callback+"(this.formTargetElementId,htm,this.getBody());")
    }
    if((typeof(content)!="undefined")&&content!=null){
    htm=content
    }
    htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");
htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");
htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");
htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");
htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");
if(this.formElement){
    this.formElement.value=htm
    }
    if(tinyMCE.isSafari&&this.formElement){
    this.formElement.innerText=htm
    }
    for(i=0;i<nl.length;i++){
    if(nl[i].type=="style"){
        nl[i].elm.style.display="none"
        }else{
        nl[i].elm.className=s.hidden_tab_class
        }
    }
}
};

TinyMCE_Engine.prototype.cleanupHTMLCode=function(a){
    a=a.replace(new RegExp("<p \\/>","gi"),"<p>&nbsp;</p>");
    a=a.replace(new RegExp("<p>\\s*<\\/p>","gi"),"<p>&nbsp;</p>");
    a=a.replace(new RegExp("<br>\\s*<\\/br>","gi"),"<br />");
    a=a.replace(new RegExp("<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>","gi"),"<$1$2$3></$1$2>");
    a=a.replace(new RegExp("\\s+></","gi"),"></");
    a=a.replace(new RegExp("<(img|br|hr)([^>]*)><\\/(img|br|hr)>","gi"),"<$1$2 />");
    if(tinyMCE.isIE){
        a=a.replace(new RegExp("<p><hr \\/><\\/p>","gi"),"<hr>")
        }
        if(tinyMCE.isIE){
        a=a.replace(/<!(\s*)\/>/g,"")
        }
        return a
    };

TinyMCE_Engine.prototype.parseStyle=function(j){
    var a=new Array();
    if(j==null){
        return a
        }
        var d=j.split(";");
    tinyMCE.clearArray(a);
    for(var e=0;e<d.length;e++){
        if(d[e]==""){
            continue
        }
        var h=new RegExp("^\\s*([^:]*):\\s*(.*)\\s*$");
        var f=d[e].replace(h,"$1||$2").split("||");
        if(f.length==2){
            a[f[0].toLowerCase()]=f[1]
            }
        }
    return a
};

TinyMCE_Engine.prototype.compressStyle=function(e,l,k,h){
    var j=new Array();
    j[0]=e[l+"-top"+k];
    j[1]=e[l+"-left"+k];
    j[2]=e[l+"-right"+k];
    j[3]=e[l+"-bottom"+k];
    for(var f=0;f<j.length;f++){
        if(j[f]==null){
            return
        }
        for(var d=0;d<j.length;d++){
            if(j[d]!=j[f]){
                return
            }
        }
        }
    e[h]=j[0];
e[l+"-top"+k]=null;
e[l+"-left"+k]=null;
e[l+"-right"+k]=null;
e[l+"-bottom"+k]=null
};

TinyMCE_Engine.prototype.serializeStyle=function(ar){
    var str="";
    tinyMCE.compressStyle(ar,"border","","border");
    tinyMCE.compressStyle(ar,"border","-width","border-width");
    tinyMCE.compressStyle(ar,"border","-color","border-color");
    tinyMCE.compressStyle(ar,"border","-style","border-style");
    tinyMCE.compressStyle(ar,"padding","","padding");
    tinyMCE.compressStyle(ar,"margin","","margin");
    for(var key in ar){
        var val=ar[key];
        if(typeof(val)=="function"){
            continue
        }
        if(key.indexOf("mso-")==0){
            continue
        }
        if(val!=null&&val!=""){
            val=""+val;
            val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)","gi"),"url('$1')");
            if(val.indexOf("url(")!=-1&&tinyMCE.getParam("convert_urls")){
                var m=new RegExp("url\\('(.*?)'\\)").exec(val);
                if(m.length>1){
                    val="url('"+eval(tinyMCE.getParam("urlconverter_callback")+"(m[1], null, true);")+"')"
                    }
                }
            if(tinyMCE.getParam("force_hex_style_colors")){
            val=tinyMCE.convertRGBToHex(val,true)
            }
            val=val.replace(/\"/g,"'");
        if(val!="url('')"){
            str+=key.toLowerCase()+": "+val+"; "
            }
        }
    }
    if(new RegExp("; $").test(str)){
    str=str.substring(0,str.length-2)
    }
    return str
};

TinyMCE_Engine.prototype.convertRGBToHex=function(f,a){
    if(f.toLowerCase().indexOf("rgb")!=-1){
        var e=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");
        var d=f.replace(e,"$1,$2,$3,$4,$5").split(",");
        if(d.length==5){
            r=parseInt(d[1]).toString(16);
            g=parseInt(d[2]).toString(16);
            b=parseInt(d[3]).toString(16);
            r=r.length==1?"0"+r:r;
            g=g.length==1?"0"+g:g;
            b=b.length==1?"0"+b:b;
            f="#"+r+g+b;
            if(a){
                f=d[0]+f+d[4]
                }
            }
    }
return f
};

TinyMCE_Engine.prototype.convertHexToRGB=function(a){
    if(a.indexOf("#")!=-1){
        a=a.replace(new RegExp("[^0-9A-F]","gi"),"");
        return"rgb("+parseInt(a.substring(0,2),16)+","+parseInt(a.substring(2,4),16)+","+parseInt(a.substring(4,6),16)+")"
        }
        return a
    };

TinyMCE_Engine.prototype.convertSpansToFonts=function(j){
    var k=tinyMCE.getParam("font_size_style_values").replace(/\s+/,"").split(",");
    var l=tinyMCE.selectElements(j,"span,font");
    for(var e=0;e<l.length;e++){
        var m=tinyMCE.trim(l[e].style.fontSize).toLowerCase();
        var f=0;
        for(var h=0;h<k.length;h++){
            if(k[h]==m){
                f=h+1;
                break
            }
        }
        if(f>0){
        tinyMCE.setAttrib(l[e],"size",f);
        l[e].style.fontSize=""
        }
        var a=l[e].style.fontFamily;
    if(a!=null&&a!=""){
        tinyMCE.setAttrib(l[e],"face",a);
        l[e].style.fontFamily=""
        }
        var d=l[e].style.color;
    if(d!=null&&d!=""){
        tinyMCE.setAttrib(l[e],"color",tinyMCE.convertRGBToHex(d));
        l[e].style.color=""
        }
    }
};

TinyMCE_Engine.prototype.convertFontsToSpans=function(k){
    var f=tinyMCE.getParam("font_size_style_values").replace(/\s+/,"").split(",");
    var l=tinyMCE.getParam("font_size_classes");
    if(l!=""){
        l=l.replace(/\s+/,"").split(",")
        }else{
        l=null
        }
        var e=tinyMCE.selectElements(k,"span,font");
    for(var d=0;d<e.length;d++){
        var j,a,h;
        j=tinyMCE.getAttrib(e[d],"size");
        a=tinyMCE.getAttrib(e[d],"face");
        h=tinyMCE.getAttrib(e[d],"color");
        if(j!=""){
            j=parseInt(j);
            if(j>0&&j<8){
                if(l!=null){
                    tinyMCE.setAttrib(e[d],"class",l[j-1])
                    }else{
                    e[d].style.fontSize=f[j-1]
                    }
                }
            e[d].removeAttribute("size")
        }
        if(a!=""){
        e[d].style.fontFamily=a;
        e[d].removeAttribute("face")
        }
        if(h!=""){
        e[d].style.color=h;
        e[d].removeAttribute("color")
        }
    }
};

TinyMCE_Engine.prototype.cleanupAnchors=function(f){
    var d,h,a,e=f.getElementsByTagName("a");
    for(d=e.length-1;d>=0;d--){
        if(tinyMCE.getAttrib(e[d],"name")!=""&&tinyMCE.getAttrib(e[d],"href")==""){
            h=e[d].childNodes;
            for(a=h.length-1;a>=0;a--){
                tinyMCE.insertAfter(h[a],e[d])
                }
            }
        }
};

TinyMCE_Engine.prototype.getContent=function(a){
    if(typeof(a)!="undefined"){
        tinyMCE.getInstanceById(a).select()
        }
        if(tinyMCE.selectedInstance){
        return tinyMCE.selectedInstance.getHTML()
        }
        return null
    };

TinyMCE_Engine.prototype._fixListElements=function(l){
    var f,o,m=["ol","ul"],k,j,h,e=new RegExp("^(OL|UL)$"),q;
    for(o=0;o<m.length;o++){
        f=l.getElementsByTagName(m[o]);
        for(k=0;k<f.length;k++){
            j=f[k];
            h=j.parentNode;
            if(e.test(h.nodeName)){
                q=tinyMCE.prevNode(j,"LI");
                if(!q){
                    q=l.createElement("li");
                    q.innerHTML="&nbsp;";
                    q.appendChild(j);
                    h.insertBefore(q,h.firstChild)
                    }else{
                    q.appendChild(j)
                    }
                }
        }
    }
};

TinyMCE_Engine.prototype._fixTables=function(l){
    var e,h,m,k,j,a,f;
    e=l.getElementsByTagName("table");
    for(h=0;h<e.length;h++){
        m=e[h];
        if((k=tinyMCE.getParentElement(m,"p,h1,h2,h3,h4,h5,h6"))!=null){
            j=k.cloneNode(false);
            j.removeAttribute("id");
            f=m;
            while((m=m.nextSibling)){
                j.appendChild(m)
                }
                tinyMCE.insertAfter(j,k);
            tinyMCE.insertAfter(f,k)
            }
        }
    };

TinyMCE_Engine.prototype._cleanupHTML=function(a,z,y,f,w,t,q,e){
    var u,v,o,m,l,k,j,x,p,i;
    if(!tinyMCE.getParam("cleanup")){
        return f.innerHTML
        }
        t=typeof(t)=="undefined"?false:t;
    x=a.cleanup;
    p=a.settings;
    v=x.settings.debug;
    if(v){
        o=new Date().getTime()
        }
        if(tinyMCE.getParam("convert_fonts_to_spans")){
        tinyMCE.convertFontsToSpans(z)
        }
        if(tinyMCE.getParam("fix_list_elements")){
        tinyMCE._fixListElements(z)
        }
        if(tinyMCE.getParam("fix_table_elements")){
        tinyMCE._fixTables(z)
        }
        tinyMCE._customCleanup(a,t?"get_from_editor_dom":"insert_to_editor_dom",z.body);
    if(v){
        m=new Date().getTime()
        }
        x.settings.on_save=t;
    x.idCount=0;
    x.serializationId++;
    x.serializedNodes=new Array();
    x.sourceIndex=-1;
    if(p.cleanup_serializer=="xml"){
        u=x.serializeNodeAsXML(f,e)
        }else{
        u=x.serializeNodeAsHTML(f,e)
        }
        if(v){
        l=new Date().getTime()
        }
        i=tinyMCE.getParam("entity_encoding")=="numeric"?"&#160;":"&nbsp;";
    u=u.replace(/<\/?(body|head|html)[^>]*>/gi,"");
    u=u.replace(new RegExp(' (rowspan="1"|colspan="1")',"g"),"");
    u=u.replace(/<p><hr \/><\/p>/g,"<hr />");
    u=u.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,"<hr />");
    u=u.replace(/<td>\s*<br \/>\s*<\/td>/g,"<td>"+i+"</td>");
    u=u.replace(/<p>\s*<br \/>\s*<\/p>/g,"<p>"+i+"</p>");
    u=u.replace(/<br \/>$/,"");
    u=u.replace(/<br \/><\/p>/g,"</p>");
    u=u.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,"<p>"+i+"</p>");
    u=u.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,"<p>"+i+"</p>");
    u=u.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,"<p>"+i+"</p>");
    u=u.replace(new RegExp("<a>(.*?)<\\/a>","g"),"$1");
    u=u.replace(/<p([^>]*)>\s*<\/p>/g,"<p$1>"+i+"</p>");
    if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(u)){
        u=""
        }
        if(p.preformatted){
        u=u.replace(/^<pre>/,"");
        u=u.replace(/<\/pre>$/,"");
        u="<pre>"+u+"</pre>"
        }
        if(tinyMCE.isGecko){
        u=u.replace(/<o:p _moz-userdefined="" \/>/g,"");
        u=u.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,"<td$1>"+i+"</td>")
        }
        if(p.force_br_newlines){
        u=u.replace(/<p>(&nbsp;|&#160;)<\/p>/g,"<br />")
        }
        u=tinyMCE._customCleanup(a,t?"get_from_editor":"insert_to_editor",u);
    if(t){
        u=u.replace(new RegExp(" ?(mceItem[a-zA-Z0-9]*|"+p.visual_table_class+")","g"),"");
        u=u.replace(new RegExp(' ?class=""',"g"),"")
        }
        if(p.remove_linebreaks&&!x.settings.indent){
        u=u.replace(/\n|\r/g," ")
        }
        if(v){
        k=new Date().getTime()
        }
        if(t&&x.settings.indent){
        u=x.formatHTML(u)
        }
        if(q&&(p.encoding=="xml"||p.encoding=="html")){
        u=x.xmlEncode(u)
        }
        if(v){
        j=new Date().getTime()
        }
        if(x.settings.debug){
        tinyMCE.debug("Cleanup in ms: Pre="+(m-o)+", Serialize: "+(l-m)+", Post: "+(k-l)+", Format: "+(j-k)+", Sum: "+(j-o)+".")
        }
        return u
    };

function TinyMCE_Cleanup(){
    this.isIE=(navigator.appName=="Microsoft Internet Explorer");
    this.rules=tinyMCE.clearArray(new Array());
    this.settings={
        indent_elements:"head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object",
        newline_before_elements:"h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td",
        newline_after_elements:"br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script",
        newline_before_after_elements:"html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div",
        indent_char:"\t",
        indent_levels:1,
        entity_encoding:"raw",
        valid_elements:"*[*]",
        entities:"",
        url_converter:"",
        invalid_elements:"",
        verify_html:false
    };

    this.vElements=tinyMCE.clearArray(new Array());
    this.vElementsRe="";
    this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
    this.codeElementsRe=/^(SCRIPT|STYLE)$/;
    this.serializationId=0;
    this.mceAttribs={
        href:"mce_href",
        src:"mce_src",
        type:"mce_type"
    }
}
TinyMCE_Cleanup.prototype={
    init:function(h){
        var l,d,f,j,k,e;
        for(l in h){
            this.settings[l]=h[l]
            }
            h=this.settings;
        this.inRe=this._arrayToRe(h.indent_elements.split(","),"","^<(",")[^>]*");
        this.ouRe=this._arrayToRe(h.indent_elements.split(","),"","^<\\/(",")[^>]*");
        this.nlBeforeRe=this._arrayToRe(h.newline_before_elements.split(","),"gi","<(",")([^>]*)>");
        this.nlAfterRe=this._arrayToRe(h.newline_after_elements.split(","),"gi","<(",")([^>]*)>");
        this.nlBeforeAfterRe=this._arrayToRe(h.newline_before_after_elements.split(","),"gi","<(\\/?)(",")([^>]*)>");
        this.serializedNodes=[];
        if(h.invalid_elements!=""){
            this.iveRe=this._arrayToRe(h.invalid_elements.toUpperCase().split(","),"g","^(",")$")
            }else{
            this.iveRe=null
            }
            e="";
        for(f=0;f<h.indent_levels;f++){
            e+=h.indent_char
            }
            this.inStr=e;
        if(!h.verify_html){
            h.valid_elements="*[*]";
            h.extended_valid_elements=""
            }
            this.fillStr=h.entity_encoding=="named"?"&nbsp;":"&#160;";
        this.idCount=0;
        this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]',"g");
        this.xmlEncodeAposRe=new RegExp("[\u007F-\uFFFF<>&\"']","g")
        },
    addRuleStr:function(a){
        var d=this.parseRuleStr(a);
        var e;
        for(e in d){
            if(d[e]){
                this.rules[e]=d[e]
                }
            }
        this.vElements=tinyMCE.clearArray(new Array());
    for(e in this.rules){
        if(this.rules[e]){
            this.vElements[this.vElements.length]=this.rules[e].tag
            }
        }
    this.vElementsRe=this._arrayToRe(this.vElements,"")
    },
isValid:function(a){
    this._setupRules();
    if(!a){
        return true
        }
        a=a.replace(/[^a-z0-9]+/gi,"").toUpperCase();
    return !tinyMCE.getParam("cleanup")||this.vElementsRe.test(a)
    },
addChildRemoveRuleStr:function(o){
    var j,h,d,e,m,l,f,k,a;
    if(!o){
        return
    }
    f=o.split(",");
    for(j=0;j<f.length;j++){
        o=f[j];
        d=this.split(/\[|\]/,o);
        if(d==null||d.length<1){
            m=o.toUpperCase()
            }else{
            m=d[0].toUpperCase()
            }
            l=this.split("/",m);
        for(h=0;h<l.length;h++){
            a="^(";
            k=this.split(/\|/,d[1]);
            for(e=0;e<k.length;e++){
                if(k[e]=="%istrict"){
                    a+=tinyMCE.inlineStrict
                    }else{
                    if(k[e]=="%itrans"){
                        a+=tinyMCE.inlineTransitional
                        }else{
                        if(k[e]=="%istrict_na"){
                            a+=tinyMCE.inlineStrict.substring(2)
                            }else{
                            if(k[e]=="%itrans_na"){
                                a+=tinyMCE.inlineTransitional.substring(2)
                                }else{
                                if(k[e]=="%btrans"){
                                    a+=tinyMCE.blockElms
                                    }else{
                                    if(k[e]=="%strict"){
                                        a+=tinyMCE.blockStrict
                                        }else{
                                        a+=(k[e].charAt(0)!="#"?k[e].toUpperCase():k[e])
                                        }
                                    }
                            }
                    }
            }
        }
        a+=(e!=k.length-1?"|":"")
        }
        a+=")$";
if(this.childRules==null){
    this.childRules=tinyMCE.clearArray(new Array())
    }
    this.childRules[l[h]]=new RegExp(a);
if(d.length>1){
    this.childRules[l[h]].wrapTag=d[2]
    }
}
}
},
parseRuleStr:function(z){
    var l,h,d,o,k,q,u,w,v,m,f,j=tinyMCE.clearArray(new Array()),e;
    if(z==null||z.length==0){
        return j
        }
        l=z.split(",");
    for(q=0;q<l.length;q++){
        z=l[q];
        if(z.length==0){
            continue
        }
        h=this.split(/\[|\]/,z);
        if(h==null||h.length<1){
            w=z.toUpperCase()
            }else{
            w=h[0].toUpperCase()
            }
            v=this.split("/",w);
        for(m=0;m<v.length;m++){
            d={};

            d.tag=v[m];
            d.forceAttribs=null;
            d.defaultAttribs=null;
            d.validAttribValues=null;
            u=d.tag.charAt(0);
            d.forceOpen=u=="+";
            d.removeEmpty=u=="-";
            d.fill=u=="#";
            d.tag=d.tag.replace(/\+|-|#/g,"");
            d.oTagName=v[0].replace(/\+|-|#/g,"").toLowerCase();
            d.isWild=new RegExp("\\*|\\?|\\+","g").test(d.tag);
            d.validRe=new RegExp(this._wildcardToRe("^"+d.tag+"$"));
            if(h.length>1){
                d.vAttribsRe="^(";
                o=this.split(/\|/,h[1]);
                for(k=0;k<o.length;k++){
                    w=o[k];
                    if(w.charAt(0)=="!"){
                        o[k]=w=w.substring(1);
                        if(!d.reqAttribsRe){
                            d.reqAttribsRe="\\s+("+w
                            }else{
                            d.reqAttribsRe+="|"+w
                            }
                        }
                    f=new RegExp("(=|:|<)(.*?)$").exec(w);
                    w=w.replace(new RegExp("(=|:|<).*?$"),"");
                    if(f&&f.length>0){
                    if(f[0].charAt(0)==":"){
                        if(!d.forceAttribs){
                            d.forceAttribs=tinyMCE.clearArray(new Array())
                            }
                            d.forceAttribs[w.toLowerCase()]=f[0].substring(1)
                        }else{
                        if(f[0].charAt(0)=="="){
                            if(!d.defaultAttribs){
                                d.defaultAttribs=tinyMCE.clearArray(new Array())
                                }
                                e=f[0].substring(1);
                            d.defaultAttribs[w.toLowerCase()]=e==""?"mce_empty":e
                            }else{
                            if(f[0].charAt(0)=="<"){
                                if(!d.validAttribValues){
                                    d.validAttribValues=tinyMCE.clearArray(new Array())
                                    }
                                    d.validAttribValues[w.toLowerCase()]=this._arrayToRe(this.split("?",f[0].substring(1)),"i")
                                }
                            }
                    }
                }
            d.vAttribsRe+=""+w.toLowerCase()+(k!=o.length-1?"|":"");
            o[k]=w.toLowerCase()
            }
            if(d.reqAttribsRe){
        d.reqAttribsRe=new RegExp(d.reqAttribsRe+')="',"g")
        }
        d.vAttribsRe+=")$";
    d.vAttribsRe=this._wildcardToRe(d.vAttribsRe);
        d.vAttribsReIsWild=new RegExp("\\*|\\?|\\+","g").test(d.vAttribsRe);
        d.vAttribsRe=new RegExp(d.vAttribsRe);
        d.vAttribs=o.reverse()
        }else{
        d.vAttribsRe="";
        d.vAttribs=tinyMCE.clearArray(new Array());
        d.vAttribsReIsWild=false
        }
        j[d.tag]=d
    }
}
return j
},
serializeNodeAsXML:function(h){
    var d,a;
    if(!this.xmlDoc){
        if(this.isIE){
            try{
                this.xmlDoc=new ActiveXObject("MSXML2.DOMDocument")
                }catch(f){}
            if(!this.xmlDoc){
                try{
                    this.xmlDoc=new ActiveXObject("Microsoft.XmlDom")
                    }catch(f){}
            }
        }else{
    this.xmlDoc=document.implementation.createDocument("","",null)
    }
    if(!this.xmlDoc){
    alert("Error XML Parser could not be found.")
    }
}
if(this.xmlDoc.firstChild){
    this.xmlDoc.removeChild(this.xmlDoc.firstChild)
    }
    a=this.xmlDoc.createElement("html");
a=this.xmlDoc.appendChild(a);
this._convertToXML(h,a);
if(this.isIE){
    return this.xmlDoc.xml
    }else{
    return new XMLSerializer().serializeToString(this.xmlDoc)
    }
},
_convertToXML:function(d,j){
    var p,a,h,f,m,e,o,k=false;
    if(tinyMCE.isRealIE&&this._isDuplicate(d)){
        return
    }
    p=this.xmlDoc;
    switch(d.nodeType){
        case 1:
            k=d.hasChildNodes();
            a=p.createElement(d.nodeName.toLowerCase());
            e=d.attributes;
            for(h=e.length-1;h>-1;h--){
            o=e[h];
            if(o.specified&&o.nodeValue){
                a.setAttribute(o.nodeName.toLowerCase(),o.nodeValue)
                }
            }
        if(!k&&!this.closeElementsRe.test(d.nodeName)){
            a.appendChild(p.createTextNode(""))
            }
            j=j.appendChild(a);
        break;
    case 3:
        j.appendChild(p.createTextNode(d.nodeValue));
        return;
    case 8:
        j.appendChild(p.createComment(d.nodeValue));
        return
        }
        if(k){
    m=d.childNodes;
    for(h=0,f=m.length;h<f;h++){
        this._convertToXML(m[h],j)
        }
    }
},
serializeNodeAsHTML:function(j,w){
    var d,x,o="",m,k,A,z,a,v,u=false,q=false,e,p,s,y;
    this._setupRules();
    if(tinyMCE.isRealIE&&this._isDuplicate(j)){
        return""
        }
        if(j.parentNode&&this.childRules!=null){
        s=this.childRules[j.parentNode.nodeName];
        if(typeof(s)!="undefined"&&!s.test(j.nodeName)){
            z=true;
            A=null
            }
        }
    switch(j.nodeType){
    case 1:
        p=j.hasChildNodes();
        if(z){
        break
    }
    if((tinyMCE.isRealIE)&&j.nodeName.indexOf("/")!=-1){
        break
    }
    y=j.nodeName;
    if(this.settings.convert_fonts_to_spans){
        if(this.settings.on_save&&y=="FONT"){
            y="SPAN"
            }
            if(!this.settings.on_save&&y=="SPAN"){
            y="FONT"
            }
        }
    if(this.vElementsRe.test(y)&&(!this.iveRe||!this.iveRe.test(y))&&!w){
        u=true;
        a=this.rules[y];
        if(!a){
            e=this.rules;
            for(x in e){
                if(e[x]&&e[x].validRe.test(y)){
                    a=e[x];
                    break
                }
            }
            }
            d=a.isWild?y.toLowerCase():a.oTagName;
q=a.fill;
if(a.removeEmpty&&!p){
    return""
    }
    A="<"+d;
if(a.vAttribsReIsWild){
    e=j.attributes;
    for(m=e.length-1;m>-1;m--){
        x=e[m];
        if(x.specified&&a.vAttribsRe.test(x.nodeName)){
            A+=this._serializeAttribute(j,a,x.nodeName)
            }
        }
    }else{
    for(m=a.vAttribs.length-1;m>-1;m--){
        A+=this._serializeAttribute(j,a,a.vAttribs[m])
        }
    }
    if(!this.settings.on_save){
    e=this.mceAttribs;
    for(x in e){
        if(e[x]){
            A+=this._serializeAttribute(j,a,e[x])
            }
        }
    }
    if(a.reqAttribsRe&&!A.match(a.reqAttribsRe)){
    A=null
    }
    if(A!=null&&this.closeElementsRe.test(y)){
    return A+" />"
    }
    if(A!=null){
    o+=A+">"
    }
    if(this.isIE&&this.codeElementsRe.test(y)){
    o+=j.innerHTML
    }
}
break;
case 3:
    if(z){
    break
}
if(j.parentNode&&this.codeElementsRe.test(j.parentNode.nodeName)){
    return this.isIE?"":j.nodeValue
    }
    return this.xmlEncode(j.nodeValue);
case 8:
    if(z){
    break
}
return"<!--"+this._trimComment(j.nodeValue)+"-->"
    }
    if(p){
    v=j.childNodes;
    for(m=0,k=v.length;m<k;m++){
        o+=this.serializeNodeAsHTML(v[m])
        }
    }
    if(q&&!p){
    o+=this.fillStr
    }
    if(A!=null&&u){
    o+="</"+d+">"
    }
    return o
},
_serializeAttribute:function(i,e,d){
    var h="",a,f=this.settings.on_save;
    if(f&&(d.indexOf("mce_")==0||d.indexOf("_moz")==0)){
        return""
        }
        if(f&&this.mceAttribs[d]){
        h=this._getAttrib(i,this.mceAttribs[d])
        }
        if(h.length==0){
        h=this._getAttrib(i,d)
        }
        if(h.length==0&&e.defaultAttribs&&(a=e.defaultAttribs[d])){
        h=a;
        if(h=="mce_empty"){
            return" "+d+'=""'
            }
        }
    if(e.forceAttribs&&(a=e.forceAttribs[d])){
    h=a
    }
    if(f&&h.length!=0&&/^(src|href|longdesc)$/.test(d)){
    h=this._urlConverter(this,i,h)
    }
    if(h.length!=0&&e.validAttribValues&&e.validAttribValues[d]&&!e.validAttribValues[d].test(h)){
    return""
    }
    if(h.length!=0&&h=="{$uid}"){
    h="uid_"+(this.idCount++)
    }
    if(h.length!=0){
    if(d.indexOf("on")!=0){
        h=this.xmlEncode(h,1)
        }
        return" "+d+'="'+h+'"'
    }
    return""
},
formatHTML:function(j){
    var f=this.settings,k="",e=0,a=0,m="",d;
    j=j.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(i,h,l){
        l=l.replace(/<br\s*\/>/gi,"\n");
        return"<pre"+h+">"+l+"</pre>"
        });
    j=j.replace(/\r/g,"");
    j="\n"+j;
    j=j.replace(new RegExp("\\n\\s+","gi"),"\n");
    j=j.replace(this.nlBeforeRe,"\n<$1$2>");
    j=j.replace(this.nlAfterRe,"<$1$2>\n");
    j=j.replace(this.nlBeforeAfterRe,"\n<$1$2$3>\n");
    j+="\n";
    while((e=j.indexOf("\n",e+1))!=-1){
        if((d=j.substring(a+1,e)).length!=0){
            if(this.ouRe.test(d)&&k.length>=f.indent_levels){
                k=k.substring(f.indent_levels)
                }
                m+=k+d+"\n";
            if(this.inRe.test(d)){
                k+=this.inStr
                }
            }
        a=e
    }
    return m
},
xmlEncode:function(f,d){
    var a=this,e=!d?this.xmlEncodeAposRe:this.xmlEncodeRe;
    this._setupEntities();
    switch(this.settings.entity_encoding){
        case"raw":
            return tinyMCE.xmlEncode(f,d);
        case"named":
            return f.replace(e,function(i,h){
            h=a.entities[i.charCodeAt(0)];
            return h?"&"+h+";":i
            });
        case"numeric":
            return f.replace(e,function(i,h){
            return h?"&#"+i.charCodeAt(0)+";":i
            })
        }
        return f
    },
split:function(f,e){
    var j=e.split(f);
    var d,a,h=new Array();
    for(d=0,a=j.length;d<a;d++){
        if(j[d]!=""){
            h[d]=j[d]
            }
        }
    return h
},
_trimComment:function(a){
    a=a.replace(new RegExp('\\smce_src="[^"]*"',"gi"),"");
    a=a.replace(new RegExp('\\smce_href="[^"]*"',"gi"),"");
    return a
    },
_getAttrib:function(h,k,i){
    var a,f,j;
    if(typeof(i)=="undefined"){
        i=""
        }
        if(!h||h.nodeType!=1){
        return i
        }
        try{
        a=h.getAttribute(k,0)
        }catch(f){
        a=h.getAttribute(k,2)
        }
        if(k=="class"&&!a){
        a=h.className
        }
        if(this.isIE){
        if(k=="http-equiv"){
            a=h.httpEquiv
            }
            j=h.nodeName;
        if(j=="FORM"&&k=="enctype"&&a=="application/x-www-form-urlencoded"){
            a=""
            }
            if(j=="INPUT"&&k=="size"&&a=="20"){
            a=""
            }
            if(j=="INPUT"&&k=="maxlength"&&a=="2147483647"){
            a=""
            }
        }
    if(k=="style"&&a){
    if(!tinyMCE.isOpera){
        a=h.style.cssText
        }
        a=tinyMCE.serializeStyle(tinyMCE.parseStyle(a))
    }
    if(this.settings.on_save&&k.indexOf("on")!=-1&&this.settings.on_save&&a&&a!=""){
    a=tinyMCE.cleanupEventStr(a)
    }
    return(a&&a!="")?""+a:i
},
_urlConverter:function(c,n,v){
    if(!c.settings.on_save){
        return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v)
        }else{
        if(tinyMCE.getParam("convert_urls")){
            if(!this.urlConverter){
                this.urlConverter=eval(tinyMCE.settings.urlconverter_callback)
                }
                return this.urlConverter(v,n,true)
            }
        }
    return v
},
_arrayToRe:function(d,k,j,e){
    var f,h;
    k=typeof(k)=="undefined"?"gi":k;
    j=typeof(j)=="undefined"?"^(":j;
    e=typeof(e)=="undefined"?")$":e;
    h=j;
    for(f=0;f<d.length;f++){
        h+=this._wildcardToRe(d[f])+(f!=d.length-1?"|":"")
        }
        h+=e;
    return new RegExp(h,k)
    },
_wildcardToRe:function(a){
    a=a.replace(/\?/g,"(\\S?)");
    a=a.replace(/\+/g,"(\\S+)");
    a=a.replace(/\*/g,"(\\S*)");
    return a
    },
_setupEntities:function(){
    var h,d,e,f=this.settings;
    if(!this.entitiesDone){
        if(f.entity_encoding=="named"){
            h=tinyMCE.clearArray(new Array());
            d=this.split(",",f.entities);
            for(e=0;e<d.length;e+=2){
                h[d[e]]=d[e+1]
                }
                this.entities=h
            }
            this.entitiesDone=true
        }
    },
_setupRules:function(){
    var a=this.settings;
    if(!this.rulesDone){
        this.addRuleStr(a.valid_elements);
        this.addRuleStr(a.extended_valid_elements);
        this.addChildRemoveRuleStr(a.valid_child_elements);
        this.rulesDone=true
        }
    },
_isDuplicate:function(d){
    var a;
    if(!this.settings.fix_content_duplication){
        return false
        }
        if(tinyMCE.isRealIE&&d.nodeType==1){
        if(d.mce_serialized==this.serializationId){
            return true
            }
            d.setAttribute("mce_serialized",this.serializationId)
        }else{
        for(a=0;a<this.serializedNodes.length;a++){
            if(this.serializedNodes[a]==d){
                return true
                }
            }
        this.serializedNodes[this.serializedNodes.length]=d
    }
    return false
}
};

TinyMCE_Engine.prototype.createTagHTML=function(d,e,i){
    var k="",j=tinyMCE.xmlEncode;
    k="<"+d;
    if(e){
        for(n in e){
            if(typeof(e[n])!="function"&&e[n]!=null){
                k+=" "+j(n)+'="'+j(""+e[n])+'"'
                }
            }
        }
        k+=!i?" />":">"+i+"</"+d+">";
return k
};

TinyMCE_Engine.prototype.createTag=function(k,e,f,i){
    var j=k.createElement(e);
    if(f){
        for(n in f){
            if(typeof(f[n])!="function"&&f[n]!=null){
                tinyMCE.setAttrib(j,n,f[n])
                }
            }
        }
        if(i){
    j.innerHTML=i
    }
    return j
};

TinyMCE_Engine.prototype.getElementByAttributeValue=function(i,h,d,f){
    return(i=this.getElementsByAttributeValue(i,h,d,f)).length==0?null:i[0]
    };

TinyMCE_Engine.prototype.getElementsByAttributeValue=function(m,k,f,h){
    var j,d=m.getElementsByTagName(k),l=new Array();
    for(j=0;j<d.length;j++){
        if(tinyMCE.getAttrib(d[j],f).indexOf(h)!=-1){
            l[l.length]=d[j]
            }
        }
    return l
};

TinyMCE_Engine.prototype.isBlockElement=function(a){
    return a!=null&&a.nodeType==1&&this.blockRegExp.test(a.nodeName)
    };

TinyMCE_Engine.prototype.getParentBlockElement=function(d,a){
    return this.getParentNode(d,function(e){
        return tinyMCE.isBlockElement(e)
        },a);
    return null
    };

TinyMCE_Engine.prototype.insertAfter=function(d,a){
    if(a.nextSibling){
        a.parentNode.insertBefore(d,a.nextSibling)
        }else{
        a.parentNode.appendChild(d)
        }
    };

TinyMCE_Engine.prototype.setInnerHTML=function(j,f){
    var d,a,k;
    if(tinyMCE.isGecko){
        f=f.replace(/<embed([^>]*)>/gi,"<tmpembed$1>");
        f=f.replace(/<em([^>]*)>/gi,"<i$1>");
        f=f.replace(/<tmpembed([^>]*)>/gi,"<embed$1>");
        f=f.replace(/<strong([^>]*)>/gi,"<b$1>");
        f=f.replace(/<\/strong>/gi,"</b>");
        f=f.replace(/<\/em>/gi,"</i>")
        }
        if(tinyMCE.isRealIE){
        f=f.replace(/\s\/>/g,">");
        f=f.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');
        f=f.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');
        f=f.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');
        j.innerHTML=tinyMCE.uniqueTag+f;
        j.firstChild.removeNode(true);
        a=j.getElementsByTagName("p");
        for(d=a.length-1;d>=0;d--){
            k=a[d];
            if(k.nodeName=="P"&&!k.hasChildNodes()&&!k.mce_keep){
                k.parentNode.removeChild(k)
                }
            }
        }else{
    f=this.fixGeckoBaseHREFBug(1,j,f);
    j.innerHTML=f;
    this.fixGeckoBaseHREFBug(2,j,f)
    }
};

TinyMCE_Engine.prototype.getOuterHTML=function(a){
    if(tinyMCE.isIE){
        return a.outerHTML
        }
        var f=a.ownerDocument.createElement("body");
    f.appendChild(a.cloneNode(true));
    return f.innerHTML
    };

TinyMCE_Engine.prototype.setOuterHTML=function(l,k,m){
    var m=typeof(m)=="undefined"?l.ownerDocument:m,j,a,f;
    if(tinyMCE.isIE&&l.nodeType==1){
        l.outerHTML=k
        }else{
        f=m.createElement("body");
        f.innerHTML=k;
        for(j=0,a=f.childNodes;j<a.length;j++){
            l.parentNode.insertBefore(a[j].cloneNode(true),l)
            }
            l.parentNode.removeChild(l)
        }
    };

TinyMCE_Engine.prototype._getElementById=function(o,m){
    var l,h,a,k;
    if(typeof(m)=="undefined"){
        m=document
        }
        l=m.getElementById(o);
    if(!l){
        k=m.forms;
        for(h=0;h<k.length;h++){
            for(a=0;a<k[h].elements.length;a++){
                if(k[h].elements[a].name==o){
                    l=k[h].elements[a];
                    break
                }
            }
            }
        }
return l
};

TinyMCE_Engine.prototype.getNodeTree=function(f,a,d,e){
    return this.selectNodes(f,function(h){
        return(!d||h.nodeType==d)&&(!e||h.nodeName==e)
        },a?a:new Array())
    };

TinyMCE_Engine.prototype.getParentElement=function(j,a,i,h){
    var e=a?new RegExp("^("+a.toUpperCase().replace(/,/g,"|")+")$"):0,d;
    if(i&&typeof(i)=="string"){
        return this.getParentElement(j,a,function(f){
            return tinyMCE.getAttrib(f,i)!=""
            })
        }
        return this.getParentNode(j,function(f){
        return((f.nodeType==1&&!e)||(e&&e.test(f.nodeName)))&&(!i||i(f))
        },h)
    };

TinyMCE_Engine.prototype.getParentNode=function(e,d,a){
    while(e){
        if(e==a){
            return null
            }
            if(d(e)){
            return e
            }
            e=e.parentNode
        }
        return null
    };

TinyMCE_Engine.prototype.getAttrib=function(h,d,f){
    var a;
    if(typeof(f)=="undefined"){
        f=""
        }
        if(!h||h.nodeType!=1){
        return f
        }
        try{
        a=h.getAttribute(d,0)
        }catch(e){
        a=h.getAttribute(d,2)
        }
        if(d=="class"&&!a){
        a=h.className
        }
        if(tinyMCE.isGecko&&d=="src"&&h.src!=null&&h.src!=""){
        a=h.src
        }
        if(tinyMCE.isGecko&&d=="href"&&h.href!=null&&h.href!=""){
        a=h.href
        }
        if(d=="http-equiv"&&tinyMCE.isIE){
        a=h.httpEquiv
        }
        if(d=="style"&&!tinyMCE.isOpera){
        a=h.style.cssText
        }
        return(a&&a!="")?a:f
    };

TinyMCE_Engine.prototype.setAttrib=function(e,d,f,a){
    if(typeof(f)=="number"&&f!=null){
        f=""+f
        }
        if(a){
        if(f==null){
            f=""
            }
            f=f.replace(/[^0-9%]/g,"")
        }
        if(d=="style"){
        e.style.cssText=f
        }
        if(d=="class"){
        e.className=f
        }
        if(f!=null&&f!=""&&f!=-1){
        e.setAttribute(d,f)
        }else{
        e.removeAttribute(d)
        }
    };

TinyMCE_Engine.prototype.setStyleAttrib=function(d,f,a){
    d.style[f]=a;
    if(tinyMCE.isIE&&a==null||a==""){
        a=tinyMCE.serializeStyle(tinyMCE.parseStyle(d.style.cssText));
        d.style.cssText=a;
        d.setAttribute("style",a)
        }
    };

TinyMCE_Engine.prototype.switchClass=function(d,f){
    var a;
    if(tinyMCE.switchClassCache[d]){
        a=tinyMCE.switchClassCache[d]
        }else{
        a=tinyMCE.switchClassCache[d]=document.getElementById(d)
        }
        if(a){
        if(tinyMCE.settings.button_tile_map&&a.className&&a.className.indexOf("mceTiledButton")==0){
            f="mceTiledButton "+f
            }
            a.className=f
        }
    };

TinyMCE_Engine.prototype.getAbsPosition=function(f,e){
    var a=0,d=0;
    while(f&&f!=e){
        a+=f.offsetLeft;
        d+=f.offsetTop;
        f=f.offsetParent
        }
        return{
        absLeft:a,
        absTop:d
    }
};

TinyMCE_Engine.prototype.prevNode=function(h,j){
    var d=j.split(","),f;
    while((h=h.previousSibling)!=null){
        for(f=0;f<d.length;f++){
            if(h.nodeName==d[f]){
                return h
                }
            }
        }
    return null
};

TinyMCE_Engine.prototype.nextNode=function(h,j){
    var d=j.split(","),f;
    while((h=h.nextSibling)!=null){
        for(f=0;f<d.length;f++){
            if(h.nodeName==d[f]){
                return h
                }
            }
        }
    return null
};

TinyMCE_Engine.prototype.selectElements=function(m,j,l){
    var k,h=[],e,d;
    for(d=0,j=j.split(",");d<j.length;d++){
        for(k=0,e=m.getElementsByTagName(j[d]);k<e.length;k++){
            (!l||l(e[k]))&&h.push(e[k])
            }
        }
        return h
};

TinyMCE_Engine.prototype.selectNodes=function(j,h,d){
    var e;
    if(!d){
        d=new Array()
        }
        if(h(j)){
        d[d.length]=j
        }
        if(j.hasChildNodes()){
        for(e=0;e<j.childNodes.length;e++){
            tinyMCE.selectNodes(j.childNodes[e],h,d)
            }
        }
        return d
};

TinyMCE_Engine.prototype.addCSSClass=function(d,h,a){
    var f=this.removeCSSClass(d,h);
    return d.className=a?h+(f!=""?(" "+f):""):(f!=""?(f+" "):"")+h
    };

TinyMCE_Engine.prototype.removeCSSClass=function(a,d){
    d=a.className.replace(new RegExp("(^|\\s+)"+d+"(\\s+|$)")," ");
    return a.className=d!=" "?d:""
    };

TinyMCE_Engine.prototype.hasCSSClass=function(d,a){
    return new RegExp("\\b"+a+"\\b","g").test(d.className)
    };

TinyMCE_Engine.prototype.renameElement=function(j,l,k){
    var h,f,a;
    k=typeof(k)=="undefined"?tinyMCE.selectedInstance.getDoc():k;
    if(j){
        h=k.createElement(l);
        a=j.attributes;
        for(f=a.length-1;f>-1;f--){
            if(a[f].specified&&a[f].nodeValue){
                h.setAttribute(a[f].nodeName.toLowerCase(),a[f].nodeValue)
                }
            }
        a=j.childNodes;
    for(f=0;f<a.length;f++){
        h.appendChild(a[f].cloneNode(true))
        }
        j.parentNode.replaceChild(h,j)
    }
};

TinyMCE_Engine.prototype.getViewPort=function(f){
    var h=f.document,e=h.compatMode=="CSS1Compat",a=h.body,i=h.documentElement;
    return{
        left:f.pageXOffset||(e?i.scrollLeft:a.scrollLeft),
        top:f.pageYOffset||(e?i.scrollTop:a.scrollTop),
        width:f.innerWidth||(e?i.clientWidth:a.clientWidth),
        height:f.innerHeight||(e?i.clientHeight:a.clientHeight)
        }
    };

TinyMCE_Engine.prototype.getStyle=function(f,a,e){
    if(!f){
        return false
        }
        if(tinyMCE.isGecko&&f.ownerDocument.defaultView){
        try{
            return f.ownerDocument.defaultView.getComputedStyle(f,null).getPropertyValue(a)
            }catch(f){
            return null
            }
        }
    a=a.replace(/-(\D)/g,function(h,d){
    return d.toUpperCase()
    });
if(f.currentStyle){
    return f.currentStyle[a]
    }
    return false
};

TinyMCE_Engine.prototype.parseURL=function(f){
    var j=new Array();
    if(f){
        var h,e;
        h=f.indexOf("://");
        if(h!=-1){
            j.protocol=f.substring(0,h);
            e=h+3
            }
            for(var a=e;a<f.length;a++){
            var d=f.charAt(a);
            if(d==":"){
                break
            }
            if(d=="/"){
                break
            }
        }
        h=a;
    j.host=f.substring(e,h);
    j.port="";
    e=h;
    if(f.charAt(h)==":"){
        h=f.indexOf("/",e);
        j.port=f.substring(e+1,h)
        }
        e=h;
    h=f.indexOf("?",e);
    if(h==-1){
        h=f.indexOf("#",e)
        }
        if(h==-1){
        h=f.length
        }
        j.path=f.substring(e,h);
    e=h;
    if(f.charAt(h)=="?"){
        h=f.indexOf("#");
        h=(h==-1)?f.length:h;
        j.query=f.substring(e+1,h)
        }
        e=h;
    if(f.charAt(h)=="#"){
        h=f.length;
        j.anchor=f.substring(e+1,h)
        }
    }
return j
};

TinyMCE_Engine.prototype.serializeURL=function(a){
    var d="";
    if(a.protocol){
        d+=a.protocol+"://"
        }
        if(a.host){
        d+=a.host
        }
        if(a.port){
        d+=":"+a.port
        }
        if(a.path){
        d+=a.path
        }
        if(a.query){
        d+="?"+a.query
        }
        if(a.anchor){
        d+="#"+a.anchor
        }
        return d
    };

TinyMCE_Engine.prototype.convertAbsoluteURLToRelativeURL=function(p,e){
    var d=this.parseURL(p);
    var o=this.parseURL(e);
    var a;
    var q;
    var l=0;
    var h="";
    var k=false;
    if(o.path==""){
        o.path="/"
        }else{
        k=true
        }
        p=d.path.substring(0,d.path.lastIndexOf("/"));
    a=p.split("/");
    q=o.path.split("/");
    if(a.length>=q.length){
        for(var j=0;j<a.length;j++){
            if(j>=q.length||a[j]!=q[j]){
                l=j+1;
                break
            }
        }
        }
    if(a.length<q.length){
    for(var j=0;j<q.length;j++){
        if(j>=a.length||a[j]!=q[j]){
            l=j+1;
            break
        }
    }
    }
if(l==1){
    return o.path
    }
    for(var j=0;j<(a.length-(l-1));j++){
    h+="../"
    }
    for(var j=l-1;j<q.length;j++){
    if(j!=(l-1)){
        h+="/"+q[j]
        }else{
        h+=q[j]
        }
    }
o.protocol=null;
o.host=null;
o.port=null;
o.path=h==""&&k?"/":h;
var f=d.path;
var m;
if((m=f.lastIndexOf("/"))!=-1){
    f=f.substring(m+1)
    }
    if(f==o.path&&o.anchor!=""){
    o.path=""
    }
    if(o.path==""&&!o.anchor){
    o.path=f!=""?f:"/"
    }
    return this.serializeURL(o)
};

TinyMCE_Engine.prototype.convertRelativeToAbsoluteURL=function(s,o){
    var h=this.parseURL(s),e,d;
    var p=this.parseURL(o);
    if(o==""||o.indexOf("://")!=-1||/^(mailto:|javascript:|#|\/)/.test(o)){
        return o
        }
        e=h.path.split("/");
    d=p.path.split("/");
    var l=new Array();
    for(var k=e.length-1;k>=0;k--){
        if(e[k].length==0){
            continue
        }
        l[l.length]=e[k]
        }
        e=l.reverse();
    var q=new Array();
    var t=0;
    for(var k=d.length-1;k>=0;k--){
        if(d[k].length==0||d[k]=="."){
            continue
        }
        if(d[k]==".."){
            t++;
            continue
        }
        if(t>0){
            t--;
            continue
        }
        q[q.length]=d[k]
        }
        d=q.reverse();
    var m=e.length-t;
    var a=(m<=0?"":"/")+e.slice(0,m).join("/")+"/"+d.join("/");
    var f="",j="";
    p.protocol=h.protocol;
    p.host=h.host;
    p.port=h.port;
    if(p.path.charAt(p.path.length-1)=="/"){
        a+="/"
        }
        p.path=a;
    return this.serializeURL(p)
    };

TinyMCE_Engine.prototype.convertURL=function(a,i,k){
    var o=document.location.protocol;
    var p=document.location.hostname;
    var h=document.location.port;
    if(o=="file:"){
        return a
        }
        a=tinyMCE.regexpReplace(a,"(http|https):///","/");
    if(a.indexOf("mailto:")!=-1||a.indexOf("javascript:")!=-1||tinyMCE.regexpReplace(a,"[ \t\r\n+]|%20","").charAt(0)=="#"){
        return a
        }
        if(!tinyMCE.isIE&&!k&&a.indexOf("://")==-1&&a.charAt(0)!="/"){
        return tinyMCE.settings.base_href+a
        }
        if(k&&tinyMCE.getParam("relative_urls")){
        var j=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,a);
        if(j.charAt(0)=="/"){
            j=tinyMCE.settings.document_base_prefix+j
            }
            var f=tinyMCE.parseURL(j);
        var m=tinyMCE.parseURL(tinyMCE.settings.document_base_url);
        if(f.host==m.host&&(f.port==m.port)){
            return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,j)
            }
        }
    if(!tinyMCE.getParam("relative_urls")){
    var f=tinyMCE.parseURL(a);
    var e=tinyMCE.parseURL(tinyMCE.settings.base_href);
    a=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,a);
    if(f.anchor&&f.path==e.path){
        return"#"+f.anchor
        }
    }
if(tinyMCE.getParam("remove_script_host")){
    var d="",l="";
    if(h!=""){
        l=":"+h
        }
        d=o+"//"+p+l+"/";
    if(a.indexOf(d)==0){
        a=a.substring(d.length-1)
        }
    }
return a
};

TinyMCE_Engine.prototype.convertAllRelativeURLs=function(a){
    var f,h,k,e,j,d;
    h=a.getElementsByTagName("img");
    for(f=0;f<h.length;f++){
        k=tinyMCE.getAttrib(h[f],"src");
        d=tinyMCE.getAttrib(h[f],"mce_src");
        if(d!=""){
            k=d
            }
            if(k!=""){
            k=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,k);
            h[f].setAttribute("src",k)
            }
        }
    h=a.getElementsByTagName("a");
    for(f=0;f<h.length;f++){
    e=tinyMCE.getAttrib(h[f],"href");
    j=tinyMCE.getAttrib(h[f],"mce_href");
    if(j!=""){
        e=j
        }
        if(e&&e!=""){
        e=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,e);
        h[f].setAttribute("href",e)
        }
    }
};

TinyMCE_Engine.prototype.clearArray=function(d){
    var e;
    for(e in d){
        d[e]=null
        }
        return d
    };

TinyMCE_Engine.prototype.explode=function(j,f){
    var a=f.split(j),h=new Array(),e;
    for(e=0;e<a.length;e++){
        if(a[e]!=""){
            h[h.length]=a[e]
            }
        }
    return h
};

TinyMCE_Engine.prototype._setEventsEnabled=function(f,a){
    var l,k,j,e,h,d;
    var m=["onfocus","onblur","onclick","ondblclick","onmousedown","onmouseup","onmouseover","onmousemove","onmouseout","onkeypress","onkeydown","onkeydown","onkeyup"];
    l=tinyMCE.settings.event_elements.split(",");
    for(j=0;j<l.length;j++){
        e=f.getElementsByTagName(l[j]);
        for(h=0;h<e.length;h++){
            d="";
            for(k=0;k<m.length;k++){
                if((d=tinyMCE.getAttrib(e[h],m[k]))!=""){
                    d=tinyMCE.cleanupEventStr(""+d);
                    if(!a){
                        d="return true;"+d
                        }else{
                        d=d.replace(/^return true;/gi,"")
                        }
                        e[h].removeAttribute(m[k]);
                    e[h].setAttribute(m[k],d)
                    }
                }
            }
        }
};

TinyMCE_Engine.prototype._eventPatch=function(i){
    var j,d,h,f;
    if(typeof(tinyMCE)=="undefined"){
        return true
        }
        try{
        if(tinyMCE.selectedInstance){
            h=tinyMCE.selectedInstance.getWin();
            if(h&&h.event){
                f=h.event;
                if(!f.target){
                    f.target=f.srcElement
                    }
                    TinyMCE_Engine.prototype.handleEvent(f);
                return
            }
        }
        for(j in tinyMCE.instances){
        d=tinyMCE.instances[j];
        if(!tinyMCE.isInstance(d)){
            continue
        }
        d.select();
        h=d.getWin();
        if(h&&h.event){
            f=h.event;
            if(!f.target){
                f.target=f.srcElement
                }
                TinyMCE_Engine.prototype.handleEvent(f);
            return
        }
    }
    }catch(a){}
};

TinyMCE_Engine.prototype.findEvent=function(d){
    var f,a;
    if(d){
        return d
        }
        for(f in tinyMCE.instances){
        a=tinyMCE.instances[f];
        if(tinyMCE.isInstance(a)&&a.getWin().event){
            return a.getWin().event
            }
        }
    return null
};

TinyMCE_Engine.prototype.unloadHandler=function(){
    tinyMCE.triggerSave(true,true)
    };

TinyMCE_Engine.prototype.addEventHandlers=function(a){
    this.setEventHandlers(a,1)
    };

TinyMCE_Engine.prototype.setEventHandlers=function(k,d){
    var m=k.getDoc(),o,h,a,j=d?tinyMCE.addEvent:tinyMCE.removeEvent;
    o=["keypress","keyup","keydown","click","mouseup","mousedown","controlselect","dblclick"];
    h=["keypress","keyup","keydown","click","mouseup","mousedown","focus","blur","dragdrop"];
    k.switchSettings();
    if(tinyMCE.isIE){
        for(a=0;a<o.length;a++){
            j(m,o[a],TinyMCE_Engine.prototype._eventPatch)
            }
        }else{
    for(a=0;a<h.length;a++){
        j(m,h[a],tinyMCE.handleEvent)
        }
        try{
        m.designMode="On"
        }catch(l){}
}
};

TinyMCE_Engine.prototype.onMouseMove=function(){
    var d,a;
    if(tinyMCE.lastHover){
        a=tinyMCE.lastHover;
        if(a.className.indexOf("mceMenu")!=-1){
            tinyMCE._menuButtonEvent("out",a)
            }else{
            a.className=a.className
            }
            tinyMCE.lastHover=null
        }
        if(!tinyMCE.hasMouseMoved){
        d=tinyMCE.selectedInstance;
        if(d.isFocused){
            d.undoBookmark=d.selection.getBookmark();
            tinyMCE.hasMouseMoved=true
            }
        }
};

TinyMCE_Engine.prototype.cancelEvent=function(a){
    if(!a){
        return false
        }
        if(tinyMCE.isIE){
        a.returnValue=false;
        a.cancelBubble=true
        }else{
        a.preventDefault();
        a.stopPropagation&&a.stopPropagation()
        }
        return false
    };

TinyMCE_Engine.prototype.addEvent=function(e,f,d){
    if(f!="unload"){
        function a(){
            var h;
            try{
                tinyMCE.removeEvent(e,f,d);
                tinyMCE.removeEvent(window,"unload",a);
                e=f=d=null
                }catch(h){}
        }
        tinyMCE.addEvent(window,"unload",a)
    }
    if(e.attachEvent){
    e.attachEvent("on"+f,d)
    }else{
    e.addEventListener(f,d,false)
    }
};

TinyMCE_Engine.prototype.removeEvent=function(d,e,a){
    if(d.detachEvent){
        d.detachEvent("on"+e,a)
        }else{
        d.removeEventListener(e,a,false)
        }
    };

TinyMCE_Engine.prototype.addSelectAccessibility=function(f,d,a){
    if(!d._isAccessible){
        d.onkeydown=tinyMCE.accessibleEventHandler;
        d.onblur=tinyMCE.accessibleEventHandler;
        d._isAccessible=true;
        d._win=a
        }
        return false
    };

TinyMCE_Engine.prototype.accessibleEventHandler=function(d){
    var a=this._win;
    d=tinyMCE.isIE?a.event:d;
    var f=tinyMCE.isIE?d.srcElement:d.target;
    if(d.type=="blur"){
        if(f.oldonchange){
            f.onchange=f.oldonchange;
            f.oldonchange=null
            }
            return true
        }
        if(f.nodeName=="SELECT"&&!f.oldonchange){
        f.oldonchange=f.onchange;
        f.onchange=null
        }
        if(d.keyCode==13||d.keyCode==32){
        f.onchange=f.oldonchange;
        f.onchange();
        f.oldonchange=null;
        tinyMCE.cancelEvent(d);
        return false
        }
        return true
    };

TinyMCE_Engine.prototype._resetIframeHeight=function(){
    var a;
    if(tinyMCE.isRealIE){
        a=tinyMCE.selectedInstance.iframeElement;
        if(a._oldHeight){
            a.style.height=a._oldHeight;
            a.height=a._oldHeight
            }
        }
};

function TinyMCE_Selection(a){
    this.instance=a
    }
    TinyMCE_Selection.prototype={
    getSelectedHTML:function(){
        var f=this.instance;
        var i,d=this.getRng(),a;
        if(!d){
            return null
            }
            i=document.createElement("body");
        if(d.cloneContents){
            i.appendChild(d.cloneContents())
            }else{
            if(typeof(d.item)!="undefined"||typeof(d.htmlText)!="undefined"){
                i.innerHTML=d.item?d.item(0).outerHTML:d.htmlText
                }else{
                i.innerHTML=d.toString()
                }
            }
        a=tinyMCE._cleanupHTML(f,f.contentDocument,f.settings,i,i,false,true,false);
    return a
    },
getSelectedText:function(){
    var h=this.instance;
    var i,f,e,a;
    if(tinyMCE.isIE){
        i=h.getDoc();
        if(i.selection.type=="Text"){
            f=i.selection.createRange();
            a=f.text
            }else{
            a=""
            }
        }else{
    e=this.getSel();
    if(e&&e.toString){
        a=e.toString()
        }else{
        a=""
        }
    }
return a
},
getBookmark:function(t){
    var f=this.instance;
    var j=this.getRng();
    var B=f.getDoc(),z=f.getBody();
    var v,q,l,y,d,u,A,a,k;
    var o,p,m,h=-999999999,x=f.getViewPort();
    p=x.left;
    m=x.top;
    if(tinyMCE.isSafari||tinyMCE.isOpera||t){
        return{
            rng:j,
            scrollX:p,
            scrollY:m
        }
    }
    if(tinyMCE.isIE){
    if(j.item){
        y=j.item(0);
        d=z.getElementsByTagName(y.nodeName);
        for(u=0;u<d.length;u++){
            if(y==d[u]){
                v=u;
                break
            }
        }
        return{
        tag:y.nodeName,
        index:v,
        scrollX:p,
        scrollY:m
    }
}else{
    o=B.body.createTextRange();
    o.moveToElementText(f.getBody());
    o.collapse(true);
    bp=Math.abs(o.move("character",h));
    o=j.duplicate();
    o.collapse(true);
    v=Math.abs(o.move("character",h));
    o=j.duplicate();
    o.collapse(false);
    q=Math.abs(o.move("character",h))-v;
    return{
        start:v-bp,
        length:q,
        scrollX:p,
        scrollY:m
    }
}
}
if(tinyMCE.isGecko){
    l=this.getSel();
    y=this.getFocusElement();
    if(!l){
        return null
        }
        if(y&&y.nodeName=="IMG"){
        return{
            start:-1,
            end:-1,
            index:v,
            scrollX:p,
            scrollY:m
        }
    }
    if(l.anchorNode==l.focusNode&&l.anchorOffset==l.focusOffset){
    y=this._getPosText(z,l.anchorNode,l.focusNode);
    if(!y){
        return{
            scrollX:p,
            scrollY:m
        }
    }
    return{
    start:y.start+l.anchorOffset,
    end:y.end+l.focusOffset,
    scrollX:p,
    scrollY:m
}
}
else{
    y=this._getPosText(z,j.startContainer,j.endContainer);
    if(!y){
        return{
            scrollX:p,
            scrollY:m
        }
    }
    return{
    start:y.start+j.startOffset,
    end:y.end+j.endOffset,
    scrollX:p,
    scrollY:m
}
}
}
return null
},
moveToBookmark:function(k){
    var h=this.instance;
    var a,d,f,m,o=h.getBody(),l;
    var p=h.getDoc();
    var j=h.getWin();
    var e=this.getSel();
    if(!k){
        return false
        }
        if(tinyMCE.isSafari){
        e.setBaseAndExtent(k.rng.startContainer,k.rng.startOffset,k.rng.endContainer,k.rng.endOffset);
        return true
        }
        if(tinyMCE.isRealIE){
        if(k.rng){
            try{
                k.rng.select()
                }catch(m){}
            return true
            }
            j.focus();
        if(k.tag){
            a=o.createControlRange();
            d=o.getElementsByTagName(k.tag);
            if(d.length>k.index){
                try{
                    a.addElement(d[k.index])
                    }catch(m){}
            }
        }else{
    try{
        if(k.start<0){
            return true
            }
            a=h.getSel().createRange();
        a.moveToElementText(h.getBody());
        a.collapse(true);
        a.moveStart("character",k.start);
        a.moveEnd("character",k.length)
        }catch(m){
        return true
        }
    }
a.select();
j.scrollTo(k.scrollX,k.scrollY);
return true
}
if(tinyMCE.isGecko||tinyMCE.isOpera){
    if(!e){
        return false
        }
        if(k.rng){
        e.removeAllRanges();
        e.addRange(k.rng)
        }
        if(k.start!=-1&&k.end!=-1){
        try{
            l=this._getTextPos(o,k.start,k.end);
            a=p.createRange();
            a.setStart(l.startNode,l.startOffset);
            a.setEnd(l.endNode,l.endOffset);
            e.removeAllRanges();
            e.addRange(a);
            j.focus()
            }catch(m){}
    }
    j.scrollTo(k.scrollX,k.scrollY);
return true
}
return false
},
_getPosText:function(f,j,e){
    var a=document.createTreeWalker(f,NodeFilter.SHOW_TEXT,null,false),k,h=0,i={};
    while((k=a.nextNode())!=null){
        if(k==j){
            i.start=h
            }
            if(k==e){
            i.end=h;
            return i
            }
            h+=k.nodeValue?k.nodeValue.length:0
        }
        return null
    },
_getTextPos:function(f,h,e){
    var a=document.createTreeWalker(f,NodeFilter.SHOW_TEXT,null,false),k,i=0,j={};
    while((k=a.nextNode())!=null){
        i+=k.nodeValue?k.nodeValue.length:0;
        if(i>=h&&!j.startNode){
            j.startNode=k;
            j.startOffset=h-(i-k.nodeValue.length)
            }
            if(i>=e){
            j.endNode=k;
            j.endOffset=e-(i-k.nodeValue.length);
            return j
            }
        }
    return null
},
selectNode:function(h,m,k,l){
    var i=this.instance,f,a,d;
    if(!h){
        return
    }
    if(typeof(m)=="undefined"){
        m=true
        }
        if(typeof(k)=="undefined"){
        k=false
        }
        if(typeof(l)=="undefined"){
        l=true
        }
        if(i.settings.auto_resize){
        i.resizeToContent()
        }
        if(tinyMCE.isRealIE){
        a=i.getDoc().body.createTextRange();
        try{
            a.moveToElementText(h);
            if(m){
                a.collapse(l)
                }
                a.select()
            }catch(j){}
    }else{
    f=this.getSel();
    if(!f){
        return
    }
    if(tinyMCE.isSafari){
        f.setBaseAndExtent(h,0,h,h.innerText.length);
        if(m){
            if(l){
                f.collapseToStart()
                }else{
                f.collapseToEnd()
                }
            }
        this.scrollToNode(h);
    return
}
a=i.getDoc().createRange();
if(k){
    d=tinyMCE.getNodeTree(h,new Array(),3);
    if(d.length>0){
        a.selectNodeContents(d[0])
        }else{
        a.selectNodeContents(h)
        }
    }else{
    a.selectNode(h)
    }
    if(m){
    if(!l&&h.nodeType==3){
        a.setStart(h,h.nodeValue.length);
        a.setEnd(h,h.nodeValue.length)
        }else{
        a.collapse(l)
        }
    }
f.removeAllRanges();
f.addRange(a)
}
this.scrollToNode(h);
tinyMCE.selectedElement=null;
if(h.nodeType==1){
    tinyMCE.selectedElement=h
    }
},
scrollToNode:function(f){
    var h=this.instance,a=h.getWin(),e=h.getViewPort(),k=tinyMCE.getAbsPosition(f),d,j,i;
    if(k.absLeft<e.left||k.absLeft>e.left+e.width||k.absTop<e.top||k.absTop>e.top+(e.height-25)){
        a.scrollTo(k.absLeft,k.absTop-e.height+25)
        }
        if(h.settings.auto_resize){
        i=h.getContainerWin();
        d=tinyMCE.getViewPort(i);
        j=this.getAbsPosition(f);
        if(j.absLeft<d.left||j.absLeft>d.left+d.width||j.absTop<d.top||j.absTop>d.top+d.height){
            i.scrollTo(j.absLeft,j.absTop-d.height+25)
            }
        }
},
getAbsPosition:function(e){
    var d=tinyMCE.getAbsPosition(e),a=tinyMCE.getAbsPosition(this.instance.iframeElement);
    return{
        absLeft:a.absLeft+d.absLeft,
        absTop:a.absTop+d.absTop
        }
    },
getSel:function(){
    var a=this.instance;
    if(tinyMCE.isRealIE){
        return a.getDoc().selection
        }
        return a.contentWindow.getSelection()
    },
getRng:function(){
    var a=this.getSel();
    if(a==null){
        return null
        }
        if(tinyMCE.isRealIE){
        return a.createRange()
        }
        if(tinyMCE.isSafari&&!a.getRangeAt){
        return""+window.getSelection()
        }
        if(a.rangeCount>0){
        return a.getRangeAt(0)
        }
        return null
    },
isCollapsed:function(){
    var a=this.getRng();
    if(a.item){
        return false
        }
        return a.boundingWidth==0||this.getSel().isCollapsed
    },
collapse:function(a){
    var e=this.getRng(),d=this.getSel();
    if(e.select){
        e.collapse(a);
        e.select()
        }else{
        if(a){
            d.collapseToStart()
            }else{
            d.collapseToEnd()
            }
        }
},
getFocusElement:function(){
    var e=this.instance,f,a,d,h;
    if(tinyMCE.isRealIE){
        f=e.getDoc();
        a=f.selection.createRange();
        h=a.item?a.item(0):a.parentElement()
        }else{
        if(!tinyMCE.isSafari&&e.isHidden()){
            return e.getBody()
            }
            d=this.getSel();
        a=this.getRng();
        if(!d||!a){
            return null
            }
            h=a.commonAncestorContainer;
        if(!a.collapsed){
            if(a.startContainer==a.endContainer){
                if(a.startOffset-a.endOffset<2){
                    if(a.startContainer.hasChildNodes()){
                        h=a.startContainer.childNodes[a.startOffset]
                        }
                    }
            }
    }
h=tinyMCE.getParentElement(h)
}
return h
}
};

function TinyMCE_UndoRedo(a){
    this.instance=a;
    this.undoLevels=new Array();
    this.undoIndex=0;
    this.typingUndoIndex=-1;
    this.undoRedo=true
    }
    TinyMCE_UndoRedo.prototype={
    add:function(a){
        var m,e,j,h=this.instance,f,k,d;
        if(a){
            this.undoLevels[this.undoLevels.length]=a;
            return true
            }
            if(this.typingUndoIndex!=-1){
            this.undoIndex=this.typingUndoIndex;
            if(tinyMCE.typingUndoIndex!=-1){
                tinyMCE.undoIndex=tinyMCE.typingUndoIndex
                }
            }
        var o=h.getBody();
    if(o!=null){
        j=tinyMCE.trim(h.getBody().innerHTML)
        }
        if(this.undoLevels[this.undoIndex]&&j!=this.undoLevels[this.undoIndex].content){
        tinyMCE.dispatchCallback(h,"onchange_callback","onChange",h);
        e=tinyMCE.settings.custom_undo_redo_levels;
        if(e!=-1&&this.undoLevels.length>e){
            for(f=0;f<this.undoLevels.length-1;f++){
                this.undoLevels[f]=this.undoLevels[f+1]
                }
                this.undoLevels.length--;
            this.undoIndex--
        }
        m=h.undoBookmark;
        if(!m){
            m=h.selection.getBookmark()
            }
            this.undoIndex++;
        this.undoLevels[this.undoIndex]={
            content:j,
            bookmark:m
        };

        k=tinyMCE.undoLevels;
        for(f=tinyMCE.undoIndex+1;f<k.length;f++){
            d=k[f].undoRedo;
            if(d.undoIndex==d.undoLevels.length-1){
                d.undoIndex--
            }
            d.undoLevels.length--
        }
        tinyMCE.undoLevels[tinyMCE.undoIndex++]=h;
        tinyMCE.undoLevels.length=tinyMCE.undoIndex;
        this.undoLevels.length=this.undoIndex+1;
        return true
        }
        return false
    },
undo:function(){
    var a=this.instance;
    if(this.undoIndex>0){
        this.undoIndex--;
        tinyMCE.setInnerHTML(a.getBody(),this.undoLevels[this.undoIndex].content);
        a.repaint();
        if(a.settings.custom_undo_redo_restore_selection){
            a.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)
            }
        }
},
redo:function(){
    var a=this.instance;
    tinyMCE.execCommand("mceEndTyping");
    if(this.undoIndex<(this.undoLevels.length-1)){
        this.undoIndex++;
        tinyMCE.setInnerHTML(a.getBody(),this.undoLevels[this.undoIndex].content);
        a.repaint();
        if(a.settings.custom_undo_redo_restore_selection){
            a.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)
            }
        }
    tinyMCE.triggerNodeChange()
}
};

var TinyMCE_ForceParagraphs={
    _insertPara:function(i,A){
        var E=i.getDoc(),v=i.getSel(),q=i.getBody(),l=i.contentWindow,p=v.getRangeAt(0);
        var h=E.documentElement,w="P",D,u,o,j;
        var d,z,a,D,x,u,m,B=tinyMCE.isOpera?i.selection.getBookmark():null;
        var f,k,C,t,y;
        function s(e){
            function H(I){
                return I.replace(new RegExp("[ \t\r\n]+","g"),"").toLowerCase()==""
                }
                if(e.getElementsByTagName("img").length>0){
                return false
                }
                if(e.getElementsByTagName("table").length>0){
                return false
                }
                if(e.getElementsByTagName("hr").length>0){
                return false
                }
                var F=tinyMCE.getNodeTree(e,new Array(),3);
            for(var G=0;G<F.length;G++){
                if(!H(F[G].nodeValue)){
                    return false
                    }
                }
            return true
        }
        d=E.createRange();
    d.setStart(v.anchorNode,v.anchorOffset);
    d.collapse(true);
    z=E.createRange();
    z.setStart(v.focusNode,v.focusOffset);
    z.collapse(true);
    a=d.compareBoundaryPoints(d.START_TO_END,z)<0;
    D=a?v.anchorNode:v.focusNode;
    x=a?v.anchorOffset:v.focusOffset;
    u=a?v.focusNode:v.anchorNode;
    m=a?v.focusOffset:v.anchorOffset;
    D=D.nodeName=="BODY"?D.firstChild:D;
    u=u.nodeName=="BODY"?u.firstChild:u;
    o=i.getParentBlockElement(D);
    j=i.getParentBlockElement(u);
    if(o&&new RegExp("absolute|relative|static","gi").test(o.style.position)){
        o=null
        }
        if(j&&new RegExp("absolute|relative|static","gi").test(j.style.position)){
        j=null
        }
        if(o!=null){
        w=o.nodeName;
        if(w=="TD"||w=="TABLE"||(w=="DIV"&&new RegExp("left|right","gi").test(o.style.cssFloat))){
            w="P"
            }
        }
    if(tinyMCE.getParentElement(o,"OL,UL",null,q)!=null){
    return false
    }
    if((o!=null&&o.nodeName=="TABLE")||(j!=null&&j.nodeName=="TABLE")){
    o=j=null
    }
    f=(o!=null&&o.nodeName==w)?o.cloneNode(false):E.createElement(w);
k=(j!=null&&j.nodeName==w)?j.cloneNode(false):E.createElement(w);
if(/^(H[1-6])$/.test(w)){
    k=E.createElement("p")
    }
    C=D;
t=u;
node=C;
do{
    if(node==q||node.nodeType==9||tinyMCE.isBlockElement(node)){
        break
    }
    C=node
    }while((node=node.previousSibling?node.previousSibling:node.parentNode));
node=t;
do{
    if(node==q||node.nodeType==9||tinyMCE.isBlockElement(node)){
        break
    }
    t=node
    }while((node=node.nextSibling?node.nextSibling:node.parentNode));
if(C.nodeName=="TD"){
    C=C.firstChild
    }
    if(t.nodeName=="TD"){
    t=t.lastChild
    }
    if(o==null){
    p.deleteContents();
    if(!tinyMCE.isSafari){
        v.removeAllRanges()
        }
        if(C!=h&&t!=h){
        d=p.cloneRange();
        if(C==q){
            d.setStart(C,0)
            }else{
            d.setStartBefore(C)
            }
            f.appendChild(d.cloneContents());
        if(t.parentNode.nodeName==w){
            t=t.parentNode
            }
            p.setEndAfter(t);
        if(t.nodeName!="#text"&&t.nodeName!="BODY"){
            d.setEndAfter(t)
            }
            y=p.cloneContents();
        if(y.firstChild&&(y.firstChild.nodeName==w||y.firstChild.nodeName=="BODY")){
            k.innerHTML=y.firstChild.innerHTML
            }else{
            k.appendChild(y)
            }
            if(s(f)){
            f.innerHTML="&nbsp;"
            }
            if(s(k)){
            k.innerHTML="&nbsp;"
            }
            p.deleteContents();
        z.deleteContents();
        d.deleteContents();
        if(tinyMCE.isOpera){
            f.normalize();
            d.insertNode(f);
            k.normalize();
            d.insertNode(k)
            }else{
            k.normalize();
            d.insertNode(k);
            f.normalize();
            d.insertNode(f)
            }
        }else{
    q.innerHTML="<"+w+">&nbsp;</"+w+"><"+w+">&nbsp;</"+w+">";
    k=q.childNodes[1]
    }
    i.selection.moveToBookmark(B);
i.selection.selectNode(k,true,true);
return true
}
if(C.nodeName==w){
    d.setStart(C,0)
    }else{
    d.setStartBefore(C)
    }
    d.setEnd(D,x);
f.appendChild(d.cloneContents());
z.setEndAfter(t);
z.setStart(u,m);
y=z.cloneContents();
if(y.firstChild&&y.firstChild.nodeName==w){
    k.innerHTML=y.firstChild.innerHTML
    }else{
    k.appendChild(y)
    }
    if(s(f)){
    f.innerHTML="&nbsp;"
    }
    if(s(k)){
    k.innerHTML="&nbsp;"
    }
    p=E.createRange();
if(!C.previousSibling&&C.parentNode.nodeName.toUpperCase()==w){
    p.setStartBefore(C.parentNode)
    }else{
    if(d.startContainer.nodeName.toUpperCase()==w&&d.startOffset==0){
        p.setStartBefore(d.startContainer)
        }else{
        p.setStart(d.startContainer,d.startOffset)
        }
    }
if(!t.nextSibling&&t.parentNode.nodeName.toUpperCase()==w){
    p.setEndAfter(t.parentNode)
    }else{
    p.setEnd(z.endContainer,z.endOffset)
    }
    p.deleteContents();
if(tinyMCE.isOpera){
    p.insertNode(f);
    p.insertNode(k)
    }else{
    p.insertNode(k);
    p.insertNode(f)
    }
    k.normalize();
f.normalize();
i.selection.moveToBookmark(B);
i.selection.selectNode(k,true,true);
return true
},
_handleBackSpace:function(f){
    var e=f.getRng(),h=e.startContainer,a,d=false;
    if(h&&h.nextSibling&&h.nextSibling.nodeName=="BR"&&h.parentNode.nodeName!="BODY"){
        a=h.nodeValue;
        if(a!=null&&e.startOffset==a.length){
            h.nextSibling.parentNode.removeChild(h.nextSibling)
            }
        }
    if(f.settings.auto_resize){
    f.resizeToContent()
    }
    return d
}
};

function TinyMCE_Layer(d,a){
    this.id=d;
    this.blockerElement=null;
    this.events=false;
    this.element=null;
    this.blockMode=typeof(a)!="undefined"?a:true;
    this.doc=document
    }
    TinyMCE_Layer.prototype={
    moveRelativeTo:function(q,a){
        var m=this.getAbsPosition(q);
        var o=parseInt(q.offsetWidth);
        var f=parseInt(q.offsetHeight);
        var i=this.getElement();
        var j=parseInt(i.offsetWidth);
        var d=parseInt(i.offsetHeight);
        var l,k;
        switch(a){
            case"tl":
                l=m.absLeft;
                k=m.absTop;
                break;
            case"tr":
                l=m.absLeft+o;
                k=m.absTop;
                break;
            case"bl":
                l=m.absLeft;
                k=m.absTop+f;
                break;
            case"br":
                l=m.absLeft+o;
                k=m.absTop+f;
                break;
            case"cc":
                l=m.absLeft+(o/2)-(j/2);
                k=m.absTop+(f/2)-(d/2);
                break
                }
                this.moveTo(l,k)
        },
    moveBy:function(a,f){
        var d=this.getElement();
        this.moveTo(parseInt(d.style.left)+a,parseInt(d.style.top)+f)
        },
    moveTo:function(a,f){
        var d=this.getElement();
        d.style.left=a+"px";
        d.style.top=f+"px";
        this.updateBlocker()
        },
    resizeBy:function(a,d){
        var f=this.getElement();
        this.resizeTo(parseInt(f.style.width)+a,parseInt(f.style.height)+d)
        },
    resizeTo:function(a,d){
        var f=this.getElement();
        if(a!=null){
            f.style.width=a+"px"
            }
            if(d!=null){
            f.style.height=d+"px"
            }
            this.updateBlocker()
        },
    show:function(){
        var a=this.getElement();
        if(a){
            a.style.display="block";
            this.updateBlocker()
            }
        },
hide:function(){
    var a=this.getElement();
    if(a){
        a.style.display="none";
        this.updateBlocker()
        }
    },
isVisible:function(){
    return this.getElement().style.display=="block"
    },
getElement:function(){
    if(!this.element){
        this.element=this.doc.getElementById(this.id)
        }
        return this.element
    },
setBlockMode:function(a){
    this.blockMode=a
    },
updateBlocker:function(){
    var j,d,a,k,f,i;
    d=this.getBlocker();
    if(d){
        if(this.blockMode){
            j=this.getElement();
            a=this.parseInt(j.style.left);
            k=this.parseInt(j.style.top);
            f=this.parseInt(j.offsetWidth);
            i=this.parseInt(j.offsetHeight);
            d.style.left=a+"px";
            d.style.top=k+"px";
            d.style.width=f+"px";
            d.style.height=i+"px";
            d.style.display=j.style.display
            }else{
            d.style.display="none"
            }
        }
},
getBlocker:function(){
    var e,a;
    if(!this.blockerElement&&this.blockMode){
        e=this.doc;
        a=e.getElementById(this.id+"_blocker");
        if(!a){
            a=e.createElement("iframe");
            a.setAttribute("id",this.id+"_blocker");
            a.style.cssText="display: none; position: absolute; left: 0; top: 0";
            a.src="javascript:false;";
            a.frameBorder="0";
            a.scrolling="no";
            e.body.appendChild(a)
            }
            this.blockerElement=a
        }
        return this.blockerElement
    },
getAbsPosition:function(d){
    var a={
        absLeft:0,
        absTop:0
    };
    while(d){
        a.absLeft+=d.offsetLeft;
        a.absTop+=d.offsetTop;
        d=d.offsetParent
        }
        return a
    },
create:function(l,k,i,a){
    var j=this.doc,f=j.createElement(l);
    f.setAttribute("id",this.id);
    if(k){
        f.className=k
        }
        if(!i){
        i=j.body
        }
        if(a){
        f.innerHTML=a
        }
        i.appendChild(f);
    return this.element=f
    },
exists:function(){
    return this.doc.getElementById(this.id)!=null
    },
parseInt:function(a){
    if(a==null||a==""){
        return 0
        }
        return parseInt(a)
    },
remove:function(){
    var d=this.getElement(),a=this.getBlocker();
    if(d){
        d.parentNode.removeChild(d)
        }
        if(a){
        a.parentNode.removeChild(a)
        }
    }
};

function TinyMCE_Menu(){
    var a;
    if(typeof(tinyMCE.menuCounter)=="undefined"){
        tinyMCE.menuCounter=0
        }
        a="mc_menu_"+tinyMCE.menuCounter++;
    TinyMCE_Layer.call(this,a,true);
    this.id=a;
    this.items=new Array();
    this.needsUpdate=true
    }
    TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{
    init:function(a){
        var d;
        this.settings={
            separator_class:"mceMenuSeparator",
            title_class:"mceMenuTitle",
            disabled_class:"mceMenuDisabled",
            menu_class:"mceMenu",
            drop_menu:true
        };

        for(d in a){
            this.settings[d]=a[d]
            }
            this.create("div",this.settings.menu_class)
        },
    clear:function(){
        this.items=new Array()
        },
    addTitle:function(a){
        this.add({
            type:"title",
            text:a
        })
        },
    addDisabled:function(a){
        this.add({
            type:"disabled",
            text:a
        })
        },
    addSeparator:function(){
        this.add({
            type:"separator"
        })
        },
    addItem:function(a,d){
        this.add({
            text:a,
            js:d
        })
        },
    add:function(a){
        this.items[this.items.length]=a;
        this.needsUpdate=true
        },
    update:function(){
        var l=this.getElement(),k="",f,d,a=this.items,j=this.settings;
        if(this.settings.drop_menu){
            k+='<span class="mceMenuLine"></span>'
            }
            k+='<table border="0" cellpadding="0" cellspacing="0">';
        for(f=0;f<a.length;f++){
            d=tinyMCE.xmlEncode(a[f].text);
            c=a[f].class_name?' class="'+a[f].class_name+'"':"";
            switch(a[f].type){
                case"separator":
                    k+='<tr class="'+j.separator_class+'"><td>';
                    break;
                case"title":
                    k+='<tr class="'+j.title_class+'"><td><span'+c+">"+d+"</span>";
                    break;
                case"disabled":
                    k+='<tr class="'+j.disabled_class+'"><td><span'+c+">"+d+"</span>";
                    break;
                default:
                    k+='<tr><td><a href="'+tinyMCE.xmlEncode(a[f].js)+'" onmousedown="'+tinyMCE.xmlEncode(a[f].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+">"+d+"</span></a>"
                    }
                    k+="</td></tr>"
            }
            k+="</table>";
        l.innerHTML=k;
        this.needsUpdate=false;
        this.updateBlocker()
        },
    show:function(){
        var a,d;
        if(tinyMCE.lastMenu==this){
            return
        }
        if(this.needsUpdate){
            this.update()
            }
            if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this){
            tinyMCE.lastMenu.hide()
            }
            TinyMCE_Layer.prototype.show.call(this);
        if(!tinyMCE.isOpera){}
        tinyMCE.lastMenu=this
        }
    });
if(!Function.prototype.call){
    Function.prototype.call=function(){
        var a=arguments,s=a[0],i,as="",r,o;
        for(i=1;i<a.length;i++){
            as+=(i>1?",":"")+"a["+i+"]"
            }
            o=s._fu;
        s._fu=this;
        r=eval("s._fu("+as+")");
        s._fu=o;
        return r
        }
    }
    TinyMCE_Engine.prototype.debug=function(){
    var d="",f,h,e=tinyMCE.log.length;
    for(h=0,f=this.debug.arguments;h<f.length;h++){
        d+=f[h];
        if(h<f.length-1){
            d+=", "
            }
        }
    if(e<1000){
    tinyMCE.log[e]="[debug] "+d
    }
};
