--- /tmp/tinymce.module	2005-04-07 23:17:52.000000000 -0400
+++ tinymce.module	2005-04-07 23:21:39.000000000 -0400
@@ -102,8 +102,10 @@
         var height = form['edit[height]'].value != '' ? form['edit[height]'].value : form['edit[origHeight]'].value;
       }
       var alt = form['edit[alt]'].value;
-
-      window.opener.tinyMCE.insertImage(src, alt, '', '', '', width, height);
+      var nid = form['edit[nid]'].value;
+      var caption = form['edit[caption]'].value;
+      var html = '<div class="image"><a href="' + "$base_url/" + "node/" + nid + '" ><img src="' + "$base_url/" + src + '" width="' + width + '" height="' + height + '" alt="' + alt + '"/></a><div class="caption">' + caption + '</div></div>';
+      window.opener.tinyMCE.execCommand('mceInsertContent','false', html );
     }
   }
 </script>
