Make WordPress Core

Changeset 2993


Ignore:
Timestamp:
11/06/2005 03:30:11 AM (20 years ago)
Author:
ryan
Message:

TinyMCE 2.0RC4 Props skeltoac. fixes #1830

Location:
trunk
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-header.php

    r2964 r2993  
    8181<?php if ( isset( $editing ) ) : ?>
    8282<?php if ( 'true' == get_user_option('rich_editing') ) :?>
    83 <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php"></script>
     83<script language="javascript" type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce_gzip.php?index=0&theme=advanced&plugins=wordpress,autosave"></script>
    8484<script type="text/javascript">
    8585tinyMCE.init({
     
    102102    remove_script_host : false,
    103103    valid_elements : "a[href|title],strong/b,em/i,strike,u,p[class|align],ol,ul,li,br,img[class|src|alt|title|width|height|align],sub,sup,blockquote,table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class],address,h1[class|align],h2[class|align],h3[class|align],h4[class|align],h5[class|align],h6[class|align],hr",
    104     plugins : "contextmenu,wordpress"
     104    plugins : "wordpress,autosave"
    105105    <?php do_action('mce_options'); ?>
    106106});
  • trunk/wp-admin/edit-form-advanced.php

    r2988 r2993  
    3939}
    4040
    41 $saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
     41$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />';
    4242
    4343if (empty($post->post_status)) $post->post_status = 'draft';
     
    151151//-->
    152152</script>
     153<?php else : ?>
     154<script type="text/javascript">
     155<!--
     156// This code is meant to allow tabbing from Title to Post (TinyMCE).
     157if ( tinyMCE.isMSIE )
     158    document.getElementById('title').onkeydown = function (e)
     159        {
     160            e = e ? e : window.event;
     161            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     162                var i = tinyMCE.selectedInstance;
     163                if(typeof i ==  'undefined')
     164                    return true;
     165                                tinyMCE.execCommand("mceStartTyping");
     166                this.blur();
     167                i.contentWindow.focus();
     168                e.returnValue = false;
     169                return false;
     170            }
     171        }
     172else
     173    document.getElementById('title').onkeypress = function (e)
     174        {
     175            e = e ? e : window.event;
     176            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
     177                var i = tinyMCE.selectedInstance;
     178                if(typeof i ==  'undefined')
     179                    return true;
     180                                tinyMCE.execCommand("mceStartTyping");
     181                this.blur();
     182                i.contentWindow.focus();
     183                e.returnValue = false;
     184                return false;
     185            }
     186        }
     187
     188//-->
     189</script>
    153190<?php endif; ?>
    154191
     
    159196<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="4" />
    160197<?php
    161 if ( 'publish' != $post->post_status || 0 == $post_ID ) {
     198if ('publish' != $post_status || 0 == $post_ID) {
    162199?>
    163200<?php if ( current_user_can('publish_posts') ) : ?>
    164     <input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" />
     201    <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
    165202<?php endif; ?>
    166203<?php
     
    176213<?php do_action('edit_form_advanced'); ?>
    177214
    178 <iframe border="0" src="image-uploading.php?action=view&amp;post=<?php echo 0 == $post_ID ? $temp_ID : $post_ID; ?>" id="imageup">This feature requires iframe support.</iframe>
     215<?php
     216$uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID);
     217$uploading_iframe_src = "image-uploading.php?action=view&amp;post=$uploading_iframe_ID";
     218$uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src);
     219if ( false != $uploading_iframe_src )
     220    echo '<iframe id="uploading" border="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>';
     221?>
    179222
    180223<div id="advancedstuff" class="dbx-group" >
     
    182225<fieldset id="postexcerpt" class="dbx-box">
    183226<h3 class="dbx-handle"><?php _e('Optional Excerpt') ?></h3>
    184 <div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="7" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
     227<div class="dbx-content"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div>
    185228</fieldset>
    186229
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin.js

    r2916 r2993  
    11/* Import plugin specific language pack */
    2  tinyMCE.importPluginLanguagePack('autosave','en,sv,cs');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler;
     2 tinyMCE.importPluginLanguagePack('autosave','en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');function TinyMCE_autosave_getInfo(){return{longname:'Auto save',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_autosave.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};function TinyMCE_autosave_beforeUnloadHandler(){var msg=tinyMCE.getLang("lang_autosave_unload_msg");var anyDirty=false;for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.isDirty())return msg;}return;}window.onbeforeunload=TinyMCE_autosave_beforeUnloadHandler;
  • trunk/wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js

    r2916 r2993  
    11/* Import plugin specific language pack */
    2 tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs');
     2tinyMCE.importPluginLanguagePack('autosave', 'en,sv,cs,he,no,hu,de,da,ru,ru_KOI8-R,ru_UTF-8,fi,cy,es,is,pl');
    33
    44function TinyMCE_autosave_getInfo() {
     
    1818    for (var n in tinyMCE.instances) {
    1919        var inst = tinyMCE.instances[n];
     20        if (!tinyMCE.isInstance(inst))
     21            continue;
    2022
    2123        if (inst.isDirty())
  • trunk/wp-includes/js/tinymce/plugins/autosave/langs/cs.js

    r2916 r2993  
    1 /**
    2  * Czech lang variables
    3  * encoding: utf-8
    4  * 
    5  * $Id$
    6  */ 
    7 
    8 tinyMCE.addToLang('',{
    9 autosave_unload_msg : 'Změny, které jste udělal(a) budou ztraceny, jestliže opustíte tuto stránku.'
    10 });
    11 
  • trunk/wp-includes/js/tinymce/plugins/autosave/langs/sv.js

    r2916 r2993  
    1 // SE lang variables
    2 
    3 tinyMCE.addToLang('',{
    4 autosave_unload_msg : 'F&ouml;r&auml;ndringarna du gjorde kommer att g&aring; f&ouml;rlorade om du v&auml;ljer att l&auml;mna denna sida.'
    5 });
    6 
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js

    r2916 r2993  
    11/**
    2  * $RCSfile: editor_plugin_src.js,v $
    3  * $Revision: 1.2 $
    4  * $Date: 2005/08/23 20:28:34 $
     2 * $RCSfile: editor_plugin.js,v $
     3 * $Revision: 1.42 $
     4 * $Date: 2005/10/30 16:06:56 $
    55 *
    66 * Moxiecode DHTML Windows script.
     
    99 * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
    1010 */
    11  function TinyMCE_inlinepopups_getInfo(){return{longname:'Inline Popups',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};TinyMCE.prototype.orgOpenWindow=TinyMCE.prototype.openWindow;TinyMCE.prototype.openWindow=function(template,args){if(args['inline']!="yes"){mcWindows.selectedWindow=null;args['mce_inside_iframe']=false;this.orgOpenWindow(template,args);return;}var url,resizable,scrollbars;args['mce_inside_iframe']=true;tinyMCE.windowArgs=args;if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";height+=18;for(var name in args)url=tinyMCE.replaceVar(url,name,escape(args[name]));var elm=document.getElementById(this.selectedInstance.editorId+'_parent');var pos=tinyMCE.getAbsPosition(elm);pos.absLeft+=Math.round((elm.firstChild.clientWidth/2)-(width/2));pos.absTop+=Math.round((elm.firstChild.clientHeight/2)-(height/2));mcWindows.open(url,mcWindows.idCounter++,"modal=yes,width="+width+",height="+height+",resizable="+resizable+",scrollbars="+scrollbars+",statusbar="+resizable+",left="+pos.absLeft+",top="+pos.absTop);};TinyMCE.prototype.orgCloseWindow=TinyMCE.prototype.closeWindow;TinyMCE.prototype.closeWindow=function(win){if(mcWindows.selectedWindow!=null)mcWindows.selectedWindow.close();else this.orgCloseWindow(win);};TinyMCE.prototype.setWindowTitle=function(win_ref,title){for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win_ref.name==win.id+"_iframe")window.frames[win.id+"_iframe"].document.getElementById(win.id+'_title').innerHTML=title;}};function MCWindows(){this.settings=new Array();this.windows=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.action="none";this.selectedWindow=null;this.lastSelectedWindow=null;this.zindex=100;this.mouseDownScreenX=0;this.mouseDownScreenY=0;this.mouseDownLayerX=0;this.mouseDownLayerY=0;this.mouseDownWidth=0;this.mouseDownHeight=0;this.idCounter=0;};MCWindows.prototype.init=function(settings){this.settings=settings;if(this.isMSIE)this.addEvent(document,"mousemove",mcWindows.eventDispatcher);else this.addEvent(window,"mousemove",mcWindows.eventDispatcher);this.addEvent(document,"mouseup",mcWindows.eventDispatcher);this.doc=document;};MCWindows.prototype.getParam=function(name,default_value){var value=null;value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");return value;};MCWindows.prototype.eventDispatcher=function(e){e=typeof(e)=="undefined"?window.event:e;if(mcWindows.selectedWindow==null)return;if(mcWindows.isGecko&&e.type=="mousedown"){var elm=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win.headElement==elm||win.resizeElement==elm){win.focus();break;}}}switch(e.type){case "mousemove":mcWindows.selectedWindow.onMouseMove(e);break;case "mouseup":mcWindows.selectedWindow.onMouseUp(e);break;case "mousedown":mcWindows.selectedWindow.onMouseDown(e);break;case "focus":mcWindows.selectedWindow.onFocus(e);break;}};MCWindows.prototype.addEvent=function(obj,name,handler){if(this.isMSIE)obj.attachEvent("on"+name,handler);else obj.addEventListener(name,handler,true);};MCWindows.prototype.cancelEvent=function(e){if(this.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};MCWindows.prototype.parseFeatures=function(opts){opts=opts.toLowerCase();opts=opts.replace(/;/g,",");opts=opts.replace(/[^0-9a-z=,]/g,"");var optionChunks=opts.split(',');var options=new Array();options['left']="10";options['top']="10";options['width']="300";options['height']="300";options['resizable']="yes";options['minimizable']="yes";options['maximizable']="yes";options['close']="yes";options['movable']="yes";options['statusbar']="yes";options['scrollbars']="auto";options['modal']="no";if(opts=="")return options;for(var i=0;i<optionChunks.length;i++){var parts=optionChunks[i].split('=');if(parts.length==2)options[parts[0]]=parts[1];}options['left']=parseInt(options['left']);options['top']=parseInt(options['top']);options['width']=parseInt(options['width']);options['height']=parseInt(options['height']);return options;};MCWindows.prototype.open=function(url,name,features){this.lastSelectedWindow=this.selectedWindow;var win=new MCWindow();var winDiv,html="",id;var imgPath=this.getParam("images_path");features=this.parseFeatures(features);id="mcWindow_"+name;win.deltaHeight=18;if(features['statusbar']=="yes"){win.deltaHeight+=13;if(this.isMSIE)win.deltaHeight+=1;}width=parseInt(features['width']);height=parseInt(features['height'])-win.deltaHeight;if(this.isMSIE)width-=2;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;html+='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';html+='<html>';html+='<head>';html+='<title>Wrapper iframe</title>';html+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';html+='<link href="'+this.getParam("css_file")+'" rel="stylesheet" type="text/css" />';html+='</head>';html+='<body onload="parent.mcWindows.onLoad(\''+name+'\');">';html+='<div id="'+id+'_container" class="mceWindow">';html+='<div id="'+id+'_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';html+='  <div id="'+id+'_title" class="mceWindowTitle"';html+='  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';html+='    <div class="mceWindowHeadTools">';html+='      <a href="javascript:parent.mcWindows.windows[\''+name+'\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="'+imgPath+'/window_close.gif" /></a>';html+='    </div>';html+='</div><div id="'+id+'_body" class="mceWindowBody" style="width: '+width+'px; height: '+height+'px;">';html+='<iframe id="'+id+'_iframe" name="'+id+'_iframe" frameborder="0" width="'+iframeWidth+'" height="'+iframeHeight+'" src="'+url+'" class="mceWindowBodyIframe" scrolling="'+features['scrollbars']+'"></iframe></div>';if(features['statusbar']=="yes"){html+='<div id="'+id+'_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';if(features['resizable']=="yes"){if(this.isGecko)html+='<div id="'+id+'_resize" class="mceWindowResize"><div style="background-image: url(\''+imgPath+'/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';else html+='<div id="'+id+'_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();" border="0" src="'+imgPath+'/window_resize.gif" /></div>';}html+='</div>';}html+='</div>';html+='</body>';html+='</html>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};MCWindows.prototype.setDocumentLock=function(state){if(state){var elm=document.getElementById('mcWindowEventBlocker');if(elm==null){elm=document.createElement("div");elm.id="mcWindowEventBlocker";elm.style.position="absolute";elm.style.left="0px";elm.style.top="0px";document.body.appendChild(elm);}elm.style.display="none";var imgPath=this.getParam("images_path");var width=document.body.clientWidth;var height=document.body.clientHeight;elm.style.width=width;elm.style.height=height;elm.innerHTML='<img src="'+imgPath+'/spacer.gif" width="'+width+'" height="'+height+'" />';elm.style.zIndex=mcWindows.zindex-1;elm.style.display="block";}else{var elm=document.getElementById('mcWindowEventBlocker');if(mcWindows.windows.length==0)elm.parentNode.removeChild(elm);else elm.style.zIndex=mcWindows.zindex-1;}};MCWindows.prototype.onLoad=function(name){var win=mcWindows.windows[name];var id="mcWindow_"+name;var wrapperIframe=window.frames[id+"_iframe"].frames[0];var wrapperDoc=window.frames[id+"_iframe"].document;var doc=window.frames[id+"_iframe"].document;var winDiv=document.getElementById("mcWindow_"+name+"_div");var realIframe=window.frames[id+"_iframe"].frames[0];win.id="mcWindow_"+name;win.winElement=winDiv;win.bodyElement=doc.getElementById(id+'_body');win.iframeElement=doc.getElementById(id+'_iframe');win.headElement=doc.getElementById(id+'_head');win.titleElement=doc.getElementById(id+'_title');win.resizeElement=doc.getElementById(id+'_resize');win.containerElement=doc.getElementById(id+'_container');win.left=win.features['left'];win.top=win.features['top'];win.frame=window.frames[id+'_iframe'].frames[0];win.wrapperFrame=window.frames[id+'_iframe'];win.wrapperIFrameElement=document.getElementById(id+"_iframe");mcWindows.addEvent(win.headElement,"mousedown",mcWindows.eventDispatcher);if(win.resizeElement!=null)mcWindows.addEvent(win.resizeElement,"mousedown",mcWindows.eventDispatcher);if(mcWindows.isMSIE){mcWindows.addEvent(realIframe.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(realIframe,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"focus",mcWindows.eventDispatcher);}for(var i=0;i<window.frames.length;i++){if(!window.frames[i]._hasMouseHandlers){if(mcWindows.isMSIE){mcWindows.addEvent(window.frames[i].document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i].document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(window.frames[i],"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i],"mouseup",mcWindows.eventDispatcher);}window.frames[i]._hasMouseHandlers=true;}}if(mcWindows.isMSIE){mcWindows.addEvent(win.frame.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(win.frame,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"focus",mcWindows.eventDispatcher);}var func=this.getParam("on_open_window","");if(func!="")eval(func+"(win);");win.focus();if(win.features['modal']=="yes")mcWindows.setDocumentLock(true);};MCWindows.prototype.createFloatingIFrame=function(id_prefix,left,top,width,height,html){var iframe=document.createElement("iframe");var div=document.createElement("div");width=parseInt(width);height=parseInt(height)+1;div.setAttribute("id",id_prefix+"_div");div.setAttribute("width",width);div.setAttribute("height",(height));div.style.position="absolute";div.style.left=left+"px";div.style.top=top+"px";div.style.width=width+"px";div.style.height=(height)+"px";div.style.backgroundColor="white";div.style.display="none";if(this.isGecko){iframeWidth=width+2;iframeHeight=height+2;}else{iframeWidth=width;iframeHeight=height+1;}iframe.setAttribute("id",id_prefix+"_iframe");iframe.setAttribute("name",id_prefix+"_iframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",iframeWidth);iframe.setAttribute("height",iframeHeight);iframe.setAttribute("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){window.setTimeout(function(){doc=window.frames[id_prefix+'_iframe'].document;doc.open();doc.write(html);doc.close();},10);}else{doc=window.frames[id_prefix+'_iframe'].window.document;doc.open();doc.write(html);doc.close();}div.style.display="block";return div;};function MCWindow(){};MCWindow.prototype.focus=function(){if(this!=mcWindows.selectedWindow){this.winElement.style.zIndex=++mcWindows.zindex;mcWindows.lastSelectedWindow=mcWindows.selectedWindow;mcWindows.selectedWindow=this;}};MCWindow.prototype.minimize=function(){};MCWindow.prototype.maximize=function(){};MCWindow.prototype.startResize=function(){mcWindows.action="resize";};MCWindow.prototype.startMove=function(e){mcWindows.action="move";};MCWindow.prototype.close=function(){if(mcWindows.lastSelectedWindow!=null)mcWindows.lastSelectedWindow.focus();var mcWindowsNew=new Array();for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win.name!=this.name)mcWindowsNew[n]=win;}mcWindows.windows=mcWindowsNew;var e=mcWindows.doc.getElementById(this.id+"_iframe");e.parentNode.removeChild(e);var e=mcWindows.doc.getElementById(this.id+"_div");e.parentNode.removeChild(e);mcWindows.setDocumentLock(false);};MCWindow.prototype.onMouseMove=function(e){var scrollX=0;var scrollY=0;var dx=e.screenX-mcWindows.mouseDownScreenX;var dy=e.screenY-mcWindows.mouseDownScreenY;switch(mcWindows.action){case "resize":width=mcWindows.mouseDownWidth+(e.screenX-mcWindows.mouseDownScreenX);height=mcWindows.mouseDownHeight+(e.screenY-mcWindows.mouseDownScreenY);width=width<100?100:width;height=height<100?100:height;this.wrapperIFrameElement.style.width=width+2;this.wrapperIFrameElement.style.height=height+2;this.wrapperIFrameElement.width=width+2;this.wrapperIFrameElement.height=height+2;this.winElement.style.width=width;this.winElement.style.height=height;height=height-this.deltaHeight;this.containerElement.style.width=width;this.iframeElement.style.width=width;this.iframeElement.style.height=height;this.bodyElement.style.width=width;this.bodyElement.style.height=height;this.headElement.style.width=width;mcWindows.cancelEvent(e);break;case "move":this.left=mcWindows.mouseDownLayerX+(e.screenX-mcWindows.mouseDownScreenX);this.top=mcWindows.mouseDownLayerY+(e.screenY-mcWindows.mouseDownScreenY);this.winElement.style.left=this.left+"px";this.winElement.style.top=this.top+"px";mcWindows.cancelEvent(e);break;}};function debug(msg){document.getElementById('debug').value+=msg+"\n";}MCWindow.prototype.onMouseUp=function(e){mcWindows.action="none";};MCWindow.prototype.onFocus=function(e){var winRef=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(winRef.name==win.id+"_iframe"){win.focus();return;}}};MCWindow.prototype.onMouseDown=function(e){var elm=mcWindows.isMSIE?this.wrapperFrame.event.srcElement:e.target;var scrollX=0;var scrollY=0;mcWindows.mouseDownScreenX=e.screenX;mcWindows.mouseDownScreenY=e.screenY;mcWindows.mouseDownLayerX=this.left;mcWindows.mouseDownLayerY=this.top;mcWindows.mouseDownWidth=parseInt(this.winElement.style.width);mcWindows.mouseDownHeight=parseInt(this.winElement.style.height);if(this.resizeElement!=null&&elm==this.resizeElement.firstChild)this.startResize(e);else this.startMove(e);mcWindows.cancelEvent(e);};var mcWindows=new MCWindows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"});
     11 function TinyMCE_inlinepopups_getInfo(){return{longname:'Inline Popups',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};};TinyMCE.prototype.orgOpenWindow=TinyMCE.prototype.openWindow;TinyMCE.prototype.openWindow=function(template,args){if(args['inline']!="yes"){mcWindows.selectedWindow=null;args['mce_inside_iframe']=false;this.orgOpenWindow(template,args);return;}var url,resizable,scrollbars;args['mce_inside_iframe']=true;tinyMCE.windowArgs=args;if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";height+=18;for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]));}var elm=document.getElementById(this.selectedInstance.editorId+'_parent');var pos=tinyMCE.getAbsPosition(elm);pos.absLeft+=Math.round((elm.firstChild.clientWidth/2)-(width/2));pos.absTop+=Math.round((elm.firstChild.clientHeight/2)-(height/2));mcWindows.open(url,mcWindows.idCounter++,"modal=yes,width="+width+",height="+height+",resizable="+resizable+",scrollbars="+scrollbars+",statusbar="+resizable+",left="+pos.absLeft+",top="+pos.absTop);};TinyMCE.prototype.orgCloseWindow=TinyMCE.prototype.closeWindow;TinyMCE.prototype.closeWindow=function(win){if(mcWindows.selectedWindow!=null)mcWindows.selectedWindow.close();else this.orgCloseWindow(win);};TinyMCE.prototype.setWindowTitle=function(win_ref,title){for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win_ref.name==win.id+"_iframe")window.frames[win.id+"_iframe"].document.getElementById(win.id+'_title').innerHTML=title;}};function MCWindows(){this.settings=new Array();this.windows=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.action="none";this.selectedWindow=null;this.lastSelectedWindow=null;this.zindex=100;this.mouseDownScreenX=0;this.mouseDownScreenY=0;this.mouseDownLayerX=0;this.mouseDownLayerY=0;this.mouseDownWidth=0;this.mouseDownHeight=0;this.idCounter=0;};MCWindows.prototype.init=function(settings){this.settings=settings;if(this.isMSIE)this.addEvent(document,"mousemove",mcWindows.eventDispatcher);else this.addEvent(window,"mousemove",mcWindows.eventDispatcher);this.addEvent(document,"mouseup",mcWindows.eventDispatcher);this.doc=document;};MCWindows.prototype.getParam=function(name,default_value){var value=null;value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");return value;};MCWindows.prototype.eventDispatcher=function(e){e=typeof(e)=="undefined"?window.event:e;if(mcWindows.selectedWindow==null)return;if(mcWindows.isGecko&&e.type=="mousedown"){var elm=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win.headElement==elm||win.resizeElement==elm){win.focus();break;}}}switch(e.type){case "mousemove":mcWindows.selectedWindow.onMouseMove(e);break;case "mouseup":mcWindows.selectedWindow.onMouseUp(e);break;case "mousedown":mcWindows.selectedWindow.onMouseDown(e);break;case "focus":mcWindows.selectedWindow.onFocus(e);break;}};MCWindows.prototype.addEvent=function(obj,name,handler){if(this.isMSIE)obj.attachEvent("on"+name,handler);else obj.addEventListener(name,handler,true);};MCWindows.prototype.cancelEvent=function(e){if(this.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};MCWindows.prototype.parseFeatures=function(opts){opts=opts.toLowerCase();opts=opts.replace(/;/g,",");opts=opts.replace(/[^0-9a-z=,]/g,"");var optionChunks=opts.split(',');var options=new Array();options['left']="10";options['top']="10";options['width']="300";options['height']="300";options['resizable']="yes";options['minimizable']="yes";options['maximizable']="yes";options['close']="yes";options['movable']="yes";options['statusbar']="yes";options['scrollbars']="auto";options['modal']="no";if(opts=="")return options;for(var i=0;i<optionChunks.length;i++){var parts=optionChunks[i].split('=');if(parts.length==2)options[parts[0]]=parts[1];}options['left']=parseInt(options['left']);options['top']=parseInt(options['top']);options['width']=parseInt(options['width']);options['height']=parseInt(options['height']);return options;};MCWindows.prototype.open=function(url,name,features){this.lastSelectedWindow=this.selectedWindow;var win=new MCWindow();var winDiv,html="",id;var imgPath=this.getParam("images_path");features=this.parseFeatures(features);id="mcWindow_"+name;win.deltaHeight=18;if(features['statusbar']=="yes"){win.deltaHeight+=13;if(this.isMSIE)win.deltaHeight+=1;}width=parseInt(features['width']);height=parseInt(features['height'])-win.deltaHeight;if(this.isMSIE)width-=2;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;html+='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';html+='<html>';html+='<head>';html+='<title>Wrapper iframe</title>';html+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';html+='<link href="'+this.getParam("css_file")+'" rel="stylesheet" type="text/css" />';html+='</head>';html+='<body onload="parent.mcWindows.onLoad(\''+name+'\');">';html+='<div id="'+id+'_container" class="mceWindow">';html+='<div id="'+id+'_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';html+='  <div id="'+id+'_title" class="mceWindowTitle"';html+='  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';html+='    <div class="mceWindowHeadTools">';html+='      <a href="javascript:parent.mcWindows.windows[\''+name+'\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="'+imgPath+'/window_close.gif" /></a>';html+='    </div>';html+='</div><div id="'+id+'_body" class="mceWindowBody" style="width: '+width+'px; height: '+height+'px;">';html+='<iframe id="'+id+'_iframe" name="'+id+'_iframe" frameborder="0" width="'+iframeWidth+'" height="'+iframeHeight+'" src="'+url+'" class="mceWindowBodyIframe" scrolling="'+features['scrollbars']+'"></iframe></div>';if(features['statusbar']=="yes"){html+='<div id="'+id+'_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';if(features['resizable']=="yes"){if(this.isGecko)html+='<div id="'+id+'_resize" class="mceWindowResize"><div style="background-image: url(\''+imgPath+'/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';else html+='<div id="'+id+'_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();" border="0" src="'+imgPath+'/window_resize.gif" /></div>';}html+='</div>';}html+='</div>';html+='</body>';html+='</html>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};MCWindows.prototype.setDocumentLock=function(state){if(state){var elm=document.getElementById('mcWindowEventBlocker');if(elm==null){elm=document.createElement("div");elm.id="mcWindowEventBlocker";elm.style.position="absolute";elm.style.left="0px";elm.style.top="0px";document.body.appendChild(elm);}elm.style.display="none";var imgPath=this.getParam("images_path");var width=document.body.clientWidth;var height=document.body.clientHeight;elm.style.width=width;elm.style.height=height;elm.innerHTML='<img src="'+imgPath+'/spacer.gif" width="'+width+'" height="'+height+'" />';elm.style.zIndex=mcWindows.zindex-1;elm.style.display="block";}else{var elm=document.getElementById('mcWindowEventBlocker');if(mcWindows.windows.length==0)elm.parentNode.removeChild(elm);else elm.style.zIndex=mcWindows.zindex-1;}};MCWindows.prototype.onLoad=function(name){var win=mcWindows.windows[name];var id="mcWindow_"+name;var wrapperIframe=window.frames[id+"_iframe"].frames[0];var wrapperDoc=window.frames[id+"_iframe"].document;var doc=window.frames[id+"_iframe"].document;var winDiv=document.getElementById("mcWindow_"+name+"_div");var realIframe=window.frames[id+"_iframe"].frames[0];win.id="mcWindow_"+name;win.winElement=winDiv;win.bodyElement=doc.getElementById(id+'_body');win.iframeElement=doc.getElementById(id+'_iframe');win.headElement=doc.getElementById(id+'_head');win.titleElement=doc.getElementById(id+'_title');win.resizeElement=doc.getElementById(id+'_resize');win.containerElement=doc.getElementById(id+'_container');win.left=win.features['left'];win.top=win.features['top'];win.frame=window.frames[id+'_iframe'].frames[0];win.wrapperFrame=window.frames[id+'_iframe'];win.wrapperIFrameElement=document.getElementById(id+"_iframe");mcWindows.addEvent(win.headElement,"mousedown",mcWindows.eventDispatcher);if(win.resizeElement!=null)mcWindows.addEvent(win.resizeElement,"mousedown",mcWindows.eventDispatcher);if(mcWindows.isMSIE){mcWindows.addEvent(realIframe.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(realIframe,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"focus",mcWindows.eventDispatcher);}for(var i=0;i<window.frames.length;i++){if(!window.frames[i]._hasMouseHandlers){if(mcWindows.isMSIE){mcWindows.addEvent(window.frames[i].document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i].document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(window.frames[i],"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i],"mouseup",mcWindows.eventDispatcher);}window.frames[i]._hasMouseHandlers=true;}}if(mcWindows.isMSIE){mcWindows.addEvent(win.frame.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(win.frame,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"focus",mcWindows.eventDispatcher);}var func=this.getParam("on_open_window","");if(func!="")eval(func+"(win);");win.focus();if(win.features['modal']=="yes")mcWindows.setDocumentLock(true);};MCWindows.prototype.createFloatingIFrame=function(id_prefix,left,top,width,height,html){var iframe=document.createElement("iframe");var div=document.createElement("div");width=parseInt(width);height=parseInt(height)+1;div.setAttribute("id",id_prefix+"_div");div.setAttribute("width",width);div.setAttribute("height",(height));div.style.position="absolute";div.style.left=left+"px";div.style.top=top+"px";div.style.width=width+"px";div.style.height=(height)+"px";div.style.backgroundColor="white";div.style.display="none";if(this.isGecko){iframeWidth=width+2;iframeHeight=height+2;}else{iframeWidth=width;iframeHeight=height+1;}iframe.setAttribute("id",id_prefix+"_iframe");iframe.setAttribute("name",id_prefix+"_iframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",iframeWidth);iframe.setAttribute("height",iframeHeight);iframe.setAttribute("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){window.setTimeout(function(){doc=window.frames[id_prefix+'_iframe'].document;doc.open();doc.write(html);doc.close();},10);}else{doc=window.frames[id_prefix+'_iframe'].window.document;doc.open();doc.write(html);doc.close();}div.style.display="block";return div;};function MCWindow(){};MCWindow.prototype.focus=function(){if(this!=mcWindows.selectedWindow){this.winElement.style.zIndex=++mcWindows.zindex;mcWindows.lastSelectedWindow=mcWindows.selectedWindow;mcWindows.selectedWindow=this;}};MCWindow.prototype.minimize=function(){};MCWindow.prototype.maximize=function(){};MCWindow.prototype.startResize=function(){mcWindows.action="resize";};MCWindow.prototype.startMove=function(e){mcWindows.action="move";};MCWindow.prototype.close=function(){if(mcWindows.lastSelectedWindow!=null)mcWindows.lastSelectedWindow.focus();var mcWindowsNew=new Array();for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win.name!=this.name)mcWindowsNew[n]=win;}mcWindows.windows=mcWindowsNew;var e=mcWindows.doc.getElementById(this.id+"_iframe");e.parentNode.removeChild(e);var e=mcWindows.doc.getElementById(this.id+"_div");e.parentNode.removeChild(e);mcWindows.setDocumentLock(false);};MCWindow.prototype.onMouseMove=function(e){var scrollX=0;var scrollY=0;var dx=e.screenX-mcWindows.mouseDownScreenX;var dy=e.screenY-mcWindows.mouseDownScreenY;switch(mcWindows.action){case "resize":width=mcWindows.mouseDownWidth+(e.screenX-mcWindows.mouseDownScreenX);height=mcWindows.mouseDownHeight+(e.screenY-mcWindows.mouseDownScreenY);width=width<100?100:width;height=height<100?100:height;this.wrapperIFrameElement.style.width=width+2;this.wrapperIFrameElement.style.height=height+2;this.wrapperIFrameElement.width=width+2;this.wrapperIFrameElement.height=height+2;this.winElement.style.width=width;this.winElement.style.height=height;height=height-this.deltaHeight;this.containerElement.style.width=width;this.iframeElement.style.width=width;this.iframeElement.style.height=height;this.bodyElement.style.width=width;this.bodyElement.style.height=height;this.headElement.style.width=width;mcWindows.cancelEvent(e);break;case "move":this.left=mcWindows.mouseDownLayerX+(e.screenX-mcWindows.mouseDownScreenX);this.top=mcWindows.mouseDownLayerY+(e.screenY-mcWindows.mouseDownScreenY);this.winElement.style.left=this.left+"px";this.winElement.style.top=this.top+"px";mcWindows.cancelEvent(e);break;}};function debug(msg){document.getElementById('debug').value+=msg+"\n";}MCWindow.prototype.onMouseUp=function(e){mcWindows.action="none";};MCWindow.prototype.onFocus=function(e){var winRef=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(winRef.name==win.id+"_iframe"){win.focus();return;}}};MCWindow.prototype.onMouseDown=function(e){var elm=mcWindows.isMSIE?this.wrapperFrame.event.srcElement:e.target;var scrollX=0;var scrollY=0;mcWindows.mouseDownScreenX=e.screenX;mcWindows.mouseDownScreenY=e.screenY;mcWindows.mouseDownLayerX=this.left;mcWindows.mouseDownLayerY=this.top;mcWindows.mouseDownWidth=parseInt(this.winElement.style.width);mcWindows.mouseDownHeight=parseInt(this.winElement.style.height);if(this.resizeElement!=null&&elm==this.resizeElement.firstChild)this.startResize(e);else this.startMove(e);mcWindows.cancelEvent(e);};var mcWindows=new MCWindows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"});
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin_src.js

    r2916 r2993  
    11/**
    22 * $RCSfile: editor_plugin_src.js,v $
    3  * $Revision: 1.2 $
    4  * $Date: 2005/08/23 20:28:34 $
     3 * $Revision: 1.3 $
     4 * $Date: 2005/10/18 13:59:43 $
    55 *
    66 * Moxiecode DHTML Windows script.
     
    5555
    5656    // Replace all args as variables in URL
    57     for (var name in args)
     57    for (var name in args) {
     58        if (typeof(args[name]) == 'function')
     59            continue;
     60
    5861        url = tinyMCE.replaceVar(url, name, escape(args[name]));
     62    }
    5963
    6064    var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
     
    8084    for (var n in mcWindows.windows) {
    8185        var win = mcWindows.windows[n];
     86        if (typeof(win) == 'function')
     87            continue;
    8288
    8389        if (win_ref.name == win.id + "_iframe")
     
    280286    html += '  onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
    281287    html += '    <div class="mceWindowHeadTools">';
    282     html += '      <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
    283 //  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
    284 //  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
     288    html += '      <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
     289//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
     290//  html += '      <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
    285291    html += '    </div>';
    286292    html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
     
    525531    for (var n in mcWindows.windows) {
    526532        var win = mcWindows.windows[n];
     533        if (typeof(win) == 'function')
     534            continue;
    527535
    528536        if (win.name != this.name)
     
    605613    for (var n in mcWindows.windows) {
    606614        var win = mcWindows.windows[n];
     615        if (typeof(win) == 'function')
     616            continue;
    607617
    608618        if (winRef.name == win.id + "_iframe") {
  • trunk/wp-includes/js/tinymce/plugins/inlinepopups/jscripts/mcwindows.js

    r2916 r2993  
    11/**
    22 * $RCSfile: mcwindows.js,v $
    3  * $Revision: 1.1 $
    4  * $Date: 2005/08/10 21:21:00 $
     3 * $Revision: 1.2 $
     4 * $Date: 2005/10/18 13:59:43 $
    55 *
    66 * Moxiecode DHTML Windows script.
     
    6565        for (var n in mcWindows.windows) {
    6666            var win = mcWindows.windows[n];
     67            if (typeof(win) == 'function')
     68                continue;
    6769
    6870            if (win.headElement == elm || win.resizeElement == elm) {
     
    409411};
    410412
    411 function debug(msg) {
    412     document.getElementById('debug').value += msg + "\n";
    413 }
    414 
    415413MCWindow.prototype.onMouseUp = function(e) {
    416414    mcWindows.action = "none";
     
    423421    for (var n in mcWindows.windows) {
    424422        var win = mcWindows.windows[n];
     423        if (typeof(win) == 'function')
     424            continue;
    425425
    426426        if (winRef.name == win.id) {
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js

    r2964 r2993  
    88
    99function TinyMCE_wordpress_getControlHTML(control_name) {
    10     switch (control_name) {
    11         case "wordpress":
    12             return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
     10    switch (control_name) {
     11        case "wordpress":
     12            var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
     13            var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
     14            return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
    1315    }
    1416
     
    2325    var attributes = new Array();
    2426    var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
     27    var titleText = tinyMCE.getLang('lang_wordpress_more');
     28    var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
    2529
    2630    if (attribute_string == null || attribute_string.length < 2)
     
    7377                var inst = tinyMCE.getInstanceById(editor_id);
    7478                var focusElm = inst.getFocusElement();
    75    
     79                var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     80
    7681                // Is selection a image
    7782                if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
     
    8792                    + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    8893                    + ' width="100%" height="10px" '
    89                     + 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
     94                    + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
    9095                tinyMCE.execCommand("mceInsertContent",true,html);
    9196                tinyMCE.selectedInstance.repaint();
     
    96101                var inst = tinyMCE.getInstanceById(editor_id);
    97102                var focusElm = inst.getFocusElement();
     103                var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
    98104   
    99105                // Is selection a image
     
    110116                    + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    111117                    + ' width="100%" height="10px" '
    112                     + 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
     118                    + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
    113119                tinyMCE.execCommand("mceInsertContent",true,html);
    114120                tinyMCE.selectedInstance.repaint();
     
    125131        case "insert_to_editor":
    126132            var startPos = 0;
     133            var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     134            var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
    127135
    128136            // Parse all <!--more--> tags and replace them with images
     
    133141                content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    134142                content += ' width="100%" height="10px" ';
    135                 content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
     143                content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
    136144                content += contentAfter;
    137145
     
    147155                content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    148156                content += ' width="100%" height="10px" ';
    149                 content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
     157                content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
    150158                content += contentAfter;
    151159
     
    183191            }
    184192
    185             // Handle TinyMCE weirdness without messing up the core
    186             //alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
    187 
    188             // Strip any trailing <br /> and whitespace.
    189             content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
    190 
    191             //alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
    192193            break;
    193194    }
  • trunk/wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js

    r2964 r2993  
    88
    99function TinyMCE_wordpress_getControlHTML(control_name) {
    10     switch (control_name) {
    11         case "wordpress":
    12             return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="More..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="...Page..." width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
     10    switch (control_name) {
     11        case "wordpress":
     12            var titleMore = tinyMCE.getLang('lang_wordpress_more_button');
     13            var titlePage = tinyMCE.getLang('lang_wordpress_page_button');
     14            return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpressmore\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_more" src="{$pluginurl}/images/more.gif" title="'+titleMore+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a><!--<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mcewordpresspage\')" target="_self" onmousedown="return false;"><img id="{$editor_id}_wordpress_page" src="{$pluginurl}/images/page.gif" title="'+titlePage+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>-->';
    1315    }
    1416
     
    2325    var attributes = new Array();
    2426    var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g');
     27    var titleText = tinyMCE.getLang('lang_wordpress_more');
     28    var titleTextPage = tinyMCE.getLang('lang_wordpress_page');
    2529
    2630    if (attribute_string == null || attribute_string.length < 2)
     
    7377                var inst = tinyMCE.getInstanceById(editor_id);
    7478                var focusElm = inst.getFocusElement();
    75    
     79                var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     80
    7681                // Is selection a image
    7782                if (focusElm != null && focusElm.nodeName.toLowerCase() == "img") {
     
    8792                    + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    8893                    + ' width="100%" height="10px" '
    89                     + 'alt="More..." title="More..." class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
     94                    + 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" name="mce_plugin_wordpress_more" />';
    9095                tinyMCE.execCommand("mceInsertContent",true,html);
    9196                tinyMCE.selectedInstance.repaint();
     
    96101                var inst = tinyMCE.getInstanceById(editor_id);
    97102                var focusElm = inst.getFocusElement();
     103                var altPage = tinyMCE.getLang('lang_wordpress_more_alt');
    98104   
    99105                // Is selection a image
     
    110116                    + '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" '
    111117                    + ' width="100%" height="10px" '
    112                     + 'alt="More..." title="More..." class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
     118                    + 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" name="mce_plugin_wordpress_page" />';
    113119                tinyMCE.execCommand("mceInsertContent",true,html);
    114120                tinyMCE.selectedInstance.repaint();
     
    125131        case "insert_to_editor":
    126132            var startPos = 0;
     133            var altMore = tinyMCE.getLang('lang_wordpress_more_alt');
     134            var altPage = tinyMCE.getLang('lang_wordpress_page_alt');
    127135
    128136            // Parse all <!--more--> tags and replace them with images
     
    133141                content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    134142                content += ' width="100%" height="10px" ';
    135                 content += 'alt="More..." title="More..." class="mce_plugin_wordpress_more" />';
     143                content += 'alt="'+altMore+'" title="'+altMore+'" class="mce_plugin_wordpress_more" />';
    136144                content += contentAfter;
    137145
     
    147155                content += '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '" ';
    148156                content += ' width="100%" height="10px" ';
    149                 content += 'alt="...Next Page..." title="...Next Page..." class="mce_plugin_wordpress_page" />';
     157                content += 'alt="'+altPage+'" title="'+altPage+'" class="mce_plugin_wordpress_page" />';
    150158                content += contentAfter;
    151159
     
    183191            }
    184192
    185             // Handle TinyMCE weirdness without messing up the core
    186             //alert("Content before TinyMCE_wordpress_cleanup\n\n'"+content+"'");
    187 
    188             // Strip any trailing <br /> and whitespace.
    189             content = content.replace(new RegExp('<br ?/?>[ \t]*$', ''), '');
    190 
    191             //alert("Content after TinyMCE_wordpress_cleanup\n\n'"+content+"'");
    192193            break;
    193194    }
  • trunk/wp-includes/js/tinymce/plugins/wordpress/langs/en.js

    r2820 r2993  
    1 // UK lang variables
     1// EN lang variables
    22
    3 /* Remember to namespace the language parameters lang_<your plugin>_<some name> */
    4 
    5 tinyMCELang['lang_template_title'] = 'This is just a template popup';
    6 tinyMCELang['lang_template_desc'] = 'This is just a template button';
     3tinyMCE.addToLang('',{
     4wordpress_more_button : 'Split post with More tag',
     5wordpress_page_button : 'Split post with Page tag',
     6wordpress_more_alt : 'More...',
     7wordpress_page_alt : '...page...'
     8});
  • trunk/wp-includes/js/tinymce/themes/advanced/about.htm

    r2916 r2993  
    77    <link href="css/dialog_about.css" rel="stylesheet" type="text/css" />
    88</head>
    9 <body id="about" onload="init();" style="display: none">
     9<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
    1010        <div class="tabs">
    1111            <ul>
  • trunk/wp-includes/js/tinymce/themes/advanced/anchor.htm

    r2916 r2993  
    55    <script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
    66</head>
    7 <body onload="init();" style="display: none">
     7<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
    88<form onsubmit="insertAnchor();return false;" action="#">
    99
  • trunk/wp-includes/js/tinymce/themes/advanced/charmap.htm

    r2916 r2993  
    66    <script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
    77</head>
    8 <body onload="init();" style="display: none">
     8<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
    99<table align="center" border="0" cellspacing="0" cellpadding="2">
    1010    <tr>
  • trunk/wp-includes/js/tinymce/themes/advanced/color_picker.htm

    r2916 r2993  
    55    <script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
    66</head>
    7 <body onload="init();" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
     7<body onload="tinyMCEPopup.executeOnLoad('init();');" marginheight="3" topmargin="3" leftmargin="3" marginwidth="3" style="display: none">
    88    <div align="center">
    99       <script language="javascript" type="text/javascript">renderColorMap();</script>
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_content.css

    r2917 r2993  
    33
    44body {
    5     background-color: #fff;
     5    background-color: #FFFFFF;
    66    font-family: Verdana, Arial, Helvetica, sans-serif;
    7     font-size: 13px;
    8     line-height: 130%;
    9     padding: 1em;
     7    font-size: 10px;
     8    scrollbar-3dlight-color: #F0F0EE;
     9    scrollbar-arrow-color: #676662;
     10    scrollbar-base-color: #F0F0EE;
     11    scrollbar-darkshadow-color: #DDDDDD;
     12    scrollbar-face-color: #E0E0DD;
     13    scrollbar-highlight-color: #F0F0EE;
     14    scrollbar-shadow-color: #F0F0EE;
     15    scrollbar-track-color: #F5F5F5;
    1016}
    1117
  • trunk/wp-includes/js/tinymce/themes/advanced/css/editor_ui.css

    r2916 r2993  
    11/* This file contains the CSS data for the editor UI of TinyMCE instances */
    22
    3 .mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected {
     3.mceToolbarTop a, .mceToolbarTop a:visited, .mceToolbarTop a:hover, .mceToolbarBottom a, .mceToolbarBottom a:visited, .mceToolbarBottom a:hover {
     4    border: 0px; margin: 0px; padding: 0px; background: transparent;
     5}
     6
     7.mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceSeparatorLine, .mceButtonDisabled, .mceButtonSelected {
     8    border: 0px; margin: 0px; padding: 0px; background: transparent;
    49    margin-top: 1px;
    510    margin-left: 1px;
     
    7883
    7984.mceLabel, .mceLabelDisabled {
    80     font-family: "MS Sans Serif";
     85    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
    8186    font-size: 9pt;
    8287}
     
    99104
    100105.mceEditorArea {
    101     font-family: "MS Sans Serif";
     106    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
    102107    background: #FFFFFF;
    103108    padding: 0px;
     
    107112.mceToolbarTop, .mceToolbarBottom {
    108113    background: #F0F0EE;
     114    line-height: 1px;
     115    font-size: 1px;
    109116}
    110117
     
    122129
    123130.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText {
    124     font-family: "MS Sans Serif";
     131    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
    125132    font-size: 9pt;
    126133    padding: 2px;
     
    143150.mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover {
    144151    text-decoration: none;
    145     font-family: "MS Sans Serif";
     152    font-family: 'MS Sans Serif', sans-serif, Verdana, Arial;
    146153    font-size: 9pt;
    147154    color: #000000;
  • trunk/wp-includes/js/tinymce/themes/advanced/editor_template.js

    r2916 r2993  
    11/* Import theme specific language pack */
    2  tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_resizer=new Object();var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i<TinyMCE_advanced_buttons.length;i++){var but=TinyMCE_advanced_buttons[i];if(but[0]==button_name){if(tinyMCE.settings['button_tile_map']){for(var x=0;!tinyMCE.isMSIE&&x<buttonTileMap.length;x++){if(buttonTileMap[x]==but[1]){return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')" onmousedown="return false;"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: '+(0-(x*20))+'px 0px" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}}return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+')" onmousedown="return false;"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/'+but[1]+'" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}switch(button_name){case "formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0]){html+='<option value="<'+lookup[x][0]+'>">'+lookup[x][1]+'</option>';}}}html+='</select>';return html;case "styleselect":return '<select id="{$editor_id}_styleSelect" onmousedown="TinyMCE_advanced_setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case "fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(var i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>';}}fontHTML+='</select>';return fontHTML;case "fontsizeselect":return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">\
     2 tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_resizer=new Object();var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i<TinyMCE_advanced_buttons.length;i++){var but=TinyMCE_advanced_buttons[i];if(but[0]==button_name){if(tinyMCE.settings['button_tile_map']){for(var x=0;!tinyMCE.isMSIE&&x<buttonTileMap.length;x++){if(buttonTileMap[x]==but[1]){var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\','+(but.length>4?but[4]:false)+(but.length>5?',\''+but[5]+'\'':'')+')';return '<a href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: '+(0-(x*20))+'px 0px" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}}var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\','+(but.length>4?but[4]:false)+(but.length>5?',\''+but[5]+'\'':'')+')';return '<a href="javascript:'+cmd+'" onclick="'+cmd+';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_'+but[0]+'" src="{$themeurl}/images/'+but[1]+'" title="'+but[2]+'" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';}}switch(button_name){case "formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0]){html+='<option value="<'+lookup[x][0]+'>">'+lookup[x][1]+'</option>';}}}html+='</select>';return html;case "styleselect":return '<select id="{$editor_id}_styleSelect" onmousedown="TinyMCE_advanced_setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case "fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;Georgia=georgia,times new roman,times,serif;Tahoma=tahoma,arial,helvetica,sans-serif;Times New Roman=times new roman,times,serif;Verdana=verdana,arial,helvetica,sans-serif;Impact=impact;WingDings=wingdings';var nFonts='Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sand;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(var i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>';}}fontHTML+='</select>';return fontHTML;case "fontsizeselect":return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">\
    33        <option value="0">{$lang_theme_font_size}</option>\
    44        <option value="1">1 (8 pt)</option>\
     
    99        <option value="6">6 (24 pt)</option>\
    1010        <option value="7">7 (36 pt)</option>\
    11         </select>';case "|":case "separator":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">';case "spacer":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case "rowseparator":return '<br />';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=tinyMCE.getAttrib(elm,"color");if(inputColor=='')inputColor=elm.style.color;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=elm.style.backgroundColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;eval('elm.onchange();');}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",500));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",400));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550;template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90;template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true;}}if(!skip){outArray[outArray.length]=in_array[i];}}return outArray;}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i];}return in_array;}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&nbsp;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="TinyMCE_advanced_setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23;}}template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap">'+toolbarHTML+'</td></tr>';}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1">'+toolbarHTML+'</td></tr>';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML);elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null;}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='</table>';break;case "RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor"){template['html']+='<tr><td align="center" class="mceEditor_border">\
     11        </select>';case "|":case "separator":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" class="mceSeparatorLine">';case "spacer":return '<img src="{$themeurl}/images/spacer.gif" width="1" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" />';case "rowseparator":return '<br />';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=tinyMCE.getAttrib(elm,"color");if(inputColor=='')inputColor=elm.style.color;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var elm=tinyMCE.selectedInstance.getFocusElement();var inputColor=elm.style.backgroundColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=190;template['width']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_backcolor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=190;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;var elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;eval('elm.onchange();');}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",500));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",400));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true;}}if(!skip){outArray[outArray.length]=in_array[i];}}return outArray;}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i];}return in_array;}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&nbsp;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="TinyMCE_advanced_setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23;}}toolbarHTML+='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';if(toolbarLocation=="top"){template['html']+='<tr><td class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap">'+toolbarHTML+'</td></tr>';}if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom"){template['html']+='<tr><td class="mceToolbarBottom" align="'+toolbarAlign+'" height="1">'+toolbarHTML+'</td></tr>';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML);elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null;}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23;}template['html']+='</tbody></table>';break;case "RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor"){template['html']+='<tr><td align="center" class="mceEditor_border">\
    1212                                                <span id="{$editor_id}"></span>\
    13                                                 </td></tr>';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j<curContainer.length;j++){curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);}if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23;}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>';}}template['html']+='</tbody></table>';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='<div id="{$editor_id}_resize_box" class="mceResizeBox"></div>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE?"block":"table";tinyMCE.execCommand('mceResetDesignMode');}}function TinyMCE_advanced_initInstance(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){var w=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_advanced_resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true));}}function TinyMCE_advanced_setCookie(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;}function TinyMCE_advanced_getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}function TinyMCE_advanced_resizeTo(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0;}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2;}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;if(tinyMCE.isGecko){iw-=2;ih-=2;}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px";}}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":TinyMCE_advanced_setResizing(e,editorId,false);TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires);break;}}function TinyMCE_advanced_getInsertLinkTemplate(){var template=new Array();template['file']='link.htm';template['width']=330;template['height']=170;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);return template;};function TinyMCE_advanced_getInsertImageTemplate(){var template=new Array();template['file']='image.htm?src={$src}';template['width']=340;template['height']=245;template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);return template;};function TinyMCE_advanced_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){function selectByValue(select_elm,value){if(select_elm){for(var i=0;i<select_elm.options.length;i++){if(select_elm.options[i].value==value){select_elm.selectedIndex=i;return true;}}}return false;};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";};if(node==null){return;}var pathElm=document.getElementById(editor_id+"_path");if(pathElm){var parentNode=node;var path=new Array();while(parentNode){if(parentNode.nodeName.toLowerCase()=="body"){break;}if(parentNode.nodeType==1){path[path.length]=parentNode;}parentNode=parentNode.parentNode;}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&tinyMCE.getAttrib(path[i],"class").indexOf('mceItemFlash')!=-1){nodeName="flash";nodeData="";}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeName+="."+className;}if(tinyMCE.isMSIE){html+='<a title="'+nodeData+'" href="javascript:void(0);" onmousedown="tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');return false;" class="mcePathItem">'+nodeName+'</a>';}else{html+='<a title="'+nodeData+'" href="javascript:tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');" class="mcePathItem">'+nodeName+'</a>';}if(i>0){html+=" &raquo; ";}}pathElm.innerHTML=tinyMCE.getLang('lang_theme_path')+": "+html+'&nbsp;';}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break;}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode));selectElm.selectedIndex=index;}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm){selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){var elm=tinyMCE.getParentElement(node);if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family))selectByValue(selectElm,"");}else selectByValue(selectElm,"");}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){var elm=tinyMCE.getParentElement(node);if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break;}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"");}else selectByValue(selectElm,"0");}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode));var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');if(tinyMCE.isGecko&&node.nodeType==3){var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(doc.queryCommandState("Bold")){tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');}if(doc.queryCommandState("Italic")){tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}if(doc.queryCommandState("Strikethrough")){tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');}}do{switch(node.nodeName.toLowerCase()){case "b":case "strong":tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');break;case "i":case "em":tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');break;case "u":tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');break;case "strike":tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');break;case "ul":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "ol":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "sub":tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonSelected');break;case "sup":tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonSelected');break;case "hr":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "img":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode));};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i<csses.length;i++){selectElm.options[selectElm.length]=new Option(csses[i],csses[i]);}}if(csses!=null&&csses.length>0){selectElm.setAttribute('cssImported','true');}}};
     13                                                </td></tr>';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j<curContainer.length;j++){curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);}if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23;}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>';}}template['html']+='</tbody></table>';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='<div id="{$editor_id}_resize_box" class="mceResizeBox"></div>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE?"block":"table";tinyMCE.execCommand('mceResetDesignMode');}}function TinyMCE_advanced_initInstance(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_advanced_getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_advanced_resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true));}}}function TinyMCE_advanced_setCookie(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie;}function TinyMCE_advanced_getCookie(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null;}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end));}function TinyMCE_advanced_resizeTo(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0;}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2;}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;if(tinyMCE.isGecko){iw-=2;ih-=2;}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px";}}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":TinyMCE_advanced_setResizing(e,editorId,false);TinyMCE_advanced_resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_advanced_setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires);}break;}}function TinyMCE_advanced_getInsertLinkTemplate(){var template=new Array();template['file']='link.htm';template['width']=330;template['height']=170;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);return template;};function TinyMCE_advanced_getInsertImageTemplate(){var template=new Array();template['file']='image.htm?src={$src}';template['width']=340;template['height']=245;template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);return template;};function TinyMCE_advanced_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true;}if(ov==value){select_elm.selectedIndex=i;return true;}}}return false;};function getAttrib(elm,name){return elm.getAttribute(name)?elm.getAttribute(name):"";};if(node==null){return;}var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(pathElm){var parentNode=node;var path=new Array();while(parentNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break;}if(parentNode.nodeType==1){path[path.length]=parentNode;}parentNode=parentNode.parentNode;}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+st+" ";}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+face+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+size+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+color+" ";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&tinyMCE.getAttrib(path[i],"class").indexOf('mceItemFlash')!=-1){nodeName="flash";nodeData="src: "+path[i].getAttribute('title');}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+anchor;nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className;}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; ";}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&nbsp;';}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break;}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index;}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm){selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=doc.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="");}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"");}else selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=doc.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size);}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break;}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"");}else selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(doc.queryCommandState(ar[i]))tinyMCE.switchClassSticky(editor_id+ar[i+1],'mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}}do{switch(node.nodeName){case "UL":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "OL":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "HR":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "IMG":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode)!=null);};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i<csses.length;i++){selectElm.options[selectElm.length]=new Option(csses[i],csses[i]);}}if(csses!=null&&csses.length>0){selectElm.setAttribute('cssImported','true');}}};
  • trunk/wp-includes/js/tinymce/themes/advanced/editor_template_src.js

    r2916 r2993  
    6969                    if (buttonTileMap[x] == but[1])
    7070                    {
    71                         return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
     71                        var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
     72                        return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] +'" src="{$themeurl}/images/spacer.gif" style="background-image:url({$themeurl}/images/buttons.gif); background-position: ' + (0-(x*20)) + 'px 0px" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
    7273                    }
    7374                }
     
    7576
    7677            // Old style
    77             return '<a href="javascript:tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ')" onmousedown="return false;"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
     78            var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\',' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ',\'' + but[5] + '\'' : '') + ')';
     79            return '<a href="javascript:' + cmd + '" onclick="' + cmd + ';return false;" onmousedown="return false;" target="_self"><img id="{$editor_id}_' + but[0] + '" src="{$themeurl}/images/' + but[1] + '" title="' + but[2] + '" width="20" height="20" class="mceButtonNormal" onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');" onmouseout="tinyMCE.restoreClass(this);" onmousedown="tinyMCE.restoreAndSwitchClass(this,\'mceButtonDown\');" /></a>';
    7880        }
    7981    }
     
    213215                template['width'] = 220;
    214216                template['height'] = 190;
     217                template['close_previous'] = "no";
    215218
    216219                template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
     
    245248
    246249            template['file'] = 'charmap.htm';
    247             template['width'] = 550;
     250            template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
    248251            template['height'] = 250;
    249    
     252
    250253            template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
    251254            template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
     
    260263            template['file'] = 'anchor.htm';
    261264            template['width'] = 320;
    262             template['height'] = 90;
     265            template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
    263266
    264267            template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
     
    329332    // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
    330333    var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
    331     if (settings['theme_advanced_styles'])
    332     {
     334    if (settings['theme_advanced_styles']) {
    333335        var stylesAr = settings['theme_advanced_styles'].split(';');
    334336       
    335         for (var i=0; i<stylesAr.length; i++)
    336         {
     337        for (var i=0; i<stylesAr.length; i++) {
    337338            var key, value;
    338339
     
    346347    }
    347348
    348     switch(layoutManager)
    349     {
     349    switch(layoutManager) {
    350350        case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
    351351            var toolbarHTML = "";
     
    360360            };
    361361
     362            // Add accessibility control
     363            toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"></a>';
     364
    362365            // Render rows
    363366            for (var i=1; i<100; i++) {
    364367                var def = defVals["theme_advanced_buttons" + i];
    365368
    366                 buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
     369                var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
    367370                if (buttons.length == 0)
    368371                    break;
     
    380383                }
    381384            }
     385
     386            // Add accessibility control
     387            toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
    382388
    383389            // Setup template html
     
    436442            }
    437443
    438             template['html'] += '</table>';
     444            template['html'] += '</tbody></table>';
    439445            //"SimpleLayout"
    440446        break;
     
    586592function TinyMCE_advanced_initInstance(inst) {
    587593    if (tinyMCE.getParam("theme_advanced_resizing", false)) {
    588         var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
    589         var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
    590 
    591         TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
     594        if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
     595            var w = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_width");
     596            var h = TinyMCE_advanced_getCookie("TinyMCE_" + inst.editorId + "_height");
     597
     598            TinyMCE_advanced_resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
     599        }
    592600    }
    593601}
     
    708716
    709717            // Expire in a month
    710             var expires = new Date();
    711             expires.setTime(expires.getTime() + 3600000 * 24 * 30);
    712 
    713             // Set the cookies
    714             TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
    715             TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
     718            if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
     719                var expires = new Date();
     720                expires.setTime(expires.getTime() + 3600000 * 24 * 30);
     721
     722                // Set the cookies
     723                TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
     724                TinyMCE_advanced_setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
     725            }
    716726            break;
    717727    }
     
    757767 * Node change handler.
    758768 */
    759 function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
    760                                                               undo_levels, visual_aid, any_selection)
    761 {
    762     function selectByValue(select_elm, value)
    763     {
    764         if (select_elm)
    765         {
    766             for (var i=0; i<select_elm.options.length; i++)
    767             {
    768                 if (select_elm.options[i].value == value)
    769                 {
     769function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
     770    function selectByValue(select_elm, value, first_index) {
     771        first_index = typeof(first_index) == "undefined" ? false : true;
     772
     773        if (select_elm) {
     774            for (var i=0; i<select_elm.options.length; i++) {
     775                var ov = "" + select_elm.options[i].value;
     776
     777                if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
    770778                    select_elm.selectedIndex = i;
    771779                    return true;
    772780                }
     781
     782                if (ov == value) {
     783                    select_elm.selectedIndex = i;
     784                    return true;
     785                }
    773786            }
    774787        }
     
    777790    };
    778791
    779     function getAttrib(elm, name)
    780     {
     792    function getAttrib(elm, name) {
    781793        return elm.getAttribute(name) ? elm.getAttribute(name) : "";
    782794    };
     
    790802    // Update path
    791803    var pathElm = document.getElementById(editor_id + "_path");
    792    
    793     if (pathElm)
    794     {
     804    var inst = tinyMCE.getInstanceById(editor_id);
     805    var doc = inst.getDoc();
     806
     807    if (pathElm) {
    795808        // Get node path
    796809        var parentNode = node;
    797810        var path = new Array();
    798811       
    799         while (parentNode)
    800         {
    801             if (parentNode.nodeName.toLowerCase() == "body")
    802             {
     812        while (parentNode != null) {
     813            if (parentNode.nodeName.toUpperCase() == "BODY") {
    803814                break;
    804815            }
    805816
    806817            // Only append element nodes to path
    807             if (parentNode.nodeType == 1)
    808             {
     818            if (parentNode.nodeType == 1) {
    809819                path[path.length] = parentNode;
    810820            }
     
    815825        // Setup HTML
    816826        var html = "";
    817         for (var i=path.length-1; i>=0; i--)
    818         {
     827        for (var i=path.length-1; i>=0; i--) {
    819828            var nodeName = path[i].nodeName.toLowerCase();
    820829            var nodeData = "";
    821830
    822             if (nodeName == "b")
    823             {
     831            if (nodeName == "b") {
    824832                nodeName = "strong";
    825833            }
    826834
    827             if (nodeName == "i")
    828             {
     835            if (nodeName == "i") {
    829836                nodeName = "em";
    830837            }
    831838
    832             if (getAttrib(path[i], 'id') != "")
    833             {
     839            if (nodeName == "span") {
     840                var cn = tinyMCE.getAttrib(path[i], "class");
     841                if (cn != "" && cn.indexOf('mceItem') == -1)
     842                    nodeData += "class: " + cn + " ";
     843
     844                var st = tinyMCE.getAttrib(path[i], "style");
     845                if (st != "") {
     846                    st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
     847                    nodeData += "style: " + st + " ";
     848                }
     849            }
     850
     851            if (nodeName == "font") {
     852                if (tinyMCE.getParam("convert_fonts_to_spans"))
     853                    nodeName = "span";
     854
     855                var face = tinyMCE.getAttrib(path[i], "face");
     856                if (face != "")
     857                    nodeData += "font: " + face + " ";
     858
     859                var size = tinyMCE.getAttrib(path[i], "size");
     860                if (size != "")
     861                    nodeData += "size: " + size + " ";
     862
     863                var color = tinyMCE.getAttrib(path[i], "color");
     864                if (color != "")
     865                    nodeData += "color: " + color + " ";
     866            }
     867
     868            if (getAttrib(path[i], 'id') != "") {
    834869                nodeData += "id: " + path[i].getAttribute('id') + " ";
    835870            }
     
    839874                nodeData += "class: " + className + " ";
    840875
    841             if (getAttrib(path[i], 'src') != "")
    842             {
     876            if (getAttrib(path[i], 'src') != "") {
    843877                nodeData += "src: " + path[i].getAttribute('src') + " ";
    844878            }
    845879
    846             if (getAttrib(path[i], 'href') != "")
    847             {
     880            if (getAttrib(path[i], 'href') != "") {
    848881                nodeData += "href: " + path[i].getAttribute('href') + " ";
    849882            }
    850883
    851             if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1)
    852             {
     884            if (nodeName == "img" && tinyMCE.getAttrib(path[i], "class").indexOf('mceItemFlash') != -1) {
    853885                nodeName = "flash";
    854                 nodeData = "";
    855             }
    856 
    857             if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "")
    858             {
     886                nodeData = "src: " + path[i].getAttribute('title');
     887            }
     888
     889            if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
    859890                nodeName = "a";
    860891                nodeName += "#" + anchor;
     
    862893            }
    863894
    864             if (getAttrib(path[i], 'name').indexOf("mce_") != 0)
    865             {
     895            if (getAttrib(path[i], 'name').indexOf("mce_") != 0) {
    866896                var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
    867                 if (className != "" && className.indexOf('mceItem') == -1)
     897                if (className != "" && className.indexOf('mceItem') == -1) {
    868898                    nodeName += "." + className;
    869             }
    870 
    871             if (tinyMCE.isMSIE)
    872             {
    873                 html += '<a title="' + nodeData + '" href="javascript:void(0);" onmousedown="tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');return false;" class="mcePathItem">' + nodeName + '</a>';
    874             }
    875             else
    876             {
    877                 html += '<a title="' + nodeData + '" href="javascript:tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');" class="mcePathItem">' + nodeName + '</a>';
    878             }
    879 
    880             if (i > 0)
    881             {
     899                }
     900            }
     901
     902            var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
     903            html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
     904
     905            if (i > 0) {
    882906                html += " &raquo; ";
    883907            }
    884908        }
    885909
    886         pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
     910        pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&nbsp;';
    887911    }
    888912
     
    971995                }
    972996            }
    973         } while (!breakOut && classNode != null && (classNode = classNode.parentNode));
     997        } while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
    974998
    975999        selectElm.selectedIndex = index;
     
    9961020    var selectElm = document.getElementById(editor_id + "_fontNameSelect");
    9971021    if (selectElm) {
    998         var elm = tinyMCE.getParentElement(node);
    999 
    1000         if (elm) {
    1001             var family = tinyMCE.getAttrib(elm, "face");
    1002             if (family == '')
    1003                 family = '' + elm.style.fontFamily;
    1004 
    1005             if (!selectByValue(selectElm, family))
     1022        if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
     1023            var face = doc.queryCommandValue('FontName');
     1024
     1025            face = face == null || face == "" ? "" : face;
     1026
     1027            selectByValue(selectElm, face, face != "");
     1028        } else {
     1029            var elm = tinyMCE.getParentElement(node, "font", "face");
     1030
     1031            if (elm) {
     1032                var family = tinyMCE.getAttrib(elm, "face");
     1033
     1034                if (family == '')
     1035                    family = '' + elm.style.fontFamily;
     1036
     1037                if (!selectByValue(selectElm, family, family != ""))
     1038                    selectByValue(selectElm, "");
     1039            } else
    10061040                selectByValue(selectElm, "");
    1007         } else
    1008             selectByValue(selectElm, "");
     1041        }
    10091042    }
    10101043
     
    10121045    var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
    10131046    if (selectElm) {
    1014         var elm = tinyMCE.getParentElement(node);
    1015 
    1016         if (elm) {
    1017             var size = tinyMCE.getAttrib(elm, "size");
    1018             if (size == '') {
    1019                 var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
    1020 
    1021                 size = '' + elm.style.fontSize;
    1022 
    1023                 for (var i=0; i<sizes.length; i++) {
    1024                     if (('' + sizes[i]) == size) {
    1025                         size = i;
    1026                         break;
     1047        if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
     1048            var size = doc.queryCommandValue('FontSize');
     1049            selectByValue(selectElm, size == null || size == "" ? "0" : size);
     1050        } else {
     1051            var elm = tinyMCE.getParentElement(node, "font", "size");
     1052            if (elm) {
     1053                var size = tinyMCE.getAttrib(elm, "size");
     1054
     1055                if (size == '') {
     1056                    var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
     1057
     1058                    size = '' + elm.style.fontSize;
     1059
     1060                    for (var i=0; i<sizes.length; i++) {
     1061                        if (('' + sizes[i]) == size) {
     1062                            size = i;
     1063                            break;
     1064                        }
    10271065                    }
    10281066                }
    1029             }
    1030 
    1031             if (!selectByValue(selectElm, size))
    1032                 selectByValue(selectElm, "");
    1033         } else
    1034             selectByValue(selectElm, "0");
     1067
     1068                if (!selectByValue(selectElm, size))
     1069                    selectByValue(selectElm, "");
     1070            } else
     1071                selectByValue(selectElm, "0");
     1072        }
    10351073    }
    10361074
     
    10381076    alignNode = node;
    10391077    breakOut = false;
    1040     do
    1041     {
    1042         if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
    1043         {
     1078    do {
     1079        if (!alignNode.getAttribute || !alignNode.getAttribute('align')) {
    10441080            continue;
    10451081        }
    10461082
    1047         switch (alignNode.getAttribute('align').toLowerCase())
    1048         {
     1083        switch (alignNode.getAttribute('align').toLowerCase()) {
    10491084            case "left":
    10501085                tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonSelected');
     
    10681103            break;
    10691104        }
    1070     } while (!breakOut && (alignNode = alignNode.parentNode));
     1105    } while (!breakOut && (alignNode = alignNode.parentNode) != null);
    10711106
    10721107    // Div justification
     
    10761111
    10771112    // Do special text
    1078     if (tinyMCE.isGecko && node.nodeType == 3)
    1079     {
    1080         var inst = tinyMCE.getInstanceById(editor_id);
    1081         var doc = inst.getDoc();
    1082 
    1083         if (doc.queryCommandState("Bold"))
    1084         {
    1085             tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
    1086         }
    1087 
    1088         if (doc.queryCommandState("Italic"))
    1089         {
    1090             tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
    1091         }
    1092 
    1093         if (doc.queryCommandState("Underline") &&
    1094                                           (node.parentNode == null || node.parentNode.nodeName != "A"))
    1095         {
     1113    if (!setup_content) {
     1114        // , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
     1115        var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
     1116        for (var i=0; i<ar.length; i+=2) {
     1117            if (doc.queryCommandState(ar[i]))
     1118                tinyMCE.switchClassSticky(editor_id + ar[i+1], 'mceButtonSelected');
     1119        }
     1120
     1121        if (doc.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A")) {
    10961122            tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
    10971123        }
    1098 
    1099         if (doc.queryCommandState("Strikethrough"))
    1100         {
    1101             tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
    1102         }
    11031124    }
    11041125
    11051126    // Handle elements
    1106     do
    1107     {
    1108         switch (node.nodeName.toLowerCase())
    1109         {
    1110             case "b":
    1111             case "strong":
     1127    do {
     1128        switch (node.nodeName) {
     1129/*          case "B":
     1130            case "STRONG":
    11121131                tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
    11131132            break;
    11141133
    1115             case "i":
    1116             case "em":
     1134            case "I":
     1135            case "EM":
    11171136                tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
    11181137            break;
    11191138
    1120             case "u":
     1139            case "U":
    11211140                tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
    11221141            break;
    11231142
    1124             case "strike":
     1143            case "STRIKE":
    11251144                tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
    1126             break;
    1127 
    1128             case "ul":
     1145            break;*/
     1146
     1147            case "UL":
    11291148                tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
    11301149            break;
    11311150
    1132             case "ol":
     1151            case "OL":
    11331152                tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
    11341153            break;
    11351154
    1136             case "sub":
    1137                 tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonSelected');
    1138             break;
    1139 
    1140             case "sup":
    1141                 tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonSelected');
    1142             break;
    1143 
    1144             case "hr":
     1155            case "HR":
    11451156                 tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonSelected');
    11461157            break;
    11471158
    1148             case "img":
    1149             if (getAttrib(node, 'name').indexOf('mce_') != 0)
    1150             {
     1159            case "IMG":
     1160            if (getAttrib(node, 'name').indexOf('mce_') != 0) {
    11511161                tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonSelected');
    11521162            }
    11531163            break;
    11541164        }
    1155     } while ((node = node.parentNode));
     1165    } while ((node = node.parentNode) != null);
    11561166};
    11571167
    11581168// This function auto imports CSS classes into the class selection droplist
    1159 function TinyMCE_advanced_setupCSSClasses(editor_id)
    1160 {
    1161     if (!TinyMCE_advanced_autoImportCSSClasses)
    1162     {
     1169function TinyMCE_advanced_setupCSSClasses(editor_id) {
     1170    if (!TinyMCE_advanced_autoImportCSSClasses) {
    11631171        return;
    11641172    }
     
    11661174    var selectElm = document.getElementById(editor_id + '_styleSelect');
    11671175
    1168     if (selectElm && selectElm.getAttribute('cssImported') != 'true')
    1169     {
     1176    if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
    11701177        var csses = tinyMCE.getCSSClasses(editor_id);
    1171         if (csses && selectElm)
    1172         {
    1173             for (var i=0; i<csses.length; i++)
    1174             {
     1178        if (csses && selectElm) {
     1179            for (var i=0; i<csses.length; i++) {
    11751180                selectElm.options[selectElm.length] = new Option(csses[i], csses[i]);
    11761181            }
     
    11781183
    11791184        // Only do this once
    1180         if (csses != null && csses.length > 0)
    1181         {
     1185        if (csses != null && csses.length > 0) {
    11821186            selectElm.setAttribute('cssImported', 'true');
    11831187        }
  • trunk/wp-includes/js/tinymce/themes/advanced/image.htm

    r2916 r2993  
    66    <script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
    77</head>
    8 <body onload="init();" style="display: none">
     8<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('src').focus();" style="display: none">
    99<form onsubmit="insertImage();return false;">
    1010  <table border="0" cellpadding="0" cellspacing="0" width="200">
     
    1919                <tr>
    2020                  <td><input name="src" type="text" id="src" value="" style="width: 200px" onchange="getImageData();"></td>
    21                   <td><script language="javascript" type="text/javascript">renderBrowser('srcbrowser','src','image','theme_advanced_image');</script></td>
     21                  <td id="srcbrowsercontainer">&nbsp;</td>
    2222                </tr>
    2323              </table></td>
     
    7979          </tr>
    8080          <tr>
    81             <td nowrap="nowrap"><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
     81            <td nowrap="nowrap"><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();">
    8282            </td>
    8383            <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/about.js

    r2916 r2993  
    2727
    2828        if (info.infourl != null && info.infourl != '')
    29             html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
     29            html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="mceplugin">' + info.longname + '</a></td>';
    3030        else
    3131            html += '<td width="50%" title="' + plugins[i] + '">' + info.longname + '</td>';
    3232
    3333        if (info.authorurl != null && info.authorurl != '')
    34             html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
     34            html += '<td width="35%"><a href="' + info.authorurl + '" target="mceplugin">' + info.author + '</a></td>';
    3535        else
    3636            html += '<td width="35%">' + info.author + '</td>';
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/charmap.js

    r2916 r2993  
    283283                + 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
    284284                + ' onmouseout="tinyMCE.restoreClass(this,\'charmapOver\');"'
    285                 + ' onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');return false;"'
    286                 + ' title="' + charmap[i][3] + '" nowrap="nowrap">'
     285                + ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" onfocus="previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');" href="javascript:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
    287286                + charmap[i][1]
    288                 + '</td>';
     287                + '</a></td>';
    289288            if ((cols+1) % charsPerRow == 0)
    290289                html += '</tr><tr height="' + tdHeight + '">';
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/image.js

    r2916 r2993  
    22if (url != null) {
    33    // Fix relative
    4     if (url.charAt(0) != '/')
     4    if (url.charAt(0) != '/' && url.indexOf('://') == -1)
    55        url = tinyMCE.documentBasePath + "/" + url;
    66
     
    2626function init() {
    2727    tinyMCEPopup.resizeToInnerSize();
     28
     29    document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
    2830
    2931    var formObj = document.forms[0];
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/link.js

    r2916 r2993  
    22if (url != null) {
    33    // Fix relative
    4     if (url.charAt(0) != '/')
     4    if (url.charAt(0) != '/' && url.indexOf('://') == -1)
    55        url = tinyMCE.documentBasePath + "/" + url;
    66
     
    1010function init() {
    1111    tinyMCEPopup.resizeToInnerSize();
     12
     13    document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
    1214
    1315    var formObj = document.forms[0];
     
    5052        var dummy;
    5153
     54        // Make anchors absolute
     55        if (href.charAt(0) == '#')
     56            href = tinyMCE.settings['document_base_url'] + href;
     57
     58        if (target == '_self')
     59            target = '';
     60
    5261        window.opener.tinyMCE.insertLink(href, target, title, dummy, style_class);
    5362        tinyMCEPopup.close();
  • trunk/wp-includes/js/tinymce/themes/advanced/jscripts/source_editor.js

    r2916 r2993  
    4040         wWidth = self.innerWidth-16;
    4141    } else {
    42          wHeight = document.body.clientHeight-80;
    43          wWidth = document.body.clientWidth-16;
     42         wHeight = document.body.clientHeight - 80;
     43         wWidth = document.body.clientWidth - 16;
    4444    }
    4545
    4646    document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
    4747    document.forms[0].htmlSource.style.width  = Math.abs(wWidth) + 'px';
    48        
    4948}
    5049
  • trunk/wp-includes/js/tinymce/themes/advanced/langs/en.js

    r2916 r2993  
    7272help : 'Help',
    7373not_set : '-- Not set --',
    74 close : 'Close'
     74close : 'Close',
     75toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X'
    7576});
  • trunk/wp-includes/js/tinymce/themes/advanced/link.htm

    r2916 r2993  
    66    <script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
    77</head>
    8 <body onload="init();" style="display: none">
     8<body onload="tinyMCEPopup.executeOnLoad('init();');document.getElementById('href').focus();" style="display: none">
    99<form onsubmit="insertLink();return false;">
    1010  <table border="0" cellpadding="0" cellspacing="0" width="100">
     
    1919                <tr>
    2020                  <td><input name="href" type="text" id="href" value="" style="width: 200px"></td>
    21                   <td><script language="javascript" type="text/javascript">renderBrowser('hrefbrowser','href','file','theme_advanced_link');</script></td>
     21                  <td id="hrefbrowsercontainer">&nbsp;</td>
    2222                </tr>
    2323              </table></td>
     
    8080          </tr>
    8181          <tr>
    82             <td><input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
     82            <td><input type="submit" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();">
    8383            </td>
    8484            <td align="right"><input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();"></td>
  • trunk/wp-includes/js/tinymce/themes/advanced/source_editor.htm

    r2917 r2993  
    11<html xmlns="http://www.w3.org/1999/xhtml">
    22<head>
    3     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     3    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    44    <title>{$lang_theme_code_title}</title>
    55    <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
    66    <script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
    77</head>
    8 <body onload="onLoadInit();" onresize="resizeInputs();" style="display: none">
     8<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');document.getElementById('htmlSource').focus();" onresize="resizeInputs();" style="display: none">
    99    <form name="source" onsubmit="saveContent();" action="#">
    1010        <div style="float: left" class="title">{$lang_theme_code_title}</div>
  • trunk/wp-includes/js/tinymce/tiny_mce.js

    r2916 r2993  
    11/**
    2  * $RCSfile: tiny_mce_src.js,v $
    3  * $Revision: 1.233 $
    4  * $Date: 2005/08/26 15:20:32 $
     2 * $RCSfile: tiny_mce.js,v $
     3 * $Revision: 1.301 $
     4 * $Date: 2005/10/30 16:06:56 $
    55 *
    66 * @author Moxiecode
    77 * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
    88 */
    9  function TinyMCE(){this.majorVersion="2";this.minorVersion="0RC2";this.releaseDate="2005-09-12";this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1)?'_src':'';src=src.substring(0,src.lastIndexOf('/'));tinyMCE.baseURL=src;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.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings['language']);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("editor_selector","");this.defParam("editor_deselector","mceNoEditor");this.defParam("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[style|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|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],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align],address[class|align],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class]");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",true);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,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,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,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,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute,237,iacute,243,oacute,250,uacute,193,Aacute,225,aacute,201,Eacute,205,Iacute,211,Oacute,218,Uacute,221,Yacute,253,yacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko");this.defParam("dialog_type","window");this.defParam("convert_fonts_to_styles",true);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;var baseHREF=tinyMCE.settings['document_base_url'];if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td)$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("content_css",false)){var cssPath=tinyMCE.getParam("content_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['content_css']=this.documentBasePath+"/"+cssPath;else this.settings['content_css']=cssPath;}else this.settings['content_css']='';if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}this._initCleanup();if(this.configs.length==0){if(this.isSafari&&this.getParam('safari_warning',true))alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}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 themePlugins=tinyMCE.getParam('plugins','',true,',');if(this.settings['plugins']!=''){for(var i=0;i<themePlugins.length;i++)this.loadScript(tinyMCE.baseURL+'/plugins/'+themePlugins[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;};TinyMCE.prototype.loadScript=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<link href="'+url+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(css_file=='')return;if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);if(inst.settings['cleanup']==false){tinyMCE.handleVisualAid(inst.getBody(),true,false,inst);tinyMCE._setEventsEnabled(inst.getBody(),false);}tinyMCE._customCleanup(inst,"submit_content_dom",inst.contentWindow.document.body);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst,inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);htm=tinyMCE._customCleanup(inst,"submit_content",htm);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.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(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var elms=node.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var event="";for(var x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event);}}}};TinyMCE.prototype.resetForm=function(form_index){var formObj=document.forms[form_index];for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();for(var i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name){inst.getBody().innerHTML=formObj.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);}};TinyMCE.prototype.execCommand=function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case 'mceHelp':var template=new Array();template['file']='about.htm';template['width']=480;template['height']=380;tinyMCE.openWindow(template,{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return;case 'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value['element'],value['document']);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance)this.selectedInstance.execCommand(command,user_interface,value);else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);};TinyMCE.prototype.eventPatch=function(editor_id){if(typeof(tinyMCE)=="undefined")return true;for(var i=0;i<document.frames.length;i++){if(document.frames[i].event){var event=document.frames[i].event;event.target=event.srcElement;TinyMCE.prototype.handleEvent(event);return;}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(editor_id){if(tinyMCE.isMSIE){var doc=document.frames[editor_id].document;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();inst.switchSettings();tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"blur",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE.prototype._createIFrame=function(replace_element){var iframe=document.createElement("iframe");var id=replace_element.getAttribute("id");iframe.setAttribute("id",id);iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",tinyMCE.settings['area_width']);iframe.setAttribute("height",tinyMCE.settings['area_height']);iframe.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=tinyMCE.settings['area_width'];iframe.style.height=tinyMCE.settings['area_height'];if(tinyMCE.isMSIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE)return window.frames[id];else return iframe;};TinyMCE.prototype.setupContent=function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;inst.switchSettings();if(!tinyMCE.isMSIE&&doc.title!="blank_page"){doc.location.href=tinyMCE.baseURL+"/blank.htm";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.executeCallback('init_instance_callback','_initInstance',0,inst);if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;base=doc.createElement("base");base.setAttribute('href',tinyMCE.settings['base_href']);head.appendChild(base);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._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('&lt;&gt;','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em(/?)>","<i$1>","gi");content=tinyMCE.regexpReplace(content,"<em ","<i ","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);if(tinyMCE.isMSIE)tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE.prototype.eventPatch);tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),true);inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoLevels[inst.undoLevels.length]=inst.startContent;};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}};TinyMCE.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isMSIE?win.event:e;var elm=tinyMCE.isMSIE?e.srcElement:e.target;if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);}};TinyMCE.prototype.addSelectAccessibility=function(e,select,win){if(!select._isAccessible){select.onkeydown=tinyMCE.accessibleEventHandler;select._isAccessible=true;select._win=win;}};TinyMCE.prototype.handleEvent=function(e){if(typeof(tinyMCE)=="undefined")return true;switch(e.type){case "blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');return;case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case "reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&e.ctrlKey&&tinyMCE.settings['custom_undo_redo']){if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false);}}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.keyCode==90&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);}if(e.keyCode==89&&e.ctrlKey&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);}if((e.keyCode==90||e.keyCode==89)&&e.ctrlKey){e.returnValue=false;e.cancelBubble=true;return false;}}}if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping");if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href)window.setTimeout('tinyMCE.getInstanceById("'+inst.editorId+'").fixBrokenURLs();',10);return false;break;}};TinyMCE.prototype.switchClass=function(element,class_name,lock_state){var lockChanged=false;if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};TinyMCE.prototype.restoreAndSwitchClass=function(element,class_name){if(element!=null&&!element.classLock){this.restoreClass(element);this.switchClass(element,class_name);}};TinyMCE.prototype.switchClassSticky=function(element_name,class_name,lock_state){var element,lockChanged=false;if(!this.stickyClassesLookup[element_name])this.stickyClassesLookup[element_name]=document.getElementById(element_name);element=this.stickyClassesLookup[element_name];if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;}};TinyMCE.prototype.restoreClass=function(element){if(element!=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(element,lock_state){if(element!=null)element.classLock=lock_state;};TinyMCE.prototype.addEvent=function(obj,name,handler){if(tinyMCE.isMSIE){obj.attachEvent("on"+name,handler);}else obj.addEventListener(name,handler,false);};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.oldSubmit();tinyMCE.isNotDirty=true;};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.oldSubmit=form.submit;form.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case "exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(tinyMCE.getAttrib(element,"class").indexOf(deselector)!=-1)continue;if(trigger=="false")continue;if(tinyMCE.settings['ask']&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case "specific_textareas":case "textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&tinyMCE.getAttrib(elm,"class").indexOf(selector)==-1)continue;if(tinyMCE.getAttrib(elm,"class").indexOf(deselector)!=-1)continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm;}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.executeCallback('oninit','_oninit',0);}};TinyMCE.prototype.removeMCEControl=function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}};TinyMCE.prototype._cleanupElementName=function(element_name,element){var name="";element_name=element_name.toLowerCase();if(element_name=="body")return null;if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==element_name)return null;}var validElement=false;var elementAttribs=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!elementAttribs;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var elmMatch=tinyMCE.cleanup_validElements[i][0][x];if(elmMatch.charAt(0)=='+'||elmMatch.charAt(0)=='-')elmMatch=elmMatch.substring(1);if(elmMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){elmMatch=elmMatch.replace(new RegExp('\\?','g'),'(\\S?)');elmMatch=elmMatch.replace(new RegExp('\\+','g'),'(\\S+)');elmMatch=elmMatch.replace(new RegExp('\\*','g'),'(\\S*)');elmMatch="^"+elmMatch+"$";if(element_name.match(new RegExp(elmMatch,'g'))){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;break;}}if(element_name==elmMatch){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;element_name=elementAttribs[0][0];break;}}}if(!validElement)return null;}if(element_name.charAt(0)=='+'||element_name.charAt(0)=='-')name=element_name.substring(1);if(!tinyMCE.isMSIE){if(name=="strong"&&!tinyMCE.cleanup_on_save)element_name="b";else if(name=="em"&&!tinyMCE.cleanup_on_save)element_name="i";}var elmData=new Object();elmData.element_name=element_name;elmData.valid_attribs=elementAttribs;return elmData;};TinyMCE.prototype._moveStyle=function(elm,style,attrib){if(tinyMCE.cleanup_inline_styles){var val=tinyMCE.getAttrib(elm,attrib);if(val!=''){val=''+val;switch(attrib){case "background":val="url('"+val+"');";break;case "bordercolor":if(elm.style.borderStyle==''||elm.style.borderStyle=='none')elm.style.borderStyle='solid';break;case "border":case "width":case "height":if(attrib=="border"&&elm.style.borderWidth>0)return;if(val.indexOf('%')==-1)val+='px';break;case "vspace":case "hspace":elm.style.marginTop=val+"px";elm.style.marginBottom=val+"px";elm.removeAttribute(attrib);return;case "align":if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE)elm.style.styleFloat=val;else elm.style.cssFloat=val;}else elm.style.textAlign=val;elm.removeAttribute(attrib);return;}if(val!=''){eval('elm.style.'+style+' = val;');elm.removeAttribute(attrib);}}}else{if(style=='')return;var val=eval('elm.style.'+style)==''?tinyMCE.getAttrib(elm,attrib):eval('elm.style.'+style);val=val==null?'':''+val;switch(attrib){case "background":if(val.indexOf('url')==-1&&val!='')val="url('"+val+"');";if(val!=''){elm.style.backgroundImage=val;elm.removeAttribute(attrib);}return;case "border":case "width":case "height":val=val.replace('px','');break;case "align":if(tinyMCE.getAttrib(elm,'align')==''){if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE&&elm.style.styleFloat!=''){val=elm.style.styleFloat;style='styleFloat';}else if(tinyMCE.isGecko&&elm.style.cssFloat!=''){val=elm.style.cssFloat;style='cssFloat';}}}break;}if(val!=''){elm.removeAttribute(attrib);elm.setAttribute(attrib,val);eval('elm.style.'+style+' = "";');}}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(attribName=="mce_onclick")verified=true;if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i<valid_attributes.length;i++){var attribMatch=valid_attributes[i][0];var re=null;if(attribMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){attribMatch=attribMatch.replace(new RegExp('\\?','g'),'(\\S?)');attribMatch=attribMatch.replace(new RegExp('\\+','g'),'(\\S+)');attribMatch=attribMatch.replace(new RegExp('\\*','g'),'(\\S*)');attribMatch="^"+attribMatch+"$";re=new RegExp(attribMatch,'g');}if((re&&attribName.match(re)!=null)||attribName==attribMatch){verified=true;attribMustBeValue=valid_attributes[i][3];break;}}if(!verified)return false;}else verified=true;switch(attribName){case "size":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.size;break;case "width":case "height":case "border":if(tinyMCE.isMSIE5)attribValue=eval("element_node."+attribName);break;case "color":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.color;break;case "class":if(element_name=="table"||element_name=="td"){if(tinyMCE.cleanup_visual_table_class!="")attribValue=tinyMCE.getVisualAidClass(attribValue,!tinyMCE.cleanup_on_save);}if(!tinyMCE._verifyClass(element_node)||attribValue=="")return null;break;case "onfocus":case "onblur":case "onclick":case "ondblclick":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeydown":case "onkeyup":attribValue=tinyMCE.cleanupEventStr(""+attribValue);if(attribValue.indexOf('return false;')==0)attribValue=attribValue.substring(14);break;case "style":attribValue=tinyMCE.serializeStyle(tinyMCE.parseStyle(element_node.style.cssText));break;case "href":case "src":if(!tinyMCE.isMSIE&&attribName=="href"&&element_node.getAttribute("mce_real_href"))attribValue=element_node.getAttribute("mce_real_href");if(!tinyMCE.isMSIE&&attribName=="src"&&element_node.getAttribute("mce_real_src"))attribValue=element_node.getAttribute("mce_real_src");if(tinyMCE.isGecko&&!tinyMCE.settings['relative_urls'])attribValue=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],attribValue);attribValue=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(attribValue=="1")return null;break;case "_moz-userdefined":case "editorid":case "mce_real_href":case "mce_real_src":return null;}if(attribMustBeValue!=null){var isCorrect=false;for(var i=0;i<attribMustBeValue.length;i++){if(attribValue==attribMustBeValue[i]){isCorrect=true;break;}}if(!isCorrect)return null;}var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;};TinyMCE.prototype.parseStyle=function(str){var ar=new Array();var st=str.split(';');for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1];}return ar;};TinyMCE.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return;}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null;};TinyMCE.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");for(var key in ar){var val=ar[key];if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val!="url('')")str+=key.toLowerCase()+": "+val+"; ";}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str;};TinyMCE.prototype._verifyClass=function(node){if(tinyMCE.isGecko){var className=node.getAttribute('class');if(!className)return false;}if(tinyMCE.isMSIE)var className=node.getAttribute('className');if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var csses=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<csses.length;c++){if(csses[c]==className){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&className.indexOf('mce_')!=0){node.removeAttribute('className');node.removeAttribute('class');return false;}}return true;};TinyMCE.prototype.cleanupNode=function(node){var output="";switch(node.nodeType){case 1:var elementData=tinyMCE._cleanupElementName(node.nodeName,node);var elementName=elementData?elementData.element_name:null;var elementValidAttribs=elementData?elementData.valid_attribs:null;var elementAttribs="";var openTag=false,nonEmptyTag=false;if(elementName!=null&&elementName.charAt(0)=='+'){elementName=elementName.substring(1);openTag=true;}if(elementName!=null&&elementName.charAt(0)=='-'){elementName=elementName.substring(1);nonEmptyTag=true;}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var lookup=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<lookup.length;i++){if(lookup[i]==node)return output;}lookup[lookup.length]=node;}if(!elementName){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}if(tinyMCE.cleanup_on_save){if(node.nodeName=="A"&&node.className=="mceItemAnchor")return '<a name="'+this.convertStringToXML(node.getAttribute("name"))+'"></a>';}if(tinyMCE.cleanup_inline_styles){var re=new RegExp("^(TABLE|TD|TR|IMG|HR)$");if(re.test(node.nodeName)){tinyMCE._moveStyle(node,'width','width');tinyMCE._moveStyle(node,'height','height');tinyMCE._moveStyle(node,'borderWidth','border');tinyMCE._moveStyle(node,'','vspace');tinyMCE._moveStyle(node,'','hspace');tinyMCE._moveStyle(node,'textAlign','align');tinyMCE._moveStyle(node,'backgroundColor','bgColor');tinyMCE._moveStyle(node,'borderColor','borderColor');tinyMCE._moveStyle(node,'backgroundImage','background');if(tinyMCE.isMSIE5)node.outerHTML=node.outerHTML;}else if(tinyMCE.isBlockElement(node))tinyMCE._moveStyle(node,'textAlign','align');if(node.nodeName=="FONT")tinyMCE._moveStyle(node,'color','color');}if(elementValidAttribs){for(var a=1;a<elementValidAttribs.length;a++){var attribName,attribDefaultValue,attribForceValue,attribValue;attribName=elementValidAttribs[a][0];attribDefaultValue=elementValidAttribs[a][1];attribForceValue=elementValidAttribs[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var attribValue=node.getAttribute(attribName);if(node.getAttribute(attribName)==null||node.getAttribute(attribName)=="")attribValue=attribDefaultValue;attribValue=attribForceValue?attribForceValue:attribValue;if(attribValue=="{$uid}")attribValue="uid_"+(tinyMCE.cleanup_idCount++);if(attribName=="class")attribValue=tinyMCE.getVisualAidClass(attribValue,tinyMCE.cleanup_on_save);node.setAttribute(attribName,attribValue);}}}if(elementName=="table"&&!node.hasChildNodes())return "";if(node.attributes.length>0){for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified){var attrib=tinyMCE._cleanupAttribute(elementValidAttribs,elementName,node.attributes[i],node);if(attrib&&attrib.value!="")elementAttribs+=" "+attrib.name+"="+'"'+this.convertStringToXML(""+attrib.value)+'"';}}}if(tinyMCE.isMSIE&&elementName=="table"&&node.getAttribute("summary")!=null&&elementAttribs.indexOf('summary')==-1){elementAttribs+=" summary="+'"'+this.convertStringToXML(""+node.getAttribute("summary"))+'"';}if(tinyMCE.isMSIE&&elementName=="input"){if(node.type){if(!elementAttribs.match(/type=/g))elementAttribs+=" type="+'"'+node.type+'"';}if(node.value){if(!elementAttribs.match(/value=/g))elementAttribs+=" value="+'"'+node.value+'"';}}if((elementName=="p"||elementName=="td")&&(node.innerHTML==""||node.innerHTML=="&nbsp;"))return "<"+elementName+elementAttribs+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"</"+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="<div"+elementAttribs+">";else output+="<"+elementName+elementAttribs+">";for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="</div><br />";else output+="</"+elementName+">";}else{if(!nonEmptyTag){if(openTag)output+="<"+elementName+elementAttribs+"></"+elementName+">";else output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "<!--"+node.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i<html_data.length;i++){var chr=html_data.charCodeAt(i);if(tinyMCE.settings['entity_encoding']=="numeric"){if(chr>127)output+='&#'+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if(chunk.charAt(0)=='-')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i<extendedValidElements.length;i++){var elementName=this._getCleanupElementName(extendedValidElements[i]);var skipAdd=false;for(var x=0;x<validElements.length;x++){if(this._getCleanupElementName(validElements[x])==elementName){validElements[x]=extendedValidElements[i];skipAdd=true;break;}}if(!skipAdd)validElements[validElements.length]=extendedValidElements[i];}for(var i=0;i<validElements.length;i++){var item=validElements[i];item=item.replace('[','|');item=item.replace(']','');var attribs=item.split('|');for(var x=0;x<attribs.length;x++)attribs[x]=attribs[x].toLowerCase();attribs[0]=attribs[0].split('/');for(var x=1;x<attribs.length;x++){var attribName=attribs[x];var attribDefault=null;var attribForce=null;var attribMustBe=null;if((pos=attribName.indexOf('='))!=-1){attribDefault=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf(':'))!=-1){attribForce=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf('<'))!=-1){attribMustBe=attribName.substring(pos+1).split('?');attribName=attribName.substring(0,pos);}attribs[x]=new Array(attribName,attribDefault,attribForce,attribMustBe);}validElements[i]=attribs;}var invalidElements=tinyMCE.settings['invalid_elements'].split(',');for(var i=0;i<invalidElements.length;i++)invalidElements[i]=invalidElements[i].toLowerCase();tinyMCE.settings['cleanup_validElements']=validElements;tinyMCE.settings['cleanup_invalidElements']=invalidElements;tinyMCE.settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)tinyMCE.settings['cleanup_entities']['c'+entities[i]]=entities[i+1];};TinyMCE.prototype._cleanupHTML=function(inst,doc,config,element,visual,on_save){if(!tinyMCE.settings['cleanup'])return element.innerHTML;tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings['cleanup_validElements'];tinyMCE.cleanup_entities=tinyMCE.settings['cleanup_entities'];tinyMCE.cleanup_invalidElements=tinyMCE.settings['cleanup_invalidElements'];tinyMCE.cleanup_verify_html=tinyMCE.settings['verify_html'];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings['force_br_newlines'];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings['urlconverter_callback'];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings['verify_css_classes'];tinyMCE.cleanup_visual_table_class=tinyMCE.settings['visual_table_class'];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings['apply_source_formatting'];tinyMCE.cleanup_inline_styles=tinyMCE.settings['inline_styles'];tinyMCE.cleanup_visual_aid=visual;tinyMCE.cleanup_on_save=on_save;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var startTime=new Date().getTime();if(tinyMCE.isMSIE){var nodes=element.getElementsByTagName("hr");for(var i=0;i<nodes.length;i++){if(nodes[i].id=="null")nodes[i].removeAttribute("id");}element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<p>[ \n\r]*<hr.*>[ \n\r]*</p>','<hr />','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'<!([^-(DOCTYPE)]* )|<!/[^-]*>','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])tinyMCE.debug("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'<p><hr /></p>','<hr />');html=tinyMCE.regexpReplace(html,'<p>&nbsp;</p><hr /><p>&nbsp;</p>','<hr />');html=tinyMCE.regexpReplace(html,'<td>\\s*<br />\\s*</td>','<td>&nbsp;</td>');html=html.replace(new RegExp('<a>(.*?)</a>','gi'),'$1');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('<o:p _moz-userdefined="" />','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n</$1$2>\n");html=html.replace(new RegExp('<br />','g'),"<br />\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('<p>&nbsp;</p>','g');html=html.replace(re,"<br />");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('&lt;&gt;','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p>&nbsp;</p>"||chk=="<p>&#160;</p>"||chk=="<p></p>")html="";if(tinyMCE.settings["preformatted"])return "<pre>"+html+"</pre>";return html;};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="#mce_temp_url#">'+this.selectedInstance.getSelectedHTML()+'</a>');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i<elementArray.length;i++){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");tinyMCE.setAttrib(elementArray[i],'href',href);tinyMCE.setAttrib(elementArray[i],'mce_real_href',href);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(this.linkElement){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,'href',href);tinyMCE.setAttrib(this.linkElement,'mce_real_href',href);tinyMCE.setAttrib(this.linkElement,'target',target);tinyMCE.setAttrib(this.linkElement,'title',title);tinyMCE.setAttrib(this.linkElement,'onclick',onclick);tinyMCE.setAttrib(this.linkElement,'class',style_class);}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.insertImage=function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!this.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="#mce_temp_url#" />');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x<n;x++){var childElements=this.getElementsByAttributeValue(node.childNodes[x],element_name,attrib,value);for(var i=0,m=childElements.length;i<m;i++)elements[elements.length]=childElements[i];}}return elements;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName))return node;node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,node_array,type,node_name){if(typeof(type)=="undefined"||node.nodeType==type&&(typeof(node_name)=="undefined"||node.nodeName==node_name))node_array[node_array.length]=node;if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)tinyMCE.getNodeTree(node.childNodes[i],node_array,type,node_name);}return node_array;};TinyMCE.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}var namesAr=names.split(',');if(node==null)return null;do{for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase()||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while(node=node.parentNode);return null;};TinyMCE.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var fileProto=(prot=="file:");url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(!tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return "#"+urlParts['anchor'];}if(on_save&&tinyMCE.settings['relative_urls']){var urlParts=tinyMCE.parseURL(url);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(!urlParts['port']||urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],url);}if(!fileProto&&tinyMCE.settings['remove_script_host']){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);if(!tinyMCE.settings['relative_urls']&&url.indexOf('://')==-1&&url.charAt(0)!='/')url='/'+url;}return url;};TinyMCE.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var strTok1;var strTok2;var breakPoint=0;var outputString="";base_url=base_url.substring(0,base_url.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=url_to_relative.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outputString+="/"+strTok2[i];else outputString+=strTok2[i];}return outputString;};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=TinyMCE.prototype.parseURL(base_url);var relURL=TinyMCE.prototype.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(relative_url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;};TinyMCE.prototype.getLang=function(name,default_value,parse_entities){var value=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name];if(parse_entities){var el=document.createElement("div");el.innerHTML=value;value=el.innerHTML;}return value;};TinyMCE.prototype.addToLang=function(prefix,ar){for(var key in ar)tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key];};TinyMCE.prototype.replaceVar=function(replace_haystack,replace_var,replace_str){var re=new RegExp('{\\\$'+replace_var+'}','g');return replace_haystack.replace(re,replace_str);};TinyMCE.prototype.replaceVars=function(replace_haystack,replace_vars){for(var key in replace_vars){var value=replace_vars[key];replace_haystack=tinyMCE.replaceVar(replace_haystack,key,value);}return replace_haystack;};TinyMCE.prototype.triggerNodeChange=function(focus,setup_content){if(tinyMCE.settings['handleNodeChangeCallback']){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(inst,type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){if(eval("typeof(TinyMCE_"+plugins[i]+"_cleanup)")!="undefined")content=eval("TinyMCE_"+plugins[i]+"_cleanup(type, content, inst);");}return content;};TinyMCE.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance)return tinyMCE._cleanupHTML(this.selectedInstance,this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);return null;};TinyMCE.prototype.setContent=function(html_content){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,html_content);tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');};TinyMCE.prototype.importPluginLanguagePack=function(name,valid_languages){var lang="en";valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}tinyMCE.loadScript(tinyMCE.baseURL+'/plugins/'+name+'/langs/'+lang+'.js');};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof(args)!="undefined")html=tinyMCE.replaceVars(html,args);html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(template,args){var html,width,height,x,y,resizable,scrollbars,url;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.isMSIE)height+=40;else height+=20;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);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)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.isMSIE&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){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";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;}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();}}};TinyMCE.prototype.closeWindow=function(win){win.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state,inst){if(!element)return;var tableElement=null;switch(element.nodeName){case "TABLE":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y<element.rows.length;y++){for(var x=0;x<element.rows[y].cells.length;x++){var className=tinyMCE.getVisualAidClass(element.rows[y].cells[x].className,state&&element.getAttribute("border")==0);element.rows[y].cells[x].className=className;}}break;case "A":var anchorName=tinyMCE.getAttrib(element,"name");if(anchorName!=''&&state){element.title=anchorName;element.className='mceItemAnchor';}else if(anchorName!=''&&!state)element.className='';break;}if(deep&&element.hasChildNodes()){for(var i=0;i<element.childNodes.length;i++)tinyMCE.handleVisualAid(element.childNodes[i],deep,state,inst);}};TinyMCE.prototype.getAttrib=function(elm,name,default_value){if(typeof(default_value)=="undefined")default_value="";if(!elm||elm.nodeType!=1)return default_value;var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(name=="style")v=elm.style.cssText;return(v&&v!="")?v:default_value;};TinyMCE.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number"&&value!=null)value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="style")element.style.cssText=value;if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype._setHTML=function(doc,html_content){if(tinyMCE.isMSIE){var re=new RegExp('<p><hr /></p>','g');html_content=html_content.replace(re,"<hr>");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;if(html.indexOf('="mso')!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p><\/o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p>&nbsp;<\/o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p><\/p>\r\n<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p>&nbsp;<\/p>","<br />");html=tinyMCE.regexpReplace(html,"<p>\s*(<p>\s*)?","<p>");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","</p>");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==element_id){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;};TinyMCE.prototype.getInstanceById=function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;};TinyMCE.prototype.queryInstanceCommandState=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;};TinyMCE.prototype.setWindowArg=function(name,value){this.windowArgs[name]=value;};TinyMCE.prototype.getWindowArg=function(name,default_value){return(typeof(this.windowArgs[name])=="undefined")?default_value:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];break;}doc=instance.getDoc();}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc();}if(doc){var styles=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets("+x+").rules : doc.styleSheets["+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++){if(rules[c].indexOf(' ')!=-1||rules[c].indexOf(':')!=-1||rules[c].indexOf('mceItem')!=-1)continue;if(rules[c]=="."+tinyMCE.settings['visual_table_class'])continue;if(rules[c].indexOf('.')!=-1){output[output.length]=rules[c].substring(rules[c].indexOf('.')+1);}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.trim=function(str){return str.replace(/^\s*|\s*$/g,"");};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');str=str.replace(/^return true;/gi,'');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i<args.length;i++){str+='args['+i+']';if(i<args.length-1)str+=',';}str+=');';return eval(str);};TinyMCE.prototype.executeCallback=function(param,suffix,mode){switch(mode){case 0:var state=false;var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}return state;case 1:var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}return false;}};TinyMCE.prototype.debug=function(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
     9 function TinyMCE(){this.majorVersion="2";this.minorVersion="0RC4";this.releaseDate="2005-10-30";this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();var ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isGecko18=ua.indexOf('Gecko')!=-1&&ua.indexOf('rv:1.8')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false;}this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip.php")!=-1)){var src=elements[i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1)?'_src':'';src=src.substring(0,src.lastIndexOf('/'));tinyMCE.baseURL=src;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.defParam("mode","none");this.defParam("theme","advanced");this.defParam("plugins","",true);this.defParam("language","en");this.defParam("docs_language",this.settings['language']);this.defParam("elements","");this.defParam("textarea_trigger","mce_editable");this.defParam("editor_selector","");this.defParam("editor_deselector","mceNoEditor");this.defParam("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[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=0|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[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class|style],font[face|size|style|id|class|dir|color]");this.defParam("extended_valid_elements","");this.defParam("invalid_elements","");this.defParam("encoding","");this.defParam("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE.prototype.convertURL"));this.defParam("save_callback","");this.defParam("debug",false);this.defParam("force_br_newlines",false);this.defParam("force_p_newlines",true);this.defParam("add_form_submit_trigger",true);this.defParam("relative_urls",true);this.defParam("remove_script_host",true);this.defParam("focus_alert",true);this.defParam("document_base_url",this.documentURL);this.defParam("visual",true);this.defParam("visual_table_class","mceVisualAid");this.defParam("setupcontent_callback","");this.defParam("fix_content_duplication",true);this.defParam("custom_undo_redo",true);this.defParam("custom_undo_redo_levels",-1);this.defParam("custom_undo_redo_keyboard_shortcuts",true);this.defParam("verify_css_classes",false);this.defParam("verify_html",true);this.defParam("apply_source_formatting",false);this.defParam("directionality","ltr");this.defParam("cleanup_on_startup",false);this.defParam("inline_styles",false);this.defParam("convert_newlines_to_brs",false);this.defParam("auto_reset_designmode",true);this.defParam("entities","160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,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,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,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,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute,237,iacute,243,oacute,250,uacute,193,Aacute,225,aacute,201,Eacute,205,Iacute,211,Oacute,218,Uacute,221,Yacute,253,yacute");this.defParam("entity_encoding","named");this.defParam("cleanup_callback","");this.defParam("add_unload_trigger",true);this.defParam("ask",false);this.defParam("nowrap",false);this.defParam("auto_resize",false);this.defParam("auto_focus",false);this.defParam("cleanup",true);this.defParam("remove_linebreaks",true);this.defParam("button_tile_map",false);this.defParam("submit_patch",true);this.defParam("browsers","msie,safari,gecko,opera");this.defParam("dialog_type","window");this.defParam("accessibility_warnings",true);this.defParam("merge_styles_invalid_parents","");this.defParam("force_hex_style_colors",true);this.defParam("trim_span_elements",true);this.defParam("convert_fonts_to_spans",false);this.defParam("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this.defParam("font_size_classes",'');this.defParam("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large');this.defParam("event_elements",'a,img');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;var baseHREF=tinyMCE.settings['document_base_url'];if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.blockRegExp=new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dir|fieldset|form|noscript|noframes|menu|isindex)$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='http://tinymce.moxiecode.cp/mce_temp_url';this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isMSIE)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("content_css",false)){var cssPath=tinyMCE.getParam("content_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['content_css']=this.documentBasePath+"/"+cssPath;else this.settings['content_css']=cssPath;}else this.settings['content_css']='';if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath;}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath;}else this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css";if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg);}this._initCleanup();if(this.configs.length==0){if(this.isSafari&&this.getParam('safari_warning',true))alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");tinyMCE.addEvent(window,"load",TinyMCE.prototype.onLoad);if(tinyMCE.isMSIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE.prototype.unloadHandler);}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true);});}}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 themePlugins=tinyMCE.getParam('plugins','',true,',');if(this.settings['plugins']!=''){for(var i=0;i<themePlugins.length;i++)this.loadScript(tinyMCE.baseURL+'/plugins/'+themePlugins[i]+'/editor_plugin'+tinyMCE.srcMode+'.js');}settings['index']=this.configs.length;this.configs[this.configs.length]=settings;};TinyMCE.prototype.loadScript=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return;}document.write('<link href="'+url+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(css_file=='')return;if(typeof(doc.createStyleSheet)=="undefined"){var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm);}else var styleSheet=doc.createStyleSheet(css_file);};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);if(inst.settings['cleanup']==false){tinyMCE.handleVisualAid(inst.getBody(),true,false,inst);tinyMCE._setEventsEnabled(inst.getBody(),true);}tinyMCE._customCleanup(inst,"submit_content_dom",inst.contentWindow.document.body);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst,inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);htm=tinyMCE._customCleanup(inst,"submit_content",htm);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.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(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var evs=tinyMCE.settings['event_elements'].split(',');for(var y=0;y<evs.length;y++){var elms=node.getElementsByTagName(evs[y]);for(var i=0;i<elms.length;i++){var event="";for(var x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!=''){event=tinyMCE.cleanupEventStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event);}}}}};TinyMCE.prototype.resetForm=function(form_index){var formObj=document.forms[form_index];for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(var i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name){inst.getBody().innerHTML=formObj.elements[i].value;return;}}}};TinyMCE.prototype.execInstanceCommand=function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id);if(inst){if(typeof(focus)=="undefined")focus=true;if(focus)inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();this.selectedInstance=inst;tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isMSIE&&window.event!=null)tinyMCE.cancelEvent(window.event);}};TinyMCE.prototype.execCommand=function(command,user_interface,value){user_interface=user_interface?user_interface:false;value=value?value:null;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();switch(command){case 'mceHelp':var template=new Array();template['file']='about.htm';template['width']=480;template['height']=380;tinyMCE.openWindow(template,{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return;case 'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.contentWindow.focus();return;case "mceAddControl":case "mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case "mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value['element'],value['document']);return;case "mceRemoveControl":case "mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case "mceResetDesignMode":if(!tinyMCE.isMSIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on";}catch(e){}}}return;}if(this.selectedInstance){this.selectedInstance.execCommand(command,user_interface,value);}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert']);};TinyMCE.prototype.eventPatch=function(editor_id){if(typeof(tinyMCE)=="undefined")return true;for(var i=0;i<document.frames.length;i++){try{if(document.frames[i].event){var event=document.frames[i].event;if(!event.target)event.target=event.srcElement;TinyMCE.prototype.handleEvent(event);return;}}catch(ex){}}};TinyMCE.prototype.unloadHandler=function(){tinyMCE.triggerSave(true,true);};TinyMCE.prototype.addEventHandlers=function(editor_id){if(tinyMCE.isMSIE){var doc=document.frames[editor_id].document;tinyMCE.addEvent(doc,"keypress",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keyup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"keydown",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"mouseup",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(doc,"click",TinyMCE.prototype.eventPatch);}else{var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();inst.switchSettings();tinyMCE.addEvent(doc,"keypress",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keydown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"keyup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"click",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mouseup",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"mousedown",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"focus",tinyMCE.handleEvent);tinyMCE.addEvent(doc,"blur",tinyMCE.handleEvent);eval('try { doc.designMode = "On"; } catch(e) {}');}};TinyMCE.prototype._createIFrame=function(replace_element){var iframe=document.createElement("iframe");var id=replace_element.getAttribute("id");var aw,ah;aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=aw<0?300:aw;aw=aw+"px";}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=ah<0?240:ah;ah=ah+"px";}iframe.setAttribute("id",id);iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isMSIE&&!tinyMCE.isOpera)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isMSIE)return window.frames[id];else return iframe;};TinyMCE.prototype.setupContent=function(editor_id){var inst=tinyMCE.instances[editor_id];var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;tinyMCE.operaOpacityCounter=100*tinyMCE.idCounter;inst.switchSettings();if(!tinyMCE.isMSIE&&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.executeCallback('init_instance_callback','_initInstance',0,inst);if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getDoc().body.setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isMSIE)doc.documentElement.editorId=editor_id;var base=doc.createElement("base");base.setAttribute('href',tinyMCE.settings['base_href']);head.appendChild(base);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._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isMSIE){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{content=tinyMCE.regexpReplace(content,"<strong","<b","gi");content=tinyMCE.regexpReplace(content,"<em(/?)>","<i$1>","gi");content=tinyMCE.regexpReplace(content,"<em ","<i ","gi");content=tinyMCE.regexpReplace(content,"</strong>","</b>","gi");content=tinyMCE.regexpReplace(content,"</em>","</i>","gi");tinyMCE.setInnerHTML(inst.getBody(),content);}inst.convertAllRelativeURLs();}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);}var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);if(tinyMCE.isMSIE)tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE.prototype.eventPatch);tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);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.undoLevels[inst.undoLevels.length]=inst.startContent;tinyMCE.operaOpacityCounter=-1;};TinyMCE.prototype.cleanupHTMLCode=function(s){s=s.replace(/<p\/>/gi,'<p>&nbsp;</p>');s=s.replace(/<p>\s*<\/p>/gi,'<p>&nbsp;</p>');s=s.replace(/<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([^\\|>]*?)\/>/gi,'<$1$2></$1>');s=s.replace(new RegExp('\\s+></','gi'),'></');if(tinyMCE.isMSIE)s=s.replace(/<p><hr\/><\/p>/gi,"<hr>");s=s.replace(new RegExp('(href=\"?)(\\s*?#)','gi'),'$1'+tinyMCE.settings['document_base_url']+"#");return s;};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i<form_obj.elements.length;i++){var elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true;}};TinyMCE.prototype.accessibleEventHandler=function(e){var win=this._win;e=tinyMCE.isMSIE?win.event:e;var elm=tinyMCE.isMSIE?e.srcElement:e.target;if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);}};TinyMCE.prototype.addSelectAccessibility=function(e,select,win){if(!select._isAccessible){select.onkeydown=tinyMCE.accessibleEventHandler;select._isAccessible=true;select._win=win;}};TinyMCE.prototype.handleEvent=function(e){if(typeof(tinyMCE)=="undefined")return true;switch(e.type){case "blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');return;case "submit":tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE?window.event.srcElement:e.target);tinyMCE.triggerSave();tinyMCE.isNotDirty=true;return;case "reset":var formObj=tinyMCE.isMSIE?window.event.srcElement:e.target;for(var i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10);}return;case "keypress":if(e.target.editorId){tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];}else{if(e.target.ownerDocument.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.ownerDocument.editorId];}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&e.keyCode==13&&!e.shiftKey){if(tinyMCE.selectedInstance._insertPara(e)){tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.cancelEvent(e);return false;}}if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}if(tinyMCE.isGecko&&(e.ctrlKey&&!e.altKey)&&tinyMCE.settings['custom_undo_redo']){if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.charCode==122){tinyMCE.selectedInstance.execCommand("Undo");e.preventDefault();return false;}if(e.charCode==121){tinyMCE.selectedInstance.execCommand("Redo");e.preventDefault();return false;}}if(e.charCode==98){tinyMCE.selectedInstance.execCommand("Bold");e.preventDefault();return false;}if(e.charCode==105){tinyMCE.selectedInstance.execCommand("Italic");e.preventDefault();return false;}if(e.charCode==117){tinyMCE.selectedInstance.execCommand("Underline");e.preventDefault();return false;}}if(tinyMCE.isMSIE&&tinyMCE.settings['force_br_newlines']&&e.keyCode==13){if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break;}}if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(8,46);for(var i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false);}}if(tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']){if(e.keyCode==90&&(e.ctrlKey&&!e.altKey)&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Undo");tinyMCE.triggerNodeChange(false);}if(e.keyCode==89&&(e.ctrlKey&&!e.altKey)&&e.type=="keydown"){tinyMCE.selectedInstance.execCommand("Redo");tinyMCE.triggerNodeChange(false);}if((e.keyCode==90||e.keyCode==89)&&(e.ctrlKey&&!e.altKey)){e.returnValue=false;e.cancelBubble=true;return false;}}}if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping");if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isMSIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;case "mousedown":case "mouseup":case "click":case "focus":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var targetBody=tinyMCE.getParentElement(e.target,"body");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;var inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody()==targetBody){tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break;}}if(tinyMCE.isSafari){tinyMCE.selectedInstance.lastSafariSelection=tinyMCE.selectedInstance.getBookmark();tinyMCE.selectedInstance.lastSafariSelectedElement=tinyMCE.selectedElement;var lnk=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");if(lnk&&e.type=="mousedown"){lnk.setAttribute("mce_real_href",lnk.getAttribute("href"));lnk.setAttribute("href","javascript:void(0);");}if(lnk&&e.type=="click"){window.setTimeout(function(){lnk.setAttribute("href",lnk.getAttribute("mce_real_href"));lnk.removeAttribute("mce_real_href");},10);}}if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTyping");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href)window.setTimeout('tinyMCE.getInstanceById("'+inst.editorId+'").fixBrokenURLs();',10);return false;break;}};TinyMCE.prototype.switchClass=function(element,class_name,lock_state){var lockChanged=false;if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.oldClassName=element.className;element.className=class_name;}};TinyMCE.prototype.restoreAndSwitchClass=function(element,class_name){if(element!=null&&!element.classLock){this.restoreClass(element);this.switchClass(element,class_name);}};TinyMCE.prototype.switchClassSticky=function(element_name,class_name,lock_state){var element,lockChanged=false;if(!this.stickyClassesLookup[element_name])this.stickyClassesLookup[element_name]=document.getElementById(element_name);element=this.stickyClassesLookup[element_name];if(typeof(lock_state)!="undefined"&&element!=null){element.classLock=lock_state;lockChanged=true;}if(element!=null&&(lockChanged||!element.classLock)){element.className=class_name;element.oldClassName=class_name;if(tinyMCE.isOpera){if(class_name=="mceButtonDisabled"){var suffix="";if(!element.mceOldSrc)element.mceOldSrc=element.src;if(this.operaOpacityCounter>-1)suffix='?rnd='+this.operaOpacityCounter++;element.src=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/images/opacity.png"+suffix;element.style.backgroundImage="url('"+element.mceOldSrc+"')";}else{if(element.mceOldSrc){element.src=element.mceOldSrc;element.parentNode.style.backgroundImage="";element.mceOldSrc=null;}}}}};TinyMCE.prototype.restoreClass=function(element){if(element!=null&&element.oldClassName&&!element.classLock){element.className=element.oldClassName;element.oldClassName=null;}};TinyMCE.prototype.setClassLock=function(element,lock_state){if(element!=null)element.classLock=lock_state;};TinyMCE.prototype.addEvent=function(obj,name,handler){if(tinyMCE.isMSIE){obj.attachEvent("on"+name,handler);}else obj.addEventListener(name,handler,false);};TinyMCE.prototype.submitPatch=function(){tinyMCE.removeTinyMCEFormElements(this);tinyMCE.triggerSave();this.mceOldSubmit();tinyMCE.isNotDirty=true;};TinyMCE.prototype.onLoad=function(){for(var c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];var selector=tinyMCE.getParam("editor_selector");var deselector=tinyMCE.getParam("editor_deselector");var elementRefAr=new Array();if(document.forms&&tinyMCE.settings['add_form_submit_trigger']&&!tinyMCE.submitTriggers){for(var i=0;i<document.forms.length;i++){var form=document.forms[i];tinyMCE.addEvent(form,"submit",TinyMCE.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings['submit_patch']){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE.prototype.submitPatch;}catch(e){}}}}var mode=tinyMCE.settings['mode'];switch(mode){case "exact":var elements=tinyMCE.getParam('elements','',true,',');for(var i=0;i<elements.length;i++){var element=tinyMCE._getElementById(elements[i]);var trigger=element?element.getAttribute(tinyMCE.settings['textarea_trigger']):"";if(tinyMCE.getAttrib(element,"class").indexOf(deselector)!=-1)continue;if(trigger=="false")continue;if(tinyMCE.settings['ask']&&element){elementRefAr[elementRefAr.length]=element;continue;}if(element)tinyMCE.addMCEControl(element,elements[i]);else if(tinyMCE.settings['debug'])alert("Error: Could not find element by id or name: "+elements[i]);}break;case "specific_textareas":case "textareas":var nodeList=document.getElementsByTagName("textarea");for(var i=0;i<nodeList.length;i++){var elm=nodeList.item(i);var trigger=elm.getAttribute(tinyMCE.settings['textarea_trigger']);if(selector!=''&&tinyMCE.getAttrib(elm,"class").indexOf(selector)==-1)continue;if(tinyMCE.getAttrib(elm,"class").indexOf(deselector)!=-1)continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm;}break;}for(var i=0;i<elementRefAr.length;i++){var element=elementRefAr[i];var elementId=element.name?element.name:element.id;if(tinyMCE.settings['ask']){if(tinyMCE.isGecko){var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE.prototype.confirmAdd(e,settings);},10);});}else{var settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(){TinyMCE.prototype.confirmAdd(null,settings);});}}else tinyMCE.addMCEControl(element,elementId);}if(tinyMCE.settings['auto_focus']){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings['auto_focus']);inst.selectNode(inst.getBody(),true,true);inst.contentWindow.focus();},10);}tinyMCE.executeCallback('oninit','_oninit',0);}};TinyMCE.prototype.removeMCEControl=function(editor_id){var inst=tinyMCE.getInstanceById(editor_id);if(inst){inst.switchSettings();editor_id=inst.editorId;var html=tinyMCE.getContent(editor_id);var tmpInstances=new Array();for(var instanceName in tinyMCE.instances){var instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;if(instanceName!=editor_id)tmpInstances[instanceName]=instance;}tinyMCE.instances=tmpInstances;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;var replaceElement=document.getElementById(editor_id+"_parent");var oldTargetElement=inst.oldTargetElement;var targetName=oldTargetElement.nodeName.toLowerCase();if(targetName=="textarea"||targetName=="input"){replaceElement.parentNode.removeChild(replaceElement);oldTargetElement.style.display="inline";oldTargetElement.value=html;}else{oldTargetElement.innerHTML=html;replaceElement.parentNode.insertBefore(oldTargetElement,replaceElement);replaceElement.parentNode.removeChild(replaceElement);}}};TinyMCE.prototype._cleanupElementName=function(element_name,element){var name="";element_name=element_name.toLowerCase();if(element_name=="body")return null;if(tinyMCE.cleanup_verify_html){for(var i=0;i<tinyMCE.cleanup_invalidElements.length;i++){if(tinyMCE.cleanup_invalidElements[i]==element_name)return null;}var validElement=false;var elementAttribs=null;for(var i=0;i<tinyMCE.cleanup_validElements.length&&!elementAttribs;i++){for(var x=0,n=tinyMCE.cleanup_validElements[i][0].length;x<n;x++){var elmMatch=tinyMCE.cleanup_validElements[i][0][x];if(elmMatch.charAt(0)=='+'||elmMatch.charAt(0)=='-')elmMatch=elmMatch.substring(1);if(elmMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){elmMatch=elmMatch.replace(new RegExp('\\?','g'),'(\\S?)');elmMatch=elmMatch.replace(new RegExp('\\+','g'),'(\\S+)');elmMatch=elmMatch.replace(new RegExp('\\*','g'),'(\\S*)');elmMatch="^"+elmMatch+"$";if(element_name.match(new RegExp(elmMatch,'g'))){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;break;}}if(element_name==elmMatch){elementAttribs=tinyMCE.cleanup_validElements[i];validElement=true;element_name=elementAttribs[0][0];break;}}}if(!validElement)return null;}if(element_name.charAt(0)=='+'||element_name.charAt(0)=='-')name=element_name.substring(1);if(!tinyMCE.isMSIE){if(name=="strong"&&!tinyMCE.cleanup_on_save)element_name="b";else if(name=="em"&&!tinyMCE.cleanup_on_save)element_name="i";}var elmData=new Object();elmData.element_name=element_name;elmData.valid_attribs=elementAttribs;return elmData;};TinyMCE.prototype._moveStyle=function(elm,style,attrib){if(tinyMCE.cleanup_inline_styles){var val=tinyMCE.getAttrib(elm,attrib);if(val!=''){val=''+val;switch(attrib){case "background":val="url('"+val+"');";break;case "bordercolor":if(elm.style.borderStyle==''||elm.style.borderStyle=='none')elm.style.borderStyle='solid';break;case "border":case "width":case "height":if(attrib=="border"&&elm.style.borderWidth>0)return;if(val.indexOf('%')==-1)val+='px';break;case "vspace":case "hspace":elm.style.marginTop=val+"px";elm.style.marginBottom=val+"px";elm.removeAttribute(attrib);return;case "align":if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE)elm.style.styleFloat=val;else elm.style.cssFloat=val;}else elm.style.textAlign=val;elm.removeAttribute(attrib);return;}if(val!=''){eval('elm.style.'+style+' = val;');elm.removeAttribute(attrib);}}}else{if(style=='')return;var val=eval('elm.style.'+style)==''?tinyMCE.getAttrib(elm,attrib):eval('elm.style.'+style);val=val==null?'':''+val;switch(attrib){case "background":if(val.indexOf('url')==-1&&val!='')val="url('"+val+"');";if(val!=''){elm.style.backgroundImage=val;elm.removeAttribute(attrib);}return;case "border":case "width":case "height":val=val.replace('px','');break;case "align":if(tinyMCE.getAttrib(elm,'align')==''){if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE&&elm.style.styleFloat!=''){val=elm.style.styleFloat;style='styleFloat';}else if(tinyMCE.isGecko&&elm.style.cssFloat!=''){val=elm.style.cssFloat;style='cssFloat';}}}break;}if(val!=''){elm.removeAttribute(attrib);elm.setAttribute(attrib,val);eval('elm.style.'+style+' = "";');}}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i<valid_attributes.length;i++){var attribMatch=valid_attributes[i][0];var re=null;if(attribMatch.match(new RegExp('\\*|\\?|\\+','g'))!=null){attribMatch=attribMatch.replace(new RegExp('\\?','g'),'(\\S?)');attribMatch=attribMatch.replace(new RegExp('\\+','g'),'(\\S+)');attribMatch=attribMatch.replace(new RegExp('\\*','g'),'(\\S*)');attribMatch="^"+attribMatch+"$";re=new RegExp(attribMatch,'g');}if((re&&attribName.match(re)!=null)||attribName==attribMatch){verified=true;attribMustBeValue=valid_attributes[i][3];break;}}if(!verified)return false;}else verified=true;switch(attribName){case "size":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.size;break;case "width":case "height":case "border":if(tinyMCE.isMSIE5)attribValue=eval("element_node."+attribName);break;case "shape":attribValue=attribValue.toLowerCase();break;case "cellspacing":if(tinyMCE.isMSIE5)attribValue=element_node.cellSpacing;break;case "cellpadding":if(tinyMCE.isMSIE5)attribValue=element_node.cellPadding;break;case "color":if(tinyMCE.isMSIE5&&element_name=="font")attribValue=element_node.color;break;case "class":if(tinyMCE.cleanup_on_save&&attribValue.indexOf('mceItemAnchor')!=-1)attribValue=attribValue.replace(/mceItem[a-z0-9]+/gi,'');if(element_name=="table"||element_name=="td"){if(tinyMCE.cleanup_visual_table_class!="")attribValue=tinyMCE.getVisualAidClass(attribValue,!tinyMCE.cleanup_on_save);}if(!tinyMCE._verifyClass(element_node)||attribValue=="")return null;break;case "onfocus":case "onblur":case "onclick":case "ondblclick":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeydown":case "onkeyup":attribValue=tinyMCE.cleanupEventStr(""+attribValue);if(attribValue.indexOf('return false;')==0)attribValue=attribValue.substring(14);break;case "style":attribValue=tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(element_node,"style")));break;case "href":case "src":if(tinyMCE.isGecko18&&attribName=="src")attribValue=element_node.src;if(!tinyMCE.isMSIE&&attribName=="href"&&element_node.getAttribute("mce_real_href"))attribValue=element_node.getAttribute("mce_real_href");if(!tinyMCE.isMSIE&&attribName=="src"&&element_node.getAttribute("mce_real_src"))attribValue=element_node.getAttribute("mce_real_src");if(tinyMCE.isGecko&&!tinyMCE.getParam('relative_urls'))attribValue=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],attribValue);attribValue=eval(tinyMCE.cleanup_urlconverter_callback+"(attribValue, element_node, tinyMCE.cleanup_on_save);");break;case "colspan":case "rowspan":if(attribValue=="1")return null;break;case "_moz-userdefined":case "editorid":case "mce_real_href":case "mce_real_src":return null;}if(attribMustBeValue!=null){var isCorrect=false;for(var i=0;i<attribMustBeValue.length;i++){if(attribValue==attribMustBeValue[i]){isCorrect=true;break;}}if(!isCorrect)return null;}var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;};TinyMCE.prototype.clearArray=function(ar){for(var key in ar)ar[key]=null;};TinyMCE.prototype.isInstance=function(inst){return inst!=null&&typeof(inst)=="object"&&inst.isTinyMCEControl;};TinyMCE.prototype.parseStyle=function(str){var ar=new Array();if(str==null)return ar;var st=str.split(';');tinyMCE.clearArray(ar);for(var i=0;i<st.length;i++){if(st[i]=='')continue;var re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');var pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1];}return ar;};TinyMCE.prototype.compressStyle=function(ar,pr,sf,res){var box=new Array();box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(var i=0;i<box.length;i++){if(box[i]==null)return;for(var a=0;a<box.length;a++){if(box[a]!=box[i])return;}}ar[res]=box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null;};TinyMCE.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");for(var key in ar){var val=ar[key];if(typeof(val)=='function')continue;if(val!=null&&val!=''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val);if(val!="url('')")str+=key.toLowerCase()+": "+val+"; ";}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str;};TinyMCE.prototype.convertRGBToHex=function(s){if(s.toLowerCase().indexOf('rgb')!=-1){var re=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");var rgb=s.replace(re,"$1,$2,$3").split(',');if(rgb.length==3){r=parseInt(rgb[0]).toString(16);g=parseInt(rgb[1]).toString(16);b=parseInt(rgb[2]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;}}return s;};TinyMCE.prototype._verifyClass=function(node){if(tinyMCE.isGecko){var className=node.getAttribute('class');if(!className)return false;}if(tinyMCE.isMSIE)var className=node.getAttribute('className');if(tinyMCE.cleanup_verify_css_classes&&tinyMCE.cleanup_on_save){var csses=tinyMCE.getCSSClasses();nonDefinedCSS=true;for(var c=0;c<csses.length;c++){if(csses[c]==className){nonDefinedCSS=false;break;}}if(nonDefinedCSS&&className.indexOf('mce_')!=0){node.removeAttribute('className');node.removeAttribute('class');return false;}}return true;};TinyMCE.prototype.cleanupNode=function(node){var output="";switch(node.nodeType){case 1:var elementData=tinyMCE._cleanupElementName(node.nodeName,node);var elementName=elementData?elementData.element_name:null;var elementValidAttribs=elementData?elementData.valid_attribs:null;var elementAttribs="";var openTag=false,nonEmptyTag=false;if(elementName!=null&&elementName.charAt(0)=='+'){elementName=elementName.substring(1);openTag=true;}if(elementName!=null&&elementName.charAt(0)=='-'){elementName=elementName.substring(1);nonEmptyTag=true;}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var lookup=tinyMCE.cleanup_elementLookupTable;for(var i=0;i<lookup.length;i++){if(lookup[i]==node)return output;}lookup[lookup.length]=node;}if(!elementName){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return output;}if(tinyMCE.cleanup_on_save){if(node.nodeName=="A"&&node.className=="mceItemAnchor"){if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);}return '<a name="'+this.convertStringToXML(node.getAttribute("name"))+'"></a>'+output;}}var re=new RegExp("^(TABLE|TD|TR)$");if(re.test(node.nodeName)){if((node.nodeName!="TABLE"||tinyMCE.cleanup_inline_styles)&&(width=tinyMCE.getAttrib(node,"width"))!=''){node.style.width=width.indexOf('%')!=-1?width:width.replace(/[^0-9]/gi,'')+"px";node.removeAttribute("width");}if((node.nodeName=="TABLE"&&!tinyMCE.cleanup_inline_styles)&&node.style.width!=''){tinyMCE.setAttrib(node,"width",node.style.width.replace('px',''));node.style.width='';}if((height=tinyMCE.getAttrib(node,"height"))!=''){node.style.height=height.indexOf('%')!=-1?height:height.replace(/[^0-9]/gi,'')+"px";node.removeAttribute("height");}}if(tinyMCE.cleanup_inline_styles){var re=new RegExp("^(TABLE|TD|TR|IMG|HR)$");if(re.test(node.nodeName)){tinyMCE._moveStyle(node,'width','width');tinyMCE._moveStyle(node,'height','height');tinyMCE._moveStyle(node,'borderWidth','border');tinyMCE._moveStyle(node,'','vspace');tinyMCE._moveStyle(node,'','hspace');tinyMCE._moveStyle(node,'textAlign','align');tinyMCE._moveStyle(node,'backgroundColor','bgColor');tinyMCE._moveStyle(node,'borderColor','borderColor');tinyMCE._moveStyle(node,'backgroundImage','background');if(tinyMCE.isMSIE5)node.outerHTML=node.outerHTML;}else if(tinyMCE.isBlockElement(node))tinyMCE._moveStyle(node,'textAlign','align');if(node.nodeName=="FONT")tinyMCE._moveStyle(node,'color','color');}if(elementValidAttribs){for(var a=1;a<elementValidAttribs.length;a++){var attribName,attribDefaultValue,attribForceValue,attribValue;attribName=elementValidAttribs[a][0];attribDefaultValue=elementValidAttribs[a][1];attribForceValue=elementValidAttribs[a][2];if(attribDefaultValue!=null||attribForceValue!=null){var attribValue=node.getAttribute(attribName);if(node.getAttribute(attribName)==null||node.getAttribute(attribName)=="")attribValue=attribDefaultValue;attribValue=attribForceValue?attribForceValue:attribValue;if(attribValue=="{$uid}")attribValue="uid_"+(tinyMCE.cleanup_idCount++);if(attribName=="class")attribValue=tinyMCE.getVisualAidClass(attribValue,tinyMCE.cleanup_on_save);node.setAttribute(attribName,attribValue);}}}if((tinyMCE.isMSIE&&!tinyMCE.isOpera)&&elementName=="style")return "<style>"+node.innerHTML+"</style>";if(elementName=="table"&&!node.hasChildNodes())return "";if(node.attributes.length>0){var lastAttrib="";for(var i=0;i<node.attributes.length;i++){if(node.attributes[i].specified){if(tinyMCE.isOpera){if(node.attributes[i].nodeName==lastAttrib)continue;lastAttrib=node.attributes[i].nodeName;}var attrib=tinyMCE._cleanupAttribute(elementValidAttribs,elementName,node.attributes[i],node);if(attrib&&attrib.value!="")elementAttribs+=" "+attrib.name+"="+'"'+this.convertStringToXML(""+attrib.value)+'"';}}}if(tinyMCE.isMSIE&&elementName=="table"&&node.getAttribute("summary")!=null&&elementAttribs.indexOf('summary')==-1){var summary=tinyMCE.getAttrib(node,'summary');if(summary!='')elementAttribs+=" summary="+'"'+this.convertStringToXML(summary)+'"';}if(tinyMCE.isMSIE5&&/^(td|img|a)$/.test(elementName)){var ma=new Array("scope","longdesc","hreflang","charset","type");for(var u=0;u<ma.length;u++){if(node.getAttribute(ma[u])!=null){var s=tinyMCE.getAttrib(node,ma[u]);if(s!='')elementAttribs+=" "+ma[u]+"="+'"'+this.convertStringToXML(s)+'"';}}}if(tinyMCE.isMSIE&&elementName=="input"){if(node.type){if(!elementAttribs.match(/type=/g))elementAttribs+=" type="+'"'+node.type+'"';}if(node.value){if(!elementAttribs.match(/value=/g))elementAttribs+=" value="+'"'+node.value+'"';}}if((elementName=="p"||elementName=="td")&&(node.innerHTML==""||node.innerHTML=="&nbsp;"))return "<"+elementName+elementAttribs+">"+this.convertStringToXML(String.fromCharCode(160))+"</"+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+"</"+elementName+">";if(node.hasChildNodes()){if(!(elementName=="span"&&elementAttribs==""&&tinyMCE.getParam("trim_span_elements"))){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="<div"+elementAttribs+">";else output+="<"+elementName+elementAttribs+">";}for(var i=0;i<node.childNodes.length;i++)output+=this.cleanupNode(node.childNodes[i]);if(!(elementName=="span"&&elementAttribs==""&&tinyMCE.getParam("trim_span_elements"))){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="</div><br />";else output+="</"+elementName+">";}}else{if(!nonEmptyTag){if(openTag)output+="<"+elementName+elementAttribs+"></"+elementName+">";else output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName=="SCRIPT"||node.parentNode.nodeName=="STYLE")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "<!--"+node.nodeValue+"-->";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i<html_data.length;i++){var chr=html_data.charCodeAt(i);if(tinyMCE.settings['entity_encoding']=="numeric"){if(chr>127)output+='&#'+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if(chunk.charAt(0)=='-')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i<extendedValidElements.length;i++){var elementName=this._getCleanupElementName(extendedValidElements[i]);var skipAdd=false;for(var x=0;x<validElements.length;x++){if(this._getCleanupElementName(validElements[x])==elementName){validElements[x]=extendedValidElements[i];skipAdd=true;break;}}if(!skipAdd)validElements[validElements.length]=extendedValidElements[i];}for(var i=0;i<validElements.length;i++){var item=validElements[i];item=item.replace('[','|');item=item.replace(']','');var attribs=item.split('|');for(var x=0;x<attribs.length;x++)attribs[x]=attribs[x].toLowerCase();attribs[0]=attribs[0].split('/');for(var x=1;x<attribs.length;x++){var attribName=attribs[x];var attribDefault=null;var attribForce=null;var attribMustBe=null;if((pos=attribName.indexOf('='))!=-1){attribDefault=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf(':'))!=-1){attribForce=attribName.substring(pos+1);attribName=attribName.substring(0,pos);}if((pos=attribName.indexOf('<'))!=-1){attribMustBe=attribName.substring(pos+1).split('?');attribName=attribName.substring(0,pos);}attribs[x]=new Array(attribName,attribDefault,attribForce,attribMustBe);}validElements[i]=attribs;}var invalidElements=tinyMCE.settings['invalid_elements'].split(',');for(var i=0;i<invalidElements.length;i++)invalidElements[i]=invalidElements[i].toLowerCase();tinyMCE.settings['cleanup_validElements']=validElements;tinyMCE.settings['cleanup_invalidElements']=invalidElements;tinyMCE.settings['cleanup_entities']=new Array();var entities=tinyMCE.getParam('entities','',true,',');for(var i=0;i<entities.length;i+=2)tinyMCE.settings['cleanup_entities']['c'+entities[i]]=entities[i+1];};TinyMCE.prototype._cleanupHTML=function(inst,doc,config,element,visual,on_save){if(!tinyMCE.settings['cleanup'])return element.innerHTML;if(on_save&&tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);tinyMCE.cleanup_validElements=tinyMCE.settings['cleanup_validElements'];tinyMCE.cleanup_entities=tinyMCE.settings['cleanup_entities'];tinyMCE.cleanup_invalidElements=tinyMCE.settings['cleanup_invalidElements'];tinyMCE.cleanup_verify_html=tinyMCE.settings['verify_html'];tinyMCE.cleanup_force_br_newlines=tinyMCE.settings['force_br_newlines'];tinyMCE.cleanup_urlconverter_callback=tinyMCE.settings['urlconverter_callback'];tinyMCE.cleanup_verify_css_classes=tinyMCE.settings['verify_css_classes'];tinyMCE.cleanup_visual_table_class=tinyMCE.settings['visual_table_class'];tinyMCE.cleanup_apply_source_formatting=tinyMCE.settings['apply_source_formatting'];tinyMCE.cleanup_inline_styles=tinyMCE.settings['inline_styles'];tinyMCE.cleanup_visual_aid=visual;tinyMCE.cleanup_on_save=on_save;tinyMCE.cleanup_idCount=0;tinyMCE.cleanup_elementLookupTable=new Array();var startTime=new Date().getTime();if(tinyMCE.isMSIE){var nodes=element.getElementsByTagName("hr");for(var i=0;i<nodes.length;i++){if(nodes[i].id=="null")nodes[i].removeAttribute("id");}tinyMCE.setInnerHTML(element,tinyMCE.regexpReplace(element.innerHTML,'<p>[ \n\r]*<hr.*>[ \n\r]*</p>','<hr />','gi'));tinyMCE.setInnerHTML(element,tinyMCE.regexpReplace(element.innerHTML,'<!([^-(DOCTYPE)]* )|<!/[^-]*>','','gi'));}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])tinyMCE.debug("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'<p><hr /></p>','<hr />');html=tinyMCE.regexpReplace(html,'<p>&nbsp;</p><hr /><p>&nbsp;</p>','<hr />');html=tinyMCE.regexpReplace(html,'<td>\\s*<br />\\s*</td>','<td>&nbsp;</td>');html=tinyMCE.regexpReplace(html,'<p>\\s*<br />\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*&nbsp;\\s*<br />\\s*&nbsp;\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*&nbsp;\\s*<br />\\s*</p>','<p>&nbsp;</p>');html=tinyMCE.regexpReplace(html,'<p>\\s*<br />\\s*&nbsp;\\s*</p>','<p>&nbsp;</p>');html=html.replace(new RegExp('<a>(.*?)</a>','gi'),'$1');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('<o:p _moz-userdefined="" />','g'),"");if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');if(tinyMCE.getParam('apply_source_formatting')){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n</$1$2>\n");html=html.replace(new RegExp('<br />','g'),"<br />\n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('<p>&nbsp;</p>','g');html=html.replace(re,"<br />");}if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt']){var re=new RegExp('&lt;&gt;','g');html=html.replace(re,"");}html=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk=="<br/>"||chk=="<br>"||chk=="<p>&nbsp;</p>"||chk=="<p>&#160;</p>"||chk=="<p></p>")html="";if(tinyMCE.settings["preformatted"])return "<pre>"+html+"</pre>";return html;};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+this.selectedInstance.getSelectedHTML()+'</a>');}else this.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");tinyMCE.setAttrib(elementArray[i],'href',href);tinyMCE.setAttrib(elementArray[i],'mce_real_href',href);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class);}tinyMCE.linkElement=elementArray[0];}if(this.linkElement){href=eval(tinyMCE.settings['urlconverter_callback']+"(href, this.linkElement);");tinyMCE.setAttrib(this.linkElement,'href',href);tinyMCE.setAttrib(this.linkElement,'mce_real_href',href);tinyMCE.setAttrib(this.linkElement,'target',target);tinyMCE.setAttrib(this.linkElement,'title',title);tinyMCE.setAttrib(this.linkElement,'onclick',onclick);tinyMCE.setAttrib(this.linkElement,'class',style_class);}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.insertImage=function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!this.imgElement&&tinyMCE.isSafari){var html="";html+='<img src="'+src+'" alt="'+alt+'"';html+=' border="'+border+'" hspace="'+hspace+'"';html+=' vspace="'+vspace+'" width="'+width+'"';html+=' height="'+height+'" align="'+align+'" title="'+title+'" onmouseover="'+onmouseover+'" onmouseout="'+onmouseout+'" />';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'<img src="'+tinyMCE.uniqueURL+'" />');else this.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL);}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node&&node.hasChildNodes()){for(var x=0,n=node.childNodes.length;x<n;x++){var childElements=this.getElementsByAttributeValue(node.childNodes[x],element_name,attrib,value);for(var i=0,m=childElements.length;i<m;i++)elements[elements.length]=childElements[i];}}return elements;};TinyMCE.prototype.isBlockElement=function(node){return node!=null&&node.nodeType==1&&this.blockRegExp.test(node.nodeName);};TinyMCE.prototype.getParentBlockElement=function(node){while(node){if(this.blockRegExp.test(node.nodeName))return node;node=node.parentNode;}return null;};TinyMCE.prototype.getNodeTree=function(node,node_array,type,node_name){if(typeof(type)=="undefined"||node.nodeType==type&&(typeof(node_name)=="undefined"||node.nodeName==node_name))node_array[node_array.length]=node;if(node.hasChildNodes()){for(var i=0;i<node.childNodes.length;i++)tinyMCE.getNodeTree(node.childNodes[i],node_array,type,node_name);}return node_array;};TinyMCE.prototype.getParentElement=function(node,names,attrib_name,attrib_value){if(typeof(names)=="undefined"){if(node.nodeType==1)return node;while((node=node.parentNode)!=null&&node.nodeType!=1);return node;}var namesAr=names.split(',');if(node==null)return null;do{for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase()||names=="*"){if(typeof(attrib_name)=="undefined")return node;else if(node.getAttribute(attrib_name)){if(typeof(attrib_value)=="undefined"){if(node.getAttribute(attrib_name)!="")return node;}else if(node.getAttribute(attrib_name)==attrib_value)return node;}}}}while((node=node.parentNode)!=null);return null;};TinyMCE.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;var fileProto=(prot=="file:");url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isMSIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return "#"+urlParts['anchor'];}if(on_save&&tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(!urlParts['port']||urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],url);}if(!fileProto&&tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1);if(!tinyMCE.getParam('relative_urls')&&url.indexOf('://')==-1&&url.charAt(0)!='/')url='/'+url;}return url;};TinyMCE.prototype.parseURL=function(url_str){var urlParts=new Array();if(url_str){var pos,lastPos;pos=url_str.indexOf('://');if(pos!=-1){urlParts['protocol']=url_str.substring(0,pos);lastPos=pos+3;}for(var i=lastPos;i<url_str.length;i++){var chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break;}pos=i;urlParts['host']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts['port']=url_str.substring(lastPos+1,pos);}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts['path']=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts['query']=url_str.substring(lastPos+1,pos);}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts['anchor']=url_str.substring(lastPos+1,pos);}}return urlParts;};TinyMCE.prototype.serializeURL=function(up){var url="";if(up['protocol'])url+=up['protocol']+"://";if(up['host'])url+=up['host'];if(up['port'])url+=":"+up['port'];if(up['path'])url+=up['path'];if(up['query'])url+="?"+up['query'];if(up['anchor'])url+="#"+up['anchor'];return url;};TinyMCE.prototype.convertAbsoluteURLToRelativeURL=function(base_url,url_to_relative){var baseURL=this.parseURL(base_url);var targetURL=this.parseURL(url_to_relative);var strTok1;var strTok2;var breakPoint=0;var outPath="";var forceSlash=false;if(targetURL.path=="")targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(var i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length<strTok2.length){for(var i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(var i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i];}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==""&&forceSlash?"/":outPath;return this.serializeURL(targetURL);};TinyMCE.prototype.convertRelativeToAbsoluteURL=function(base_url,relative_url){var baseURL=TinyMCE.prototype.parseURL(base_url);var relURL=TinyMCE.prototype.parseURL(relative_url);if(relative_url==""||relative_url.charAt(0)=='/'||relative_url.indexOf('://')!=-1||relative_url.indexOf('mailto:')!=-1||relative_url.indexOf('javascript:')!=-1)return relative_url;baseURLParts=baseURL['path'].split('/');relURLParts=relURL['path'].split('/');var newBaseURLParts=new Array();for(var i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return TinyMCE.prototype.serializeURL(relURL);};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i<value.length;i++){if(value[i]&&value[i]!="")outArray[outArray.length]=value[i];}value=outArray;}return value;};TinyMCE.prototype.getLang=function(name,default_value,parse_entities){var value=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name];if(parse_entities){var el=document.createElement("div");el.innerHTML=value;value=el.innerHTML;}return value;};TinyMCE.prototype.addToLang=function(prefix,ar){for(var key in ar){if(typeof(ar[key])=='function')continue;tinyMCELang[(key.indexOf('lang_')==-1?'lang_':'')+(prefix!=''?(prefix+"_"):'')+key]=ar[key];}};TinyMCE.prototype.replaceVar=function(replace_haystack,replace_var,replace_str){var re=new RegExp('{\\\$'+replace_var+'}','g');return replace_haystack.replace(re,replace_str);};TinyMCE.prototype.replaceVars=function(replace_haystack,replace_vars){for(var key in replace_vars){var value=replace_vars[key];if(typeof(value)=='function')continue;replace_haystack=tinyMCE.replaceVar(replace_haystack,key,value);}return replace_haystack;};TinyMCE.prototype.triggerNodeChange=function(focus,setup_content){if(tinyMCE.settings['handleNodeChangeCallback']){if(tinyMCE.selectedInstance){var inst=tinyMCE.selectedInstance;var editorId=inst.editorId;var elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();var undoIndex=-1;var undoLevels=-1;var anySelection=false;var selectedText=inst.getSelectedText();if(tinyMCE.settings["auto_resize"]){var doc=inst.getDoc();inst.iframeElement.style.width=doc.body.offsetWidth+"px";inst.iframeElement.style.height=doc.body.offsetHeight+"px";}if(tinyMCE.selectedElement)anySelection=(tinyMCE.selectedElement.nodeName.toLowerCase()=="img")||(selectedText&&selectedText.length>0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(inst,type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){if(eval("typeof(TinyMCE_"+plugins[i]+"_cleanup)")!="undefined")content=eval("TinyMCE_"+plugins[i]+"_cleanup(type, content, inst);");}return content;};TinyMCE.prototype.getContent=function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.selectedInstance=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedInstance){var old=this.selectedInstance.getBody().innerHTML;var html=tinyMCE._cleanupHTML(this.selectedInstance,this.selectedInstance.getDoc(),tinyMCE.settings,this.selectedInstance.getBody(),false,true);tinyMCE.setInnerHTML(this.selectedInstance.getBody(),old);return html;}return null;};TinyMCE.prototype.setContent=function(html_content){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,html_content);tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.importThemeLanguagePack=function(name){if(typeof(name)=="undefined")name=tinyMCE.settings['theme'];tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings['language']+'.js');};TinyMCE.prototype.importPluginLanguagePack=function(name,valid_languages){var lang="en";valid_languages=valid_languages.split(',');for(var i=0;i<valid_languages.length;i++){if(tinyMCE.settings['language']==valid_languages[i])lang=tinyMCE.settings['language'];}tinyMCE.loadScript(tinyMCE.baseURL+'/plugins/'+name+'/langs/'+lang+'.js');};TinyMCE.prototype.applyTemplate=function(html,args){html=tinyMCE.replaceVar(html,"themeurl",tinyMCE.themeURL);if(typeof(args)!="undefined")html=tinyMCE.replaceVars(html,args);html=tinyMCE.replaceVars(html,tinyMCE.settings);html=tinyMCE.replaceVars(html,tinyMCELang);return html;};TinyMCE.prototype.openWindow=function(template,args){var html,width,height,x,y,resizable,scrollbars,url;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.isMSIE)height+=40;else height+=20;x=parseInt(screen.width/2.0)-(width/2.0);y=parseInt(screen.height/2.0)-(height/2.0);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.isMSIE&&resizable!='yes'&&tinyMCE.settings["dialog_type"]=="modal"){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();}}};TinyMCE.prototype.closeWindow=function(win){win.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!="")classNames[classNames.length]=ar[i];}if(state)classNames[classNames.length]=aidClass;var className="";for(var i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(el,deep,state,inst){if(!el)return;var tableElement=null;switch(el.nodeName){case "TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y<el.rows.length;y++){for(var x=0;x<el.rows[y].cells.length;x++){var cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn);}}break;case "A":var anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!=''&&state){el.title=anchorName;el.className='mceItemAnchor';}else if(anchorName!=''&&!state)el.className='';break;}if(deep&&el.hasChildNodes()){for(var i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst);}};TinyMCE.prototype.getAttrib=function(elm,name,default_value){if(typeof(default_value)=="undefined")default_value="";if(!elm||elm.nodeType!=1)return default_value;var v=elm.getAttribute(name);if(name=="class"&&!v)v=elm.className;if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!="")?v:default_value;};TinyMCE.prototype.setAttrib=function(element,name,value,fix_value){if(typeof(value)=="number"&&value!=null)value=""+value;if(fix_value){if(value==null)value="";var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(name=="style")element.style.cssText=value;if(name=="class")element.className=value;if(value!=null&&value!=""&&value!=-1)element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype.setStyleAttrib=function(elm,name,value){eval('elm.style.'+name+'=value;');if(tinyMCE.isMSIE&&value==null||value==''){var str=tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));elm.style.cssText=str;elm.setAttribute("style",str);}};TinyMCE.prototype.convertSpansToFonts=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<span/gi,'<font');h=h.replace(/<\/span/gi,'</font');doc.body.innerHTML=h;var s=doc.getElementsByTagName("font");for(var i=0;i<s.length;i++){var size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();var fSize=0;for(var x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break;}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize='';}var fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!=""){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily='';}var fColor=s[i].style.color;if(fColor!=null&&fColor!=""){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color='';}}};TinyMCE.prototype.convertFontsToSpans=function(doc){var sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');var h=doc.body.innerHTML;h=h.replace(/<font/gi,'<span');h=h.replace(/<\/font/gi,'</span');doc.body.innerHTML=h;var fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;var s=doc.getElementsByTagName("span");for(var i=0;i<s.length;i++){var fSize,fFace,fColor;fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!=""){fSize=parseInt(fSize);if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1];}s[i].removeAttribute('size');}if(fFace!=""){s[i].style.fontFamily=fFace;s[i].removeAttribute('face');}if(fColor!=""){s[i].style.color=fColor;s[i].removeAttribute('color');}}};TinyMCE.prototype.setInnerHTML=function(e,h){if(tinyMCE.isMSIE&&!tinyMCE.isOpera){e.innerHTML='<div id="mceTMPElement" style="display: none">TMP</div>'+h;e.firstChild.removeNode(true);}else e.innerHTML=h;};TinyMCE.prototype.getOuterHTML=function(e){if(tinyMCE.isMSIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e);return d.innerHTML;};TinyMCE.prototype.setOuterHTML=function(doc,e,h){if(tinyMCE.isMSIE){e.outerHTML=h;return;}var d=e.ownerDocument.createElement("body");d.innerHTML=h;e.parentNode.replaceChild(d.firstChild,e);};TinyMCE.prototype.insertAfter=function(nc,rc){if(rc.nextSibling)rc.parentNode.insertBefore(nc,rc.nextSibling);else rc.parentNode.appendChild(nc);};TinyMCE.prototype.cleanupAnchors=function(doc){var an=doc.getElementsByTagName("a");for(var i=0;i<an.length;i++){if(tinyMCE.getAttrib(an[i],"name")!=""){var cn=an[i].childNodes;for(var x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i]);}}};TinyMCE.prototype._setHTML=function(doc,html_content){html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content);}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<paras.length;i++){var node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName.toLowerCase()=="p")node.outerHTML=node.innerHTML;}}var html=doc.body.innerHTML;if(html.indexOf('="mso')!=-1){for(var i=0;i<doc.body.all.length;i++){var el=doc.body.all[i];el.removeAttribute("className","",0);el.removeAttribute("style","",0);}html=doc.body.innerHTML;html=tinyMCE.regexpReplace(html,"<o:p><\/o:p>","<br />");html=tinyMCE.regexpReplace(html,"<o:p>&nbsp;<\/o:p>","");html=tinyMCE.regexpReplace(html,"<st1:.*?>","");html=tinyMCE.regexpReplace(html,"<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p><\/p>\r\n<p><\/p>","");html=tinyMCE.regexpReplace(html,"<p>&nbsp;<\/p>","<br />");html=tinyMCE.regexpReplace(html,"<p>\s*(<p>\s*)?","<p>");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","</p>");}tinyMCE.setInnerHTML(doc.body,html);}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j<document.forms.length;j++){for(var k=0;k<document.forms[j].elements.length;k++){if(document.forms[j].elements[k].name==element_id){elm=document.forms[j].elements[k];break;}}}}return elm;};TinyMCE.prototype.getEditorId=function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId;};TinyMCE.prototype.getInstanceById=function(editor_id){var inst=this.instances[editor_id];if(!inst){for(var n in tinyMCE.instances){var instance=tinyMCE.instances[n];if(!tinyMCE.isInstance(instance))continue;if(instance.formTargetElementId==editor_id){inst=instance;break;}}}return inst;};TinyMCE.prototype.queryInstanceCommandValue=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false;};TinyMCE.prototype.queryInstanceCommandState=function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandState(command);return null;};TinyMCE.prototype.setWindowArg=function(name,value){this.windowArgs[name]=value;};TinyMCE.prototype.getWindowArg=function(name,default_value){return(typeof(this.windowArgs[name])=="undefined")?default_value:this.windowArgs[name];};TinyMCE.prototype.getCSSClasses=function(editor_id,doc){var output=new Array();if(typeof(tinyMCE.cssClasses)!="undefined")return tinyMCE.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=tinyMCE.isMSIE?doc.styleSheets:doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x<styles.length;x++){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets("+x+").rules : doc.styleSheets["+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++){if(rules[c].indexOf(' ')!=-1||rules[c].indexOf(':')!=-1||rules[c].indexOf('mceItem')!=-1)continue;if(rules[c]=="."+tinyMCE.settings['visual_table_class'])continue;if(rules[c].indexOf('.')!=-1){output[output.length]=rules[c].substring(rules[c].indexOf('.')+1);}}}}}}}if(output.length>0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.trim=function(str){return str.replace(/^\s*|\s*$/g,"");};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');str=str.replace(/^return true;/gi,'');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i<args.length;i++){str+='args['+i+']';if(i<args.length-1)str+=',';}str+=');';return eval(str);};TinyMCE.prototype.executeCallback=function(param,suffix,mode){switch(mode){case 0:var state=false;var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){tinyMCE.exec(func,this.executeCallback.arguments);state=true;}return state;case 1:var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i<plugins.length;i++){var func="TinyMCE_"+plugins[i]+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}}var func='TinyMCE_'+tinyMCE.settings['theme']+suffix;if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}var func=tinyMCE.getParam(param,'');if(tinyMCE.isFunc(func)){if(tinyMCE.exec(func,this.executeCallback.arguments))return true;}return false;}};TinyMCE.prototype.debug=function(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
    1010            Debug output:\
    11             <textarea id="tinymce_debug" style="width: 100%; height: 300px"></textarea>';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1)msg+=', ';}elm.value+=msg+"\n";};function TinyMCEControl(settings){this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true;this.settings=settings;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);};TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE)return;this.getBody().style.display='none';this.getBody().style.display='block';};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('mce_real_src');if(src&&src!="")elms[i].setAttribute("src",src);}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('mce_real_href');if(href&&href!="")elms[i].setAttribute("href",href);}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('src');if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('href');if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko)elm.appendChild(this.getRng().cloneContents());else elm.innerHTML=this.getRng().htmlText;return tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari)return rng;if(tinyMCE.isMSIE)return rng;if(tinyMCE.isGecko)return rng.cloneRange();return null;};TinyMCEControl.prototype.moveToBookmark=function(bookmark){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE)return bookmark.select();if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(bookmark.startContainer,bookmark.startOffset);rng.setEnd(bookmark.endContainer,bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText='';}else{var sel=this.getSel();if(sel&&sel.toString)selectedText=sel.toString();else selectedText='';}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,collapse,select_text_node,to_start){if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.realSelection.collapseToStart();else sel.realSelection.collapseToEnd();}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(select_text_node){var nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var self=this;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock!=null){blockName=startBlock.nodeName.toUpperCase();if(blockName=="TD"||blockName=="TABLE")blockName="P";}if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="li")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="li"))return false;if((startBlock!=null&&startBlock.nodeName.toLowerCase()=="table")||(endBlock!=null&&endBlock.nodeName.toLowerCase()=="table"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName.toUpperCase()==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName.toUpperCase()==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName.toLowerCase()=="body")){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i<nodes.length;i++){if(nodes[i].nodeName.toLowerCase()!="body")paraAfter.appendChild(nodes[i]);}}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();this.selectNode(paraAfter,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(evt_type){var doc=this.getDoc();var sel=this.getSel();if(sel==null)return false;var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null)return;if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild)para.appendChild(elm.firstChild);elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&&para.nodeName.toLowerCase()=='p'&&evt_type=="keypress"){var htm=para.innerHTML;var block=tinyMCE.getParentBlockElement(node);if(htm==""||htm=="&nbsp;"||block.nodeName.toLowerCase()=="li"){var prevElm=para.previousSibling;while(prevElm!=null&&prevElm.nodeType!=1)prevElm=prevElm.previousSibling;if(prevElm==null)return false;var nodes=tinyMCE.getNodeTree(prevElm,new Array(),3);var lastTextNode=nodes.length==0?null:nodes[nodes.length-1];if(lastTextNode!=null)this.selectNode(lastTextNode,true,false,false);para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings['auto_reset_designmode']){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0)eval('try { this.getDoc().designMode = "On"; } catch(e) {}');}};TinyMCEControl.prototype.isDirty=function(){return this.startContent!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty;};TinyMCEControl.prototype._mergeElements=function(pa,ch,override){ch=ch.cloneNode(true);var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className+=" "+tinyMCE.getAttrib(ch,"class");if(override){for(var n in st)stc[n]=st[n];}else{for(var n in stc)st[n]=stc[n];}tinyMCE.setAttrib(ch,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(ch,"class",tinyMCE.trim(className));pa.parentNode.replaceChild(ch,pa);};TinyMCEControl.prototype.execCommand=function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();var focusElm=this.getFocusElement();if(this.lastSafariSelection&&!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command)){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){doc.execCommand("useCSS",false,true);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(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.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.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.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 "mceStoreSelection":this.selectionBookmark=this.getBookmark();return true;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);return true;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li>&nbsp;</li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.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");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){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.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;if(tinyMCE.isMSIE){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)parentElm=pelm;}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(/td|tr|tbody|table/ig.test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm;}if(parentElm){if(scmd=="setstyle")eval("parentElm.style."+sname+" = svalue;");if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);}else{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")eval("spanElm.style."+sname+" = svalue;");if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);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 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(elm,elm.childNodes[0],isNew);continue;}if(elm.parentNode.childNodes.length==1){this._mergeElements(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));if(new RegExp('<span>|<span style="">','gi').test(tmp.innerHTML)){for(var i=elm.childNodes.length-1;i>=0;i--){if(elm.parentNode!=null){elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true),elm);elm.parentNode.removeChild(elm);}}}}tinyMCE.triggerNodeChange();break;case "FontName":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontFamily",value:value});else this.getDoc().execCommand('FontName',false,value);break;case "FontSize":if(tinyMCE.getParam("convert_fonts_to_styles")){var sizes=new Array('',8,10,12,14,18,24,36);var size=sizes[value]==''?'':sizes[value]+'px';this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontSize",value:size});}else this.getDoc().execCommand('FontSize',false,value);break;case "forecolor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"color",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,true);this.getDoc().execCommand('forecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('forecolor',false,value);}break;case "HiliteColor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"backgroundColor",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}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.isGecko&&cmdFailed){if(confirm(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._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,true);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),true);this.repaint();tinyMCE.triggerNodeChange();break;case "mceReplaceContent":var selectedText="";if(tinyMCE.isMSIE){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("SetStyleInfo",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.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)this.getBody().innerHTML=html.substring(0,pos)+value+html.substring(pos+key.length);this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case "mceInsertContent":if(!tinyMCE.isMSIE){var sel=this.getSel();var rng=this.getRng();var isHTML=value.indexOf('<')!=-1;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);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex==-1){this.typingUndoIndex=this.undoIndex;this.execCommand('mceAddUndoLevel');}break;case "mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.typingUndoIndex=-1;}break;case "mceBeginUndoLevel":this.undoRedo=false;break;case "mceEndUndoLevel":this.undoRedo=true;this.execCommand('mceAddUndoLevel');break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo){if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(this.getBody().innerHTML);if(newHTML!=this.undoLevels[this.undoIndex]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoIndex++;this.undoLevels[this.undoIndex]=newHTML;this.undoLevels.length=this.undoIndex+1;tinyMCE.triggerNodeChange(false);}}break;case "Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex>0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}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 "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);if(rng.text==rng.parentElement().innerText){rng.moveToElementText(rng.parentElement());rng.select();}rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel");};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent">'+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"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']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.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']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';else html+='<input type="hidden" type="text" id="'+form_element_name+'" name="'+form_element_name+'" />';html+='</span>';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><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{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var rng=this.getRng();var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();
     11            <textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap"></textarea>';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i<args.length;i++){msg+=args[i];if(i<args.length-1)msg+=', ';}elm.value+=msg+"\n";};function TinyMCEControl(settings){this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true;this.isTinyMCEControl=true;this.settings=settings;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);};TinyMCEControl.prototype.repaint=function(){if(tinyMCE.isMSIE)return;this.getBody().style.display='none';this.getBody().style.display='block';};TinyMCEControl.prototype.switchSettings=function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('mce_real_src');if(src&&src!="")elms[i].setAttribute("src",src);}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('mce_real_href');if(href&&href!="")elms[i].setAttribute("href",href);}};TinyMCEControl.prototype.convertAllRelativeURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i<elms.length;i++){var src=elms[i].getAttribute('src');if(src&&src!=""){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src);elms[i].setAttribute("src",src);elms[i].setAttribute("mce_real_src",src);}}var elms=body.getElementsByTagName("a");for(var i=0;i<elms.length;i++){var href=elms[i].getAttribute('href');if(href&&href!=""){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],href);elms[i].setAttribute("href",href);elms[i].setAttribute("mce_real_href",href);}}};TinyMCEControl.prototype.getSelectedHTML=function(){if(tinyMCE.isSafari){return this.getRng().toString();}var elm=document.createElement("body");if(tinyMCE.isGecko)elm.appendChild(this.getRng().cloneContents());else elm.innerHTML=this.getRng().htmlText;return tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,elm,this.visualAid);};TinyMCEControl.prototype.getBookmark=function(){var rng=this.getRng();if(tinyMCE.isSafari)return rng;if(tinyMCE.isMSIE)return rng;if(tinyMCE.isGecko)return rng.cloneRange();return null;};TinyMCEControl.prototype.moveToBookmark=function(bookmark){if(tinyMCE.isSafari){var sel=this.getSel().realSelection;sel.setBaseAndExtent(bookmark.startContainer,bookmark.startOffset,bookmark.endContainer,bookmark.endOffset);return true;}if(tinyMCE.isMSIE)return bookmark.select();if(tinyMCE.isGecko){var rng=this.getDoc().createRange();var sel=this.getSel();rng.setStart(bookmark.startContainer,bookmark.startOffset);rng.setEnd(bookmark.endContainer,bookmark.endOffset);sel.removeAllRanges();sel.addRange(rng);return true;}return false;};TinyMCEControl.prototype.getSelectedText=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();if(doc.selection.type=="Text"){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText='';}else{var sel=this.getSel();if(sel&&sel.toString)selectedText=sel.toString();else selectedText='';}return selectedText;};TinyMCEControl.prototype.selectNode=function(node,collapse,select_text_node,to_start){if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(tinyMCE.isMSIE){var rng=this.getBody().createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select();}catch(e){}}else{var sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.realSelection.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.realSelection.collapseToStart();else sel.realSelection.collapseToEnd();}this.scrollToNode(node);return;}var rng=this.getDoc().createRange();if(select_text_node){var nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(pos.absTop>scrollY&&pos.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE&&!tinyMCE.isOpera)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false;}return true;}var doc=this.getDoc();var sel=this.getSel();var win=this.contentWindow;var rng=sel.getRangeAt(0);var body=doc.body;var rootElm=doc.documentElement;var self=this;var blockName="P";var rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);var rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);var direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;var startNode=direct?sel.anchorNode:sel.focusNode;var startOffset=direct?sel.anchorOffset:sel.focusOffset;var endNode=direct?sel.focusNode:sel.anchorNode;var endOffset=direct?sel.focusOffset:sel.anchorOffset;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;var startBlock=tinyMCE.getParentBlockElement(startNode);var endBlock=tinyMCE.getParentBlockElement(endNode);if(startBlock!=null){blockName=startBlock.nodeName;if(blockName=="TD"||blockName=="TABLE"||(blockName=="DIV"&&new RegExp('left|right','gi').test(startBlock.style.cssFloat)))blockName="P";}if(tinyMCE.getParentElement(startBlock,"OL,UL")!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;var paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNode(false):doc.createElement(blockName);var paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");var startChop=startNode;var endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node;}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node;}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents());if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);var contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore);}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML;}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";var rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode);}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset);}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();rng.insertNode(paraAfter);rng.insertNode(paraBefore);paraAfter.normalize();paraBefore.normalize();this.selectNode(paraAfter,true,true);return true;};TinyMCEControl.prototype._handleBackSpace=function(evt_type){var doc=this.getDoc();var sel=this.getSel();if(sel==null)return false;var rng=sel.getRangeAt(0);var node=rng.startContainer;var elm=node.nodeType==3?node.parentNode:node;if(node==null)return;if(elm&&elm.nodeName==""){var para=doc.createElement("p");while(elm.firstChild)para.appendChild(elm.firstChild);elm.parentNode.insertBefore(para,elm);elm.parentNode.removeChild(elm);var rng=rng.cloneRange();rng.setStartBefore(node.nextSibling);rng.setEndAfter(node.nextSibling);rng.extractContents();this.selectNode(node.nextSibling,true,true);}var para=tinyMCE.getParentBlockElement(node);if(para!=null&&para.nodeName.toLowerCase()=='p'&&evt_type=="keypress"){var htm=para.innerHTML;var block=tinyMCE.getParentBlockElement(node);if(htm==""||htm=="&nbsp;"||block.nodeName.toLowerCase()=="li"){var prevElm=para.previousSibling;while(prevElm!=null&&prevElm.nodeType!=1)prevElm=prevElm.previousSibling;if(prevElm==null)return false;var nodes=tinyMCE.getNodeTree(prevElm,new Array(),3);var lastTextNode=nodes.length==0?null:nodes[nodes.length-1];if(lastTextNode!=null)this.selectNode(lastTextNode,true,false,false);para.parentNode.removeChild(para);return true;}}return false;};TinyMCEControl.prototype._insertSpace=function(){return true;};TinyMCEControl.prototype.autoResetDesignMode=function(){if(!tinyMCE.isMSIE&&tinyMCE.settings['auto_reset_designmode']){var sel=this.getSel();if(!sel||!sel.rangeCount||sel.rangeCount==0)eval('try { this.getDoc().designMode = "On"; } catch(e) {}');}};TinyMCEControl.prototype.isDirty=function(){return this.startContent!=tinyMCE.trim(this.getBody().innerHTML)&&!tinyMCE.isNotDirty;};TinyMCEControl.prototype._mergeElements=function(scmd,pa,ch,override){if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return;}var st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));var stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));var className=tinyMCE.getAttrib(pa,"class");className+=" "+tinyMCE.getAttrib(ch,"class");if(override){for(var n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n];}}else{for(var n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n];}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style");};TinyMCEControl.prototype.setUseCSS=function(b){var doc=this.getDoc();try{doc.execCommand("useCSS",false,!b);}catch(ex){}try{doc.execCommand("styleWithCSS",false,b);}catch(ex){}};TinyMCEControl.prototype.execCommand=function(command,user_interface,value){var doc=this.getDoc();var win=this.getWin();var focusElm=this.getFocusElement();if(this.lastSafariSelection&&!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command)){this.moveToBookmark(this.lastSafariSelection);tinyMCE.selectedElement=this.lastSafariSelectedElement;}if(!tinyMCE.isMSIE&&!this.useCSS){this.setUseCSS(false);this.useCSS=true;}this.contentDocument=doc;if(tinyMCE._themeExecCommand(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.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.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.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 "mceStoreSelection":this.selectionBookmark=this.getBookmark();return true;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);return true;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"><li>&nbsp;</li><"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<strike>"+this.getSelectedHTML()+"</strike>");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.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");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){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.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;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.isMSIE){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||(/td|tr|tbody|table/ig.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{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":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":this.getDoc().execCommand('forecolor',false,value);break;case "HiliteColor":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.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._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);tinyMCE.setInnerHTML(doc.body,tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body));tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,false);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this.repaint();tinyMCE.triggerNodeChange();break;case "mceReplaceContent":this.getWin().focus();var selectedText="";if(tinyMCE.isMSIE){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("SetStyleInfo",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.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.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":var insertHTMLFailed=false;this.getWin().focus();if(tinyMCE.isGecko||tinyMCE.isOpera){try{this.getDoc().execCommand('inserthtml',false,value);}catch(ex){insertHTMLFailed=true;}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return;}}if(tinyMCE.isOpera&&insertHTMLFailed){this.getDoc().execCommand("insertimage",false,tinyMCE.uniqueURL);var ar=tinyMCE.getElementsByAttributeValue(this.getBody(),"img","src",tinyMCE.uniqueURL);ar[0].outerHTML=value;return;}if(!tinyMCE.isMSIE){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);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex==-1){this.typingUndoIndex=this.undoIndex;this.execCommand('mceAddUndoLevel');}break;case "mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.typingUndoIndex=-1;}break;case "mceBeginUndoLevel":this.undoRedo=false;break;case "mceEndUndoLevel":this.undoRedo=true;this.execCommand('mceAddUndoLevel');break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo){if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(this.getBody().innerHTML);if(newHTML!=this.undoLevels[this.undoIndex]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i<this.undoLevels.length-1;i++){this.undoLevels[i]=this.undoLevels[i+1];}this.undoLevels.length--;this.undoIndex--;}this.undoIndex++;this.undoLevels[this.undoIndex]=newHTML;this.undoLevels.length=this.undoIndex+1;tinyMCE.triggerNodeChange(false);}}break;case "Undo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(this.getBody(),this.undoLevels[this.undoIndex]);this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(this.getBody(),this.undoLevels[this.undoIndex]);this.repaint();}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.isMSIE){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":var text=this.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return;}if(tinyMCE.isMSIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);}catch(e){}this.execCommand("SetStyleInfo",false,{command:"removeformat"});}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("SetStyleInfo",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");};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html='<span id="'+this.editorId+'_parent">'+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"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']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.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']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='<textarea wrap="off" id="'+form_element_name+'" name="'+form_element_name+'" cols="100" rows="15"></textarea>';else html+='<input type="hidden" type="text" id="'+form_element_name+'" name="'+form_element_name+'" />';html+='</span>';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='</span>';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true;}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;}this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=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{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE&&!tinyMCE.isOpera){var doc=this.getDoc();var rng=doc.selection.createRange();var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var rng=this.getRng();var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();
  • trunk/wp-includes/js/tinymce/tiny_mce_gzip.php

    r2917 r2993  
    22    /**
    33     * $RCSfile: tiny_mce_gzip.php,v $
    4      * $Revision: 1.1 $
    5      * $Date: 2005/06/14 18:55:34 $
     4     * $Revision: $
     5     * $Date: $
    66     *
     7     * @version 1.02
    78     * @author Moxiecode
    8      * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
     9     * @copyright Copyright © 2005, Moxiecode Systems AB, All rights reserved.
    910     *
    1011     * This file compresses the TinyMCE JavaScript using GZip and
     
    1617     */
    1718
     19    @ include('../../../wp-config.php');
     20
     21    function wp_translate_tinymce_lang($text) {
     22        if ( ! function_exists('__') ) {
     23            return $text;
     24        } else {
     25            header('Content-Type: text/plain');
     26
     27            $search1 = "/^tinyMCELang\\[(['\"])(.*)\\1\]( ?= ?)(['\"])(.*)\\4/uem";
     28            $replace1 = "'tinyMCELang[\\1\\2\\1]\\3'.stripslashes('\\4').__('\\5').stripslashes('\\4')";
     29
     30            $search2 = "/ : (['\"])(.*)\\1/uem";
     31            $replace2 = "' : '.stripslashes('\\1').__('\\2').stripslashes('\\1')";
     32
     33            $search = array($search1, $search2);
     34            $replace = array($replace1, $replace2);
     35
     36            $text = preg_replace($search, $replace, $text);
     37
     38            return $text;
     39        }
     40    }
     41
    1842    // General options
    1943    $suffix = "";                           // Set to "_src" to use source version
     
    2448    $language = isset($_REQUEST['language']) ? $_REQUEST['language'] : "";
    2549    $plugins = isset($_REQUEST['plugins']) ? $_REQUEST['plugins'] : "";
     50    $lang = isset($_REQUEST['lang']) ? $_REQUEST['lang'] : "en";
     51    $index = isset($_REQUEST['index']) ? $_REQUEST['index'] : -1;
    2652
    27     // GZip compress and cache it for 10 days
    28     ob_start ("ob_gzhandler");
     53    // Only gzip the contents if clients and server support it
     54    $encodings = explode(',', strtolower($_SERVER['HTTP_ACCEPT_ENCODING']));
     55    if (in_array('gzip', $encodings) && function_exists('ob_gzhandler'))
     56        ob_start("ob_gzhandler");
     57
     58    // Output rest of headers
    2959    header("Content-type: text/javascript; charset: UTF-8");
    30     header("Cache-Control: must-revalidate");
     60    // header("Cache-Control: must-revalidate");
     61    header("Vary: Accept-Encoding"); // Handle proxies
    3162    header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
    3263
    33     if ($theme) {
     64    if ($index > -1) {
    3465        // Write main script and patch some things
    35         echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
    36         echo 'TinyMCE.prototype.loadScript = function() {};';
    37         echo "tinyMCE.init(TinyMCECompressed_settings);";
     66        if ($index == 0) {
     67            echo file_get_contents(realpath("tiny_mce" . $suffix . ".js"));
     68            echo "\n\n";
     69            echo "TinyMCE.prototype.loadScript = function() {};\n";
     70        }
     71
     72        // WP
     73        $lang = $language = 'en';
     74        echo "\n/* WP Cancels all TinyMCE language handling */\n";
     75        echo "TinyMCE.prototype.importThemeLanguagePack = function() {};\n";
     76        echo "TinyMCE.prototype.importPluginLanguagePack = function() {};\n\n";
     77
     78        // Do init based on index
     79// WP       echo "tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);\n\n";
    3880
    3981        // Load theme, language pack and theme language packs
    40         echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
    41         echo file_get_contents(realpath("themes/" . $theme . "/langs/" . $language . ".js"));
    42         echo file_get_contents(realpath("langs/" . $language . ".js"));
     82        if ($theme) {
     83            echo file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js"));
     84            echo wp_translate_tinymce_lang(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
     85        }
     86
     87        if ($language)
     88            echo wp_translate_tinymce_lang(file_get_contents(realpath("langs/" . $language . ".js")));
    4389
    4490        // Load all plugins and their language packs
     
    4692        foreach ($plugins as $plugin) {
    4793            $pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
    48             $languageFile = realpath("plugins/" . $plugin . "/langs/" . $language . ".js");
     94            $languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
    4995
    5096            if ($pluginFile)
     
    5298
    5399            if ($languageFile)
    54                 echo file_get_contents($languageFile);
     100                echo wp_translate_tinymce_lang(file_get_contents($languageFile));
    55101        }
    56102
     
    59105?>
    60106
    61 var TinyMCECompressed_settings = null;
    62 
    63107function TinyMCECompressed() {
     108    this.configs = new Array();
     109    this.loadedFiles = new Array();
    64110}
    65111
     
    79125    settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
    80126    settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
     127    this.configs[this.configs.length] = settings;
     128    this.settings = settings;
    81129
    82     scriptURL += "?theme=" + escape(settings["theme"]) + "&language=" + escape(settings["language"]) + "&plugins=" + escape(settings["plugins"]);
     130    scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
    83131    document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
     132}
    84133
    85     TinyMCECompressed_settings = settings;
     134TinyMCECompressed.prototype.getOnce = function(str) {
     135    var ar = str.split(',');
     136
     137    for (var i=0; i<ar.length; i++) {
     138        if (ar[i] == '')
     139            continue;
     140
     141        // Skip load
     142        for (var x=0; x<this.loadedFiles.length; x++) {
     143            if (this.loadedFiles[x] == ar[i])
     144                ar[i] = null;
     145        }
     146
     147        this.loadedFiles[this.loadedFiles.length] = ar[i];
     148    }
     149
     150    // Glue
     151    str = "";
     152    for (var i=0; i<ar.length; i++) {
     153        if (ar[i] == null)
     154            continue;
     155
     156        str += ar[i];
     157
     158        if (i != ar.length-1)
     159            str += ",";
     160    }
     161
     162    return str;
    86163}
    87164
    88165var tinyMCE = new TinyMCECompressed();
     166var tinyMCECompressed = tinyMCE;
  • trunk/wp-includes/js/tinymce/tiny_mce_popup.js

    r2916 r2993  
    11/**
    22 * $RCSfile: tiny_mce_popup.js,v $
    3  * $Revision: 1.14 $
    4  * $Date: 2005/08/23 17:01:39 $
     3 * $Revision: 1.18 $
     4 * $Date: 2005/10/29 19:13:20 $
    55 *
    66 * @author Moxiecode
     
    2121    window.opener = win;
    2222    this.windowOpener = win;
     23    this.onLoadEval = "";
    2324
    2425    // Setup parent references
     
    3334    this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
    3435    this.storeSelection = tinyMCE.isMSIE && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
     36
     37    if (this.isWindow)
     38        window.focus();
    3539
    3640    // Store selection
     
    6367    var body = document.body;
    6468
     69    body.onkeydown = function (e) {
     70        e = e ? e : window.event;
     71        if ( e.keyCode == 27 && !e.shiftKey && !e.controlKey && !e.altKey ) {
     72            tinyMCEPopup.close();
     73        }
     74    }
     75
    6576    if (tinyMCE.getWindowArg('mce_replacevariables', true))
    6677        body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
     
    7788    if (body.style.display == 'none')
    7889        body.style.display = 'block';
     90
     91    // Execute real onload (Opera fix)
     92    if (tinyMCEPopup.onLoadEval != "") {
     93        eval(tinyMCEPopup.onLoadEval);
     94    }
     95};
     96
     97TinyMCEPopup.prototype.executeOnLoad = function(str) {
     98    if (tinyMCE.isOpera)
     99        this.onLoadEval = str;
     100    else
     101        eval(str);
    79102};
    80103
    81104TinyMCEPopup.prototype.resizeToInnerSize = function() {
     105    // Netscape 7.1 workaround
     106    if (this.isWindow && tinyMCE.isNS71) {
     107        window.resizeBy(0, 10);
     108        return;
     109    }
     110
    82111    if (this.isWindow) {
    83112        var doc = document;
     
    115144        iframe = document.createElement("iframe");
    116145        iframe.id = "mcWinIframe";
    117         iframe.src = "about:blank";
     146        iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document'];
    118147        iframe.width = "100%";
    119148        iframe.height = "100%";
  • trunk/wp-includes/js/tinymce/tiny_mce_src.js

    r2916 r2993  
    11/**
    22 * $RCSfile: tiny_mce_src.js,v $
    3  * $Revision: 1.233 $
    4  * $Date: 2005/08/26 15:20:32 $
     3 * $Revision: 1.249 $
     4 * $Date: 2005/10/30 16:06:57 $
    55 *
    66 * @author Moxiecode
     
    1010function TinyMCE() {
    1111    this.majorVersion = "2";
    12     this.minorVersion = "0RC2";
    13     this.releaseDate = "2005-09-12";
     12    this.minorVersion = "0RC4";
     13    this.releaseDate = "2005-10-30";
    1414
    1515    this.instances = new Array();
     
    2222
    2323    // Browser check
     24    var ua = navigator.userAgent;
    2425    this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
    25     this.isMSIE5 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5') != -1);
    26     this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
    27     this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
    28     this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
    29     this.isMac = navigator.userAgent.indexOf('Mac') != -1;
     26    this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
     27    this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
     28    this.isGecko = ua.indexOf('Gecko') != -1;
     29    this.isGecko18 = ua.indexOf('Gecko') != -1 && ua.indexOf('rv:1.8') != -1;
     30    this.isSafari = ua.indexOf('Safari') != -1;
     31    this.isOpera = ua.indexOf('Opera') != -1;
     32    this.isMac = ua.indexOf('Mac') != -1;
     33    this.isNS7 = ua.indexOf('Netscape/7') != -1;
     34    this.isNS71 = ua.indexOf('Netscape/7.1') != -1;
    3035    this.dialogCounter = 0;
     36
     37    // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
     38    if (this.isOpera) {
     39        this.isMSIE = true;
     40        this.isGecko = false;
     41        this.isSafari =  false;
     42    }
    3143
    3244    // TinyMCE editor id instance counter
     
    8799    this.defParam("editor_selector", "");
    88100    this.defParam("editor_deselector", "mceNoEditor");
    89     this.defParam("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[style|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|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],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align],address[class|align],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class]");
     101    this.defParam("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[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=0|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[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class|style],font[face|size|style|id|class|dir|color]");
    90102    this.defParam("extended_valid_elements", "");
    91103    this.defParam("invalid_elements", "");
     
    128140    this.defParam("button_tile_map", false);
    129141    this.defParam("submit_patch", true);
    130     this.defParam("browsers", "msie,safari,gecko");
     142    this.defParam("browsers", "msie,safari,gecko,opera");
    131143    this.defParam("dialog_type", "window");
    132     this.defParam("convert_fonts_to_styles", true);
     144    this.defParam("accessibility_warnings", true);
     145    this.defParam("merge_styles_invalid_parents", "");
     146    this.defParam("force_hex_style_colors", true);
     147    this.defParam("trim_span_elements", true);
     148    this.defParam("convert_fonts_to_spans", false);
     149    this.defParam("doctype", '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
     150    this.defParam("font_size_classes", '');
     151    this.defParam("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large');
     152    this.defParam("event_elements", 'a,img');
    133153
    134154    // Browser check IE
     
    142162    // Browser check Safari
    143163    if (this.isSafari && this.settings['browsers'].indexOf('safari') == -1)
     164        return;
     165
     166    // Browser check Opera
     167    if (this.isOpera && this.settings['browsers'].indexOf('opera') == -1)
    144168        return;
    145169
     
    151175
    152176    theme = this.settings['theme'];
    153 
    154     this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td)$", "i");
     177    this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|blockquote|center|dl|dir|fieldset|form|noscript|noframes|menu|isindex)$", "i");
    155178    this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
     179    this.uniqueURL = 'http://tinymce.moxiecode.cp/mce_temp_url';
    156180
    157181    // Theme url
     
    213237        // Is Safari enabled
    214238        if (this.isSafari && this.getParam('safari_warning', true))
    215             alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");
     239            alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.\nYou can disable this message by setting: safari_warning option to false");
    216240
    217241        tinyMCE.addEvent(window, "load", TinyMCE.prototype.onLoad);
     
    232256    this.loadCSS(this.settings['editor_css']);
    233257
    234     // Add theme plugins
     258    // Add plugins
    235259    var themePlugins = tinyMCE.getParam('plugins', '', true, ',');
    236260    if (this.settings['plugins'] != '') {
     
    270294        return;
    271295
    272     if (tinyMCE.isMSIE)
    273         var styleSheet = doc.createStyleSheet(css_file);
    274     else {
     296    if (typeof(doc.createStyleSheet) == "undefined") {
    275297        var elm = doc.createElement("link");
    276298
     
    278300        elm.href = css_file;
    279301
    280         if (headArr = doc.getElementsByTagName("head"))
     302        if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0)
    281303            headArr[0].appendChild(elm);
    282     }
     304    } else
     305        var styleSheet = doc.createStyleSheet(css_file);
    283306};
    284307
     
    300323    for (var n in tinyMCE.instances) {
    301324        var inst = tinyMCE.instances[n];
     325        if (!tinyMCE.isInstance(inst))
     326            continue;
    302327
    303328        inst.switchSettings();
     
    328353    for (var n in tinyMCE.instances) {
    329354        var inst = tinyMCE.instances[n];
     355        if (!tinyMCE.isInstance(inst))
     356            continue;
    330357
    331358        inst.switchSettings();
     
    346373        if (inst.settings['cleanup'] == false) {
    347374            tinyMCE.handleVisualAid(inst.getBody(), true, false, inst);
    348             tinyMCE._setEventsEnabled(inst.getBody(), false);
     375            tinyMCE._setEventsEnabled(inst.getBody(), true);
    349376        }
    350377
     
    380407                'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');
    381408
    382     var elms = node.getElementsByTagName("a");
    383     for (var i=0; i<elms.length; i++) {
    384         var event = "";
    385 
    386         for (var x=0; x<events.length; x++) {
    387             if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
    388                 event = tinyMCE.cleanupEventStr("" + event);
    389 
    390                 if (state)
    391                     event = "return true;" + event;
    392                 else
    393                     event = event.replace(/^return true;/gi, '');
    394 
    395                 elms[i].removeAttribute(events[x]);
    396                 elms[i].setAttribute(events[x], event);
     409    var evs = tinyMCE.settings['event_elements'].split(',');
     410    for (var y=0; y<evs.length; y++){
     411        var elms = node.getElementsByTagName(evs[y]);
     412        for (var i=0; i<elms.length; i++) {
     413            var event = "";
     414
     415            for (var x=0; x<events.length; x++) {
     416                if ((event = tinyMCE.getAttrib(elms[i], events[x])) != '') {
     417                    event = tinyMCE.cleanupEventStr("" + event);
     418
     419                    if (!state)
     420                        event = "return true;" + event;
     421                    else
     422                        event = event.replace(/^return true;/gi, '');
     423
     424                    elms[i].removeAttribute(events[x]);
     425                    elms[i].setAttribute(events[x], event);
     426                }
    397427            }
    398428        }
     
    405435    for (var n in tinyMCE.instances) {
    406436        var inst = tinyMCE.instances[n];
     437        if (!tinyMCE.isInstance(inst))
     438            continue;
    407439
    408440        inst.switchSettings();
     
    416448    }
    417449};
    418 
     450var asdf = 0;
    419451TinyMCE.prototype.execInstanceCommand = function(editor_id, command, user_interface, value, focus) {
    420452    var inst = tinyMCE.getInstanceById(editor_id);
     
    428460        // Reset design mode if lost
    429461        inst.autoResetDesignMode();
    430 
     462asdf = asdf + 1; if ( asdf == 1 ) alert ( 'asdf = 1' );
    431463        this.selectedElement = inst.getFocusElement();
    432464        this.selectedInstance = inst;
    433465        tinyMCE.execCommand(command, user_interface, value);
     466
     467        // Cancel event so it doesn't call onbeforeonunlaod
     468        if (tinyMCE.isMSIE && window.event != null)
     469            tinyMCE.cancelEvent(window.event);
    434470    }
    435471};
     
    482518            if (!tinyMCE.isMSIE) {
    483519                for (var n in tinyMCE.instances) {
     520                    if (!tinyMCE.isInstance(tinyMCE.instances[n]))
     521                        continue;
     522
    484523                    try {
    485524                        tinyMCE.instances[n].getDoc().designMode = "on";
     
    493532    }
    494533
    495     if (this.selectedInstance)
     534    if (this.selectedInstance) {
    496535        this.selectedInstance.execCommand(command, user_interface, value);
    497     else if (tinyMCE.settings['focus_alert'])
     536    } else if (tinyMCE.settings['focus_alert'])
    498537        alert(tinyMCELang['lang_focus_alert']);
    499538};
     
    505544
    506545    for (var i=0; i<document.frames.length; i++) {
    507         if (document.frames[i].event) {
    508             var event = document.frames[i].event;
    509 
    510             event.target = event.srcElement;
    511 
    512             TinyMCE.prototype.handleEvent(event);
    513             return;
     546        try {
     547            if (document.frames[i].event) {
     548                var event = document.frames[i].event;
     549
     550                if (!event.target)
     551                    event.target = event.srcElement;
     552
     553                TinyMCE.prototype.handleEvent(event);
     554                return;
     555            }
     556        } catch (ex) {
     557            // Ignore error if iframe is pointing to external URL
    514558        }
    515559    }
     
    552596    var iframe = document.createElement("iframe");
    553597    var id = replace_element.getAttribute("id");
     598    var aw, ah;
     599
     600    aw = "" + tinyMCE.settings['area_width'];
     601    ah = "" + tinyMCE.settings['area_height'];
     602
     603    if (aw.indexOf('%') == -1) {
     604        aw = parseInt(aw);
     605        aw = aw < 0 ? 300 : aw;
     606        aw = aw + "px";
     607    }
     608
     609    if (ah.indexOf('%') == -1) {
     610        ah = parseInt(ah);
     611        ah = ah < 0 ? 240 : ah;
     612        ah = ah + "px";
     613    }
    554614
    555615    iframe.setAttribute("id", id);
     
    561621    iframe.setAttribute("leftMargin", "0");
    562622    iframe.setAttribute("topMargin", "0");
    563     iframe.setAttribute("width", tinyMCE.settings['area_width']);
    564     iframe.setAttribute("height", tinyMCE.settings['area_height']);
     623    iframe.setAttribute("width", aw);
     624    iframe.setAttribute("height", ah);
    565625    iframe.setAttribute("allowtransparency", "true");
    566626
     
    569629
    570630    // Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
    571     if (tinyMCE.isMSIE)
     631    if (tinyMCE.isMSIE && !tinyMCE.isOpera)
    572632        iframe.setAttribute("src", this.settings['default_document']);
    573633
    574     iframe.style.width = tinyMCE.settings['area_width'];
    575     iframe.style.height = tinyMCE.settings['area_height'];
     634    iframe.style.width = aw;
     635    iframe.style.height = ah;
    576636
    577637    // MSIE 5.0 issue
    578     if (tinyMCE.isMSIE)
     638    if (tinyMCE.isMSIE && !tinyMCE.isOpera)
    579639        replace_element.outerHTML = iframe.outerHTML;
    580640    else
     
    593653    var content = inst.startContent;
    594654
     655    tinyMCE.operaOpacityCounter = 100 * tinyMCE.idCounter;
     656
    595657    inst.switchSettings();
    596658
     
    598660    if (!tinyMCE.isMSIE && doc.title != "blank_page") {
    599661        // This part will remove the designMode status
    600         doc.location.href = tinyMCE.baseURL + "/blank.htm";
     662        // Failes first time in Firefox 1.5b2 on Mac
     663        try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
    601664        window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000);
    602665        return;
     
    613676    tinyMCE.executeCallback('init_instance_callback', '_initInstance', 0, inst);
    614677
     678    // Setup span styles
     679    if (tinyMCE.getParam("convert_fonts_to_spans"))
     680        inst.getDoc().body.setAttribute('id', 'mceSpanFonts');
     681
    615682    if (tinyMCE.settings['nowrap'])
    616683        doc.body.style.whiteSpace = "nowrap";
     
    624691
    625692    // Setup base element
    626     base = doc.createElement("base");
     693    var base = doc.createElement("base");
    627694    base.setAttribute('href', tinyMCE.settings['base_href']);
    628695    head.appendChild(base);
     
    635702    }
    636703
     704    // Open closed anchors
     705//  content = content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
     706
    637707    // Call custom cleanup code
    638708    content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
     
    652722        body.editorId = editor_id;
    653723    }
     724
     725    content = tinyMCE.cleanupHTMLCode(content);
    654726
    655727    // Fix for bug #958637
     
    661733
    662734        // Remove weridness!
    663         if (tinyMCE.settings['force_p_newlines'])
     735        if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt'])
    664736            content = content.replace(new RegExp('&lt;&gt;', 'g'), "");
    665737
    666738        if (tinyMCE.settings['cleanup_on_startup'])
    667             inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement);
     739            tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
    668740        else {
    669741            // Convert all strong/em to b/i
     
    673745            content = tinyMCE.regexpReplace(content, "</strong>", "</b>", "gi");
    674746            content = tinyMCE.regexpReplace(content, "</em>", "</i>", "gi");
    675             inst.getBody().innerHTML = content;
     747            tinyMCE.setInnerHTML(inst.getBody(), content);
    676748        }
    677749
     
    682754
    683755            // Produces permission denied error in MSIE 5.5
    684             eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
     756            eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
    685757        } else
    686758            tinyMCE._setHTML(inst.getDoc(), content);
     
    716788    tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody());
    717789    tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody());
    718     tinyMCE._setEventsEnabled(inst.getBody(), true);
     790    tinyMCE._setEventsEnabled(inst.getBody(), false);
     791    tinyMCE.cleanupAnchors(inst.getDoc());
     792
     793    if (tinyMCE.getParam("convert_fonts_to_spans"))
     794        tinyMCE.convertSpansToFonts(inst.getDoc());
    719795
    720796    inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
    721797    inst.undoLevels[inst.undoLevels.length] = inst.startContent;
     798
     799    tinyMCE.operaOpacityCounter = -1;
     800};
     801
     802TinyMCE.prototype.cleanupHTMLCode = function(s) {
     803    s = s.replace(/<p \/>/gi, '<p>&nbsp;</p>');
     804    s = s.replace(/<p>\s*<\/p>/gi, '<p>&nbsp;</p>');
     805    s = s.replace(/<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([^\\|>]*?)\/>/gi, '<$1$2></$1>');
     806    s = s.replace(new RegExp('\\s+></', 'gi'), '></');
     807
     808    // Weird MSIE bug, <p><hr /></p> breaks runtime?
     809    if (tinyMCE.isMSIE)
     810        s = s.replace(/<p><hr \/><\/p>/gi, "<hr>");
     811
     812    // Convert relative anchors to absolute URLs ex: #something to file.htm#something
     813    s = s.replace(new RegExp('(href=\"?)(\\s*?#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#");
     814
     815    return s;
    722816};
    723817
     
    752846
    753847    // Execute onchange and remove piggyback
    754     if (e.keyCode == 13) {
     848    if (e.keyCode == 13 || e.keyCode == 32) {
    755849        elm.onchange = elm.oldonchange;
    756850        elm.onchange();
     
    825919                    // Cancel event
    826920                    tinyMCE.execCommand("mceAddUndoLevel");
    827                     e.preventDefault();
     921                    tinyMCE.cancelEvent(e);
    828922                    return false;
    829923                }
     
    842936
    843937            // Mozilla custom key handling
    844             if (tinyMCE.isGecko && e.ctrlKey && tinyMCE.settings['custom_undo_redo']) {
     938            if (tinyMCE.isGecko && (e.ctrlKey && !e.altKey) && tinyMCE.settings['custom_undo_redo']) {
    845939                if (tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']) {
    846940                    if (e.charCode == 122) { // Ctrl+Z
     
    9921086            }
    9931087
    994             //tinyMCE.debug(e.keyCode);
    995 
    9961088            // MSIE custom key handling
    9971089            if (tinyMCE.isMSIE && tinyMCE.settings['custom_undo_redo']) {
     
    10051097
    10061098                if (tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']) {
    1007                     if (e.keyCode == 90 && e.ctrlKey && e.type == "keydown") { // Ctrl+Z
     1099                    if (e.keyCode == 90 && (e.ctrlKey && !e.altKey) && e.type == "keydown") { // Ctrl+Z
    10081100                        tinyMCE.selectedInstance.execCommand("Undo");
    10091101                        tinyMCE.triggerNodeChange(false);
    10101102                    }
    10111103
    1012                     if (e.keyCode == 89 && e.ctrlKey && e.type == "keydown") { // Ctrl+Y
     1104                    if (e.keyCode == 89 && (e.ctrlKey && !e.altKey) && e.type == "keydown") { // Ctrl+Y
    10131105                        tinyMCE.selectedInstance.execCommand("Redo");
    10141106                        tinyMCE.triggerNodeChange(false);
    10151107                    }
    10161108
    1017                     if ((e.keyCode == 90 || e.keyCode == 89) && e.ctrlKey) {
     1109                    if ((e.keyCode == 90 || e.keyCode == 89) && (e.ctrlKey && !e.altKey)) {
    10181110                        // Cancel event
    10191111                        e.returnValue = false;
     
    10361128            if (posKey && e.type == "keyup")
    10371129                tinyMCE.triggerNodeChange(false);
     1130
     1131            if (tinyMCE.isMSIE && e.ctrlKey)
     1132                window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
    10381133        break;
    10391134
     
    10481143            var targetBody = tinyMCE.getParentElement(e.target, "body");
    10491144            for (var instanceName in tinyMCE.instances) {
     1145                if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
     1146                    continue;
     1147
    10501148                var inst = tinyMCE.instances[instanceName];
    10511149
     
    11451243        element.className = class_name;
    11461244        element.oldClassName = class_name;
     1245
     1246        // Fix opacity in Opera
     1247        if (tinyMCE.isOpera) {
     1248            if (class_name == "mceButtonDisabled") {
     1249                var suffix = "";
     1250
     1251                if (!element.mceOldSrc)
     1252                    element.mceOldSrc = element.src;
     1253
     1254                if (this.operaOpacityCounter > -1)
     1255                    suffix = '?rnd=' + this.operaOpacityCounter++;
     1256
     1257                element.src = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/images/opacity.png" + suffix;
     1258                element.style.backgroundImage = "url('" + element.mceOldSrc + "')";
     1259            } else {
     1260                if (element.mceOldSrc) {
     1261                    element.src = element.mceOldSrc;
     1262                    element.parentNode.style.backgroundImage = "";
     1263                    element.mceOldSrc = null;
     1264                }
     1265            }
     1266        }
    11471267    }
    11481268};
     
    11701290    tinyMCE.removeTinyMCEFormElements(this);
    11711291    tinyMCE.triggerSave();
    1172     this.oldSubmit();
     1292    this.mceOldSubmit();
    11731293    tinyMCE.isNotDirty = true;
    11741294};
     
    11941314                if (tinyMCE.settings['submit_patch']) {
    11951315                    try {
    1196                         form.oldSubmit = form.submit;
     1316                        form.mceOldSubmit = form.submit;
    11971317                        form.submit = TinyMCE.prototype.submitPatch;
    11981318                    } catch (e) {
     
    12961416        for (var instanceName in tinyMCE.instances) {
    12971417            var instance = tinyMCE.instances[instanceName];
     1418            if (!tinyMCE.isInstance(instance))
     1419                continue;
     1420
    12981421            if (instanceName != editor_id)
    12991422                    tmpInstances[instanceName] = instance;
     
    15231646    }
    15241647
    1525     // Auto verify
    1526     if (attribName == "mce_onclick")
    1527         verified = true;
    1528 
    15291648    // Verify attrib
    15301649    if (tinyMCE.cleanup_verify_html && !verified) {
     
    15691688            break;
    15701689
     1690        case "shape":
     1691            attribValue = attribValue.toLowerCase();
     1692            break;
     1693
     1694        case "cellspacing":
     1695            if (tinyMCE.isMSIE5)
     1696                attribValue = element_node.cellSpacing;
     1697            break;
     1698
     1699        case "cellpadding":
     1700            if (tinyMCE.isMSIE5)
     1701                attribValue = element_node.cellPadding;
     1702            break;
     1703
    15711704        case "color":
    15721705            if (tinyMCE.isMSIE5 && element_name == "font")
     
    15751708
    15761709        case "class":
     1710            // Remove mceItem classes from anchors
     1711            if (tinyMCE.cleanup_on_save && attribValue.indexOf('mceItemAnchor') != -1)
     1712                attribValue = attribValue.replace(/mceItem[a-z0-9]+/gi, '');
     1713
    15771714            if (element_name == "table" || element_name == "td") {
    15781715                // Handle visual aid
     
    16071744
    16081745        case "style":
    1609             attribValue = tinyMCE.serializeStyle(tinyMCE.parseStyle(element_node.style.cssText));
     1746            attribValue = tinyMCE.serializeStyle(tinyMCE.parseStyle(tinyMCE.getAttrib(element_node, "style")));
    16101747            break;
    16111748
     
    16131750        case "href":
    16141751        case "src":
     1752            // Gecko 1.8 issue
     1753            if (tinyMCE.isGecko18 && attribName == "src")
     1754                attribValue = element_node.src;
     1755
    16151756            // Fix for dragdrop/copy paste Mozilla issue
    16161757            if (!tinyMCE.isMSIE && attribName == "href" && element_node.getAttribute("mce_real_href"))
     
    16221763
    16231764            // Force absolute URLs in Firefox
    1624             if (tinyMCE.isGecko && !tinyMCE.settings['relative_urls'])
     1765            if (tinyMCE.isGecko && !tinyMCE.getParam('relative_urls'))
    16251766                attribValue = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], attribValue);
    16261767
     
    16651806};
    16661807
     1808TinyMCE.prototype.clearArray = function(ar) {
     1809    // Since stupid people tend to extend core objects like
     1810    // Array with their own crap I needed to make functions that clean away
     1811    // this junk so the arrays get clean and nice as they should be
     1812    for (var key in ar)
     1813        ar[key] = null;
     1814};
     1815
     1816TinyMCE.prototype.isInstance = function(inst) {
     1817    return inst != null && typeof(inst) == "object" && inst.isTinyMCEControl;
     1818};
     1819
    16671820TinyMCE.prototype.parseStyle = function(str) {
    16681821    var ar = new Array();
     1822
     1823    if (str == null)
     1824        return ar;
     1825
    16691826    var st = str.split(';');
     1827
     1828    tinyMCE.clearArray(ar);
    16701829
    16711830    for (var i=0; i<st.length; i++) {
     
    17191878    for (var key in ar) {
    17201879        var val = ar[key];
     1880        if (typeof(val) == 'function')
     1881            continue;
    17211882
    17221883        if (val != null && val != '') {
     
    17261887            val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
    17271888
     1889            // Force HEX colors
     1890            if (tinyMCE.getParam("force_hex_style_colors"))
     1891                val = tinyMCE.convertRGBToHex(val);
     1892
    17281893            if (val != "url('')")
    17291894                str += key.toLowerCase() + ": " + val + "; ";
     
    17351900
    17361901    return str;
     1902};
     1903
     1904TinyMCE.prototype.convertRGBToHex = function(s) {
     1905    if (s.toLowerCase().indexOf('rgb') != -1) {
     1906        var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
     1907        var rgb = s.replace(re, "$1,$2,$3").split(',');
     1908        if (rgb.length == 3) {
     1909            r = parseInt(rgb[0]).toString(16);
     1910            g = parseInt(rgb[1]).toString(16);
     1911            b = parseInt(rgb[2]).toString(16);
     1912
     1913            r = r.length == 1 ? '0' + r : r;
     1914            g = g.length == 1 ? '0' + g : g;
     1915            b = b.length == 1 ? '0' + b : b;
     1916
     1917            s = "#" + r + g + b;
     1918        }
     1919    }
     1920
     1921    return s;
    17371922};
    17381923
     
    18152000
    18162001            if (tinyMCE.cleanup_on_save) {
    1817                 if (node.nodeName == "A" && node.className == "mceItemAnchor")
    1818                     return '<a name="' + this.convertStringToXML(node.getAttribute("name")) + '"></a>';
     2002                if (node.nodeName == "A" && node.className == "mceItemAnchor") {
     2003                    if (node.hasChildNodes()) {
     2004                        for (var i=0; i<node.childNodes.length; i++)
     2005                            output += this.cleanupNode(node.childNodes[i]);
     2006                    }
     2007
     2008                    return '<a name="' + this.convertStringToXML(node.getAttribute("name")) + '"></a>' + output;
     2009                }
     2010            }
     2011
     2012            // Remove deprecated attributes
     2013            var re = new RegExp("^(TABLE|TD|TR)$");
     2014            if (re.test(node.nodeName)) {
     2015                // Move attrib to style
     2016                if ((node.nodeName != "TABLE" || tinyMCE.cleanup_inline_styles) && (width = tinyMCE.getAttrib(node, "width")) != '') {
     2017                    node.style.width = width.indexOf('%') != -1 ? width : width.replace(/[^0-9]/gi, '') + "px";
     2018                    node.removeAttribute("width");
     2019                }
     2020
     2021                // Is table and not inline
     2022                if ((node.nodeName == "TABLE" && !tinyMCE.cleanup_inline_styles) && node.style.width != '') {
     2023                    tinyMCE.setAttrib(node, "width", node.style.width.replace('px',''));
     2024                    node.style.width = '';
     2025                }
     2026
     2027                // Move attrib to style
     2028                if ((height = tinyMCE.getAttrib(node, "height")) != '') {
     2029                    node.style.height = height.indexOf('%') != -1 ? height : height.replace(/[^0-9]/gi, '') + "px";
     2030                    node.removeAttribute("height");
     2031                }
    18192032            }
    18202033
     
    18742087            }
    18752088
     2089            if ((tinyMCE.isMSIE && !tinyMCE.isOpera) && elementName == "style")
     2090                return "<style>" + node.innerHTML + "</style>";
     2091
    18762092            // Remove empty tables
    18772093            if (elementName == "table" && !node.hasChildNodes())
     
    18802096            // Handle element attributes
    18812097            if (node.attributes.length > 0) {
     2098                var lastAttrib = "";
     2099
    18822100                for (var i=0; i<node.attributes.length; i++) {
    18832101                    if (node.attributes[i].specified) {
    1884                         // tinyMCE.debug(node.attributes[i].nodeName + "=" + node.attributes[i].nodeValue);
     2102                        // Is the attrib already processed (removed duplicate attributes in opera TD[align=left])
     2103                        if (tinyMCE.isOpera) {
     2104                            if (node.attributes[i].nodeName == lastAttrib)
     2105                                continue;
     2106
     2107                            lastAttrib = node.attributes[i].nodeName;
     2108                        }
     2109
     2110                        // tinyMCE.debug(node.nodeName, node.attributes[i].nodeName, node.attributes[i].nodeValue, node.innerHTML);
    18852111                        var attrib = tinyMCE._cleanupAttribute(elementValidAttribs, elementName, node.attributes[i], node);
    18862112                        if (attrib && attrib.value != "")
     
    18902116            }
    18912117
    1892             // MSIE table summary fix
     2118            // MSIE table summary fix (MSIE 5.5)
    18932119            if (tinyMCE.isMSIE && elementName == "table" && node.getAttribute("summary") != null && elementAttribs.indexOf('summary') == -1) {
    1894                 elementAttribs += " summary=" + '"' + this.convertStringToXML("" + node.getAttribute("summary")) + '"';
     2120                var summary = tinyMCE.getAttrib(node, 'summary');
     2121                if (summary != '')
     2122                    elementAttribs += " summary=" + '"' + this.convertStringToXML(summary) + '"';
     2123            }
     2124
     2125            // Handle missing attributes in MSIE 5.5
     2126            if (tinyMCE.isMSIE5 && /^(td|img|a)$/.test(elementName)) {
     2127                var ma = new Array("scope", "longdesc", "hreflang", "charset", "type");
     2128
     2129                for (var u=0; u<ma.length; u++) {
     2130                    if (node.getAttribute(ma[u]) != null) {
     2131                        var s = tinyMCE.getAttrib(node, ma[u]);
     2132
     2133                        if (s != '')
     2134                            elementAttribs += " " + ma[u] + "=" + '"' + this.convertStringToXML(s) + '"';
     2135                    }
     2136                }
    18952137            }
    18962138
     
    19182160            // Clean up children
    19192161            if (node.hasChildNodes()) {
    1920                 // Force BR
    1921                 if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
    1922                     output += "<div" + elementAttribs + ">";
    1923                 else
    1924                     output += "<" + elementName + elementAttribs + ">";
     2162                // If not empty span
     2163                if (!(elementName == "span" && elementAttribs == "" && tinyMCE.getParam("trim_span_elements"))) {
     2164                    // Force BR
     2165                    if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
     2166                        output += "<div" + elementAttribs + ">";
     2167                    else
     2168                        output += "<" + elementName + elementAttribs + ">";
     2169                }
    19252170
    19262171                for (var i=0; i<node.childNodes.length; i++)
    19272172                    output += this.cleanupNode(node.childNodes[i]);
    19282173
    1929                 // Force BR
    1930                 if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
    1931                     output += "</div><br />";
    1932                 else
    1933                     output += "</" + elementName + ">";
     2174                // If not empty span
     2175                if (!(elementName == "span" && elementAttribs == "" && tinyMCE.getParam("trim_span_elements"))) {
     2176                    // Force BR
     2177                    if (elementName == "p" && tinyMCE.cleanup_force_br_newlines)
     2178                        output += "</div><br />";
     2179                    else
     2180                        output += "</" + elementName + ">";
     2181                }
    19342182            } else {
    19352183                if (!nonEmptyTag) {
     
    19452193        case 3: // Text
    19462194            // Do not convert script elements
    1947             if (node.parentNode.nodeName.toLowerCase() == "script")
     2195            if (node.parentNode.nodeName == "SCRIPT" || node.parentNode.nodeName == "STYLE")
    19482196                return node.nodeValue;
    19492197
     
    20962344    if (!tinyMCE.settings['cleanup'])
    20972345        return element.innerHTML;
     2346
     2347    if (on_save && tinyMCE.getParam("convert_fonts_to_spans"))
     2348        tinyMCE.convertFontsToSpans(doc);
    20982349
    20992350    // Call custom cleanup code
     
    21272378        }
    21282379
    2129         element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '<p>[ \n\r]*<hr.*>[ \n\r]*</p>', '<hr />', 'gi');
    2130         element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '<!([^-(DOCTYPE)]* )|<!/[^-]*>', '', 'gi');
     2380        tinyMCE.setInnerHTML(element, tinyMCE.regexpReplace(element.innerHTML, '<p>[ \n\r]*<hr.*>[ \n\r]*</p>', '<hr />', 'gi'));
     2381        tinyMCE.setInnerHTML(element, tinyMCE.regexpReplace(element.innerHTML, '<!([^-(DOCTYPE)]* )|<!/[^-]*>', '', 'gi'));
    21312382    }
    21322383
     
    21362387        tinyMCE.debug("Cleanup process executed in: " + (new Date().getTime()-startTime) + " ms.");
    21372388
    2138     // Remove pesky HR paragraphs
     2389    // Remove pesky HR paragraphs and other crap
    21392390    html = tinyMCE.regexpReplace(html, '<p><hr /></p>', '<hr />');
    21402391    html = tinyMCE.regexpReplace(html, '<p>&nbsp;</p><hr /><p>&nbsp;</p>', '<hr />');
    21412392    html = tinyMCE.regexpReplace(html, '<td>\\s*<br />\\s*</td>', '<td>&nbsp;</td>');
    2142 
    2143     // Remove empty achors
     2393    html = tinyMCE.regexpReplace(html, '<p>\\s*<br />\\s*</p>', '<p>&nbsp;</p>');
     2394    html = tinyMCE.regexpReplace(html, '<p>\\s*&nbsp;\\s*<br />\\s*&nbsp;\\s*</p>', '<p>&nbsp;</p>');
     2395    html = tinyMCE.regexpReplace(html, '<p>\\s*&nbsp;\\s*<br />\\s*</p>', '<p>&nbsp;</p>');
     2396    html = tinyMCE.regexpReplace(html, '<p>\\s*<br />\\s*&nbsp;\\s*</p>', '<p>&nbsp;</p>');
     2397
     2398    // Remove empty anchors
    21442399    html = html.replace(new RegExp('<a>(.*?)</a>', 'gi'), '$1');
    21452400
     
    21482403        html = html.replace(new RegExp('<o:p _moz-userdefined="" />', 'g'), "");
    21492404
    2150     if (tinyMCE.settings['apply_source_formatting']) {
     2405    if (tinyMCE.settings['remove_linebreaks'])
     2406        html = html.replace(new RegExp('\r|\n', 'g'), ' ');
     2407
     2408    if (tinyMCE.getParam('apply_source_formatting')) {
    21512409        html = html.replace(new RegExp('<(p|div)([^>]*)>', 'g'), "\n<$1$2>\n");
    21522410        html = html.replace(new RegExp('<\/(p|div)([^>]*)>', 'g'), "\n</$1$2>\n");
     
    21592417    }
    21602418
    2161     if (tinyMCE.settings['force_p_newlines']) {
     2419    if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt']) {
    21622420        // Remove weridness!
    21632421        var re = new RegExp('&lt;&gt;', 'g');
    21642422        html = html.replace(re, "");
    21652423    }
    2166 
    2167     if (tinyMCE.settings['remove_linebreaks'])
    2168         html = html.replace(new RegExp('\r|\n', 'g'), ' ');
    21692424
    21702425    // Call custom cleanup code
     
    22122467    if (!this.linkElement && this.selectedInstance) {
    22132468        if (tinyMCE.isSafari) {
    2214             tinyMCE.execCommand("mceInsertContent", false, '<a href="#mce_temp_url#">' + this.selectedInstance.getSelectedHTML() + '</a>');
     2469            tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + this.selectedInstance.getSelectedHTML() + '</a>');
    22152470        } else
    2216             this.selectedInstance.contentDocument.execCommand("createlink", false, "#mce_temp_url#");
    2217 
    2218         tinyMCE.linkElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", "#mce_temp_url#");
    2219 
    2220         var elementArray = this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", "#mce_temp_url#");
     2471            this.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
     2472
     2473        tinyMCE.linkElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
     2474
     2475        var elementArray = this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
    22212476
    22222477        for (var i=0; i<elementArray.length; i++) {
     
    22642519        if (!this.imgElement && this.selectedInstance) {
    22652520            if (tinyMCE.isSafari)
    2266                 tinyMCE.execCommand("mceInsertContent", false, '<img src="#mce_temp_url#" />');
     2521                tinyMCE.execCommand("mceInsertContent", false, '<img src="' + tinyMCE.uniqueURL + '" />');
    22672522            else
    2268                 this.selectedInstance.contentDocument.execCommand("insertimage", false, "#mce_temp_url#");
    2269 
    2270             tinyMCE.imgElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "img", "src", "#mce_temp_url#");
     2523                this.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL);
     2524
     2525            tinyMCE.imgElement = this.getElementByAttributeValue(this.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL);
    22712526        }
    22722527    }
     
    23332588    }
    23342589
    2335     if (node.hasChildNodes) {
     2590    if (node && node.hasChildNodes()) {
    23362591        for (var x=0, n=node.childNodes.length; x<n; x++) {
    23372592            var childElements = this.getElementsByAttributeValue(node.childNodes[x], element_name, attrib, value);
     
    24022657            }
    24032658        }
    2404     } while (node = node.parentNode);
     2659    } while ((node = node.parentNode) != null);
    24052660
    24062661    return null;
     
    24262681
    24272682    // Handle absolute url anchors
    2428     if (!tinyMCE.settings['relative_urls']) {
     2683    if (!tinyMCE.getParam('relative_urls')) {
    24292684        var urlParts = tinyMCE.parseURL(url);
    24302685        var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']);
     
    24362691
    24372692    // Convert to relative urls
    2438     if (on_save && tinyMCE.settings['relative_urls']) {
     2693    if (on_save && tinyMCE.getParam('relative_urls')) {
    24392694        var urlParts = tinyMCE.parseURL(url);
    24402695
     
    24592714
    24602715    // Remove current domain
    2461     if (!fileProto && tinyMCE.settings['remove_script_host']) {
     2716    if (!fileProto && tinyMCE.getParam('remove_script_host')) {
    24622717        var start = "", portPart = "";
    24632718
     
    24712726
    24722727        // Add first slash if missing on a absolute URL
    2473         if (!tinyMCE.settings['relative_urls'] && url.indexOf('://') == -1 && url.charAt(0) != '/')
     2728        if (!tinyMCE.getParam('relative_urls') && url.indexOf('://') == -1 && url.charAt(0) != '/')
    24742729            url = '/' + url;
    24752730    }
     
    25472802};
    25482803
     2804TinyMCE.prototype.serializeURL = function(up) {
     2805    var url = "";
     2806
     2807    if (up['protocol'])
     2808        url += up['protocol'] + "://";
     2809
     2810    if (up['host'])
     2811        url += up['host'];
     2812
     2813    if (up['port'])
     2814        url += ":" + up['port'];
     2815
     2816    if (up['path'])
     2817        url += up['path'];
     2818
     2819    if (up['query'])
     2820        url += "?" + up['query'];
     2821
     2822    if (up['anchor'])
     2823        url += "#" + up['anchor'];
     2824
     2825    return url;
     2826};
     2827
    25492828/**
    25502829 * Converts an absolute path to relative path.
    25512830 */
    25522831TinyMCE.prototype.convertAbsoluteURLToRelativeURL = function(base_url, url_to_relative) {
     2832    var baseURL = this.parseURL(base_url);
     2833    var targetURL = this.parseURL(url_to_relative);
    25532834    var strTok1;
    25542835    var strTok2;
    25552836    var breakPoint = 0;
    2556     var outputString = "";
     2837    var outPath = "";
     2838    var forceSlash = false;
     2839
     2840    if (targetURL.path == "")
     2841        targetURL.path = "/";
     2842    else
     2843        forceSlash = true;
    25572844
    25582845    // Crop away last path part
    2559     base_url = base_url.substring(0, base_url.lastIndexOf('/'));
     2846    base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
    25602847    strTok1 = base_url.split('/');
    2561     strTok2 = url_to_relative.split('/');
     2848    strTok2 = targetURL.path.split('/');
    25622849
    25632850    if (strTok1.length >= strTok2.length) {
     
    25802867
    25812868    if (breakPoint == 1)
    2582         return url_to_relative;
     2869        return targetURL.path;
    25832870
    25842871    for (var i=0; i<(strTok1.length-(breakPoint-1)); i++)
    2585         outputString += "../";
     2872        outPath += "../";
    25862873
    25872874    for (var i=breakPoint-1; i<strTok2.length; i++) {
    25882875        if (i != (breakPoint-1))
    2589             outputString += "/" + strTok2[i];
     2876            outPath += "/" + strTok2[i];
    25902877        else
    2591             outputString += strTok2[i];
    2592     }
    2593 
    2594     return outputString;
     2878            outPath += strTok2[i];
     2879    }
     2880
     2881    targetURL.protocol = null;
     2882    targetURL.host = null;
     2883    targetURL.port = null;
     2884    targetURL.path = outPath == "" && forceSlash ? "/" : outPath;
     2885
     2886    return this.serializeURL(targetURL);
    25952887};
    25962888
     
    25992891    var relURL = TinyMCE.prototype.parseURL(relative_url);
    26002892
    2601     if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(relative_url,'[ \t\r\n\+]|%20','').charAt(0) == "#")
     2893    if (relative_url == "" || relative_url.charAt(0) == '/' || relative_url.indexOf('://') != -1 || relative_url.indexOf('mailto:') != -1 || relative_url.indexOf('javascript:') != -1)
    26022894        return relative_url;
    26032895
     
    26432935    var start = "", end = "";
    26442936
    2645     // Build start part
    2646     if (baseURL['protocol'])
    2647         start += baseURL['protocol'] + "://";
    2648 
    2649     if (baseURL['host'])
    2650         start += baseURL['host'];
    2651 
    2652     if (baseURL['port'])
    2653         start += ":" + baseURL['port'];
    2654 
    2655     // Build end part
    2656     if (relURL['query'])
    2657         end += "?" + relURL['query'];
    2658 
    2659     if (relURL['anchor'])
    2660         end += "#" + relURL['anchor'];
     2937    // Build output URL
     2938    relURL.protocol = baseURL.protocol;
     2939    relURL.host = baseURL.host;
     2940    relURL.port = baseURL.port;
    26612941
    26622942    // Re-add trailing slash if it's removed
    2663     if (relative_url.charAt(relative_url.length-1) == "/")
    2664         end += "/";
    2665 
    2666     return start + absPath + end;
     2943    if (relURL.path.charAt(relURL.path.length-1) == "/")
     2944        absPath += "/";
     2945
     2946    relURL.path = absPath;
     2947
     2948    return TinyMCE.prototype.serializeURL(relURL);
    26672949};
    26682950
     
    27052987
    27062988TinyMCE.prototype.addToLang = function(prefix, ar) {
    2707     for (var key in ar)
     2989    for (var key in ar) {
     2990        if (typeof(ar[key]) == 'function')
     2991            continue;
     2992
    27082993        tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];
     2994    }
    27092995
    27102996//  for (var key in ar)
     
    27203006    for (var key in replace_vars) {
    27213007        var value = replace_vars[key];
     3008        if (typeof(value) == 'function')
     3009            continue;
     3010
    27223011        replace_haystack = tinyMCE.replaceVar(replace_haystack, key, value);
    27233012    }
     
    27523041            }
    27533042
    2754             tinyMCE.executeCallback('handleNodeChangeCallback', '_handleNodeChange', 0, editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection);
     3043            tinyMCE.executeCallback('handleNodeChangeCallback', '_handleNodeChange', 0, editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content);
    27553044        }
    27563045    }
     
    27803069        tinyMCE.selectedInstance = tinyMCE.getInstanceById(editor_id);
    27813070
    2782     if (tinyMCE.selectedInstance)
    2783         return tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
     3071    if (tinyMCE.selectedInstance) {
     3072        var old = this.selectedInstance.getBody().innerHTML;
     3073        var html = tinyMCE._cleanupHTML(this.selectedInstance, this.selectedInstance.getDoc(), tinyMCE.settings, this.selectedInstance.getBody(), false, true);
     3074        tinyMCE.setInnerHTML(this.selectedInstance.getBody(), old);
     3075        return html;
     3076    }
    27843077
    27853078    return null;
     
    28603153
    28613154    // Replace all args as variables in URL
    2862     for (var name in args)
     3155    for (var name in args) {
     3156        if (typeof(args[name]) == 'function')
     3157            continue;
     3158
    28633159        url = tinyMCE.replaceVar(url, name, escape(args[name]));
     3160    }
    28643161
    28653162    if (html) {
     
    28913188                modal = "no";
    28923189
     3190            if (template['close_previous'] != "no")
     3191                try {tinyMCE.lastWindow.close();} catch (ex) {}
     3192
    28933193            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);
    28943194            if (win == null) {
     
    28963196                return;
    28973197            }
     3198
     3199            if (template['close_previous'] != "no")
     3200                tinyMCE.lastWindow = win;
    28983201
    28993202            eval('try { win.resizeTo(width, height); } catch(e) { }');
     
    29463249};
    29473250
    2948 TinyMCE.prototype.handleVisualAid = function(element, deep, state, inst) {
    2949     if (!element)
     3251TinyMCE.prototype.handleVisualAid = function(el, deep, state, inst) {
     3252    if (!el)
    29503253        return;
    29513254
    29523255    var tableElement = null;
    29533256
    2954     switch (element.nodeName) {
     3257    switch (el.nodeName) {
    29553258        case "TABLE":
    2956             var oldW = element.style.width;
    2957             var oldH = element.style.height;
    2958 
    2959             element.className = tinyMCE.getVisualAidClass(element.className, state && element.getAttribute("border") == 0);
    2960 
    2961             element.style.width = oldW;
    2962             element.style.height = oldH;
    2963 
    2964             for (var y=0; y<element.rows.length; y++) {
    2965                 for (var x=0; x<element.rows[y].cells.length; x++) {
    2966                     var className = tinyMCE.getVisualAidClass(element.rows[y].cells[x].className, state && element.getAttribute("border") == 0);
    2967                     element.rows[y].cells[x].className = className;
     3259            var oldW = el.style.width;
     3260            var oldH = el.style.height;
     3261            var bo = tinyMCE.getAttrib(el, "border");
     3262
     3263            bo = bo == "" || bo == "0" ? true : false;
     3264
     3265            tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo));
     3266
     3267            el.style.width = oldW;
     3268            el.style.height = oldH;
     3269
     3270            for (var y=0; y<el.rows.length; y++) {
     3271                for (var x=0; x<el.rows[y].cells.length; x++) {
     3272                    var cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
     3273                    tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn);
    29683274                }
    29693275            }
     
    29723278
    29733279        case "A":
    2974             var anchorName = tinyMCE.getAttrib(element, "name");
     3280            var anchorName = tinyMCE.getAttrib(el, "name");
    29753281
    29763282            if (anchorName != '' && state) {
    2977                 element.title = anchorName;
    2978                 element.className = 'mceItemAnchor';
     3283                el.title = anchorName;
     3284                el.className = 'mceItemAnchor';
    29793285            } else if (anchorName != '' && !state)
    2980                 element.className = '';
     3286                el.className = '';
    29813287
    29823288            break;
    29833289    }
    29843290
    2985     if (deep && element.hasChildNodes()) {
    2986         for (var i=0; i<element.childNodes.length; i++)
    2987             tinyMCE.handleVisualAid(element.childNodes[i], deep, state, inst);
     3291    if (deep && el.hasChildNodes()) {
     3292        for (var i=0; i<el.childNodes.length; i++)
     3293            tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst);
    29883294    }
    29893295};
     
    30033309        v = elm.className;
    30043310
    3005     if (name == "style")
     3311    if (name == "style" && !tinyMCE.isOpera)
    30063312        v = elm.style.cssText;
    30073313
     
    30333339};
    30343340
     3341TinyMCE.prototype.setStyleAttrib = function(elm, name, value) {
     3342    eval('elm.style.' + name + '=value;');
     3343
     3344    // Style attrib deleted
     3345    if (tinyMCE.isMSIE && value == null || value == '') {
     3346        var str = tinyMCE.serializeStyle(tinyMCE.parseStyle(elm.style.cssText));
     3347        elm.style.cssText = str;
     3348        elm.setAttribute("style", str);
     3349    }
     3350};
     3351
     3352TinyMCE.prototype.convertSpansToFonts = function(doc) {
     3353    var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
     3354
     3355    var h = doc.body.innerHTML;
     3356    h = h.replace(/<span/gi, '<font');
     3357    h = h.replace(/<\/span/gi, '</font');
     3358    doc.body.innerHTML = h;
     3359
     3360    var s = doc.getElementsByTagName("font");
     3361    for (var i=0; i<s.length; i++) {
     3362        var size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
     3363        var fSize = 0;
     3364
     3365        for (var x=0; x<sizes.length; x++) {
     3366            if (sizes[x] == size) {
     3367                fSize = x + 1;
     3368                break;
     3369            }
     3370        }
     3371
     3372        if (fSize > 0) {
     3373            tinyMCE.setAttrib(s[i], 'size', fSize);
     3374            s[i].style.fontSize = '';
     3375        }
     3376
     3377        var fFace = s[i].style.fontFamily;
     3378        if (fFace != null && fFace != "") {
     3379            tinyMCE.setAttrib(s[i], 'face', fFace);
     3380            s[i].style.fontFamily = '';
     3381        }
     3382
     3383        var fColor = s[i].style.color;
     3384        if (fColor != null && fColor != "") {
     3385            tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
     3386            s[i].style.color = '';
     3387        }
     3388    }
     3389};
     3390
     3391TinyMCE.prototype.convertFontsToSpans = function(doc) {
     3392    var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
     3393
     3394    var h = doc.body.innerHTML;
     3395    h = h.replace(/<font/gi, '<span');
     3396    h = h.replace(/<\/font/gi, '</span');
     3397    doc.body.innerHTML = h;
     3398
     3399    var fsClasses = tinyMCE.getParam('font_size_classes');
     3400    if (fsClasses != '')
     3401        fsClasses = fsClasses.replace(/\s+/, '').split(',');
     3402    else
     3403        fsClasses = null;
     3404
     3405    var s = doc.getElementsByTagName("span");
     3406    for (var i=0; i<s.length; i++) {
     3407        var fSize, fFace, fColor;
     3408
     3409        fSize = tinyMCE.getAttrib(s[i], 'size');
     3410        fFace = tinyMCE.getAttrib(s[i], 'face');
     3411        fColor = tinyMCE.getAttrib(s[i], 'color');
     3412
     3413        if (fSize != "") {
     3414            fSize = parseInt(fSize);
     3415
     3416            if (fSize > 0 && fSize < 8) {
     3417                if (fsClasses != null)
     3418                    tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
     3419                else
     3420                    s[i].style.fontSize = sizes[fSize-1];
     3421            }
     3422
     3423            s[i].removeAttribute('size');
     3424        }
     3425
     3426        if (fFace != "") {
     3427            s[i].style.fontFamily = fFace;
     3428            s[i].removeAttribute('face');
     3429        }
     3430
     3431        if (fColor != "") {
     3432            s[i].style.color = fColor;
     3433            s[i].removeAttribute('color');
     3434        }
     3435    }
     3436};
     3437
     3438/*
     3439TinyMCE.prototype.applyClassesToFonts = function(doc, size) {
     3440    var f = doc.getElementsByTagName("font");
     3441    for (var i=0; i<f.length; i++) {
     3442        var s = tinyMCE.getAttrib(f[i], "size");
     3443
     3444        if (s != "")
     3445            tinyMCE.setAttrib(f[i], 'class', "mceItemFont" + s);
     3446    }
     3447
     3448    if (typeof(size) != "undefined") {
     3449        var css = "";
     3450
     3451        for (var x=0; x<doc.styleSheets.length; x++) {
     3452            for (var i=0; i<doc.styleSheets[x].rules.length; i++) {
     3453                if (doc.styleSheets[x].rules[i].selectorText == '#mceSpanFonts .mceItemFont' + size) {
     3454                    css = doc.styleSheets[x].rules[i].style.cssText;
     3455                    break;
     3456                }
     3457            }
     3458
     3459            if (css != "")
     3460                break;
     3461        }
     3462
     3463        if (doc.styleSheets[0].rules[0].selectorText == "FONT")
     3464            doc.styleSheets[0].removeRule(0);
     3465
     3466        doc.styleSheets[0].addRule("FONT", css, 0);
     3467    }
     3468};
     3469*/
     3470
     3471TinyMCE.prototype.setInnerHTML = function(e, h) {
     3472    if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
     3473        e.innerHTML = '<div id="mceTMPElement" style="display: none">TMP</div>' + h;
     3474        e.firstChild.removeNode(true);
     3475    } else
     3476        e.innerHTML = h;
     3477};
     3478
     3479TinyMCE.prototype.getOuterHTML = function(e) {
     3480    if (tinyMCE.isMSIE)
     3481        return e.outerHTML;
     3482
     3483    var d = e.ownerDocument.createElement("body");
     3484    d.appendChild(e);
     3485    return d.innerHTML;
     3486};
     3487
     3488TinyMCE.prototype.setOuterHTML = function(doc, e, h) {
     3489    if (tinyMCE.isMSIE) {
     3490        e.outerHTML = h;
     3491        return;
     3492    }
     3493
     3494    var d = e.ownerDocument.createElement("body");
     3495    d.innerHTML = h;
     3496    e.parentNode.replaceChild(d.firstChild, e);
     3497};
     3498
     3499TinyMCE.prototype.insertAfter = function(nc, rc){
     3500    if (rc.nextSibling)
     3501        rc.parentNode.insertBefore(nc, rc.nextSibling);
     3502    else
     3503        rc.parentNode.appendChild(nc);
     3504};
     3505
     3506TinyMCE.prototype.cleanupAnchors = function(doc) {
     3507    var an = doc.getElementsByTagName("a");
     3508
     3509    for (var i=0; i<an.length; i++) {
     3510        if (tinyMCE.getAttrib(an[i], "name") != "") {
     3511            var cn = an[i].childNodes;
     3512            for (var x=cn.length-1; x>=0; x--)
     3513                tinyMCE.insertAfter(cn[x], an[i]);
     3514        }
     3515    }
     3516};
     3517
    30353518TinyMCE.prototype._setHTML = function(doc, html_content) {
    3036     // Weird MSIE bug, <p><hr /></p> breaks runtime?
    3037     if (tinyMCE.isMSIE) {
    3038         var re = new RegExp('<p><hr /></p>', 'g');
    3039         html_content = html_content.replace(re, "<hr>");
    3040     }
     3519    // Force closed anchors open
     3520    //html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
     3521
     3522    html_content = tinyMCE.cleanupHTMLCode(html_content);
    30413523
    30423524    // Try innerHTML if it fails use pasteHTML in MSIE
    30433525    try {
    3044         doc.body.innerHTML = html_content;
     3526        tinyMCE.setInnerHTML(doc.body, html_content);
    30453527    } catch (e) {
    30463528        if (this.isMSIE)
     
    30823564
    30833565        // Always set the htmlText output
    3084         doc.body.innerHTML = html;
    3085     }
     3566        tinyMCE.setInnerHTML(doc.body, html);
     3567    }
     3568
     3569    tinyMCE.cleanupAnchors(doc);
     3570
     3571    if (tinyMCE.getParam("convert_fonts_to_spans"))
     3572        tinyMCE.convertSpansToFonts(doc);
    30863573};
    30873574
     
    31313618    var inst = this.instances[editor_id];
    31323619    if (!inst) {
    3133         for (var instanceName in tinyMCE.instances) {
    3134             var instance = tinyMCE.instances[instanceName];
     3620        for (var n in tinyMCE.instances) {
     3621            var instance = tinyMCE.instances[n];
     3622            if (!tinyMCE.isInstance(instance))
     3623                continue;
     3624
    31353625            if (instance.formTargetElementId == editor_id) {
    31363626                inst = instance;
     
    31793669        for (var instanceName in tinyMCE.instances) {
    31803670            instance = tinyMCE.instances[instanceName];
     3671            if (!tinyMCE.isInstance(instance))
     3672                continue;
     3673
    31813674            break;
    31823675        }
     
    32363729
    32373730TinyMCE.prototype.regexpReplace = function(in_str, reg_exp, replace_str, opts) {
     3731    if (in_str == null)
     3732        return in_str;
     3733
    32383734    if (typeof(opts) == "undefined")
    32393735        opts = 'g';
     
    32513747    str = str.replace('function anonymous()\n{\n', '');
    32523748    str = str.replace('\n}', '');
    3253     str = str.replace(/^return true;/gi, '');
     3749    str = str.replace(/^return true;/gi, ''); // Remove event blocker
    32543750
    32553751    return str;
     
    34243920        debugDiv.innerHTML = '\
    34253921            Debug output:\
    3426             <textarea id="tinymce_debug" style="width: 100%; height: 300px"></textarea>';
     3922            <textarea id="tinymce_debug" style="width: 100%; height: 300px" wrap="nowrap"></textarea>';
    34273923
    34283924        document.body.appendChild(debugDiv);
     
    34473943    this.typingUndoIndex = -1;
    34483944    this.undoRedo = true;
     3945    this.isTinyMCEControl = true;
    34493946
    34503947    // Default settings
     
    36844181
    36854182    // Only scroll if out of visible area
    3686     if (!tinyMCE.settings['auto_resize'] && !(node.absTop > scrollY && node.absTop < (scrollY - 25 + height)))
    3687         this.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25);
     4183    if (!tinyMCE.settings['auto_resize'] && !(pos.absTop > scrollY && pos.absTop < (scrollY - 25 + height)))
     4184        this.contentWindow.scrollTo(pos.absLeft, pos.absTop - height + 25); 
    36884185};
    36894186
     
    37014198
    37024199TinyMCEControl.prototype.getSel = function() {
    3703     if (tinyMCE.isMSIE)
     4200    if (tinyMCE.isMSIE && !tinyMCE.isOpera)
    37044201        return this.getDoc().selection;
    37054202
     
    37604257        return null;
    37614258
    3762     if (tinyMCE.isMSIE)
     4259    if (tinyMCE.isMSIE && !tinyMCE.isOpera)
    37634260        return sel.createRange();
    37644261
     
    38144311    var blockName = "P";
    38154312
     4313//  tinyMCE.debug(body.innerHTML);
     4314
    38164315//  debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
    38174316
     
    38334332    var endOffset = direct ? sel.focusOffset : sel.anchorOffset;
    38344333
     4334    startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
     4335    endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
     4336
     4337    // tinyMCE.debug(startNode, endNode);
     4338
    38354339    // Get block elements
    38364340    var startBlock = tinyMCE.getParentBlockElement(startNode);
     
    38394343    // Use current block name
    38404344    if (startBlock != null) {
    3841         blockName = startBlock.nodeName.toUpperCase();
     4345        blockName = startBlock.nodeName;
    38424346
    38434347        // Use P instead
    3844         if (blockName == "TD" || blockName == "TABLE")
     4348        if (blockName == "TD" || blockName == "TABLE" || (blockName == "DIV" && new RegExp('left|right', 'gi').test(startBlock.style.cssFloat)))
    38454349            blockName = "P";
    38464350    }
    38474351
    3848     // Within a list item (use normal behavior)
    3849     if ((startBlock != null && startBlock.nodeName.toLowerCase() == "li") || (endBlock != null && endBlock.nodeName.toLowerCase() == "li"))
     4352    // Within a list use normal behaviour
     4353    if (tinyMCE.getParentElement(startBlock, "OL,UL") != null)
    38504354        return false;
    38514355
    38524356    // Within a table create new paragraphs
    3853     if ((startBlock != null && startBlock.nodeName.toLowerCase() == "table") || (endBlock != null && endBlock.nodeName.toLowerCase() == "table"))
     4357    if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE"))
    38544358        startBlock = endBlock = null;
    38554359
    38564360    // Setup new paragraphs
    3857     var paraBefore = (startBlock != null && startBlock.nodeName.toUpperCase() == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
    3858     var paraAfter = (endBlock != null && endBlock.nodeName.toUpperCase() == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
     4361    var paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
     4362    var paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
     4363
     4364    // Is header, then force paragraph under
     4365    if (/^(H[1-6])$/.test(blockName))
     4366        paraAfter = doc.createElement("p");
    38594367
    38604368    // Setup chop nodes
     
    38804388    } while ((node = node.nextSibling ? node.nextSibling : node.parentNode));
    38814389
     4390    // Fix when only a image is within the TD
     4391    if (startChop.nodeName == "TD")
     4392        startChop = startChop.firstChild;
     4393
     4394    if (endChop.nodeName == "TD")
     4395        endChop = endChop.lastChild;
     4396
    38824397    // If not in a block element
    38834398    if (startBlock == null) {
     
    39014416                endChop = endChop.parentNode;
    39024417
    3903             rng.setEndAfter(endChop);
     4418            // If not after image
     4419            //if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY")
     4420                rng.setEndAfter(endChop);
     4421
     4422            if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
     4423                rngBefore.setEndAfter(endChop);
    39044424
    39054425            var contents = rng.cloneContents();
    3906             if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName.toLowerCase() == "body")) {
    3907                 var nodes = contents.firstChild.childNodes;
    3908                 for (var i=0; i<nodes.length; i++) {
    3909                     if (nodes[i].nodeName.toLowerCase() != "body")
    3910                         paraAfter.appendChild(nodes[i]);
    3911                 }
    3912             } else
     4426            if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
     4427                paraAfter.innerHTML = contents.firstChild.innerHTML;
     4428            else
    39134429                paraAfter.appendChild(contents);
    39144430
     
    39324448            rngBefore.insertNode(paraBefore);
    39334449
    3934 //          tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
     4450            // tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
    39354451        } else {
    39364452            body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
     
    39484464    else
    39494465        rngBefore.setStartBefore(startChop);
     4466
    39504467    rngBefore.setEnd(startNode, startOffset);
    39514468    paraBefore.appendChild(rngBefore.cloneContents());
     
    39554472    rngAfter.setStart(endNode, endOffset);
    39564473    var contents = rngAfter.cloneContents();
     4474
    39574475    if (contents.firstChild && contents.firstChild.nodeName == blockName) {
    3958         var nodes = contents.firstChild.childNodes;
     4476/*      var nodes = contents.firstChild.childNodes;
    39594477        for (var i=0; i<nodes.length; i++) {
    3960             if (nodes[i].nodeName.toLowerCase() != "body")
     4478            //tinyMCE.debug(nodes[i].nodeName);
     4479            if (nodes[i].nodeName != "BODY")
    39614480                paraAfter.appendChild(nodes[i]);
    39624481        }
     4482*/
     4483        paraAfter.innerHTML = contents.firstChild.innerHTML;
    39634484    } else
    39644485        paraAfter.appendChild(contents);
     
    39934514    rng.insertNode(paraAfter);
    39944515    rng.insertNode(paraBefore);
    3995     // debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
     4516    //tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
    39964517
    39974518    // Normalize
     
    41014622};
    41024623
    4103 TinyMCEControl.prototype._mergeElements = function(pa, ch, override) {
    4104     ch = ch.cloneNode(true);
     4624TinyMCEControl.prototype._mergeElements = function(scmd, pa, ch, override) {
     4625    if (scmd == "removeformat") {
     4626        pa.className = "";
     4627        pa.style.cssText = "";
     4628        ch.className = "";
     4629        ch.style.cssText = "";
     4630        return;
     4631    }
     4632
    41054633    var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
    41064634    var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
     
    41104638
    41114639    if (override) {
    4112         for (var n in st)
     4640        for (var n in st) {
     4641            if (typeof(st[n]) == 'function')
     4642                continue;
     4643
    41134644            stc[n] = st[n];
     4645        }
    41144646    } else {
    4115         for (var n in stc)
     4647        for (var n in stc) {
     4648            if (typeof(stc[n]) == 'function')
     4649                continue;
     4650
    41164651            st[n] = stc[n];
    4117     }
    4118 
    4119     tinyMCE.setAttrib(ch, "style", tinyMCE.serializeStyle(st));
    4120     tinyMCE.setAttrib(ch, "class", tinyMCE.trim(className));
    4121     pa.parentNode.replaceChild(ch, pa);
     4652        }
     4653    }
     4654
     4655    tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st));
     4656    tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className));
     4657    ch.className = "";
     4658    ch.style.cssText = "";
     4659    ch.removeAttribute("class");
     4660    ch.removeAttribute("style");
     4661};
     4662
     4663TinyMCEControl.prototype.setUseCSS = function(b) {
     4664    var doc = this.getDoc();
     4665    try {doc.execCommand("useCSS", false, !b);} catch (ex) {}
     4666    try {doc.execCommand("styleWithCSS", false, b);} catch (ex) {}
    41224667};
    41234668
     
    41344679    // Mozilla issue
    41354680    if (!tinyMCE.isMSIE && !this.useCSS) {
    4136         doc.execCommand("useCSS", false, true);
     4681        this.setUseCSS(false);
    41374682        this.useCSS = true;
    41384683    }
     
    43434888            var scmd = value['command'];
    43444889            var sname = value['name'];
    4345             var svalue = value['value'];
     4890            var svalue = value['value'] == null ? '' : value['value'];
     4891            //var svalue = value['value'] == null ? '' : value['value'];
    43464892            var wrapper = value['wrapper'] ? value['wrapper'] : "span";
    43474893            var parentElm = null;
     4894            var invalidRe = new RegExp("^BODY|HTML$", "g");
     4895            var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null;
    43484896
    43494897            // Whole element selected check
     
    43574905                    prng.moveToElementText(pelm);
    43584906
    4359                     if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0)
    4360                         parentElm = pelm;
     4907                    if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
     4908                        if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
     4909                            parentElm = pelm;
     4910                    }
    43614911                }
    43624912            } else {
     
    43674917
    43684918            // Whole element selected
    4369             if (parentElm) {
     4919            if (parentElm && !invalidRe.test(parentElm.nodeName)) {
    43704920                if (scmd == "setstyle")
    4371                     eval("parentElm.style." + sname + " = svalue;");
     4921                    tinyMCE.setStyleAttrib(parentElm, sname, svalue);
    43724922
    43734923                if (scmd == "setattrib")
    43744924                    tinyMCE.setAttrib(parentElm, sname, svalue);
     4925
     4926                if (scmd == "removeformat") {
     4927                    parentElm.style.cssText = '';
     4928                    tinyMCE.setAttrib(parentElm, 'class', '');
     4929                }
     4930
     4931                // Remove style/attribs from all children
     4932                var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1);
     4933                for (var z=0; z<ch.length; z++) {
     4934                    if (ch[z] == parentElm)
     4935                        continue;
     4936
     4937                    if (scmd == "setstyle")
     4938                        tinyMCE.setStyleAttrib(ch[z], sname, '');
     4939
     4940                    if (scmd == "setattrib")
     4941                        tinyMCE.setAttrib(ch[z], sname, '');
     4942
     4943                    if (scmd == "removeformat") {
     4944                        ch[z].style.cssText = '';
     4945                        tinyMCE.setAttrib(ch[z], 'class', '');
     4946                    }
     4947                }
    43754948            } else {
    43764949                doc.execCommand("fontname", false, "#mce_temp_font#");
     
    43844957
    43854958                        if (scmd == "setstyle")
    4386                             eval("spanElm.style." + sname + " = svalue;");
     4959                            tinyMCE.setStyleAttrib(spanElm, sname, svalue);
    43874960
    43884961                        if (scmd == "setattrib")
    43894962                            tinyMCE.setAttrib(spanElm, sname, svalue);
     4963
     4964                        if (scmd == "removeformat") {
     4965                            spanElm.style.cssText = '';
     4966                            tinyMCE.setAttrib(spanElm, 'class', '');
     4967                        }
    43904968
    43914969                        if (elm.hasChildNodes()) {
     
    43964974                        spanElm.setAttribute("mce_new", "true");
    43974975                        elm.parentNode.replaceChild(spanElm, elm);
     4976
     4977                        // Remove style/attribs from all children
     4978                        var ch = tinyMCE.getNodeTree(spanElm, new Array(), 1);
     4979                        for (var z=0; z<ch.length; z++) {
     4980                            if (ch[z] == spanElm)
     4981                                continue;
     4982
     4983                            if (scmd == "setstyle")
     4984                                tinyMCE.setStyleAttrib(ch[z], sname, '');
     4985
     4986                            if (scmd == "setattrib")
     4987                                tinyMCE.setAttrib(ch[z], sname, '');
     4988
     4989                            if (scmd == "removeformat") {
     4990                                ch[z].style.cssText = '';
     4991                                tinyMCE.setAttrib(ch[z], 'class', '');
     4992                            }
     4993                        }
    43984994                    }
    43994995                }
     
    44105006                // Is only child a element
    44115007                if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) {
    4412                     // tinyMCE.debug("merge1" + isNew);
    4413                     this._mergeElements(elm, elm.childNodes[0], isNew);
     5008                    //tinyMCE.debug("merge1" + isNew);
     5009                    this._mergeElements(scmd, elm, elm.childNodes[0], isNew);
    44145010                    continue;
    44155011                }
    44165012
    44175013                // Is I the only child
    4418                 if (elm.parentNode.childNodes.length == 1) {
    4419                     // tinyMCE.debug("merge2" + isNew);
    4420                     this._mergeElements(elm.parentNode, elm, false);
     5014                if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) {
     5015                    //tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);
     5016                    if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
     5017                        this._mergeElements(scmd, elm.parentNode, elm, false);
    44215018                }
    44225019            }
     
    44335030
    44345031                // Is empty span, remove it
    4435                 if (new RegExp('<span>|<span style="">', 'gi').test(tmp.innerHTML)) {
    4436                     for (var i=elm.childNodes.length-1; i>=0; i--) {
    4437                         if (elm.parentNode != null) {
    4438                             elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true), elm);
    4439                             elm.parentNode.removeChild(elm);
    4440                         }
     5032                tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), '');
     5033                //tinyMCE.debug(tmp.innerHTML);
     5034                if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) {
     5035                    for (var x=0; x<elm.childNodes.length; x++) {
     5036                        if (elm.parentNode != null)
     5037                            elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
    44415038                    }
    4442                 }
    4443             }
     5039
     5040                    elm.parentNode.removeChild(elm);
     5041                }
     5042            }
     5043
     5044            // Re add the visual aids
     5045            if (scmd == "removeformat")
     5046                tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
    44445047
    44455048            tinyMCE.triggerNodeChange();
     
    44485051
    44495052        case "FontName":
    4450             if (tinyMCE.getParam("convert_fonts_to_styles"))
    4451                 this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontFamily", value : value});
    4452             else
    4453                 this.getDoc().execCommand('FontName', false, value);
     5053            this.getDoc().execCommand('FontName', false, value);
     5054
     5055            if (tinyMCE.isGecko)
     5056                window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
     5057
     5058            return;
     5059
     5060        case "FontSize":
     5061            this.getDoc().execCommand('FontSize', false, value);
     5062
     5063            if (tinyMCE.isGecko)
     5064                window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
     5065
     5066            return;
     5067
     5068        case "forecolor":
     5069            this.getDoc().execCommand('forecolor', false, value);
    44545070            break;
    44555071
    4456         case "FontSize":
    4457             if (tinyMCE.getParam("convert_fonts_to_styles")) {
    4458                 var sizes = new Array('', 8, 10, 12, 14, 18, 24, 36);
    4459                 var size = sizes[value] == '' ? '' : sizes[value] + 'px';
    4460 
    4461                 this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontSize", value : size});
     5072        case "HiliteColor":
     5073            if (tinyMCE.isGecko) {
     5074                this.setUseCSS(true);
     5075                this.getDoc().execCommand('hilitecolor', false, value);
     5076                this.setUseCSS(false);
    44625077            } else
    4463                 this.getDoc().execCommand('FontSize', false, value);
    4464 
    4465             break;
    4466 
    4467         case "forecolor":
    4468             if (tinyMCE.getParam("convert_fonts_to_styles"))
    4469                 this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "color", value : value});
    4470             else {
    4471                 if (tinyMCE.isGecko) {
    4472                     this.getDoc().execCommand("useCSS", false, true);
    4473                     this.getDoc().execCommand('forecolor', false, value);
    4474                     this.getDoc().execCommand("useCSS", false, true);
    4475                 } else
    4476                     this.getDoc().execCommand('forecolor', false, value);
    4477             }
    4478             break;
    4479 
    4480         case "HiliteColor":
    4481             if (tinyMCE.getParam("convert_fonts_to_styles"))
    4482                 this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "backgroundColor", value : value});
    4483             else {
    4484                 if (tinyMCE.isGecko) {
    4485                     this.getDoc().execCommand("useCSS", false, false);
    4486                     this.getDoc().execCommand('hilitecolor', false, value);
    4487                     this.getDoc().execCommand("useCSS", false, true);
    4488                 } else
    4489                     this.getDoc().execCommand('BackColor', false, value);
    4490             }
    4491 
     5078                this.getDoc().execCommand('BackColor', false, value);
    44925079            break;
    44935080
     
    44995086            // Try executing command
    45005087            eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');
     5088
     5089            if (tinyMCE.isOpera && cmdFailed)
     5090                alert('Currently not supported by your browser, use keyboard shortcuts instead.');
    45015091
    45025092            // Alert error in gecko if command failed
     
    45185108            value = tinyMCE._customCleanup(this, "insert_to_editor", value);
    45195109            tinyMCE._setHTML(doc, value);
    4520             doc.body.innerHTML = tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body);
     5110            tinyMCE.setInnerHTML(doc.body, tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body));
    45215111            tinyMCE.handleVisualAid(doc.body, true, this.visualAid, this);
    4522             tinyMCE._setEventsEnabled(doc.body, true);
     5112            tinyMCE._setEventsEnabled(doc.body, false);
    45235113            return true;
    45245114
     
    46555245        case "mceCleanup":
    46565246            tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
    4657             this.getBody().innerHTML = tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid);
     5247            tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid));
    46585248            tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
    4659             tinyMCE._setEventsEnabled(this.getBody(), true);
     5249            tinyMCE._setEventsEnabled(this.getBody(), false);
    46605250            this.repaint();
    46615251            tinyMCE.triggerNodeChange();
     
    46635253
    46645254        case "mceReplaceContent":
     5255            this.getWin().focus();
     5256
    46655257            var selectedText = "";
    46665258
     
    47105302            var html = this.getBody().innerHTML;
    47115303            if ((pos = html.indexOf(key)) != -1)
    4712                 this.getBody().innerHTML = html.substring(0, pos) + value + html.substring(pos + key.length);
     5304                tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length));
    47135305
    47145306            // Restore scoll pos
     
    47205312
    47215313        case "mceInsertContent":
     5314            var insertHTMLFailed = false;
     5315            this.getWin().focus();
     5316
     5317            if (tinyMCE.isGecko || tinyMCE.isOpera) {
     5318                try {this.getDoc().execCommand('inserthtml', false, value);} catch (ex) {insertHTMLFailed = true;}
     5319                if (!insertHTMLFailed) {
     5320                    tinyMCE.triggerNodeChange();
     5321                    return;
     5322                }
     5323            }
     5324
     5325            // Ugly hack in Opera due to non working "inserthtml"
     5326            if (tinyMCE.isOpera && insertHTMLFailed) {
     5327                this.getDoc().execCommand("insertimage", false, tinyMCE.uniqueURL);
     5328                var ar = tinyMCE.getElementsByAttributeValue(this.getBody(), "img", "src", tinyMCE.uniqueURL);
     5329                ar[0].outerHTML = value;
     5330                return;
     5331            }
     5332
    47225333            if (!tinyMCE.isMSIE) {
     5334                var isHTML = value.indexOf('<') != -1;
    47235335                var sel = this.getSel();
    47245336                var rng = this.getRng();
    4725                 var isHTML = value.indexOf('<') != -1;
    47265337
    47275338                if (isHTML) {
     
    48615472                if (this.undoIndex > 0) {
    48625473                    this.undoIndex--;
    4863                     this.getBody().innerHTML = this.undoLevels[this.undoIndex];
     5474                    tinyMCE.setInnerHTML(this.getBody(), this.undoLevels[this.undoIndex]);
    48645475                    this.repaint();
    48655476                }
     
    48775488                if (this.undoIndex < (this.undoLevels.length-1)) {
    48785489                    this.undoIndex++;
    4879                     this.getBody().innerHTML = this.undoLevels[this.undoIndex];
     5490                    tinyMCE.setInnerHTML(this.getBody(), this.undoLevels[this.undoIndex]);
    48805491                    this.repaint();
    48815492                    // tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
     
    48935504            break;
    48945505
     5506        case "Indent":
     5507            this.getDoc().execCommand(command, user_interface, value);
     5508            tinyMCE.triggerNodeChange();
     5509            if (tinyMCE.isMSIE) {
     5510                var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
     5511                do {
     5512                    if (n && n.nodeName == "BLOCKQUOTE") {
     5513                        n.removeAttribute("dir");
     5514                        n.removeAttribute("style");
     5515                    }
     5516                } while (n != null && (n = n.parentNode) != null);
     5517            }
     5518            break;
     5519
    48955520        case "removeformat":
    48965521            var text = this.getSelectedText();
    48975522
     5523            if (tinyMCE.isOpera) {
     5524                this.getDoc().execCommand("RemoveFormat", false, null);
     5525                return;
     5526            }
     5527
    48985528            if (tinyMCE.isMSIE) {
    48995529                try {
    4900                     win.focus();
    49015530                    var rng = doc.selection.createRange();
    49025531                    rng.execCommand("RemoveFormat", false, null);
    4903 
    4904                     // If all element contents is selected, move selection around element
    4905                     if (rng.text == rng.parentElement().innerText) {
    4906                         rng.moveToElementText(rng.parentElement());
    4907                         rng.select();
    4908                     }
    4909 
    4910                     rng.pasteHTML(rng.text);
    49115532                } catch (e) {
    49125533                    // Do nothing
    49135534                }
    4914             } else
     5535
     5536                this.execCommand("SetStyleInfo", false, {command : "removeformat"});
     5537            } else {
    49155538                this.getDoc().execCommand(command, user_interface, value);
     5539
     5540                this.execCommand("SetStyleInfo", false, {command : "removeformat"});
     5541            }
    49165542
    49175543            // Remove class
     
    49245550        default:
    49255551            this.getDoc().execCommand(command, user_interface, value);
    4926             tinyMCE.triggerNodeChange();
     5552
     5553            if (tinyMCE.isGecko)
     5554                window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
     5555            else
     5556                tinyMCE.triggerNodeChange();
    49275557    }
    49285558
     
    51065736        this.targetElement = tElm;
    51075737        this.iframeElement = targetDoc.getElementById(this.editorId);
    5108         this.contentDocument = tElm.window.document;
    5109         this.contentWindow = tElm.window;
     5738
     5739        if (tinyMCE.isOpera) {
     5740            this.contentDocument = this.iframeElement.contentDocument;
     5741            this.contentWindow = this.iframeElement.contentWindow;
     5742            dynamicIFrame = true;
     5743        } else {
     5744            this.contentDocument = tElm.window.document;
     5745            this.contentWindow = tElm.window;
     5746        }
     5747
    51105748        this.getDoc().designMode = "on";
    51115749    }
     
    51145752    var doc = this.contentDocument;
    51155753    if (dynamicIFrame) {
    5116         var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><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>';
     5754        var html = 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>';
    51175755
    51185756        try {
     
    51385776
    51395777TinyMCEControl.prototype.getFocusElement = function() {
    5140     if (tinyMCE.isMSIE) {
     5778    if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
    51415779        var doc = this.getDoc();
    51425780        var rng = doc.selection.createRange();
    51435781
    5144         if (rng.collapse)
    5145             rng.collapse(true);
     5782//      if (rng.collapse)
     5783//          rng.collapse(true);
    51465784
    51475785        var elm = rng.item ? rng.item(0) : rng.parentElement();
     
    51495787        var sel = this.getSel();
    51505788        var rng = this.getRng();
     5789
    51515790        var elm = rng.commonAncestorContainer;
    51525791        //var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
  • trunk/wp-includes/js/tinymce/utils/form_utils.js

    r2954 r2993  
    11/**
    22 * $RCSfile: form_utils.js,v $
    3  * $Revision: 1.3 $
    4  * $Date: 2005/08/23 17:01:40 $
     3 * $Revision: 1.5 $
     4 * $Date: 2005/10/25 16:01:51 $
    55 *
    66 * Various form utilitiy functions.
     
    1010 */
    1111
    12 function renderColorPicker(id, target_form_element) {
     12function getColorPickerHTML(id, target_form_element) {
    1313    var html = "";
    1414
    15     html += '<a id="' + id + '_link" href="javascript:tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;">';
     15    html += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
    1616    html += '<img id="' + id + '" src="../../themes/advanced/images/color.gif"';
    1717    html += ' onmouseover="tinyMCE.switchClass(this,\'mceButtonOver\');"';
     
    2121    html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
    2222
    23     document.write(html);
     23    return html;
     24}
     25
     26function pickColor(e, target_form_element) {
     27    if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
     28        tinyMCEPopup.pickColor(e, target_form_element);
    2429}
    2530
     
    4449}
    4550
    46 function renderBrowser(id, target_form_element, type, prefix) {
     51function getBrowserHTML(id, target_form_element, type, prefix) {
    4752    var option = prefix + "_" + type + "_browser_callback";
    4853    var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
    4954    if (cb == null)
    50         return;
     55        return "";
    5156
    5257    var html = "";
     
    6065    html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
    6166
    62     document.write(html);
     67    return html;
    6368}
    6469
     
    137142    return elm && elm.style.display != "none";
    138143}
     144
     145function convertRGBToHex(col) {
     146    var re = new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)", "gi");
     147
     148    var rgb = col.replace(re, "$1,$2,$3").split(',');
     149    if (rgb.length == 3) {
     150        r = parseInt(rgb[0]).toString(16);
     151        g = parseInt(rgb[1]).toString(16);
     152        b = parseInt(rgb[2]).toString(16);
     153
     154        r = r.length == 1 ? '0' + r : r;
     155        g = g.length == 1 ? '0' + g : g;
     156        b = b.length == 1 ? '0' + b : b;
     157
     158        return "#" + r + g + b;
     159    }
     160
     161    return col;
     162}
     163
     164function convertHexToRGB(col) {
     165    if (col.indexOf('#') != -1) {
     166        col = col.replace(new RegExp('[^0-9A-F]', 'gi'), '');
     167
     168        r = parseInt(col.substring(0, 2), 16);
     169        g = parseInt(col.substring(2, 4), 16);
     170        b = parseInt(col.substring(4, 6), 16);
     171
     172        return "rgb(" + r + "," + g + "," + b + ")";
     173    }
     174
     175    return col;
     176}
     177
     178function trimSize(size) {
     179    return size.replace(new RegExp('[^0-9%]', 'gi'), '');
     180}
     181
     182function getCSSSize(size) {
     183    size = trimSize(size);
     184
     185    if (size == "")
     186        return "";
     187
     188    return size.indexOf('%') != -1 ? size : size + "px";
     189}
     190
     191function getStyle(elm, attrib, style) {
     192    var val = tinyMCE.getAttrib(elm, attrib);
     193
     194    if (val != '')
     195        return '' + val;
     196
     197    if (typeof(style) == 'undefined')
     198        style = attrib;
     199
     200    val = eval('elm.style.' + style);
     201
     202    return val == null ? '' : '' + val;
     203}
Note: See TracChangeset for help on using the changeset viewer.