<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12660] trunk/wp-includes/js/tinymce/plugins/wpeditimage:
  Clean CSS of the Edit Image popup in the visual editor props Simek,
  show changed image size and fill width or height when left blank,
  fixes #11655, fixes #10442</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12660">12660</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2010-01-08 13:06:17 +0000 (Fri, 08 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Clean CSS of the Edit Image popup in the visual editor props Simek, show changed image size and fill width or height when left blank, fixes <a href="http://trac.wordpress.org/ticket/11655">#11655</a>, fixes <a href="http://trac.wordpress.org/ticket/10442">#10442</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss">trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimageeditimagehtml">trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html</a></li>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagejs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs">trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesjstinymcepluginswpeditimagecsseditimagecss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css (12659 => 12660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2010-01-08 08:51:12 UTC (rev 12659)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css        2010-01-08 13:06:17 UTC (rev 12660)
</span><span class="lines">@@ -40,6 +40,12 @@
</span><span class="cx">         padding: 3px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+p.help {
+        margin: 4px 0;
+        font-size: 12px;
+        font-style: italic;
+}
+
</ins><span class="cx"> body, td {
</span><span class="cx">         font: 13px &quot;Lucida Grande&quot;, &quot;Lucida Sans Unicode&quot;, Tahoma, Verdana, sans-serif;
</span><span class="cx"> }
</span><span class="lines">@@ -52,11 +58,13 @@
</span><span class="cx"> img.alignright,
</span><span class="cx"> .alignright {
</span><span class="cx">         float: right;
</span><ins>+        margin-left: 5px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> img.alignleft,
</span><span class="cx"> .alignleft {
</span><span class="cx">         float: left;
</span><ins>+        margin-right: 5px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> img.aligncenter {
</span><span class="lines">@@ -149,9 +157,9 @@
</span><span class="cx">         -khtml-border-top-right-radius: 4px;
</span><span class="cx">         -webkit-border-top-right-radius: 4px;
</span><span class="cx">         border-top-right-radius: 4px;
</span><del>-        border-style:solid;
-        border-width:1px;
-        font-weight:normal;
</del><ins>+        border-style: solid;
+        border-width: 1px;
+        font-weight: normal;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #adv_settings .field label {
</span><span class="lines">@@ -279,13 +287,16 @@
</span><span class="cx"> .describe textarea {
</span><span class="cx">         width: 460px;
</span><span class="cx">         border: 1px solid #dfdfdf;
</span><ins>+        -moz-border-radius: 4px;
+         -khtml-border-radius: 4px;
+         -webkit-border-radius: 4px;
+        border-radius: 4px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> .media-upload-form label,
</span><span class="cx"> .media-upload-form legend {
</span><span class="cx">         font-weight: bold;
</span><del>-        font-size: 13px;
</del><ins>+        font-size: 12px;
</ins><span class="cx">         color: #464646;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -341,3 +352,7 @@
</span><span class="cx">         height: 27px;
</span><span class="cx">         line-height: 26px;
</span><span class="cx"> }
</span><ins>+
+* html input {
+        border: 1px solid #ddd;
+}
</ins></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimageeditimagehtml"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html (12659 => 12660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2010-01-08 08:51:12 UTC (rev 12659)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/editimage.html        2010-01-08 13:06:17 UTC (rev 12660)
</span><span class="lines">@@ -4,10 +4,10 @@
</span><span class="cx"> &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
</span><span class="cx"> &lt;title&gt;&lt;/title&gt;
</span><span class="cx"> 
</span><del>-&lt;script type=&quot;text/javascript&quot; src=&quot;js/editimage.js?ver=3223&quot;&gt;&lt;/script&gt;
</del><ins>+&lt;script type=&quot;text/javascript&quot; src=&quot;js/editimage.js?ver=327&quot;&gt;&lt;/script&gt;
</ins><span class="cx"> &lt;script type=&quot;text/javascript&quot; src=&quot;../../utils/form_utils.js?ver=3223&quot;&gt;&lt;/script&gt;
</span><span class="cx"> 
</span><del>-&lt;link rel=&quot;stylesheet&quot; href=&quot;css/editimage.css?ver=3223&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
</del><ins>+&lt;link rel=&quot;stylesheet&quot; href=&quot;css/editimage.css?ver=327&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;script type=&quot;text/javascript&quot;&gt;
</span><span class="cx"> if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
</span><span class="lines">@@ -85,6 +85,17 @@
</span><span class="cx">                         &lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><span class="cx"> 
</span><ins>+                &lt;tr&gt;
+                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
+                                &lt;label for=&quot;img_alt&quot;&gt;
+                                &lt;span class=&quot;alignleft&quot;&gt;{#wpeditimage.alt}&lt;/span&gt;
+                                &lt;/label&gt;
+                        &lt;/th&gt;
+                        &lt;td class=&quot;field&quot;&gt;
+                                &lt;input type=&quot;text&quot; id=&quot;img_alt&quot; name=&quot;img_alt&quot; value=&quot;&quot; size=&quot;60&quot; /&gt;
+                        &lt;/td&gt;
+                &lt;/tr&gt;
+
</ins><span class="cx">                 &lt;tr id=&quot;cap_field&quot;&gt;
</span><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span><span class="cx">                                 &lt;label for=&quot;img_cap&quot;&gt;
</span><span class="lines">@@ -128,17 +139,6 @@
</span><span class="cx">                                 &lt;input type=&quot;text&quot; id=&quot;img_src&quot; name=&quot;img_src&quot; value=&quot;&quot; onblur=&quot;wpImage.checkVal(this)&quot; aria-required=&quot;true&quot; size=&quot;60&quot; /&gt;
</span><span class="cx">                         &lt;/td&gt;
</span><span class="cx">                 &lt;/tr&gt;
</span><del>-                
-                &lt;tr&gt;
-                        &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
-                                &lt;label for=&quot;img_alt&quot;&gt;
-                                &lt;span class=&quot;alignleft&quot;&gt;{#wpeditimage.alt}&lt;/span&gt;
-                                &lt;/label&gt;
-                        &lt;/th&gt;
-                        &lt;td class=&quot;field&quot;&gt;
-                                &lt;input type=&quot;text&quot; id=&quot;img_alt&quot; name=&quot;img_alt&quot; value=&quot;&quot; size=&quot;60&quot; /&gt;
-                        &lt;/td&gt;
-                &lt;/tr&gt;
</del><span class="cx"> 
</span><span class="cx">                 &lt;tr id=&quot;img_dim&quot;&gt;
</span><span class="cx">                         &lt;th valign=&quot;top&quot; scope=&quot;row&quot; class=&quot;label&quot;&gt;
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagedevjs"></a>
<div class="addfile"><h4>Added: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js (0 => 12660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js                                (rev 0)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js        2010-01-08 13:06:17 UTC (rev 12660)
</span><span class="lines">@@ -0,0 +1,613 @@
</span><ins>+
+var tinymce = null, tinyMCEPopup, tinyMCE, wpImage;
+
+tinyMCEPopup = {
+        init: function() {
+                var t = this, w, li, q, i, it;
+
+                li = ('' + document.location.search).replace(/^\?/, '').split('&amp;');
+                q = {};
+                for ( i = 0; i &lt; li.length; i++ ) {
+                        it = li[i].split('=');
+                        q[unescape(it[0])] = unescape(it[1]);
+                }
+
+                if (q.mce_rdomain)
+                        document.domain = q.mce_rdomain;
+
+                // Find window &amp; API
+                w = t.getWin();
+                tinymce = w.tinymce;
+                tinyMCE = w.tinyMCE;
+                t.editor = tinymce.EditorManager.activeEditor;
+                t.params = t.editor.windowManager.params;
+
+                // Setup local DOM
+                t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
+                t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
+        },
+
+        getWin : function() {
+                return window.dialogArguments || opener || parent || top;
+        },
+
+        getParam : function(n, dv) {
+                return this.editor.getParam(n, dv);
+        },
+
+        close : function() {
+                var t = this, win = t.getWin();
+
+                // To avoid domain relaxing issue in Opera
+                function close() {
+                        win.tb_remove();
+                        tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
+                };
+
+                if (tinymce.isOpera)
+                        win.setTimeout(close, 0);
+                else
+                        close();
+        },
+
+        execCommand : function(cmd, ui, val, a) {
+                a = a || {};
+                a.skip_focus = 1;
+
+                this.restoreSelection();
+                return this.editor.execCommand(cmd, ui, val, a);
+        },
+
+        storeSelection : function() {
+                this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
+        },
+
+        restoreSelection : function() {
+                var t = tinyMCEPopup;
+
+                if (tinymce.isIE)
+                        t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
+        }
+}
+tinyMCEPopup.init();
+
+wpImage = {
+        preInit : function() {
+                // import colors stylesheet from parent
+                var win = tinyMCEPopup.getWin(), styles = win.document.styleSheets, url, i;
+
+                for ( i = 0; i &lt; styles.length; i++ ) {
+                        url = styles.item(i).href;
+                        if ( url &amp;&amp; url.indexOf('colors') != -1 )
+                                document.write( '&lt;link rel=&quot;stylesheet&quot; href=&quot;'+url+'&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;' );
+                }
+        },
+
+        I : function(e) {
+                return document.getElementById(e);
+        },
+
+        current : '',
+        link : '',
+        link_rel : '',
+        target_value : '',
+        current_size_sel : 's100',
+        width : '',
+        height : '',
+        align : '',
+        img_alt : '',
+
+        setTabs : function(tab) {
+                var t = this;
+
+                if ( 'current' == tab.className ) return false;
+                t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
+                t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
+                t.I('tab_basic').className = t.I('tab_advanced').className = '';
+                tab.className = 'current';
+                return false;
+        },
+
+        img_seturl : function(u) {
+                var t = this, rel = t.I('link_rel').value;
+
+                if ( 'current' == u ) {
+                        t.I('link_href').value = t.current;
+                        t.I('link_rel').value = t.link_rel;
+                } else {
+                        t.I('link_href').value = t.link;
+                        if ( rel ) {
+                                rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
+                                t.I('link_rel').value = tinymce.trim(rel);
+                        }
+                }
+        },
+
+        imgAlignCls : function(v) {
+                var t = this, cls = t.I('img_classes').value;
+
+                t.I('img_demo').className = t.align = v;
+
+                cls = cls.replace( /align[^ &quot;']+/gi, '' );
+                cls += (' ' + v);
+                cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
+
+                if ( 'aligncenter' == v ) {
+                        t.I('hspace').value = '';
+                        t.updateStyle('hspace');
+                }
+
+                t.I('img_classes').value = cls;
+        },
+
+        showSize : function(el) {
+                var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
+
+                size = parseInt(id.substring(1)) / 200;
+                demo.width = Math.round(w * size);
+                demo.height = Math.round(h * size);
+
+                t.showSizeClear();
+                el.style.borderColor = '#A3A3A3';
+                el.style.backgroundColor = '#E5E5E5';
+        },
+
+        showSizeSet : function() {
+                var t = this, s130, s120, s110;
+
+                if ( (t.width * 1.3) &gt; parseInt(t.preloadImg.width) ) {
+                        s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
+
+                        s130.onclick = s120.onclick = s110.onclick = null;
+                        s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
+                        s130.style.color = s120.style.color = s110.style.color = '#aaa';
+                }
+        },
+
+        showSizeRem : function() {
+                var t = this, demo = t.I('img_demo'), f = document.forms[0];
+
+                demo.width = Math.round(f.width.value * 0.5);
+                demo.height = Math.round(f.height.value * 0.5);
+                t.showSizeClear();
+                t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
+                t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
+
+                return false;
+        },
+
+        showSizeClear : function() {
+                var divs = this.I('img_size').getElementsByTagName('div'), i;
+
+                for ( i = 0; i &lt; divs.length; i++ ) {
+                        divs[i].style.borderColor = '#f1f1f1';
+                        divs[i].style.backgroundColor = '#f1f1f1';
+                }
+        },
+
+        imgEditSize : function(el) {
+                var t = this, f = document.forms[0], W, H, w, h, id;
+
+                if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )
+                        return;
+                
+                W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
+
+                size = parseInt(id.substring(1)) / 100;
+
+                w = Math.round(w * size);
+                h = Math.round(h * size);
+
+                f.width.value = Math.min(W, w);
+                f.height.value = Math.min(H, h);
+
+                t.current_size_sel = id;
+                t.demoSetSize();
+        },
+
+        demoSetSize : function(img) {
+                var demo = this.I('img_demo'), f = document.forms[0];
+
+                demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
+                demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
+        },
+
+        demoSetStyle : function() {
+                var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
+
+                if (demo) {
+                        dom.setAttrib(demo, 'style', f.img_style.value);
+                        dom.setStyle(demo, 'width', '');
+                        dom.setStyle(demo, 'height', '');
+                }
+        },
+
+        origSize : function() {
+                var t = this, f = document.forms[0], el = t.I('s100');
+
+                f.width.value = t.width = t.preloadImg.width;
+                f.height.value = t.height = t.preloadImg.height;
+                t.showSizeSet();
+                t.demoSetSize();
+                t.showSize(el);
+        },
+
+        init : function() {
+                var ed = tinyMCEPopup.editor, h;
+
+                h = document.body.innerHTML;
+                document.body.innerHTML = ed.translate(h);
+                window.setTimeout( function(){wpImage.setup();}, 500 );
+        },
+
+        setup : function() {
+                var t = this, c, el, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor,
+                        d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '', dlc, pa;
+
+                document.dir = tinyMCEPopup.editor.getParam('directionality','');
+
+                if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
+                        t.I('cap_field').style.display = 'none';
+
+                tinyMCEPopup.restoreSelection();
+                el = ed.selection.getNode();
+                if (el.nodeName != 'IMG')
+                        return;
+
+                f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
+                ed.dom.setStyle(el, 'float', '');
+                t.getImageData();
+                c = ed.dom.getAttrib(el, 'class');
+
+                if ( DL = dom.getParent(el, 'dl') ) {
+                        dlc = ed.dom.getAttrib(DL, 'class');
+                        dlc = dlc.match(/align[^ &quot;']+/i);
+                        if ( dlc &amp;&amp; ! dom.hasClass(el, dlc) ) {
+                                c += ' '+dlc;
+                                tinymce.trim(c);
+                        }
+
+                        tinymce.each(DL.childNodes, function(e) {
+                                if ( e.nodeName == 'DD' &amp;&amp; dom.hasClass(e, 'wp-caption-dd') ) {
+                                        caption = e.innerHTML;
+                                        return;
+                                }
+                        });
+                }
+
+                f.img_cap.value = caption;
+                f.img_title.value = ed.dom.getAttrib(el, 'title');
+                f.img_alt.value = ed.dom.getAttrib(el, 'alt');
+                f.border.value = ed.dom.getAttrib(el, 'border');
+                f.vspace.value = ed.dom.getAttrib(el, 'vspace');
+                f.hspace.value = ed.dom.getAttrib(el, 'hspace');
+                f.align.value = ed.dom.getAttrib(el, 'align');
+                f.width.value = t.width = ed.dom.getAttrib(el, 'width');
+                f.height.value = t.height = ed.dom.getAttrib(el, 'height');
+                f.img_classes.value = c;
+                f.img_style.value = ed.dom.getAttrib(el, 'style');
+
+                // Move attribs to styles
+                if ( dom.getAttrib(el, 'hspace') )
+                        t.updateStyle('hspace');
+
+                if ( dom.getAttrib(el, 'border') )
+                        t.updateStyle('border');
+
+                if ( dom.getAttrib(el, 'vspace') )
+                        t.updateStyle('vspace');
+
+                if ( pa = ed.dom.getParent(el, 'A') ) {
+                        f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
+                        f.link_title.value = ed.dom.getAttrib(pa, 'title');
+                        f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
+                        f.link_style.value = ed.dom.getAttrib(pa, 'style');
+                        t.target_value = ed.dom.getAttrib(pa, 'target');
+                        f.link_classes.value = ed.dom.getAttrib(pa, 'class');
+                }
+
+                f.link_target.checked = ( t.target_value &amp;&amp; t.target_value == '_blank' ) ? 'checked' : '';
+
+                fname = link.substring( link.lastIndexOf('/') );
+                fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
+                t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
+
+                if ( c.indexOf('alignleft') != -1 ) {
+                        t.I('alignleft').checked = &quot;checked&quot;;
+                        d.className = t.align = &quot;alignleft&quot;;
+                } else if ( c.indexOf('aligncenter') != -1 ) {
+                        t.I('aligncenter').checked = &quot;checked&quot;;
+                        d.className = t.align = &quot;aligncenter&quot;;
+                } else if ( c.indexOf('alignright') != -1 ) {
+                        t.I('alignright').checked = &quot;checked&quot;;
+                        d.className = t.align = &quot;alignright&quot;;
+                } else if ( c.indexOf('alignnone') != -1 ) {
+                        t.I('alignnone').checked = &quot;checked&quot;;
+                        d.className = t.align = &quot;alignnone&quot;;
+                }
+
+                if ( t.width &amp;&amp; t.preloadImg.width ) t.showSizeSet();
+                document.body.style.display = '';
+        },
+
+        remove : function() {
+                var ed = tinyMCEPopup.editor, p, el;
+
+                tinyMCEPopup.restoreSelection();
+                el = ed.selection.getNode();
+                if (el.nodeName != 'IMG') return;
+
+                if ( (p = ed.dom.getParent(el, 'div')) &amp;&amp; ed.dom.hasClass(p, 'mceTemp') )
+                        ed.dom.remove(p);
+                else if ( (p = ed.dom.getParent(el, 'A')) &amp;&amp; p.childNodes.length == 1 )
+                        ed.dom.remove(p);
+                else ed.dom.remove(el);
+
+                ed.execCommand('mceRepaint');
+                tinyMCEPopup.close();
+                return;
+        },
+
+        update : function() {
+                var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null,
+                        DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html,
+                        id, cap_id = '', cap, DT, DD, cap_width, div_cls, lnk = '', pa, aa;
+
+                tinyMCEPopup.restoreSelection();
+                el = ed.selection.getNode();
+
+                if (el.nodeName != 'IMG') return;
+                if (f.img_src.value === '') {
+                        t.remove();
+                        return;
+                }
+
+                if ( f.img_cap.value != '' &amp;&amp; f.width.value != '' ) {
+                        do_caption = 1;
+                        img_class = img_class.replace( /align[^ &quot;']+\s?/gi, '' );
+                }
+
+                A = ed.dom.getParent(el, 'a');
+                P = ed.dom.getParent(el, 'p');
+                DL = ed.dom.getParent(el, 'dl');
+                DIV = ed.dom.getParent(el, 'div');
+
+                tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);
+
+                ed.dom.setAttribs(el, {
+                        src : f.img_src.value,
+                        title : f.img_title.value,
+                        alt : f.img_alt.value,
+                        width : f.width.value,
+                        height : f.height.value,
+                        style : f.img_style.value,
+                        'class' : img_class
+                });
+
+                if ( f.link_href.value ) {
+                        // Create new anchor elements
+                        if ( A == null ) {
+                                if ( ! f.link_href.value.match(/https?:\/\//i) )
+                                        f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
+
+                                if ( tinymce.isWebKit &amp;&amp; ed.dom.hasClass(el, 'aligncenter') ) {
+                                        ed.dom.removeClass(el, 'aligncenter');
+                                        fixSafari = 1;
+                                }
+
+                                tinyMCEPopup.execCommand(&quot;CreateLink&quot;, false, &quot;#mce_temp_url#&quot;, {skip_undo : 1});
+                                if ( fixSafari ) ed.dom.addClass(el, 'aligncenter');
+
+                                tinymce.each(ed.dom.select(&quot;a&quot;), function(n) {
+                                        if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+
+                                                ed.dom.setAttribs(n, {
+                                                        href : f.link_href.value,
+                                                        title : f.link_title.value,
+                                                        rel : f.link_rel.value,
+                                                        target : (f.link_target.checked == true) ? '_blank' : '',
+                                                        'class' : f.link_classes.value,
+                                                        style : f.link_style.value
+                                                });
+                                        }
+                                });
+                        } else {
+                                ed.dom.setAttribs(A, {
+                                        href : f.link_href.value,
+                                        title : f.link_title.value,
+                                        rel : f.link_rel.value,
+                                        target : (f.link_target.checked == true) ? '_blank' : '',
+                                        'class' : f.link_classes.value,
+                                        style : f.link_style.value
+                                });
+                        }
+                }
+
+                if ( do_caption ) {
+                        cap_width = 10 + parseInt(f.width.value);
+                        div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
+
+                        if ( DL ) {
+                                ed.dom.setAttribs(DL, {
+                                        'class' : 'wp-caption '+t.align,
+                                        style : 'width: '+cap_width+'px;'
+                                });
+
+                                if ( DIV )
+                                        ed.dom.setAttrib(DIV, 'class', div_cls);
+
+                                if ( (DT = ed.dom.getParent(el, 'dt')) &amp;&amp; (DD = DT.nextSibling) &amp;&amp; ed.dom.hasClass(DD, 'wp-caption-dd') )
+                                        ed.dom.setHTML(DD, f.img_cap.value);
+
+                        } else {
+                                if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) &amp;&amp; id[1] )
+                                        cap_id = 'attachment_'+id[1];
+
+                                if ( f.link_href.value &amp;&amp; (lnk = ed.dom.getParent(el, 'a')) ) {
+                                        if ( lnk.childNodes.length == 1 )
+                                                html = ed.dom.getOuterHTML(lnk);
+                                        else {
+                                                html = ed.dom.getOuterHTML(lnk);
+                                                html = html.match(/&lt;a[^&gt;]+&gt;/i);
+                                                html = html+ed.dom.getOuterHTML(el)+'&lt;/a&gt;';
+                                        }
+                                } else html = ed.dom.getOuterHTML(el);
+
+                                html = '&lt;dl id=&quot;'+cap_id+'&quot; class=&quot;wp-caption '+t.align+'&quot; style=&quot;width: '+cap_width+
+                                'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+html+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+f.img_cap.value+'&lt;/dd&gt;&lt;/dl&gt;';
+
+                                cap = ed.dom.create('div', {'class': div_cls}, html);
+
+                                if ( P ) {
+                                        P.parentNode.insertBefore(cap, P);
+                                        if ( P.childNodes.length == 1 )
+                                                ed.dom.remove(P);
+                                        else if ( lnk &amp;&amp; lnk.childNodes.length == 1 )
+                                                ed.dom.remove(lnk);
+                                        else ed.dom.remove(el);
+                                } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
+                                        pa.appendChild(cap);
+                                        if ( lnk &amp;&amp; lnk.childNodes.length == 1 )
+                                                ed.dom.remove(lnk);
+                                        else ed.dom.remove(el);
+                                }
+                        }
+
+                } else {
+                        if ( DL &amp;&amp; DIV ) {
+                                if ( f.link_href.value &amp;&amp; (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
+                                else html = ed.dom.getOuterHTML(el);
+
+                                P = ed.dom.create('p', {}, html);
+                                DIV.parentNode.insertBefore(P, DIV);
+                                ed.dom.remove(DIV);
+                        }
+                }
+
+                if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
+                        if ( P &amp;&amp; ( ! P.style || P.style.textAlign != 'center' ) )
+                                ed.dom.setStyle(P, 'textAlign', 'center');
+                } else {
+                        if ( P &amp;&amp; P.style &amp;&amp; P.style.textAlign == 'center' )
+                                ed.dom.setStyle(P, 'textAlign', '');
+                }
+
+                if ( ! f.link_href.value &amp;&amp; A ) {
+                        b = ed.selection.getBookmark();
+                        ed.dom.remove(A, 1);
+                        ed.selection.moveToBookmark(b);
+                }
+
+                tinyMCEPopup.execCommand(&quot;mceEndUndoLevel&quot;);
+                ed.execCommand('mceRepaint');
+                tinyMCEPopup.close();
+        },
+
+        updateStyle : function(ty) {
+                var dom = tinyMCEPopup.dom, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
+
+                if (tinyMCEPopup.editor.settings.inline_styles) {
+                        // Handle align
+                        if (ty == 'align') {
+                                dom.setStyle(img, 'float', '');
+                                dom.setStyle(img, 'vertical-align', '');
+
+                                v = f.align.value;
+                                if (v) {
+                                        if (v == 'left' || v == 'right')
+                                                dom.setStyle(img, 'float', v);
+                                        else
+                                                img.style.verticalAlign = v;
+                                }
+                        }
+
+                        // Handle border
+                        if (ty == 'border') {
+                                dom.setStyle(img, 'border', '');
+
+                                v = f.border.value;
+                                if (v || v == '0') {
+                                        if (v == '0')
+                                                img.style.border = '0';
+                                        else
+                                                img.style.border = v + 'px solid black';
+                                }
+                        }
+
+                        // Handle hspace
+                        if (ty == 'hspace') {
+                                dom.setStyle(img, 'marginLeft', '');
+                                dom.setStyle(img, 'marginRight', '');
+
+                                v = f.hspace.value;
+                                if (v) {
+                                        img.style.marginLeft = v + 'px';
+                                        img.style.marginRight = v + 'px';
+                                }
+                        }
+
+                        // Handle vspace
+                        if (ty == 'vspace') {
+                                dom.setStyle(img, 'marginTop', '');
+                                dom.setStyle(img, 'marginBottom', '');
+
+                                v = f.vspace.value;
+                                if (v) {
+                                        img.style.marginTop = v + 'px';
+                                        img.style.marginBottom = v + 'px';
+                                }
+                        }
+
+                        // Merge
+                        f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
+                        this.demoSetStyle();
+                }
+        },
+
+        checkVal : function(f) {
+
+                if ( f.value == '' ) {
+        //                if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
+        //                if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
+                        if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
+                }
+        },
+
+        resetImageData : function() {
+                var f = document.forms[0];
+
+                f.width.value = f.height.value = '';
+        },
+
+        updateImageData : function() {
+                var f = document.forms[0], t = wpImage, w = f.width.value, h = f.height.value;
+
+                if ( !w &amp;&amp; h )
+                        w = f.width.value = t.width = Math.round( t.preloadImg.width / (t.preloadImg.height / h) );
+                else if ( w &amp;&amp; !h )
+                        h = f.height.value = t.height = Math.round( t.preloadImg.height / (t.preloadImg.width / w) );
+
+                if ( !w )
+                        f.width.value = t.width = t.preloadImg.width;
+
+                if ( !h )
+                        f.height.value = t.height = t.preloadImg.height;
+
+                t.showSizeSet();
+                t.demoSetSize();
+                if ( f.img_style.value )
+                        t.demoSetStyle();
+        },
+
+        getImageData : function() {
+                var t = wpImage, f = document.forms[0];
+
+                t.preloadImg = new Image();
+                t.preloadImg.onload = t.updateImageData;
+                t.preloadImg.onerror = t.resetImageData;
+                t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
+        }
+};
+
+window.onload = function(){wpImage.init();}
+wpImage.preInit();
</ins><span class="cx">Property changes on: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.dev.js
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx">   + native
</span></span></pre></div>
<a id="trunkwpincludesjstinymcepluginswpeditimagejseditimagejs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js (12659 => 12660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2010-01-08 08:51:12 UTC (rev 12659)
+++ trunk/wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js        2010-01-08 13:06:17 UTC (rev 12660)
</span><span class="lines">@@ -1,607 +1 @@
</span><del>-
-var tinymce = null, tinyMCEPopup, tinyMCE;
-
-tinyMCEPopup = {
-        init: function() {
-                var t = this, w, ti, li, q, i, it;
-
-                li = ('' + document.location.search).replace(/^\?/, '').split('&amp;');
-                q = {};
-                for (i=0; i&lt;li.length; i++) {
-                        it = li[i].split('=');
-                        q[unescape(it[0])] = unescape(it[1]);
-                }
-
-                if (q.mce_rdomain)
-                        document.domain = q.mce_rdomain;
-
-                // Find window &amp; API
-                w = t.getWin();
-                tinymce = w.tinymce;
-                tinyMCE = w.tinyMCE;
-                t.editor = tinymce.EditorManager.activeEditor;
-                t.params = t.editor.windowManager.params;
-
-                // Setup local DOM
-                t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
-                t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
-        },
-
-        getWin : function() {
-                return window.dialogArguments || opener || parent || top;
-        },
-
-        getParam : function(n, dv) {
-                return this.editor.getParam(n, dv);
-        },
-
-        close : function() {
-                var t = this, win = t.getWin();
-
-                // To avoid domain relaxing issue in Opera
-                function close() {
-                        win.tb_remove();
-                        tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
-                };
-
-                if (tinymce.isOpera)
-                        win.setTimeout(close, 0);
-                else
-                        close();
-        },
-
-        execCommand : function(cmd, ui, val, a) {
-                a = a || {};
-                a.skip_focus = 1;
-
-                this.restoreSelection();
-                return this.editor.execCommand(cmd, ui, val, a);
-        },
-
-        storeSelection : function() {
-                this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
-        },
-
-        restoreSelection : function() {
-                var t = tinyMCEPopup;
-
-                if (tinymce.isIE)
-                        t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
-        }
-}
-tinyMCEPopup.init();
-
-var wpImage = {
-        preInit : function() {
-                // import colors stylesheet from parent
-                var win = tinyMCEPopup.getWin();
-                var styles = win.document.styleSheets;
-
-                for ( i = 0; i &lt; styles.length; i++ ) {
-                        var url = styles.item(i).href;
-                        if ( url &amp;&amp; url.indexOf('colors') != -1 )
-                                document.write( '&lt;link rel=&quot;stylesheet&quot; href=&quot;'+url+'&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;' );
-                }
-        },
-
-        I : function(e) {
-                return document.getElementById(e);
-        },
-
-        current : '',
-        link : '',
-        link_rel : '',
-        target_value : '',
-        current_size_sel : 's100',
-        width : '',
-        height : '',
-        align : '',
-        img_alt : '',
-
-        setTabs : function(tab) {
-                var t = this;
-
-                if ( 'current' == tab.className ) return false;
-                t.I('div_advanced').style.display = ( 'tab_advanced' == tab.id ) ? 'block' : 'none';
-                t.I('div_basic').style.display = ( 'tab_basic' == tab.id ) ? 'block' : 'none';
-                t.I('tab_basic').className = t.I('tab_advanced').className = '';
-                tab.className = 'current';
-                return false;
-        },
-
-        img_seturl : function(u) {
-                var t = this, rel = t.I('link_rel').value;
-
-                if ( 'current' == u ) {
-                        t.I('link_href').value = t.current;
-                        t.I('link_rel').value = t.link_rel;
-                } else {
-                        t.I('link_href').value = t.link;
-                        if ( rel ) {
-                                rel = rel.replace( /attachment|wp-att-[0-9]+/gi, '' );
-                                t.I('link_rel').value = tinymce.trim(rel);
-                        }
-                }
-        },
-
-        imgAlignCls : function(v) {
-                var t = this, cls = t.I('img_classes').value;
-
-                t.I('img_demo').className = t.align = v;
-
-                cls = cls.replace( /align[^ &quot;']+/gi, '' );
-                cls += (' ' + v);
-                cls = cls.replace( /\s+/g, ' ' ).replace( /^\s/, '' );
-
-                if ( 'aligncenter' == v ) {
-                        t.I('hspace').value = '';
-                        t.updateStyle('hspace');
-                }
-
-                t.I('img_classes').value = cls;
-        },
-
-        showSize : function(el) {
-                var t = this, demo = t.I('img_demo'), w = t.width, h = t.height, id = el.id || 's100', size;
-
-                size = parseInt(id.substring(1)) / 200;
-                demo.width = Math.round(w * size);
-                demo.height = Math.round(h * size);
-
-                t.showSizeClear();
-                el.style.borderColor = '#A3A3A3';
-                el.style.backgroundColor = '#E5E5E5';
-        },
-
-        showSizeSet : function() {
-                var t = this;
-
-                if ( (t.width * 1.3) &gt; parseInt(t.preloadImg.width) ) {
-                        var s130 = t.I('s130'), s120 = t.I('s120'), s110 = t.I('s110');
-
-                        s130.onclick = s120.onclick = s110.onclick = null;
-                        s130.onmouseover = s120.onmouseover = s110.onmouseover = null;
-                        s130.style.color = s120.style.color = s110.style.color = '#aaa';
-                }
-        },
-
-        showSizeRem : function() {
-                var t = this, demo = t.I('img_demo'), f = document.forms[0];
-
-                demo.width = Math.round(f.width.value * 0.5);
-                demo.height = Math.round(f.height.value * 0.5);
-                t.showSizeClear();
-                t.I(t.current_size_sel).style.borderColor = '#A3A3A3';
-                t.I(t.current_size_sel).style.backgroundColor = '#E5E5E5';
-
-                return false;
-        },
-
-        showSizeClear : function() {
-                var divs = this.I('img_size').getElementsByTagName('div');
-
-                for ( i = 0; i &lt; divs.length; i++ ) {
-                        divs[i].style.borderColor = '#f1f1f1';
-                        divs[i].style.backgroundColor = '#f1f1f1';
-                }
-        },
-
-        imgEditSize : function(el) {
-                var t = this, f = document.forms[0];
-
-                if ( ! t.preloadImg || ! t.preloadImg.width || ! t.preloadImg.height )        return;
-                var W = parseInt(t.preloadImg.width), H = parseInt(t.preloadImg.height), w = t.width || W, h = t.height || H, id = el.id || 's100';
-
-                size = parseInt(id.substring(1)) / 100;
-
-                w = Math.round(w * size);
-                h = Math.round(h * size);
-
-                f.width.value = Math.min(W, w);
-                f.height.value = Math.min(H, h);
-
-                t.current_size_sel = id;
-                t.demoSetSize();
-        },
-
-        demoSetSize : function(img) {
-                var demo = this.I('img_demo'), f = document.forms[0];
-
-                demo.width = f.width.value ? Math.round(f.width.value * 0.5) : '';
-                demo.height = f.height.value ? Math.round(f.height.value * 0.5) : '';
-        },
-
-        demoSetStyle : function() {
-                var f = document.forms[0], demo = this.I('img_demo'), dom = tinyMCEPopup.editor.dom;
-
-                if (demo) {
-                        dom.setAttrib(demo, 'style', f.img_style.value);
-                        dom.setStyle(demo, 'width', '');
-                        dom.setStyle(demo, 'height', '');
-                }
-        },
-
-        origSize : function() {
-                var t = this, f = document.forms[0], el = t.I('s100');
-
-                f.width.value = t.width = t.preloadImg.width;
-                f.height.value = t.height = t.preloadImg.height;
-                t.showSizeSet();
-                t.demoSetSize();
-                t.showSize(el);
-        },
-
-        init : function() {
-                var ed = tinyMCEPopup.editor, h;
-
-                h = document.body.innerHTML;
-
-                // Replace a=x with a=&quot;x&quot; in IE
-                if (tinymce.isIE)
-                        h = h.replace(/ (value|title|alt)=([^&quot;][^\s&gt;]+)/gi, ' $1=&quot;$2&quot;')
-
-                document.body.innerHTML = ed.translate(h);
-                window.setTimeout( function(){wpImage.setup();}, 100 );
-        },
-
-        setup : function() {
-                var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = '';
-                document.dir = tinyMCEPopup.editor.getParam('directionality','');
-
-                if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
-                        t.I('cap_field').style.display = 'none';
-
-                tinyMCEPopup.restoreSelection();
-                el = ed.selection.getNode();
-                if (el.nodeName != 'IMG') return;
-
-                f.img_src.value = d.src = link = ed.dom.getAttrib(el, 'src');
-                ed.dom.setStyle(el, 'float', '');
-                t.getImageData();
-                c = ed.dom.getAttrib(el, 'class');
-
-                if ( DL = dom.getParent(el, 'dl') ) {
-                        var dlc = ed.dom.getAttrib(DL, 'class');
-                        dlc = dlc.match(/align[^ &quot;']+/i);
-                        if ( dlc &amp;&amp; ! dom.hasClass(el, dlc) ) {
-                                c += ' '+dlc;
-                                tinymce.trim(c);
-                        }
-
-                        tinymce.each(DL.childNodes, function(e) {
-                                if ( e.nodeName == 'DD' &amp;&amp; dom.hasClass(e, 'wp-caption-dd') ) {
-                                        caption = e.innerHTML;
-                                        return;
-                                }
-                        });
-                }
-
-                f.img_cap.value = caption;
-                f.img_title.value = ed.dom.getAttrib(el, 'title');
-                f.img_alt.value = ed.dom.getAttrib(el, 'alt');
-                f.border.value = ed.dom.getAttrib(el, 'border');
-                f.vspace.value = ed.dom.getAttrib(el, 'vspace');
-                f.hspace.value = ed.dom.getAttrib(el, 'hspace');
-                f.align.value = ed.dom.getAttrib(el, 'align');
-                f.width.value = t.width = ed.dom.getAttrib(el, 'width');
-                f.height.value = t.height = ed.dom.getAttrib(el, 'height');
-                f.img_classes.value = c;
-                f.img_style.value = ed.dom.getAttrib(el, 'style');
-
-                // Move attribs to styles
-                if (dom.getAttrib(el, 'hspace'))
-                        t.updateStyle('hspace');
-
-                if (dom.getAttrib(el, 'border'))
-                        t.updateStyle('border');
-
-                if (dom.getAttrib(el, 'vspace'))
-                        t.updateStyle('vspace');
-
-                if (pa = ed.dom.getParent(el, 'A')) {
-                        f.link_href.value = t.current = ed.dom.getAttrib(pa, 'href');
-                        f.link_title.value = ed.dom.getAttrib(pa, 'title');
-                        f.link_rel.value = t.link_rel = ed.dom.getAttrib(pa, 'rel');
-                        f.link_style.value = ed.dom.getAttrib(pa, 'style');
-                        t.target_value = ed.dom.getAttrib(pa, 'target');
-                        f.link_classes.value = ed.dom.getAttrib(pa, 'class');
-                }
-
-                f.link_target.checked = ( t.target_value &amp;&amp; t.target_value == '_blank' ) ? 'checked' : '';
-
-                fname = link.substring( link.lastIndexOf('/') );
-                fname = fname.replace(/-[0-9]{2,4}x[0-9]{2,4}/, '' );
-                t.link = link.substring( 0, link.lastIndexOf('/') ) + fname;
-
-                if ( c.indexOf('alignleft') != -1 ) {
-                        t.I('alignleft').checked = &quot;checked&quot;;
-                        d.className = t.align = &quot;alignleft&quot;;
-                } else if ( c.indexOf('aligncenter') != -1 ) {
-                        t.I('aligncenter').checked = &quot;checked&quot;;
-                        d.className = t.align = &quot;aligncenter&quot;;
-                } else if ( c.indexOf('alignright') != -1 ) {
-                        t.I('alignright').checked = &quot;checked&quot;;
-                        d.className = t.align = &quot;alignright&quot;;
-                } else if ( c.indexOf('alignnone') != -1 ) {
-                        t.I('alignnone').checked = &quot;checked&quot;;
-                        d.className = t.align = &quot;alignnone&quot;;
-                }
-
-                if ( t.width &amp;&amp; t.preloadImg.width ) t.showSizeSet();
-                document.body.style.display = '';
-        },
-
-        remove : function() {
-                var ed = tinyMCEPopup.editor, p, el;
-
-                tinyMCEPopup.restoreSelection();
-                el = ed.selection.getNode();
-                if (el.nodeName != 'IMG') return;
-
-                if ( (p = ed.dom.getParent(el, 'div')) &amp;&amp; ed.dom.hasClass(p, 'mceTemp') )
-                        ed.dom.remove(p);
-                else if ( (p = ed.dom.getParent(el, 'A')) &amp;&amp; p.childNodes.length == 1 )
-                        ed.dom.remove(p);
-                else ed.dom.remove(el);
-
-                ed.execCommand('mceRepaint');
-                tinyMCEPopup.close();
-                return;
-        },
-
-        update : function() {
-                var t = this, f = document.forms[0], ed = tinyMCEPopup.editor, el, b, fixSafari = null, DL, P, A, DIV, do_caption = null, img_class = f.img_classes.value, html;
-
-                tinyMCEPopup.restoreSelection();
-                el = ed.selection.getNode();
-
-                if (el.nodeName != 'IMG') return;
-                if (f.img_src.value === '') {
-                        t.remove();
-                        return;
-                }
-
-                if ( f.img_cap.value != '' &amp;&amp; f.width.value != '' ) {
-                        do_caption = 1;
-                        img_class = img_class.replace( /align[^ &quot;']+\s?/gi, '' );
-                }
-
-                A = ed.dom.getParent(el, 'a');
-                P = ed.dom.getParent(el, 'p');
-                DL = ed.dom.getParent(el, 'dl');
-                DIV = ed.dom.getParent(el, 'div');
-
-                tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);
-
-                ed.dom.setAttribs(el, {
-                        src : f.img_src.value,
-                        title : f.img_title.value,
-                        alt : f.img_alt.value,
-                        width : f.width.value,
-                        height : f.height.value,
-                        style : f.img_style.value,
-                        'class' : img_class
-                });
-
-                if ( f.link_href.value ) {
-                        // Create new anchor elements
-                        if ( A == null ) {
-                                if ( ! f.link_href.value.match(/https?:\/\//i) )
-                                        f.link_href.value = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.link_href.value);
-
-                                if ( tinymce.isWebKit &amp;&amp; ed.dom.hasClass(el, 'aligncenter') ) {
-                                        ed.dom.removeClass(el, 'aligncenter');
-                                        fixSafari = 1;
-                                }
-
-                                tinyMCEPopup.execCommand(&quot;CreateLink&quot;, false, &quot;#mce_temp_url#&quot;, {skip_undo : 1});
-                                if ( fixSafari ) ed.dom.addClass(el, 'aligncenter');
-
-                                tinymce.each(ed.dom.select(&quot;a&quot;), function(n) {
-                                        if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
-
-                                                ed.dom.setAttribs(n, {
-                                                        href : f.link_href.value,
-                                                        title : f.link_title.value,
-                                                        rel : f.link_rel.value,
-                                                        target : (f.link_target.checked == true) ? '_blank' : '',
-                                                        'class' : f.link_classes.value,
-                                                        style : f.link_style.value
-                                                });
-                                        }
-                                });
-                        } else {
-                                ed.dom.setAttribs(A, {
-                                        href : f.link_href.value,
-                                        title : f.link_title.value,
-                                        rel : f.link_rel.value,
-                                        target : (f.link_target.checked == true) ? '_blank' : '',
-                                        'class' : f.link_classes.value,
-                                        style : f.link_style.value
-                                });
-                        }
-                }
-
-                if ( do_caption ) {
-                        var id, cap_id = '', cap, DT, DD, cap_width = 10 + parseInt(f.width.value), align = t.align.substring(5), div_cls = (t.align == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp';
-
-                        if ( DL ) {
-                                ed.dom.setAttribs(DL, {
-                                        'class' : 'wp-caption '+t.align,
-                                        style : 'width: '+cap_width+'px;'
-                                });
-
-                                if ( DIV )
-                                        ed.dom.setAttrib(DIV, 'class', div_cls);
-
-                                if ( (DT = ed.dom.getParent(el, 'dt')) &amp;&amp; (DD = DT.nextSibling) &amp;&amp; ed.dom.hasClass(DD, 'wp-caption-dd') )
-                                        ed.dom.setHTML(DD, f.img_cap.value);
-
-                        } else {
-                                var lnk = '', pa;
-                                if ( (id = f.img_classes.value.match( /wp-image-([0-9]{1,6})/ )) &amp;&amp; id[1] )
-                                        cap_id = 'attachment_'+id[1];
-
-                                if ( f.link_href.value &amp;&amp; (lnk = ed.dom.getParent(el, 'a')) ) {
-                                        if ( lnk.childNodes.length == 1 )
-                                                html = ed.dom.getOuterHTML(lnk);
-                                        else {
-                                                html = ed.dom.getOuterHTML(lnk);
-                                                html = html.match(/&lt;a[^&gt;]+&gt;/i);
-                                                html = html+ed.dom.getOuterHTML(el)+'&lt;/a&gt;';
-                                        }
-                                } else html = ed.dom.getOuterHTML(el);
-
-                                html = '&lt;dl id=&quot;'+cap_id+'&quot; class=&quot;wp-caption '+t.align+'&quot; style=&quot;width: '+cap_width+
-                                'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+html+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+f.img_cap.value+'&lt;/dd&gt;&lt;/dl&gt;';
-
-                                cap = ed.dom.create('div', {'class': div_cls}, html);
-
-                                if ( P ) {
-                                        P.parentNode.insertBefore(cap, P);
-                                        if ( P.childNodes.length == 1 )
-                                                ed.dom.remove(P);
-                                        else if ( lnk &amp;&amp; lnk.childNodes.length == 1 )
-                                                ed.dom.remove(lnk);
-                                        else ed.dom.remove(el);
-                                } else if ( pa = ed.dom.getParent(el, 'TD,TH,LI') ) {
-                                        pa.appendChild(cap);
-                                        if ( lnk &amp;&amp; lnk.childNodes.length == 1 )
-                                                ed.dom.remove(lnk);
-                                        else ed.dom.remove(el);
-                                }
-                        }
-
-                } else {
-                        if ( DL &amp;&amp; DIV ) {
-                                var aa;
-                                if ( f.link_href.value &amp;&amp; (aa = ed.dom.getParent(el, 'a')) ) html = ed.dom.getOuterHTML(aa);
-                                else html = ed.dom.getOuterHTML(el);
-
-                                P = ed.dom.create('p', {}, html);
-                                DIV.parentNode.insertBefore(P, DIV);
-                                ed.dom.remove(DIV);
-                        }
-                }
-
-                if ( f.img_classes.value.indexOf('aligncenter') != -1 ) {
-                        if ( P &amp;&amp; ( ! P.style || P.style.textAlign != 'center' ) )
-                                ed.dom.setStyle(P, 'textAlign', 'center');
-                } else {
-                        if ( P &amp;&amp; P.style &amp;&amp; P.style.textAlign == 'center' )
-                                ed.dom.setStyle(P, 'textAlign', '');
-                }
-
-                if ( ! f.link_href.value &amp;&amp; A ) {
-                        b = ed.selection.getBookmark();
-                        ed.dom.remove(A, 1);
-                        ed.selection.moveToBookmark(b);
-                }
-
-                tinyMCEPopup.execCommand(&quot;mceEndUndoLevel&quot;);
-                ed.execCommand('mceRepaint');
-                tinyMCEPopup.close();
-        },
-
-        updateStyle : function(ty) {
-                var dom = tinyMCEPopup.dom, st, v, f = document.forms[0], img = dom.create('img', {style : f.img_style.value});
-
-                if (tinyMCEPopup.editor.settings.inline_styles) {
-                        // Handle align
-                        if (ty == 'align') {
-                                dom.setStyle(img, 'float', '');
-                                dom.setStyle(img, 'vertical-align', '');
-
-                                v = f.align.value;
-                                if (v) {
-                                        if (v == 'left' || v == 'right')
-                                                dom.setStyle(img, 'float', v);
-                                        else
-                                                img.style.verticalAlign = v;
-                                }
-                        }
-
-                        // Handle border
-                        if (ty == 'border') {
-                                dom.setStyle(img, 'border', '');
-
-                                v = f.border.value;
-                                if (v || v == '0') {
-                                        if (v == '0')
-                                                img.style.border = '0';
-                                        else
-                                                img.style.border = v + 'px solid black';
-                                }
-                        }
-
-                        // Handle hspace
-                        if (ty == 'hspace') {
-                                dom.setStyle(img, 'marginLeft', '');
-                                dom.setStyle(img, 'marginRight', '');
-
-                                v = f.hspace.value;
-                                if (v) {
-                                        img.style.marginLeft = v + 'px';
-                                        img.style.marginRight = v + 'px';
-                                }
-                        }
-
-                        // Handle vspace
-                        if (ty == 'vspace') {
-                                dom.setStyle(img, 'marginTop', '');
-                                dom.setStyle(img, 'marginBottom', '');
-
-                                v = f.vspace.value;
-                                if (v) {
-                                        img.style.marginTop = v + 'px';
-                                        img.style.marginBottom = v + 'px';
-                                }
-                        }
-
-                        // Merge
-                        f.img_style.value = dom.serializeStyle(dom.parseStyle(img.style.cssText));
-                        this.demoSetStyle();
-                }
-        },
-
-        checkVal : function(f) {
-
-                if ( f.value == '' ) {
-        //                if ( f.id == 'width' ) f.value = this.width || this.preloadImg.width;
-        //                if ( f.id == 'height' ) f.value = this.height || this.preloadImg.height;
-                        if ( f.id == 'img_src' ) f.value = this.I('img_demo').src || this.preloadImg.src;
-                }
-        },
-
-        resetImageData : function() {
-                var f = document.forms[0];
-
-                f.width.value = f.height.value = '';
-        },
-
-        updateImageData : function() {
-                var f = document.forms[0], t = wpImage;
-
-                if ( f.width.value == '' || f.height.value == '' ) {
-                        f.width.value = t.width = t.preloadImg.width;
-                        f.height.value = t.height = t.preloadImg.height;
-                }
-
-                t.showSizeSet();
-                t.demoSetSize();
-                if ( f.img_style.value )
-                        t.demoSetStyle();
-        },
-
-        getImageData : function() {
-                var t = wpImage, f = document.forms[0];
-
-                t.preloadImg = new Image();
-                t.preloadImg.onload = t.updateImageData;
-                t.preloadImg.onerror = t.resetImageData;
-                t.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.img_src.value);
-        }
-};
-
-window.onload = function(){wpImage.init();}
-wpImage.preInit();
</del><ins>+var tinymce=null,tinyMCEPopup,tinyMCE,wpImage;tinyMCEPopup={init:function(){var d=this,b,a,f,c,e;a=(&quot;&quot;+document.location.search).replace(/^\?/,&quot;&quot;).split(&quot;&amp;&quot;);f={};for(c=0;c&lt;a.length;c++){e=a[c].split(&quot;=&quot;);f[unescape(e[0])]=unescape(e[1])}if(f.mce_rdomain){document.domain=f.mce_rdomain}b=d.getWin();tinymce=b.tinymce;tinyMCE=b.tinyMCE;d.editor=tinymce.EditorManager.activeEditor;d.params=d.editor.windowManager.params;d.dom=d.editor.windowManager.createInstance(&quot;tinymce.dom.DOMUtils&quot;,document);d.editor.windowManager.onOpen.dispatch(d.editor.windowManager,window)},getWin:function(){return window.dialogArguments||opener||parent||top},getParam:function(b,a){return this.editor.getParam(b,a)},close:function(){var a=this,b=a.getWin();function c(){b.tb_remove();tinymce=tinyMCE=a.editor=a.dom=a.dom.doc=null}if(tinymce.isOpera){b.setTimeout(c,0)}else{c()}},execCommand:function(d,c,e,b){b=b||{};b.skip_focus=1;this.restoreSelection();return this.editor.execCommand(d,c,e,b)},storeSelection:function(){this.editor.windowManager.bookmark=tinyMCEPopup.editor.selection.getBookmark(&quot;simple&quot;)},restoreSelection:function(){var a=tinyMCEPopup;if(tinymce.isIE){a.editor.selection.moveToBookmark(a.editor.windowManager.bookmark)}}};tinyMCEPopup.init();wpImage={preInit:function(){var d=tinyMCEPopup.getWin(),c=d.document.styleSheets,a,b;for(b=0;b&lt;c.length;b++){a=c.item(b).href;if(a&amp;&amp;a.indexOf(&quot;colors&quot;)!=-1){document.write('&lt;link rel=&quot;stylesheet&quot; href=&quot;'+a+'&quot; type=&quot;text/css&quot; media=&quot;all&quot; /&gt;')}}},I:function(a){return document.getElementById(a)},current:&quot;&quot;,link:&quot;&quot;,link_rel:&quot;&quot;,target_value:&quot;&quot;,current_size_sel:&quot;s100&quot;,width:&quot;&quot;,height:&quot;&quot;,align:&quot;&quot;,img_alt:&quot;&quot;,setTabs:function(b){var a=this;if(&quot;current&quot;==b.className){return false}a.I(&quot;div_advanced&quot;).style.display=(&quot;tab_advanced&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;div_basic&quot;).style.display=(&quot;tab_basic&quot;==b.id)?&quot;block&quot;:&quot;none&quot;;a.I(&quot;tab_basic&quot;).className=a.I(&quot;tab_advanced&quot;).className=&quot;&quot;;b.className=&quot;current&quot;;return false},img_seturl:function(b){var c=this,a=c.I(&quot;link_rel&quot;).value;if(&quot;current&quot;==b){c.I(&quot;link_href&quot;).value=c.current;c.I(&quot;link_rel&quot;).value=c.link_rel}else{c.I(&quot;link_href&quot;).value=c.link;if(a){a=a.replace(/attachment|wp-att-[0-9]+/gi,&quot;&quot;);c.I(&quot;link_rel&quot;).value=tinymce.trim(a)}}},imgAlignCls:function(b){var c=this,a=c.I(&quot;img_classes&quot;).value;c.I(&quot;img_demo&quot;).className=c.align=b;a=a.replace(/align[^ &quot;']+/gi,&quot;&quot;);a+=(&quot; &quot;+b);a=a.replace(/\s+/g,&quot; &quot;).replace(/^\s/,&quot;&quot;);if(&quot;aligncenter&quot;==b){c.I(&quot;hspace&quot;).value=&quot;&quot;;c.updateStyle(&quot;hspace&quot;)}c.I(&quot;img_classes&quot;).value=a},showSize:function(e){var c=this,f=c.I(&quot;img_demo&quot;),a=c.width,d=c.height,g=e.id||&quot;s100&quot;,b;b=parseInt(g.substring(1))/200;f.width=Math.round(a*b);f.height=Math.round(d*b);c.showSizeClear();e.style.borderColor=&quot;#A3A3A3&quot;;e.style.backgroundColor=&quot;#E5E5E5&quot;},showSizeSet:function(){var b=this,d,c,a;if((b.width*1.3)&gt;parseInt(b.preloadImg.width)){d=b.I(&quot;s130&quot;),c=b.I(&quot;s120&quot;),a=b.I(&quot;s110&quot;);d.onclick=c.onclick=a.onclick=null;d.onmouseover=c.onmouseover=a.onmouseover=null;d.style.color=c.style.color=a.style.color=&quot;#aaa&quot;}},showSizeRem:function(){var a=this,c=a.I(&quot;img_demo&quot;),b=document.forms[0];c.width=Math.round(b.width.value*0.5);c.height=Math.round(b.height.value*0.5);a.showSizeClear();a.I(a.current_size_sel).style.borderColor=&quot;#A3A3A3&quot;;a.I(a.current_size_sel).style.backgroundColor=&quot;#E5E5E5&quot;;return false},showSizeClear:function(){var b=this.I(&quot;img_size&quot;).getElementsByTagName(&quot;div&quot;),a;for(a=0;a&lt;b.length;a++){b[a].style.borderColor=&quot;#f1f1f1&quot;;b[a].style.backgroundColor=&quot;#f1f1f1&quot;}},imgEditSize:function(g){var d=this,i=document.forms[0],a,c,b,e,j;if(!d.preloadImg||!d.preloadImg.width||!d.preloadImg.height){return}a=parseInt(d.preloadImg.width),c=parseInt(d.preloadImg.height),b=d.width||a,e=d.height||c,j=g.id||&quot;s100&quot;;size=parseInt(j.substring(1))/100;b=Math.round(b*size);e=Math.round(e*size);i.width.value=Math.min(a,b);i.height.value=Math.min(c,e);d.current_size_sel=j;d.demoSetSize()},demoSetSize:function(a){var c=this.I(&quot;img_demo&quot;),b=document.forms[0];c.width=b.width.value?Math.round(b.width.value*0.5):&quot;&quot;;c.height=b.height.value?Math.round(b.height.value*0.5):&quot;&quot;},demoSetStyle:function(){var b=document.forms[0],a=this.I(&quot;img_demo&quot;),c=tinyMCEPopup.editor.dom;if(a){c.setAttrib(a,&quot;style&quot;,b.img_style.value);c.setStyle(a,&quot;width&quot;,&quot;&quot;);c.setStyle(a,&quot;height&quot;,&quot;&quot;)}},origSize:function(){var a=this,c=document.forms[0],b=a.I(&quot;s100&quot;);c.width.value=a.width=a.preloadImg.width;c.height.value=a.height=a.preloadImg.height;a.showSizeSet();a.demoSetSize();a.showSize(b)},init:function(){var a=tinyMCEPopup.editor,b;b=document.body.innerHTML;document.body.innerHTML=a.translate(b);window.setTimeout(function(){wpImage.setup()},500)},setup:function(){var p=this,k,b,l,e,i=document.forms[0],h=tinyMCEPopup.editor,j=p.I(&quot;img_demo&quot;),g=tinyMCEPopup.dom,a,o=&quot;&quot;,n,m;document.dir=tinyMCEPopup.editor.getParam(&quot;directionality&quot;,&quot;&quot;);if(tinyMCEPopup.editor.getParam(&quot;wpeditimage_disable_captions&quot;,false)){p.I(&quot;cap_field&quot;).style.display=&quot;none&quot;}tinyMCEPopup.restoreSelection();b=h.selection.getNode();if(b.nodeName!=&quot;IMG&quot;){return}i.img_src.value=j.src=l=h.dom.getAttrib(b,&quot;src&quot;);h.dom.setStyle(b,&quot;float&quot;,&quot;&quot;);p.getImageData();k=h.dom.getAttrib(b,&quot;class&quot;);if(a=g.getParent(b,&quot;dl&quot;)){n=h.dom.getAttrib(a,&quot;class&quot;);n=n.match(/align[^ &quot;']+/i);if(n&amp;&amp;!g.hasClass(b,n)){k+=&quot; &quot;+n;tinymce.trim(k)}tinymce.each(a.childNodes,function(c){if(c.nodeName==&quot;DD&quot;&amp;&amp;g.hasClass(c,&quot;wp-caption-dd&quot;)){o=c.innerHTML;return}})}i.img_cap.value=o;i.img_title.value=h.dom.getAttrib(b,&quot;title&quot;);i.img_alt.value=h.dom.getAttrib(b,&quot;alt&quot;);i.border.value=h.dom.getAttrib(b,&quot;border&quot;);i.vspace.value=h.dom.getAttrib(b,&quot;vspace&quot;);i.hspace.value=h.dom.getAttrib(b,&quot;hspace&quot;);i.align.value=h.dom.getAttrib(b,&quot;align&quot;);i.width.value=p.width=h.dom.getAttrib(b,&quot;width&quot;);i.height.value=p.height=h.dom.getAttrib(b,&quot;height&quot;);i.img_classes.value=k;i.img_style.value=h.dom.getAttrib(b,&quot;style&quot;);if(g.getAttrib(b,&quot;hspace&quot;)){p.updateStyle(&quot;hspace&quot;)}if(g.getAttrib(b,&quot;border&quot;)){p.updateStyle(&quot;border&quot;)}if(g.getAttrib(b,&quot;vspace&quot;)){p.updateStyle(&quot;vspace&quot;)}if(m=h.dom.getParent(b,&quot;A&quot;)){i.link_href.value=p.current=h.dom.getAttrib(m,&quot;href&quot;);i.link_title.value=h.dom.getAttrib(m,&quot;title&quot;);i.link_rel.value=p.link_rel=h.dom.getAttrib(m,&quot;rel&quot;);i.link_style.value=h.dom.getAttrib(m,&quot;style&quot;);p.target_value=h.dom.getAttrib(m,&quot;target&quot;);i.link_classes.value=h.dom.getAttrib(m,&quot;class&quot;)}i.link_target.checked=(p.target_value&amp;&amp;p.target_value==&quot;_blank&quot;)?&quot;checked&quot;:&quot;&quot;;e=l.substring(l.lastIndexOf(&quot;/&quot;));e=e.replace(/-[0-9]{2,4}x[0-9]{2,4}/,&quot;&quot;);p.link=l.substring(0,l.lastIndexOf(&quot;/&quot;))+e;if(k.indexOf(&quot;alignleft&quot;)!=-1){p.I(&quot;alignleft&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignleft&quot;}else{if(k.indexOf(&quot;aligncenter&quot;)!=-1){p.I(&quot;aligncenter&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;aligncenter&quot;}else{if(k.indexOf(&quot;alignright&quot;)!=-1){p.I(&quot;alignright&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignright&quot;}else{if(k.indexOf(&quot;alignnone&quot;)!=-1){p.I(&quot;alignnone&quot;).checked=&quot;checked&quot;;j.className=p.align=&quot;alignnone&quot;}}}}if(p.width&amp;&amp;p.preloadImg.width){p.showSizeSet()}document.body.style.display=&quot;&quot;},remove:function(){var a=tinyMCEPopup.editor,c,b;tinyMCEPopup.restoreSelection();b=a.selection.getNode();if(b.nodeName!=&quot;IMG&quot;){return}if((c=a.dom.getParent(b,&quot;div&quot;))&amp;&amp;a.dom.hasClass(c,&quot;mceTemp&quot;)){a.dom.remove(c)}else{if((c=a.dom.getParent(b,&quot;A&quot;))&amp;&amp;c.childNodes.length==1){a.dom.remove(c)}else{a.dom.remove(b)}}a.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close();return},update:function(){var m=this,v=document.forms[0],g=tinyMCEPopup.editor,e,x,d=null,n,h,p,r,o=null,k=v.img_classes.value,l,q,u=&quot;&quot;,j,i,s,a,z,w=&quot;&quot;,c,y;tinyMCEPopup.restoreSelection();e=g.selection.getNode();if(e.nodeName!=&quot;IMG&quot;){return}if(v.img_src.value===&quot;&quot;){m.remove();return}if(v.img_cap.value!=&quot;&quot;&amp;&amp;v.width.value!=&quot;&quot;){o=1;k=k.replace(/align[^ &quot;']+\s?/gi,&quot;&quot;)}p=g.dom.getParent(e,&quot;a&quot;);h=g.dom.getParent(e,&quot;p&quot;);n=g.dom.getParent(e,&quot;dl&quot;);r=g.dom.getParent(e,&quot;div&quot;);tinyMCEPopup.execCommand(&quot;mceBeginUndoLevel&quot;);g.dom.setAttribs(e,{src:v.img_src.value,title:v.img_title.value,alt:v.img_alt.value,width:v.width.value,height:v.height.value,style:v.img_style.value,&quot;class&quot;:k});if(v.link_href.value){if(p==null){if(!v.link_href.value.match(/https?:\/\//i)){v.link_href.value=tinyMCEPopup.editor.documentBaseURI.toAbsolute(v.link_href.value)}if(tinymce.isWebKit&amp;&amp;g.dom.hasClass(e,&quot;aligncenter&quot;)){g.dom.removeClass(e,&quot;aligncenter&quot;);d=1}tinyMCEPopup.execCommand(&quot;CreateLink&quot;,false,&quot;#mce_temp_url#&quot;,{skip_undo:1});if(d){g.dom.addClass(e,&quot;aligncenter&quot;)}tinymce.each(g.dom.select(&quot;a&quot;),function(b){if(g.dom.getAttrib(b,&quot;href&quot;)==&quot;#mce_temp_url#&quot;){g.dom.setAttribs(b,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}})}else{g.dom.setAttribs(p,{href:v.link_href.value,title:v.link_title.value,rel:v.link_rel.value,target:(v.link_target.checked==true)?&quot;_blank&quot;:&quot;&quot;,&quot;class&quot;:v.link_classes.value,style:v.link_style.value})}}if(o){a=10+parseInt(v.width.value);z=(m.align==&quot;aligncenter&quot;)?&quot;mceTemp mceIEcenter&quot;:&quot;mceTemp&quot;;if(n){g.dom.setAttribs(n,{&quot;class&quot;:&quot;wp-caption &quot;+m.align,style:&quot;width: &quot;+a+&quot;px;&quot;});if(r){g.dom.setAttrib(r,&quot;class&quot;,z)}if((i=g.dom.getParent(e,&quot;dt&quot;))&amp;&amp;(s=i.nextSibling)&amp;&amp;g.dom.hasClass(s,&quot;wp-caption-dd&quot;)){g.dom.setHTML(s,v.img_cap.value)}}else{if((q=v.img_classes.value.match(/wp-image-([0-9]{1,6})/))&amp;&amp;q[1]){u=&quot;attachment_&quot;+q[1]}if(v.link_href.value&amp;&amp;(w=g.dom.getParent(e,&quot;a&quot;))){if(w.childNodes.length==1){l=g.dom.getOuterHTML(w)}else{l=g.dom.getOuterHTML(w);l=l.match(/&lt;a[^&gt;]+&gt;/i);l=l+g.dom.getOuterHTML(e)+&quot;&lt;/a&gt;&quot;}}else{l=g.dom.getOuterHTML(e)}l='&lt;dl id=&quot;'+u+'&quot; class=&quot;wp-caption '+m.align+'&quot; style=&quot;width: '+a+'px&quot;&gt;&lt;dt class=&quot;wp-caption-dt&quot;&gt;'+l+'&lt;/dt&gt;&lt;dd class=&quot;wp-caption-dd&quot;&gt;'+v.img_cap.value+&quot;&lt;/dd&gt;&lt;/dl&gt;&quot;;j=g.dom.create(&quot;div&quot;,{&quot;class&quot;:z},l);if(h){h.parentNode.insertBefore(j,h);if(h.childNodes.length==1){g.dom.remove(h)}else{if(w&amp;&amp;w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}else{if(c=g.dom.getParent(e,&quot;TD,TH,LI&quot;)){c.appendChild(j);if(w&amp;&amp;w.childNodes.length==1){g.dom.remove(w)}else{g.dom.remove(e)}}}}}else{if(n&amp;&amp;r){if(v.link_href.value&amp;&amp;(y=g.dom.getParent(e,&quot;a&quot;))){l=g.dom.getOuterHTML(y)}else{l=g.dom.getOuterHTML(e)}h=g.dom.create(&quot;p&quot;,{},l);r.parentNode.insertBefore(h,r);g.dom.remove(r)}}if(v.img_classes.value.indexOf(&quot;aligncenter&quot;)!=-1){if(h&amp;&amp;(!h.style||h.style.textAlign!=&quot;center&quot;)){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;center&quot;)}}else{if(h&amp;&amp;h.style&amp;&amp;h.style.textAlign==&quot;center&quot;){g.dom.setStyle(h,&quot;textAlign&quot;,&quot;&quot;)}}if(!v.link_href.value&amp;&amp;p){x=g.selection.getBookmark();g.dom.remove(p,1);g.selection.moveToBookmark(x)}tinyMCEPopup.execCommand(&quot;mceEndUndoLevel&quot;);g.execCommand(&quot;mceRepaint&quot;);tinyMCEPopup.close()},updateStyle:function(a){var e=tinyMCEPopup.dom,c,d=document.forms[0],b=e.create(&quot;img&quot;,{style:d.img_style.value});if(tinyMCEPopup.editor.settings.inline_styles){if(a==&quot;align&quot;){e.setStyle(b,&quot;float&quot;,&quot;&quot;);e.setStyle(b,&quot;vertical-align&quot;,&quot;&quot;);c=d.align.value;if(c){if(c==&quot;left&quot;||c==&quot;right&quot;){e.setStyle(b,&quot;float&quot;,c)}else{b.style.verticalAlign=c}}}if(a==&quot;border&quot;){e.setStyle(b,&quot;border&quot;,&quot;&quot;);c=d.border.value;if(c||c==&quot;0&quot;){if(c==&quot;0&quot;){b.style.border=&quot;0&quot;}else{b.style.border=c+&quot;px solid black&quot;}}}if(a==&quot;hspace&quot;){e.setStyle(b,&quot;marginLeft&quot;,&quot;&quot;);e.setStyle(b,&quot;marginRight&quot;,&quot;&quot;);c=d.hspace.value;if(c){b.style.marginLeft=c+&quot;px&quot;;b.style.marginRight=c+&quot;px&quot;}}if(a==&quot;vspace&quot;){e.setStyle(b,&quot;marginTop&quot;,&quot;&quot;);e.setStyle(b,&quot;marginBottom&quot;,&quot;&quot;);c=d.vspace.value;if(c){b.style.marginTop=c+&quot;px&quot;;b.style.marginBottom=c+&quot;px&quot;}}d.img_style.value=e.serializeStyle(e.parseStyle(b.style.cssText));this.demoSetStyle()}},checkVal:function(a){if(a.value==&quot;&quot;){if(a.id==&quot;img_src&quot;){a.value=this.I(&quot;img_demo&quot;).src||this.preloadImg.src}}},resetImageData:function(){var a=document.forms[0];a.width.value=a.height.value=&quot;&quot;},updateImageData:function(){var d=document.forms[0],b=wpImage,a=d.width.value,c=d.height.value;if(!a&amp;&amp;c){a=d.width.value=b.width=Math.round(b.preloadImg.width/(b.preloadImg.height/c))}else{if(a&amp;&amp;!c){c=d.height.value=b.height=Math.round(b.preloadImg.height/(b.preloadImg.width/a))}}if(!a){d.width.value=b.width=b.preloadImg.width}if(!c){d.height.value=b.height=b.preloadImg.height}b.showSizeSet();b.demoSetSize();if(d.img_style.value){b.demoSetStyle()}},getImageData:function(){var a=wpImage,b=document.forms[0];a.preloadImg=new Image();a.preloadImg.onload=a.updateImageData;a.preloadImg.onerror=a.resetImageData;a.preloadImg.src=tinyMCEPopup.editor.documentBaseURI.toAbsolute(b.img_src.value)}};window.onload=function(){wpImage.init()};wpImage.preInit();
</ins><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>