--- modules/fckeditor/fckeditor.module.o	2008-05-21 11:10:50.000000000 +0200
+++ modules/fckeditor/fckeditor.module	2008-05-22 13:52:00.000000000 +0200
@@ -634,7 +634,7 @@
     $wysiwyg_link .= $fckeditor_on ? t("Switch to plain text editor") : t("Switch to rich text editor");
     $wysiwyg_link .= "</a>";
     $wysiwyg_link .= "\n<script type=\"text/javascript\">";
-    $wysiwyg_link .= "CreateToggle('{$element['#id']}','{$js_id}', $fckeditor_on);\n</script>";
+    $wysiwyg_link .= "$(document).ready( function () {CreateToggle('{$element['#id']}','{$js_id}', $fckeditor_on);});\n</script>";
     if (!isset($element['#suffix'])) {
       $element['#suffix'] = "";
     }
@@ -679,7 +679,9 @@
 
     $textarea_id = $profile->settings['show_toggle'] == 't' ? $js_id : $element['#id'];
 
+    // begin the script with a $(document).ready implementation
     $element['#suffix'] .= "\n<script type=\"text/javascript\">
+$(document).ready( function() {
 var ". $js_id ." = new FCKeditor( '". $textarea_id ."' );
 ". $js_id .".BasePath	= '". $module_full_path ."/fckeditor/';
 ". $js_id .".Config['CustomConfigurationsPath'] = \"". $module_full_path ."/fckeditor.config.js\";
@@ -785,6 +787,15 @@
       $element['#suffix'] .=  $js_id .".Config['EditorAreaCSS'] = \"". str_replace(array('%h', '%t'), array($host, $themepath), $conf['css_path']) .",". $module_full_path ."/fckeditor.css\";";
     }
 
+    // Inline mode, replace the textarea after initialising it
+    if ($conf['popup'] == "f") {
+      if ($fckeditor_on) {
+        $element['#suffix'] .= $js_id .'.ReplaceTextarea();' ;
+      }
+    }
+
+    // end the $(document).ready implementation
+    $element['#suffix'] .= "});\n";
     $element['#suffix'] .= "</script>\n";
 
     if ($conf['popup']=="t") {
@@ -792,13 +803,6 @@
       drupal_add_js($module_drupal_path .'/fckeditor.popup.js');
       $element['#suffix'] .= " <span class=\"fckeditor_popuplink\">(<a href=\"#\" onclick=\"FCKeditor_OpenPopup('". $module_full_path ."/fckeditor.popup.html?var=". $js_id ."&el=". $element['#id'] ."');return false;\">". t('Open rich editor') ."</a>)</span>";
     }
-    else {
-      // if no popup mode, add the editor initialization to the footer
-      // this obviously needs print($closure) in page.tpl.php
-      if ($fckeditor_on) {
-        drupal_add_js('if (Drupal.jsEnabled) {$(document).ready(function() {'. $js_id .'.ReplaceTextarea();});}', 'inline', 'footer');
-      }
-    }
   }
 
   // display the field id for administrators
--- misc/collapse.js.o	2008-02-28 12:51:29.000000000 +0100
+++ misc/collapse.js	2008-05-20 15:42:08.000000000 +0200
@@ -70,7 +71,9 @@
           Drupal.toggleFieldset(fieldset);
         }
         return false;
-      })).after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)')));
+      }));
+      //.after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)')));
+      // this piece of code is commented out because it interferes with the correct operation of FCK 2.5+
     });
   });
 }
