Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1000
diff -u -r1.1000 common.inc
--- includes/common.inc	29 Sep 2009 17:52:46 -0000	1.1000
+++ includes/common.inc	30 Sep 2009 01:17:10 -0000
@@ -3546,6 +3546,44 @@
 }
 
 /**
+ * Adds a jQuery UI element to the page, and invokes its behaviors.
+ *
+ * @param $tool
+ *   The name of the tool to add (dialog, accordion, resizable, etc).
+ * @param $selector
+ *   (optional) The CSS selector of which to apply the tool.
+ * @param $options
+ *   (optional) The options that are passed to the element during execution.
+ * @param $event
+ *   (optional) On what binded event the tool should be applied to the element.
+ *   Defaults to document ready.
+ * @param $binded_element
+ *   (optional) When binding on an event other then ready, will be the element
+ *   that the event is binded to.
+ */
+function drupal_add_jqueryui($tool, $selector = NULL, $options = array(), $event = 'ready', $binded_element = NULL) {
+  $elements = &drupal_static(__FUNCTION__, array());
+  if (empty($elements)) {
+    drupal_add_library('system', "ui.$tool");
+    drupal_add_js('misc/jqueryui.js');
+  }
+  if (!isset($elements[$tool][$selector][$event])) {
+    $elements[$tool][$selector][$event] = $options;
+    drupal_add_js(array('jqueryui' => array(
+      $tool => array(
+        $selector => array(
+          $event => array(
+            'options' => $options,
+            'item' => $binded_element,
+          ),
+        ),
+      ),
+    )), 'setting');
+  }
+  return $elements;
+}
+
+/**
  * Retrieves information for a JavaScript/CSS library.
  *
  * Library information is statically cached. Libraries are keyed by module for
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.291
diff -u -r1.291 filter.module
--- modules/filter/filter.module	20 Sep 2009 07:32:18 -0000	1.291
+++ modules/filter/filter.module	30 Sep 2009 01:17:10 -0000
@@ -49,9 +49,6 @@
       'arguments' => array('tips' => NULL, 'long' => FALSE),
       'file' => 'filter.pages.inc',
     ),
-    'filter_tips_more_info' => array(
-      'arguments' => array(),
-    ),
     'filter_guidelines' => array(
       'arguments' => array('format' => NULL),
     ),
@@ -776,10 +773,28 @@
   );
   $form['format_help'] = array(
     '#prefix' => '<div id="' . $element_id . '-help" class="filter-help">',
-    '#markup' => theme('filter_tips_more_info'),
     '#suffix' => '</div>',
     '#weight' => 1,
   );
+  // Present the more information about text formats link.
+  $form['format_help']['more'] = array(
+    '#markup' => l(t('More information about text formats'), 'filter/tips', array('attributes' => array('class' => array('filter-tips-modal')))),
+  );
+  $form['format_help']['long'] = array(
+    '#prefix' => '<div id="filter-tips-modal-dialog" class="ui-helper-hidden" title="' . t('Filter tips') . '">',
+    '#markup' => filter_tips_long(),
+    '#suffix' => '</div>',
+  );
+
+  // Create a dialog box for the filter tips.
+  $form['#attached']['drupal_add_jqueryui'][] = array('dialog', '#filter-tips-modal-dialog', array(
+    'width' => 600,
+    'height' => 500,
+    'dialogClass' => 'filter-tips',
+    'autoOpen' => FALSE,
+  ));
+  // When the user clicks on the more information link, present the dialog box.
+  $form['#attached']['drupal_add_jqueryui'][] = array('dialog', '#filter-tips-modal-dialog', 'open', 'click', '.filter-tips-modal');
 
   return $form;
 }
@@ -893,15 +908,6 @@
 }
 
 /**
- * Format a link to the more extensive filter tips.
- *
- * @ingroup themeable
- */
-function theme_filter_tips_more_info() {
-  return '<p>' . l(t('More information about text formats'), 'filter/tips') . '</p>';
-}
-
-/**
  * Format guidelines for a text format.
  *
  * @ingroup themeable
Index: modules/filter/filter.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.pages.inc,v
retrieving revision 1.7
diff -u -r1.7 filter.pages.inc
--- modules/filter/filter.pages.inc	8 Mar 2009 21:25:18 -0000	1.7
+++ modules/filter/filter.pages.inc	30 Sep 2009 01:17:10 -0000
@@ -11,14 +11,7 @@
  * Menu callback; show a page with long filter tips.
  */
 function filter_tips_long() {
-  $format = arg(2);
-  if ($format) {
-    $output = theme('filter_tips', _filter_tips($format, TRUE), TRUE);
-  }
-  else {
-    $output = theme('filter_tips', _filter_tips(-1, TRUE), TRUE);
-  }
-  return $output;
+  return theme('filter_tips', _filter_tips(-1, TRUE), TRUE);
 }
 
 
Index: misc/jqueryui.js
===================================================================
RCS file: misc/jqueryui.js
diff -N misc/jqueryui.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/jqueryui.js	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,45 @@
+// $Id$
+(function ($) {
+
+/**
+ * @file
+ * Provides the jQuery UI Drupal behaviors.
+ */
+
+/**
+ * The jQuery UI Drupal behavior.
+ *
+ * This will go through all widgets and apply them to the given selectors with
+ * the appropriate arguments. It also takes binded events into consideration.
+ */
+Drupal.behaviors.jqueryui = {
+  attach: function(context, settings) {
+    if (settings.jqueryui || false) {
+      // Iterate through each widget and apply the tool to the elements.
+      jQuery.each(settings.jqueryui, function(tool, selectors) {
+        // Iterate through each selector to bind the events.
+        jQuery.each(selectors, function(selector, events) {
+          // Iterate through each event to bind the elements to their properties.
+          jQuery.each(events, function(event, options) {
+            // See if we are to bind the tool to an event, or just apply it when
+            // the document is ready.
+            if (event == 'ready') {
+              // Apply the jQuery UI's effect.
+              $(selector, context).once('jqueryui-' + tool + '-ready')[tool](options.options);
+            }
+            else {
+              // Apply the jQuery UI's effect on a binded event.
+              $(options.item, context).once('jqueryui-' + tool + '-' + event).bind(event, function(e) {
+                $(selector, context)[tool](options.options);
+                // Remove the default effect as we're using jQuery UI now.
+                return false;
+              });
+            }
+          });
+        });
+      });
+    }
+  }
+};
+
+})(jQuery);
