--- img_assist_tinymce.js.old	Sun Apr 06 18:43:18 2008
+++ img_assist_tinymce.js	Fri Jun 06 14:15:54 2008
@@ -19,25 +19,29 @@
 var nid, captionTitle, captionDesc, link, url, align, width, height;
 
 function preinit() {
-  tinyMCE.setWindowArg('mce_windowresize', false);
-  tinyMCE.setWindowArg('mce_replacevariables', false);
+  // FIXME
+  //tinyMCEPopup.setWindowArg('mce_windowresize', false);
+  //tinyMCEPopup.setWindowArg('mce_replacevariables', false);
 }
 
 function initLoader() {
-  nid          =      tinyMCE.getWindowArg('nid');
-  captionTitle = '' + tinyMCE.getWindowArg('captionTitle');
-  captionDesc  = '' + tinyMCE.getWindowArg('captionDesc');
-  link         = '' + tinyMCE.getWindowArg('link');
-  url          = '' + tinyMCE.getWindowArg('url');
-  align        = '' + tinyMCE.getWindowArg('align');
-  width        = '' + tinyMCE.getWindowArg('width');
-  height       = '' + tinyMCE.getWindowArg('height');
+  nid          =      tinyMCEPopup.getWindowArg('nid');
+  captionTitle = '' + tinyMCEPopup.getWindowArg('captionTitle');
+  captionDesc  = '' + tinyMCEPopup.getWindowArg('captionDesc');
+  link         = '' + tinyMCEPopup.getWindowArg('link');
+  url          = '' + tinyMCEPopup.getWindowArg('url');
+  align        = '' + tinyMCEPopup.getWindowArg('align');
+  width        = '' + tinyMCEPopup.getWindowArg('width');
+  height       = '' + tinyMCEPopup.getWindowArg('height');
+
+  
 
   if (nid > 0) {
     frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/properties/' + nid + '/update';
   }
   else {
     frames['img_assist_main'].window.location.href = BASE_URL + 'index.php?q=img_assist/thumbs/myimages';
+    
   }
 }
 
@@ -107,7 +111,7 @@ function getFilterTag(formObj) {
     miscAttribs += '|url=' + url;
   }
   miscAttribs = encodeURIComponent(miscAttribs);
-  var content = '<img src="' + (tinyMCE.getParam("theme_href") + "/images/spacer.gif") + '"'
+  var content = '<img src="' + (tinyMCE.activeEditor.getParam("theme_href") + "/images/spacer.gif") + '"'
               + ' width="' + width + '" height="' + height + '" align="' + align + '"'
               + ' alt="' + miscAttribs + '" title="' + miscAttribs + '"'
               + ' name="mceItemDrupalImage" class="mceItemDrupalImage" />';
@@ -118,6 +122,8 @@ function getFilterTag(formObj) {
 function insertToEditor(content) {
   // Insert the image
   tinyMCE.execCommand("mceInsertContent", true, content);
+  
+  // FIXME: it is necessary?
   tinyMCE.selectedInstance.repaint();
   
   // Close the dialog
