Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.563
diff -u -d -F^\s*function -r1.563 common.inc
--- includes/common.inc	23 Aug 2006 08:04:29 -0000	1.563
+++ includes/common.inc	23 Aug 2006 11:01:58 -0000
@@ -1368,6 +1368,7 @@ function drupal_add_js($data = NULL, $ty
 
     if (empty($javascript['header']['core']['misc/drupal.js'])) {
       drupal_add_js('misc/drupal.js', 'core');
+      drupal_add_js('misc/jquery.js', 'core');
     }
   }
 
Index: misc/autocomplete.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/autocomplete.js,v
retrieving revision 1.12
diff -u -d -F^\s*function -r1.12 autocomplete.js
--- misc/autocomplete.js	20 May 2006 07:23:47 -0000	1.12
+++ misc/autocomplete.js	23 Aug 2006 11:01:58 -0000
@@ -1,76 +1,51 @@
 // $Id: autocomplete.js,v 1.12 2006/05/20 07:23:47 drumm Exp $
 
-// Global Killswitch
-if (isJsEnabled()) {
-  addLoadEvent(autocompleteAutoAttach);
-}
-
 /**
  * Attaches the autocomplete behaviour to all required fields
  */
-function autocompleteAutoAttach() {
+Drupal.autocompleteAutoAttach = function () {
   var acdb = [];
-  var inputs = document.getElementsByTagName('input');
-  for (i = 0; input = inputs[i]; i++) {
-    if (input && hasClass(input, 'autocomplete')) {
-      uri = input.value;
-      if (!acdb[uri]) {
-        acdb[uri] = new ACDB(uri);
-      }
-      input = $(input.id.substr(0, input.id.length - 13));
-      input.setAttribute('autocomplete', 'OFF');
-      addSubmitEvent(input.form, autocompleteSubmit);
-      new jsAC(input, acdb[uri]);
+  $('input.autocomplete').each(function () {
+    var uri = this.value;
+    if (!acdb[uri]) {
+      acdb[uri] = new Drupal.ACDB(uri);
     }
-  }
+    var input = $('#' + this.id.substr(0, this.id.length - 13))
+      .attr('autocomplete', 'OFF')[0];
+    $(input.form).submit(Drupal.autocompleteSubmit);
+    new Drupal.jsAC(input, acdb[uri]);
+  });
 }
 
 /**
  * Prevents the form from submitting if the suggestions popup is open
+ * and closes the suggestions popup when doing so.
  */
-function autocompleteSubmit() {
-  var popup = document.getElementById('autocomplete');
-  if (popup) {
-    popup.owner.hidePopup();
-    return false;
-  }
-  return true;
+Drupal.autocompleteSubmit = function () {
+  return $('#autocomplete').each(function () {
+    this.owner.hidePopup();
+  }).size() == 0;
 }
 
-
 /**
  * An AutoComplete object
  */
-function jsAC(input, db) {
+Drupal.jsAC = function (input, db) {
   var ac = this;
   this.input = input;
   this.db = db;
-  this.input.onkeydown = function (event) { return ac.onkeydown(this, event); };
-  this.input.onkeyup = function (event) { ac.onkeyup(this, event) };
-  this.input.onblur = function () { ac.hidePopup(); ac.db.cancel(); };
-  this.popup = document.createElement('div');
-  this.popup.id = 'autocomplete';
-  this.popup.owner = this;
-};
 
-/**
- * Hides the autocomplete suggestions
- */
-jsAC.prototype.hidePopup = function (keycode) {
-  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
-    this.input.value = this.selected.autocompleteValue;
-  }
-  if (this.popup.parentNode && this.popup.parentNode.tagName) {
-    removeNode(this.popup);
-  }
-  this.selected = false;
-}
+  $(this.input)
+    .keydown(function (event) { return ac.onkeydown(this, event); })
+    .keyup(function (event) { ac.onkeyup(this, event) })
+    .blur(function () { ac.hidePopup(); ac.db.cancel(); });
 
+};
 
 /**
  * Handler for the "keydown" event
  */
-jsAC.prototype.onkeydown = function (input, e) {
+Drupal.jsAC.prototype.onkeydown = function (input, e) {
   if (!e) {
     e = window.event;
   }
@@ -89,7 +64,7 @@ function jsAC(input, db) {
 /**
  * Handler for the "keyup" event
  */
-jsAC.prototype.onkeyup = function (input, e) {
+Drupal.jsAC.prototype.onkeyup = function (input, e) {
   if (!e) {
     e = window.event;
   }
@@ -126,21 +101,21 @@ function jsAC(input, db) {
 /**
  * Puts the currently highlighted suggestion into the autocomplete field
  */
-jsAC.prototype.select = function (node) {
+Drupal.jsAC.prototype.select = function (node) {
   this.input.value = node.autocompleteValue;
 }
 
 /**
  * Highlights the next suggestion
  */
-jsAC.prototype.selectDown = function () {
+Drupal.jsAC.prototype.selectDown = function () {
   if (this.selected && this.selected.nextSibling) {
     this.highlight(this.selected.nextSibling);
   }
   else {
-    var lis = this.popup.getElementsByTagName('li');
-    if (lis.length > 0) {
-      this.highlight(lis[0]);
+    var lis = $('li', this.popup);
+    if (lis.size() > 0) {
+      this.highlight(lis.get(0));
     }
   }
 }
@@ -148,7 +123,7 @@ function jsAC(input, db) {
 /**
  * Highlights the previous suggestion
  */
-jsAC.prototype.selectUp = function () {
+Drupal.jsAC.prototype.selectUp = function () {
   if (this.selected && this.selected.previousSibling) {
     this.highlight(this.selected.previousSibling);
   }
@@ -157,30 +132,61 @@ function jsAC(input, db) {
 /**
  * Highlights a suggestion
  */
-jsAC.prototype.highlight = function (node) {
-  removeClass(this.selected, 'selected');
-  addClass(node, 'selected');
+Drupal.jsAC.prototype.highlight = function (node) {
+  if (this.selected) {
+    $(this.selected).removeClass('selected');
+  }
+  $(node).addClass('selected');
   this.selected = node;
 }
 
 /**
  * Unhighlights a suggestion
  */
-jsAC.prototype.unhighlight = function (node) {
-  removeClass(node, 'selected');
+Drupal.jsAC.prototype.unhighlight = function (node) {
+  $(node).removeClass('selected');
+  this.selected = false;
+}
+
+/**
+ * Hides the autocomplete suggestions
+ */
+Drupal.jsAC.prototype.hidePopup = function (keycode) {
+  // Select item if the right key or mousebutton was pressed
+  if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
+    this.input.value = this.selected.autocompleteValue;
+  }
+  // Hide popup
+  var popup = this.popup;
+  if (popup) {
+    this.popup = null;
+    $(popup).fadeOut('fast', function() { $(popup).remove(); });
+  }
   this.selected = false;
 }
 
 /**
  * Positions the suggestions popup and starts a search
  */
-jsAC.prototype.populatePopup = function () {
-  var ac = this;
-  var pos = absolutePosition(this.input);
+Drupal.jsAC.prototype.populatePopup = function () {
+  // Show popup
+  if (this.popup) {
+    $(this.popup).remove();
+  }
+  var pos = Drupal.absolutePosition(this.input);
   this.selected = false;
-  this.popup.style.top   = (pos.y + this.input.offsetHeight) +'px';
-  this.popup.style.left  = pos.x +'px';
-  this.popup.style.width = (this.input.offsetWidth - 4) +'px';
+  this.popup = document.createElement('div');
+  this.popup.id = 'autocomplete';
+  this.popup.owner = this;
+  $(this.popup).css({
+    top: (pos.y + this.input.offsetHeight) +'px',
+    left: pos.x +'px',
+    width: (this.input.offsetWidth - 4) +'px',
+    display: 'none'
+  });
+  $('body').append(this.popup);
+
+  // Do search
   this.db.owner = this;
   this.db.search(this.input.value);
 }
@@ -188,45 +194,39 @@ function jsAC(input, db) {
 /**
  * Fills the suggestion popup with any matches received
  */
-jsAC.prototype.found = function (matches) {
-  while (this.popup.hasChildNodes()) {
-    this.popup.removeChild(this.popup.childNodes[0]);
-  }
-  if (!this.popup.parentNode || !this.popup.parentNode.tagName) {
-    document.getElementsByTagName('body')[0].appendChild(this.popup);
-  }
+Drupal.jsAC.prototype.found = function (matches) {
+  // Prepare matches
   var ul = document.createElement('ul');
   var ac = this;
-
   for (key in matches) {
     var li = document.createElement('li');
-    var div = document.createElement('div');
-    div.innerHTML = matches[key];
-    li.appendChild(div);
+    $(li)
+      .html('<div>'+ matches[key] +'</div>')
+      .mousedown(function () { ac.select(this); })
+      .mouseover(function () { ac.highlight(this); })
+      .mouseout(function () { ac.unhighlight(this); });
     li.autocompleteValue = key;
-    li.onmousedown = function() { ac.select(this); };
-    li.onmouseover = function() { ac.highlight(this); };
-    li.onmouseout  = function() { ac.unhighlight(this); };
-    ul.appendChild(li);
+    $(ul).append(li);
   }
 
+  // Show popup with matches, if any
   if (ul.childNodes.length > 0) {
-    this.popup.appendChild(ul);
+    $(this.popup).empty().append(ul).show();
   }
   else {
     this.hidePopup();
   }
 }
 
-jsAC.prototype.setStatus = function (status) {
+Drupal.jsAC.prototype.setStatus = function (status) {
   switch (status) {
     case 'begin':
-      addClass(this.input, 'throbbing');
+      $(this.input).addClass('throbbing');
       break;
     case 'cancel':
     case 'error':
     case 'found':
-      removeClass(this.input, 'throbbing');
+      $(this.input).removeClass('throbbing');
       break;
   }
 }
@@ -234,7 +234,7 @@ function jsAC(input, db) {
 /**
  * An AutoComplete DataBase object
  */
-function ACDB(uri) {
+Drupal.ACDB = function (uri) {
   this.uri = uri;
   this.delay = 300;
   this.cache = {};
@@ -243,47 +243,55 @@ function ACDB(uri) {
 /**
  * Performs a cached and delayed search
  */
-ACDB.prototype.search = function(searchString) {
+Drupal.ACDB.prototype.search = function (searchString) {
+  var db = this;
   this.searchString = searchString;
+
+  // See if this key has been searched for before
   if (this.cache[searchString]) {
     return this.owner.found(this.cache[searchString]);
   }
+
+  // Initiate delayed search
   if (this.timer) {
     clearTimeout(this.timer);
   }
-  var db = this;
   this.timer = setTimeout(function() {
     db.owner.setStatus('begin');
-    db.transport = HTTPGet(db.uri +'/'+ encodeURIComponent(searchString), db.receive, db);
-  }, this.delay);
-}
 
-/**
- * HTTP callback function. Passes suggestions to the autocomplete object
- */
-ACDB.prototype.receive = function(string, xmlhttp, acdb) {
-  // Note: Safari returns 'undefined' status if the request returns no data.
-  if (xmlhttp.status != 200 && typeof xmlhttp.status != 'undefined') {
-    acdb.owner.setStatus('error');
-    return alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ acdb.uri);
-  }
-  // Parse back result
-  var matches = parseJson(string);
-  if (typeof matches['status'] == 'undefined' || matches['status'] != 0) {
-    acdb.cache[acdb.searchString] = matches;
-    acdb.owner.found(matches);
-    acdb.owner.setStatus('found');
-  }
+    // Ajax GET request for autocompletion
+    $.ajax({
+      type: "GET",
+      url: db.uri +'/'+ encodeURIComponent(searchString),
+      success: function (xmlhttp) {
+        // Parse back result
+        var matches = Drupal.parseJson(xmlhttp.responseText);
+        if (typeof matches['status'] == 'undefined' || matches['status'] != 0) {
+          db.cache[searchString] = matches;
+          // Verify if these are still the matches the user wants to see
+          if (db.searchString == searchString) {
+            db.owner.found(matches);
+          }
+          db.owner.setStatus('found');
+        }
+      },
+      error: function (xmlhttp) {
+        alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ db.uri);
+      }
+    });
+  }, this.delay);
 }
 
 /**
  * Cancels the current autocomplete request
  */
-ACDB.prototype.cancel = function() {
+Drupal.ACDB.prototype.cancel = function() {
   if (this.owner) this.owner.setStatus('cancel');
   if (this.timer) clearTimeout(this.timer);
-  if (this.transport) {
-    this.transport.onreadystatechange = function() {};
-    this.transport.abort();
-  }
+  this.searchString = '';
+}
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.autocompleteAutoAttach);
 }
Index: misc/collapse.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/collapse.js,v
retrieving revision 1.6
diff -u -d -F^\s*function -r1.6 collapse.js
--- misc/collapse.js	14 Apr 2006 13:48:56 -0000	1.6
+++ misc/collapse.js	23 Aug 2006 11:01:58 -0000
@@ -1,70 +1,99 @@
 // $Id: collapse.js,v 1.6 2006/04/14 13:48:56 killes Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(collapseAutoAttach);
-}
-
-function collapseAutoAttach() {
-  var fieldsets = document.getElementsByTagName('fieldset');
-  var legend, fieldset;
-  for (var i = 0; fieldset = fieldsets[i]; i++) {
-    if (!hasClass(fieldset, 'collapsible')) {
-      continue;
-    }
-    legend = fieldset.getElementsByTagName('legend');
-    if (legend.length == 0) {
-      continue;
-    }
-    legend = legend[0];
+Drupal.collapseAutoAttach = function () {
+  $('fieldset.collapsible legend').each(function () {
+    // Turn the legend into clickable link
     var a = document.createElement('a');
     a.href = '#';
-    a.onclick = function() {
-      toggleClass(this.parentNode.parentNode, 'collapsed');
-      if (!hasClass(this.parentNode.parentNode, 'collapsed')) {
-        collapseScrollIntoView(this.parentNode.parentNode);
-        if (typeof textAreaAutoAttach != 'undefined') {
-          // Add the grippie to a textarea in a collapsed fieldset.
-          textAreaAutoAttach(null, this.parentNode.parentNode);
+    $(a)
+      .click(function() {
+        var fieldset = this.parentNode.parentNode;
+
+        // Prevent double animations
+        if (fieldset.animating) {
+          return false;
         }
-      }
-      this.blur();
-      return false;
-    };
-    a.innerHTML = legend.innerHTML;
-    while (legend.hasChildNodes()) {
-      removeNode(legend.childNodes[0]);
+        fieldset.animating = true;
+
+        if ($(fieldset).is('.collapsed')) {
+          // Open fieldset with animation
+          $(fieldset.contentWrapper).hide();
+          $(fieldset).removeClass('collapsed');
+          $(fieldset.contentWrapper).slideDown('medium',
+            {
+              // Make sure we open to height auto
+              complete: function() {
+                $(fieldset.contentWrapper).css('height', 'auto');
+                Drupal.collapseScrollIntoView(fieldset);
+                fieldset.animating = false;
+              },
+              // Scroll the fieldset into view
+              step: function() {
+                Drupal.collapseScrollIntoView(fieldset);
+              }
+            }
+          );
+          if (typeof Drupal.textAreaAutoAttach != 'undefined') {
+            // Initialize resizable textareas that are now revealed
+            Drupal.textAreaAutoAttach(null, fieldset);
+          }
+        }
+        else {
+          // Collapse fieldset with animation (reverse of opening)
+          $(fieldset.contentWrapper)
+            .slideUp('medium', function () { $(fieldset).addClass('collapsed'); fieldset.animating = false; } )
+            .show();
+        }
+        this.blur();
+        return false;
+      })
+      .html(this.innerHTML);
+    $(this)
+      .empty()
+      .append(a);
+
+    // Wrap fieldsets contents (except for the legend) into wrapper divs for animating.
+    // div1 is used to avoid margin problems inside fieldsets,
+    // div2 is the one that is actually animated.
+    var div1 = document.createElement('div');
+    var div2 = document.createElement('div');
+    this.parentNode.contentWrapper = div2;
+    $(this).after(div1);
+    $(div1).append(div2);
+    var el = div1.nextSibling;
+    while (el != null) {
+      var next = el.nextSibling;
+      $(el).remove();
+      $(div2).append(el);
+      el = next;
     }
-    legend.appendChild(a);
-    collapseEnsureErrorsVisible(fieldset);
-  }
-}
+    // Avoid jumping around due to margins collapsing into fieldset border
+    $(div1).css('overflow', 'hidden');
 
-function collapseEnsureErrorsVisible(fieldset) {
-  if (!hasClass(fieldset, 'collapsed')) {
-    return;
-  }
-  var inputs = [];
-  inputs = inputs.concat(fieldset.getElementsByTagName('input'));
-  inputs = inputs.concat(fieldset.getElementsByTagName('textarea'));
-  inputs = inputs.concat(fieldset.getElementsByTagName('select'));
-  for (var j = 0; j<3; j++) {
-    for (var i = 0; i < inputs[j].length; i++) {
-      if (hasClass(inputs[j][i], 'error')) {
-        return removeClass(fieldset, 'collapsed');
-      }
+    // Expand if there are errors inside
+    if ($('input.error, textarea.error, select.error', this.parentNode).size() > 0) {
+      $(fieldset).removeClass('collapsed');
     }
-  }
+  });
 }
 
-function collapseScrollIntoView(node) {
+/**
+ * Scroll a given fieldset into view as much as possible.
+ */
+Drupal.collapseScrollIntoView = function (node) {
   var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || 0;
   var offset = self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
-  var pos = absolutePosition(node);
+  var pos = Drupal.absolutePosition(node);
   if (pos.y + node.scrollHeight > h + offset) {
     if (node.scrollHeight > h) {
       window.scrollTo(0, pos.y);
     } else {
-      window.scrollTo(0, pos.y + node.scrollHeight - h);
+      window.scrollTo(0, pos.y + node.scrollHeight - h + 15);
     }
   }
 }
+
+// Global Killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.collapseAutoAttach);
+}
Index: misc/drupal.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.js,v
retrieving revision 1.27
diff -u -d -F^\s*function -r1.27 drupal.js
--- misc/drupal.js	23 Aug 2006 04:59:17 -0000	1.27
+++ misc/drupal.js	23 Aug 2006 11:01:59 -0000
@@ -1,389 +1,207 @@
 // $Id: drupal.js,v 1.27 2006/08/23 04:59:17 drumm Exp $
 
 /**
- * Only enable Javascript functionality if all required features are supported.
- */
-function isJsEnabled() {
-  if (typeof document.jsEnabled == 'undefined') {
-    // Note: ! casts to boolean implicitly.
-    document.jsEnabled = !(
-     !document.getElementsByTagName ||
-     !document.createElement        ||
-     !document.createTextNode       ||
-     !document.documentElement      ||
-     !document.getElementById);
-  }
-  return document.jsEnabled;
-}
-
-// Global Killswitch on the <html> element
-if (isJsEnabled()) {
-  document.documentElement.className = 'js';
-}
-
-/**
  * The global Drupal variable.
  */
-Drupal = { };
-
-/**
- * Merge an object into the Drupal namespace.
- *
- * @param obj
- *   The object that should be merged into the Drupal namespace. Arbitrary objects
- *   containing functions, variables or other objects can be used. An example object
- *   would be { settings: { tree: { '/js/menu/tree': { mid: 206 } } } }. This item
- *   can now be accessed at Drupal.settings.tree['/js/menu/tree'].mid.
- */
-Drupal.extend = function(obj) {
-  for (var i in obj) {
-    if (this[i]) {
-      Drupal.extend.apply(this[i], [obj[i]]);
-    }
-    else {
-      this[i] = obj[i];
-    }
-  }
-};
-
-/**
- * Make IE's XMLHTTP object accessible through XMLHttpRequest()
- */
-if (typeof XMLHttpRequest == 'undefined') {
-  XMLHttpRequest = function () {
-    var msxmls = ['MSXML3', 'MSXML2', 'Microsoft']
-    for (var i=0; i < msxmls.length; i++) {
-      try {
-        return new ActiveXObject(msxmls[i]+'.XMLHTTP')
-      }
-      catch (e) { }
-    }
-    throw new Error("No XML component installed!");
-  }
-}
-
-/**
- * Creates an HTTP GET request and sends the response to the callback function.
- *
- * Note that dynamic arguments in the URI should be escaped with encodeURIComponent().
- */
-function HTTPGet(uri, callbackFunction, callbackParameter) {
-  var xmlHttp = new XMLHttpRequest();
-  var bAsync = true;
-  if (!callbackFunction) {
-    bAsync = false;
-  }
-
-  xmlHttp.open('GET', uri, bAsync);
-  xmlHttp.send(null);
-
-  if (bAsync) {
-    xmlHttp.onreadystatechange = function() {
-      if (xmlHttp.readyState == 4) {
-        callbackFunction(xmlHttp.responseText, xmlHttp, callbackParameter);
+var Drupal = {
+  /**
+   * Set the variable that indicates if JavaScript behaviors should be applied
+   */
+  jsEnabled: !(!document.getElementsByTagName || !document.createElement || 
+    !document.createTextNode || !document.documentElement || !document.getElementById),
+  
+  /**
+   * Merge an object into the Drupal namespace.
+   *
+   * @param obj
+   *   The object that should be merged into the Drupal namespace. Arbitrary objects
+   *   containing functions, variables or other objects can be used. An example object
+   *   would be { settings: { tree: { '/js/menu/tree': { mid: 206 } } } }. This item
+   *   can now be accessed at Drupal.settings.tree['/js/menu/tree'].mid.
+   */
+  extend: function(obj) {
+    for (var i in obj) {
+      if (this[i]) {
+        Drupal.extend.apply(this[i], [obj[i]]);
       }
-    }
-    return xmlHttp;
-  }
-  else {
-    return xmlHttp.responseText;
-  }
-}
-
-/**
- * Creates an HTTP POST request and sends the response to the callback function
- *
- * Note: passing null or undefined for 'object' makes the request fail in Opera 8.
- *       Pass an empty string instead.
- */
-function HTTPPost(uri, callbackFunction, callbackParameter, object) {
-  var xmlHttp = new XMLHttpRequest();
-  var bAsync = true;
-  if (!callbackFunction) {
-    bAsync = false;
-  }
-  xmlHttp.open('POST', uri, bAsync);
-
-  var toSend = '';
-  if (typeof object == 'object') {
-    xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
-    for (var i in object) {
-      toSend += (toSend ? '&' : '') + i + '=' + encodeURIComponent(object[i]);
-    }
-  }
-  else {
-    toSend = object;
-  }
-  xmlHttp.send(toSend);
-
-  if (bAsync) {
-    xmlHttp.onreadystatechange = function() {
-      if (xmlHttp.readyState == 4) {
-        callbackFunction(xmlHttp.responseText, xmlHttp, callbackParameter);
+      else {
+        this[i] = obj[i];
       }
     }
-    return xmlHttp;
-  }
-  else {
-    return xmlHttp.responseText;
-  }
-}
-
-/**
- * Redirects a button's form submission to a hidden iframe and displays the result
- * in a given wrapper. The iframe should contain a call to
- * window.parent.iframeHandler() after submission.
- */
-function redirectFormButton(uri, button, handler) {
-  // (Re)create an iframe to target.
-  createIframe();
+  },
 
-  // Trap the button
-  button.onmouseover = button.onfocus = function() {
-    button.onclick = function() {
-      // Prepare variables for use in anonymous function.
-      var button = this;
-      var action = button.form.action;
-      var target = button.form.target;
+  /**
+   * Redirects a button's form submission to a hidden iframe and displays the result
+   * in a given wrapper. The iframe should contain a call to
+   * window.parent.iframeHandler() after submission.
+   */
+  redirectFormButton: function (uri, button, handler) {
+    // Trap the button
+    button.onmouseover = button.onfocus = function() {
+      button.onclick = function() {
+        // Create target iframe
+        Drupal.createIframe();
+ 
+        // Prepare variables for use in anonymous function.
+        var button = this;
+        var action = button.form.action;
+        var target = button.form.target;
 
-      // Redirect form submission
-      this.form.action = uri;
-      this.form.target = 'redirect-target';
+        // Redirect form submission to iframe
+        this.form.action = uri;
+        this.form.target = 'redirect-target';
 
-      handler.onsubmit();
+        handler.onsubmit();
 
-      // Set iframe handler for later
-      window.iframeHandler = function () {
-        var iframe = $('redirect-target');
-        // Restore form submission
-        button.form.action = action;
-        button.form.target = target;
+        // Set iframe handler for later
+        window.iframeHandler = function () {
+          var iframe = $('#redirect-target').get(0);
+          // Restore form submission
+          button.form.action = action;
+          button.form.target = target;
 
-        // Get response from iframe body
-        try {
-          response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
-          // Firefox 1.0.x hack: Remove (corrupted) control characters
-          response = response.replace(/[\f\n\r\t]/g, ' ');
-          if (window.opera) {
-            // Opera-hack: it returns innerHTML sanitized.
-            response = response.replace(/&quot;/g, '"');
+          // Get response from iframe body
+          try {
+            response = (iframe.contentWindow || iframe.contentDocument || iframe).document.body.innerHTML;
+            // Firefox 1.0.x hack: Remove (corrupted) control characters
+            response = response.replace(/[\f\n\r\t]/g, ' ');
+            if (window.opera) {
+              // Opera-hack: it returns innerHTML sanitized.
+              response = response.replace(/&quot;/g, '"');
+            }
+          }
+          catch (e) {
+            response = null;
           }
-        }
-        catch (e) {
-          response = null;
-        }
 
-        $('redirect-target').onload = null;
-        $('redirect-target').src = 'about:blank';
+          response = Drupal.parseJson(response);
+          // Check response code
+          if (response.status == 0) {
+            handler.onerror(response.data);
+            return;
+          }
+          handler.oncomplete(response.data);
 
-        response = parseJson(response);
-        // Check response code
-        if (response.status == 0) {
-          handler.onerror(response.data);
-          return;
+          return true;
         }
-        handler.oncomplete(response.data);
-      }
 
-      return true;
+        return true;
+      }
     }
-  }
-  button.onmouseout = button.onblur = function() {
-    button.onclick = null;
-  }
-}
-
-/**
- * Adds a function to the window onload event
- */
-function addLoadEvent(func) {
-  var oldOnload = window.onload;
-  if (typeof window.onload != 'function') {
-    window.onload = func;
-  }
-  else {
-    window.onload = function() {
-      oldOnload();
-      func();
+    button.onmouseout = button.onblur = function() {
+      button.onclick = null;
     }
-  }
-}
+  },
 
-/**
- * Adds a function to a given form's submit event
- */
-function addSubmitEvent(form, func) {
-  var oldSubmit = form.onsubmit;
-  if (typeof oldSubmit != 'function') {
-    form.onsubmit = func;
-  }
-  else {
-    form.onsubmit = function() {
-      return oldSubmit() && func();
+  /**
+   * Retrieves the absolute position of an element on the screen
+   */
+  absolutePosition: function (el) {
+    var sLeft = 0, sTop = 0;
+    var isDiv = /^div$/i.test(el.tagName);
+    if (isDiv && el.scrollLeft) {
+      sLeft = el.scrollLeft;
     }
-  }
-}
-
-/**
- * Retrieves the absolute position of an element on the screen
- */
-function absolutePosition(el) {
-  var sLeft = 0, sTop = 0;
-  var isDiv = /^div$/i.test(el.tagName);
-  if (isDiv && el.scrollLeft) {
-    sLeft = el.scrollLeft;
-  }
-  if (isDiv && el.scrollTop) {
-    sTop = el.scrollTop;
-  }
-  var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
-  if (el.offsetParent) {
-    var tmp = absolutePosition(el.offsetParent);
-    r.x += tmp.x;
-    r.y += tmp.y;
-  }
-  return r;
-};
-
-function dimensions(el) {
-  return { width: el.offsetWidth, height: el.offsetHeight };
-}
-
-/**
- * Returns true if an element has a specified class name
- */
-function hasClass(node, className) {
-  if (node.className == className) {
-    return true;
-  }
-  var reg = new RegExp('(^| )'+ className +'($| )')
-  if (reg.test(node.className)) {
-    return true;
-  }
-  return false;
-}
-
-/**
- * Adds a class name to an element
- */
-function addClass(node, className) {
-  if (hasClass(node, className)) {
-    return false;
-  }
-  node.className += ' '+ className;
-  return true;
-}
-
-/**
- * Removes a class name from an element
- */
-function removeClass(node, className) {
-  if (!hasClass(node, className)) {
-    return false;
-  }
-  // Replaces words surrounded with whitespace or at a string border with a space. Prevents multiple class names from being glued together.
-  node.className = eregReplace('(^|\\s+)'+ className +'($|\\s+)', ' ', node.className);
-  return true;
-}
+    if (isDiv && el.scrollTop) {
+      sTop = el.scrollTop;
+    }
+    var r = { x: el.offsetLeft - sLeft, y: el.offsetTop - sTop };
+    if (el.offsetParent) {
+      var tmp = Drupal.absolutePosition(el.offsetParent);
+      r.x += tmp.x;
+      r.y += tmp.y;
+    }
+    return r;
+  },
 
-/**
- * Toggles a class name on or off for an element
- */
-function toggleClass(node, className) {
-  if (!removeClass(node, className) && !addClass(node, className)) {
-    return false;
-  }
-  return true;
-}
+  /**
+   * Return the dimensions of an element on the screen
+   */
+  dimensions: function (el) {
+    return { width: el.offsetWidth, height: el.offsetHeight };
+  },
+  
+  /**
+   *  Returns the position of the mouse cursor based on the event object passed
+   */
+  mousePosition: function(e) {
+    return { x: e.clientX + document.documentElement.scrollLeft, y: e.clientY + document.documentElement.scrollTop };
+  },
 
-/**
- * Emulate PHP's ereg_replace function in javascript
- */
-function eregReplace(search, replace, subject) {
-  return subject.replace(new RegExp(search,'g'), replace);
-}
+  /**
+   * Parse a JSON response.
+   *
+   * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
+   */
+  parseJson: function (data) {
+    if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
+      return { status: 0, data: data.length ? data : 'Unspecified error' };
+    }
+    return eval('(' + data + ');');
+  },
 
-/**
- * Removes an element from the page
- */
-function removeNode(node) {
-  if (typeof node == 'string') {
-    node = $(node);
-  }
-  if (node && node.parentNode) {
-    return node.parentNode.removeChild(node);
-  }
-  else {
-    return false;
-  }
-}
+  /**
+   * Create an invisible iframe for form submissions.
+   */
+  createIframe: function () {
+    if ($('#redirect-holder').size()) {
+      return;
+    }
+    // Note: some browsers require the literal name/id attributes on the tag,
+    // some want them set through JS. We do both.
+    window.iframeHandler = function () {};
+    var div = document.createElement('div');
+    div.id = 'redirect-holder';
+    $(div).html('<iframe name="redirect-target" id="redirect-target" class="redirect" onload="window.iframeHandler();"></iframe>');
+    var iframe = div.firstChild;
+    $(iframe)
+      .attr({
+        name: 'redirect-target',
+        id: 'redirect-target'
+      })
+      .css({
+        position: 'absolute',
+        height: '1px',
+        width: '1px',
+        visibility: 'hidden'
+      });
+    $('body').append(div);
+  },
 
-/**
- * Prevents an event from propagating.
- */
-function stopEvent(event) {
-  if (event.preventDefault) {
-    event.preventDefault();
-    event.stopPropagation();
-  }
-  else {
-    event.returnValue = false;
-    event.cancelBubble = true;
-  }
-}
+  /**
+   * Delete the invisible iframe
+   */
+  deleteIframe: function () {
+    $('#redirect-holder').remove();
+  },
 
-/**
- * Parse a JSON response.
- *
- * The result is either the JSON object, or an object with 'status' 0 and 'data' an error message.
- */
-function parseJson(data) {
-  if ((data.substring(0, 1) != '{') && (data.substring(0, 1) != '[')) {
-    return { status: 0, data: data.length ? data : 'Unspecified error' };
-  }
-  return eval('(' + data + ');');
-}
+  /**
+   * Freeze the current body height (as minimum height). Used to prevent
+   * unnecessary upwards scrolling when doing DOM manipulations.
+   */
+  freezeHeight: function () {
+    Drupal.unfreezeHeight();
+    var div = document.createElement('div');
+    $(div).css({
+      position: 'absolute',
+      top: '0px',
+      left: '0px',
+      width: '1px',
+      height: $('body').css('height') +'px'
+    }).attr('id', 'freeze-height');
+    $('body').append(div);
+  },
 
-/**
- * Create an invisible iframe for form submissions.
- */
-function createIframe() {
-  // Delete any previous iframe
-  deleteIframe();
-  // Note: some browsers require the literal name/id attributes on the tag,
-  // some want them set through JS. We do both.
-  window.iframeHandler = function () {};
-  var div = document.createElement('div');
-  div.id = 'redirect-holder';
-  div.innerHTML = '<iframe name="redirect-target" id="redirect-target" class="redirect" onload="window.iframeHandler();"></iframe>';
-  var iframe = div.firstChild;
-  with (iframe) {
-    name = 'redirect-target';
-    setAttribute('name', 'redirect-target');
-    id = 'redirect-target';
-  }
-  with (iframe.style) {
-    position = 'absolute';
-    height = '1px';
-    width = '1px';
-    visibility = 'hidden';
+  /**
+   * Unfreeze the body height
+   */
+  unfreezeHeight: function () {
+    $('#freeze-height').remove();
   }
-  document.body.appendChild(div);
 }
 
-/**
- * Delete the invisible iframe for form submissions.
- */
-function deleteIframe() {
-  var holder = $('redirect-holder');
-  if (holder != null) {
-    removeNode(holder);
-  }
-}
 
-/**
- * Wrapper around document.getElementById().
- */
-function $(id) {
-  return document.getElementById(id);
-}
+// Global Killswitch on the <html> element
+if (Drupal.jsEnabled) {
+  document.documentElement.className = 'js';
+}
\ No newline at end of file
Index: misc/jquery.js
===================================================================
RCS file: misc/jquery.js
diff -N misc/jquery.js
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ misc/jquery.js	23 Aug 2006 11:02:00 -0000
@@ -0,0 +1,5 @@
+/* jQuery - New Wave Javascript
+ * Copyright (c) 2006 John Resig (jquery.com). Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. 
+ * Date: 2006-08-22 07:00:07 +0200 (Tue, 22 Aug 2006)
+ * Rev: 221 */
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[(function(e){return d[e]})];e=(function(){return'\\w+'});c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1F.17=1F.17;8 6(a,c){l(!6.48)6.5c();l(a&&a.H==1g&&6.D.1O)u 6(W).1O(a);a=a||6.19||W;l(a.35)u $(6.1X(a,[]));l(c&&c.35)u $(c).20(a);l(1F==7)u 12 6(a,c);q m=/^[^<]*(<.+>)[^>]*$/.2R(a);l(m)a=6.3b([m[1]]);7.1j(a.H==2g||a.C&&!a.1Y&&a[0]!=17&&a[0].1Y?6.1X(a,[]):6.20(a,c));q D=1d[1d.C-1];l(D&&D.H==1g)7.R(D)}l($)6.3q$=$;q $=6;6.D=6.7n={35:"$5v: 5w $",42:8(){u 7.C},1j:8(1Z){l(1Z&&1Z.H==2g){7.C=0;[].18.11(7,1Z);u 7}G u 1Z==17?6.27(7,8(a){u a}):7[1Z]},R:8(D,1s){u 6.R(7,D,1s)},1B:8(1w,1M,B){u 1w.H!=1t||1M!=17?7.R(8(){l(1M==17)E(q J 1r 1w)6.1B(B?7.1b:7,J,1w[J]);G 6.1B(B?7.1b:7,1w,1M)}):6[B||"1B"](7[0],1w)},1a:8(1w,1M){u 7.1B(1w,1M,"1D")},3Q:8(e){e=e||7;q t="";E(q j=0;j<e.C;j++){q r=e[j].1Q;E(q i=0;i<r.C;i++)t+=r[i].1Y!=1?r[i].7e:6.D.3Q([r[i]])}u t},73:8(){q a=6.3b(1d);u 7.R(8(){q b=a[0].3r(14);7.1y.2r(b,7);2k(b.1J)b=b.1J;b.3n(7)})},4B:8(){u 7.2s(1d,14,1,8(a){7.3n(a)})},4D:8(){u 7.2s(1d,14,-1,8(a){7.2r(a,7.1J)})},4E:8(){u 7.2s(1d,15,1,8(a){7.1y.2r(a,7)})},4G:8(){u 7.2s(1d,15,-1,8(a){7.1y.2r(a,7.5y)})},5z:8(){u 7.1j(7.2Z.5A())},20:8(t){u 7.26(6.27(7,8(a){u 6.20(t,a)}),1d)},3p:8(3U){u 7.26(6.27(7,8(a){u a.3r(3U!=17?3U:14)}),1d)},1c:8(t){u 7.26(t.H==2g&&6.27(7,8(a){E(q i=0;i<t.C;i++)l(6.1c(t[i],[a]).r.C)u a})||t.H==6Y&&(t?7.1j():[])||t.H==1g&&6.2v(7,t)||6.1c(t,7).r,1d)},2S:8(t){u 7.26(t.H==1t?6.1c(t,7,15).r:6.2v(7,8(a){u a!=t}),1d)},1N:8(t){u 7.26(6.1X(7,t.H==1t?6.20(t):t.H==2g?t:[t]),1d)},5B:8(2j){u 2j?6.1c(2j,7).r.C>0:7.C>0},2s:8(1s,1e,2z,D){q 3p=7.42()>1;q a=6.3b(1s);u 7.R(8(){q Y=7;l(1e&&7.3F=="5D"&&a[0].3F!="5E"){q 1U=7.4k("1U");l(!1U.C){Y=W.4e("1U");7.3n(Y)}G Y=1U[0]}E(q i=(2z<0?a.C-1:0);i!=(2z<0?2z:a.C);i+=2z){D.11(Y,[3p?a[i].3r(14):a[i]])}})},26:8(a,1s){q D=1s&&1s[1s.C-1];l(!D||D.H!=1g){l(!7.2Z)7.2Z=[];7.2Z.18(7.1j());7.1j(a)}G{q 1L=7.1j();7.1j(a);l(D.H==1g)u 7.R(D);7.1j(1L)}u 7}};6.1K=6.D.1K=8(Y,J){l(!J){J=Y;Y=7}E(q i 1r J)Y[i]=J[i];u Y};6.1K({5c:8(){6.48=14;6.R(6.24.4P,8(i,n){6.D[i]=8(a){q O=6.27(7,n);l(a&&a.H==1t)O=6.1c(a,O).r;u 7.26(O,1d)}});6.R(6.24.2h,8(i,n){6.D[i]=8(){q a=1d;u 7.R(8(){E(q j=0;j<a.C;j++)$(a[j])[n](7)})}});6.R(6.24.R,8(i,n){6.D[i]=8(){u 7.R(n,1d)}});6.R(6.24.1c,8(i,n){6.D[n]=8(1Z,D){u 7.1c(":"+n+"("+1Z+")",D)}});6.R(6.24.1B,8(i,n){n=n||i;6.D[i]=8(h){u h==17?7.C?7[0][n]:P:7.1B(n,h)}});6.R(6.24.1a,8(i,n){6.D[n]=8(h){u h==17?(7.C?6.1a(7[0],n):P):7.1a(n,h)}})},R:8(Y,D,1s){l(Y.C==17)E(q i 1r Y)D.11(Y[i],1s||[i,Y[i]]);G E(q i=0;i<Y.C;i++)D.11(Y[i],1s||[i,Y[i]]);u Y},1f:{1N:8(o,c){l(6.1f.2E(o,c))u;o.1f+=(o.1f?" ":"")+c},28:8(o,c){o.1f=!c?"":o.1f.1h(12 2J("(^|\\\\s*\\\\b[^-])"+c+"($|\\\\b(?=[^-]))","g"),"")},2E:8(e,a){l(e.1f)e=e.1f;u 12 2J("(^|\\\\s)"+a+"(\\\\s|$)").1S(e)}},3S:8(e,o,f){E(q i 1r o){e.1b["1L"+i]=e.1b[i];e.1b[i]=o[i]}f.11(e,[]);E(q i 1r o)e.1b[i]=e.1b["1L"+i]},1a:8(e,p){l(p=="1G"||p=="2b"){q 1L={},3c,31,d=["5M","5O","5P","5Q"];E(q i 1r d){1L["5R"+d[i]]=0;1L["5S"+d[i]+"5T"]=0}6.3S(e,1L,8(){l(6.1a(e,"1l")!="1R"){3c=e.5U;31=e.5V}G 6.3S(e,{3A:"23",4H:"7D",1l:""},8(){3c=e.5W;31=e.5X})});u p=="1G"?3c:31}G l(p=="1o"&&6.1k.1T)u 3l(6.1D(e,"1c").1h(/[^0-9.]/,""))||1;u 6.1D(e,p)},1D:8(e,p,5a){q r;l(!5a&&e.1b[p])r=e.1b[p];G l(e.2Q){p=p.1h(/\\-(\\w)/g,8(m,c){u c.2P()});r=e.2Q[p]}G l(W.3P&&W.3P.56){p=p.1h(/([A-Z])/g,"-$1").4z();q s=W.3P.56(e,"");r=s?s.62(p):P}u r},3b:8(a){q r=[];E(q i=0;i<a.C;i++){l(a[i].H==1t){q 1e="";l(!a[i].16("<3M")||!a[i].16("<1U")){1e="3M";a[i]="<1e>"+a[i]+"</1e>"}G l(!a[i].16("<37")){1e="37";a[i]="<1e>"+a[i]+"</1e>"}G l(!a[i].16("<3K")||!a[i].16("<64")){1e="3K";a[i]="<1e><1U><37>"+a[i]+"</37></1U></1e>"}q 1q=W.4e("1q");1q.39=a[i];l(1e){1q=1q.1J;l(1e!="3M")1q=1q.1J;l(1e=="3K")1q=1q.1J}E(q j=0;j<1q.1Q.C;j++)r.18(1q.1Q[j])}G l(a[i].35||a[i].C&&!a[i].1Y)E(q k=0;k<a[i].C;k++)r.18(a[i][k]);G l(a[i]!==P)r.18(a[i].1Y?a[i]:W.68(a[i].69()))}u r},2j:{"":"m[2]== \'*\'||a.3F.2P()==m[2].2P()","#":"a.2X(\'2C\')&&a.2X(\'2C\')==m[2]",":":{4L:"i<m[3]-0",43:"i>m[3]-0",6b:"m[3]-0==i",4K:"m[3]-0==i",4T:"i==0",1v:"i==r.C-1",4q:"i%2==0",4r:"i%2","4T-3H":"6.1x(a,0).29","1v-3H":"6.1x(a,0).1v","6c-3H":"6.1x(a).C==1",4R:"a.1Q.C",4Z:"!a.1Q.C",4M:"(a.6d||a.39).16(m[3])>=0",6e:"a.B!=\'23\'&&6.1a(a,\'1l\')!=\'1R\'&&6.1a(a,\'3A\')!=\'23\'",23:"a.B==\'23\'||6.1a(a,\'1l\')==\'1R\'||6.1a(a,\'3A\')==\'23\'",6g:"!a.2Y",2Y:"a.2Y",4O:"a.4O",44:"a.44"},".":"6.1f.2E(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"!z.16(m[4])","$=":"z.2y(z.C - m[4].C,m[4].C)==m[4]","*=":"z.16(m[4])>=0","":"z"},"[":"6.20(m[2],a).C"},2L:["\\\\.\\\\.|/\\\\.\\\\.","a.1y",">|/","6.1x(a.1J)","\\\\+","6.1x(a).2K","~",8(a){q r=[];q s=6.1x(a);l(s.n>0)E(q i=s.n;i<s.C;i++)r.18(s[i]);u r}],20:8(t,19){l(19&&19.1Y==17)19=P;19=19||6.19||W;l(t.H!=1t)u[t];l(!t.16("//")){19=19.4j;t=t.2y(2,t.C)}G l(!t.16("/")){19=19.4j;t=t.2y(1,t.C);l(t.16("/")>=1)t=t.2y(t.16("/"),t.C)}q O=[19];q 2i=[];q 1v=P;2k(t.C>0&&1v!=t){q r=[];1v=t;t=6.2T(t).1h(/^\\/\\//i,"");q 3C=15;E(q i=0;i<6.2L.C;i+=2){q 2f=12 2J("^("+6.2L[i]+")");q m=2f.2R(t);l(m){r=O=6.27(O,6.2L[i+1]);t=6.2T(t.1h(2f,""));3C=14}}l(!3C){l(!t.16(",")||!t.16("|")){l(O[0]==19)O.3i();2i=6.1X(2i,O);r=O=[19];t=" "+t.2y(1,t.C)}G{q 3z=/^([#.]?)([a-4s-9\\\\*3q-]*)/i;q m=3z.2R(t);l(m[1]=="#"){q 3w=W.41(m[2]);r=O=3w?[3w]:[];t=t.1h(3z,"")}G{l(!m[2]||m[1]==".")m[2]="*";E(q i=0;i<O.C;i++)r=6.1X(r,m[2]=="*"?6.3x(O[i]):O[i].4k(m[2]))}}}l(t){q 32=6.1c(t,r);O=r=32.r;t=6.2T(32.t)}}l(O&&O[0]==19)O.3i();2i=6.1X(2i,O);u 2i},3x:8(o,r){r=r||[];q s=o.1Q;E(q i=0;i<s.C;i++)l(s[i].1Y==1){r.18(s[i]);6.3x(s[i],r)}u r},1B:8(o,a,v){l(a&&a.H==1t){q 22={"E":"6n","6p":"1f","4I":"6q"};a=(22[a]&&22[a].1h&&22[a]||a).1h(/-([a-z])/6r,8(z,b){u b.2P()});l(v!=17){o[a]=v;l(o.4n&&a!="2Y")o.4n(a,v)}u o[a]||o.2X&&o.2X(a)||""}G u""},4p:[["\\\\[ *(@)S *([!*$^=]*) *Q\\\\]",1],["(\\\\[)Q\\\\]",0],["(:)S\\\\(Q\\\\)",0],["([:.#]*)S",0]],1c:8(t,r,2S){q g=2S!==15?6.2v:8(a,f){u 6.2v(a,f,14)};2k(t&&/^[a-z[({<*:.#]/i.1S(t)){q p=6.4p;E(q i=0;i<p.C;i++){q 2f=12 2J("^"+p[i][0].1h(\'S\',"([a-z*3q-][a-4s-6v-]*)").1h(\'Q\'," *\'?\\"?([^\'\\"]*?)\'?\\"? *"),"i");q m=2f.2R(t);l(m){l(p[i][1])m=["",m[1],m[3],m[2],m[4]];t=t.1h(2f,"");6y}}l(m[1]==":"&&m[2]=="2S")r=6.1c(m[3],r,15).r;G{q f=6.2j[m[1]];l(f.H!=1t)f=6.2j[m[1]][m[2]];3W("f = 8(a,i){"+(m[1]=="@"?"z=6.1B(a,m[3]);":"")+"u "+f+"}");r=g(r,f)}}u{r:r,t:t}},2T:8(t){u t.1h(/^\\s+|\\s+$/g,"")},2M:8(a){q b=[];q c=a.1y;2k(c&&c!=W){b.18(c);c=c.1y}u b},1x:8(a,n){q B=[];q 2u=a.1y.1Q;E(q i=0;i<2u.C;i++){l(2u[i].1Y==1)B.18(2u[i]);l(2u[i]==a)B.n=B.C-1}B.1v=B.n==B.C-1;B.29=n=="4q"&&B.n%2==0||n=="4r"&&B.n%2||B[n]==a;B.3D=B[B.n-1];B.2K=B[B.n+1];u B},1X:8(a,b){q d=[];E(q k=0;k<a.C;k++)d[k]=a[k];E(q i=0;i<b.C;i++){q c=14;E(q j=0;j<a.C;j++)l(b[i]==a[j])c=15;l(c)d.18(b[i])}u d},2v:8(a,f,s){l(f.H==1t)f=12 1g("a","i","u "+f);q r=[];E(q i=0;i<a.C;i++)l(!s&&f(a[i],i)||s&&!f(a[i],i))r.18(a[i]);u r},27:8(a,f){l(f.H==1t)f=12 1g("a","u "+f);q r=[];E(q i=0;i<a.C;i++){q t=f(a[i],i);l(t!==P&&t!=17){l(t.H!=2g)t=[t];r=6.1X(r,t)}}u r},L:{1N:8(M,B,1W){l(6.1k.1T&&M.3u!=17)M=1F;l(!1W.2m)1W.2m=7.2m++;l(!M.1p)M.1p={};q 2w=M.1p[B];l(!2w){2w=M.1p[B]={};l(M["2t"+B])2w[0]=M["2t"+B]}2w[1W.2m]=1W;M["2t"+B]=7.4x;l(!7.2x[B])7.2x[B]=[];7.2x[B].18(M)},2m:1,2x:{},28:8(M,B,1W){l(M.1p)l(B&&M.1p[B])l(1W)4t M.1p[B][1W.2m];G E(q i 1r M.1p[B])4t M.1p[B][i];G E(q j 1r M.1p)7.28(M,j)},1z:8(B,I,M){I=I||[];l(!M){q g=7.2x[B];l(g)E(q i=0;i<g.C;i++)7.1z(B,I,g[i])}G l(M["2t"+B]){I.6F(7.22({B:B,6G:M}));M["2t"+B].11(M,I)}},4x:8(L){l(6H 6=="17")u;L=L||6.L.22(1F.L);l(!L)u;q 2N=14;q c=7.1p[L.B];E(q j 1r c){l(c[j].11(7,[L])===15){L.3L();L.4y();2N=15}}u 2N},22:8(L){l(L){L.3L=8(){7.2N=15};L.4y=8(){7.6J=14}}u L}}});12 8(){q b=55.57.4z();6.1k={2W:/6K/.1S(b),2B:/2B/.1S(b),1T:/1T/.1S(b)&&!/2B/.1S(b),3e:/3e/.1S(b)&&!/6L/.1S(b)};6.6N=!6.1k.1T||W.6O=="6Q"};6.24={2h:{6R:"4B",6S:"4D",2r:"4E",6T:"4G"},1a:"2b,1G,6U,6V,4H,4I,2D,6W,6X".3V(","),1c:["4K","4L","43","4M"],1B:{32:"1M",4X:"39",2C:P,6Z:P,3Z:P,70:P,34:P,72:P},4P:{4R:"a.1y",74:6.2M,2M:6.2M,2K:"6.1x(a).2K",3D:"6.1x(a).3D",76:6.1x,77:"a.1Q"},R:{78:8(1w){7.79(1w)},45:8(){7.1b.1l=7.2a?7.2a:"";l(6.1a(7,"1l")=="1R")7.1b.1l="3k"},46:8(){7.2a=7.2a||6.1a(7,"1l");l(7.2a=="1R")7.2a="3k";7.1b.1l="1R"},52:8(){q d=6.1a(7,"1l");$(7)[!d||d=="1R"?"1V":"1n"]()},7b:8(c){6.1f.1N(7,c)},7c:8(c){6.1f.28(7,c)},7d:8(c){6.1f[6.1f.2E(7,c)?"28":"1N"](7,c)},28:8(a){l(!a||6.1c([7],a).r)7.1y.50(7)},4Z:8(){2k(7.1J)7.50(7.1J)},2A:8(B,D){l(D.H==1t)D=12 1g("e",(!D.16(".")?"$(7)":"u ")+D);6.L.1N(7,B,D)},3X:8(B,D){6.L.28(7,B,D)},1z:8(B,I){6.L.1z(B,I,7)}}};6.D.1K({7f:8(a,b){u a&&b?7.59(8(e){7.1v=7.1v==a?b:a;e.3L();u 7.1v.11(7,[e])||15}):7.52()},7i:8(f,g){8 3N(e){q p=(e.B=="3d"?e.7j:e.7l)||e.7m;2k(p&&p!=7)p=p.1y;l(p==7)u 15;u(e.B=="3d"?f:g).11(7,[e])}u 7.3d(3N).5d(3N)},1O:8(f){l(6.3a)f.11(W);G{6.2l.18(f)}u 7}});6.1K({3a:15,2l:[],1O:8(){l(!6.3a){6.3a=14;l(6.2l){E(q i=0;i<6.2l.C;i++)6.2l[i].11(W);6.2l=P}}}});12 8(){q e=("7o,7p,2p,7q,7r,7t,59,7v,"+"7w,7y,7z,3d,5d,7C,7E,7F,"+"7G,5h,5i,5j,25").3V(",");E(q i=0;i<e.C;i++)12 8(){q o=e[i];6.D[o]=8(f){u f?7.2A(o,f):7.1z(o)};6.D["5k"+o]=8(f){u 7.3X(o,f)};6.D["5l"+o]=8(f){u 7.R(8(){q 3Y=0;6.L.1N(7,o,8(e){l(3Y++)u;u f.11(7,[e])})})}};l(6.1k.3e||6.1k.2B){W.5n("5p",6.1O,15)}G l(6.1k.1T){W.5q("<5r"+"5s 2C=4W 5t=14 "+"34=//:><\\/21>");q 21=W.41("4W");21.2n=8(){l(7.2H=="1m")6.1O()};21=P}G l(6.1k.2W){6.3J=3u(8(){l(W.2H=="5x"||W.2H=="1m"){4w(6.3J);6.3J=P;6.1O()}},10)}6.L.1N(1F,"2p",6.1O)};6.D.1K({1V:8(V,F){u V?7.1P({1G:"1V",2b:"1V",1o:"1V"},V,F):7.45()},1n:8(V,F){u V?7.1P({1G:"1n",2b:"1n",1o:"1n"},V,F):7.46()},5G:8(V,F){u 7.1P({1G:"1V"},V,F)},5H:8(V,F){u 7.1P({1G:"1n"},V,F)},5J:8(V,F){u 7.1P({1o:"1V"},V,F)},60:8(V,F){u 7.1P({1o:"1n"},V,F)},5N:8(V,2h,F){u 7.1P({1o:2h},V,F)},1P:8(J,V,F){u 7.1i(8(){q i=0;E(q p 1r J){q e=12 6.2o(7,6.V(V,F,i++),p);l(J[p].H==3v)e.30(e.29(),J[p]);G e[J[p]](J)}})},1i:8(B,D){l(!D){D=B;B="2o"}u 7.R(8(){l(!7.1i)7.1i={};l(!7.1i[B])7.1i[B]=[];7.1i[B].18(D);l(7.1i[B].C==1)D.11(7)})}});6.1K({4F:8(e,p){l(e.4c)u;l(p=="1G"&&e.40!=2G(6.1D(e,p)))u;l(p=="2b"&&e.5b!=2G(6.1D(e,p)))u;q a=e.1b[p];q o=6.1D(e,p,1);l(p=="1G"&&e.40!=o||p=="2b"&&e.5b!=o)u;e.1b[p]=e.2Q?"":"4b";q n=6.1D(e,p,1);l(o!=n&&n!="4b"){e.1b[p]=a;e.4c=14}},V:8(s,o,i){o=o||{};l(o.H==1g)o={1m:o};q 4d={61:63,65:49};o.2q=(s&&s.H==3v?s:4d[s])||4V;o.36=o.1m;o.1m=8(){6.4f(7,"2o");l(o.36&&o.36.H==1g)o.36.11(7)};l(i>0)o.1m=P;u o},1i:{},4f:8(1H,B){B=B||"2o";l(1H.1i&&1H.1i[B]){1H.1i[B].3i();q f=1H.1i[B][0];l(f)f.11(1H)}},2o:8(1H,2d,J){q z=7;z.o={2q:2d.2q||4V,1m:2d.1m,2e:2d.2e};z.T=1H;q y=z.T.1b;z.a=8(){l(2d.2e)2d.2e.11(1H,[z.1A]);l(J=="1o"){l(z.1A==1)z.1A=0.6h;l(1F.54)y.1c="6j(1o="+z.1A*6l+")";G y.1o=z.1A}G l(2G(z.1A))y[J]=2G(z.1A)+"4C";y.1l="3k"};z.4m=8(){u 3l(6.1a(z.T,J))};z.29=8(){u 3l(6.1D(z.T,J))||z.4m()};z.30=8(3m,2h){z.3y=(12 4u()).4v();z.1A=3m;z.a();z.3t=3u(8(){z.2e(3m,2h)},13)};z.1V=8(p){l(!z.T.1u)z.T.1u={};z.T.1u[J]=7.29();z.30(0,z.T.1u[J]);l(J!="1o")y[J]="6w"};z.1n=8(){l(!z.T.1u)z.T.1u={};z.T.1u[J]=7.29();z.o.1n=14;z.30(z.29(),0)};l(6.1k.1T&&!z.T.2Q.6A)y.6B="1";l(!z.T.6C)z.T.4A=6.1a(z.T,"2D");y.2D="23";z.2e=8(3f,3E){q t=(12 4u()).4v();l(t>z.o.2q+z.3y){4w(z.3t);z.3t=P;z.1A=3E;z.a();l(z.o.1n)y.1l=\'1R\';y.2D=z.T.4A;l(z.o.1n)y[J]=z.T.1u[J].H==3v&&J!="1o"?z.T.1u[J]+"4C":z.T.1u[J];6.4F(z.T,J);l(z.o.1m&&z.o.1m.H==1g)z.o.1m.11(z.T)}G{q p=(t-7.3y)/z.o.2q;z.1A=((-4S.71(p*4S.75)/2)+0.5)*(3E-3f)+3f;z.a()}}}});6.D.7a=8(N,1C,F){7.2p(N,1C,F,1)};6.D.2p=8(N,1C,F,1I){l(N.H==1g)u 7.2A("2p",N);F=F||8(){};q B="3R";l(1C){l(1C.H==1g){F=1C;1C=P}G{1C=6.2O(1C);B="47"}}q 33=7;6.2F(B,N,1C,8(38,U){l(U=="2c"||!1I&&U=="4N"){33.4X(38.2V).R(F,[38.2V,U]);$("21",33).R(8(){l(7.34)$.4Q(7.34);G 3W.4i(1F,7.3Q||7.7g||7.39||"")})}G F.11(33,[38.2V,U])},1I);u 7};l(6.1k.1T)3s=8(){u 12 54(55.57.16("7u 5")>=0?"7A.5e":"7B.5e")};12 8(){q e="4a,53,51,4Y,4U".3V(\',\');E(q i=0;i<e.C;i++)12 8(){q o=e[i];6.D[o]=8(f){u 7.2A(o,f)}}};6.1K({1j:8(N,I,F,B,1I){l(I.H==1g){B=F;F=I;I=P}l(I)N+="?"+6.2O(I);6.2F("3R",N,P,8(r,U){l(F)F(6.3G(r,B),U)},1I)},5u:8(N,I,F,B){6.1j(N,I,F,B,1)},4Q:8(N,I,F){6.1j(N,I,F,"21")},5F:8(N,I,F,B){6.2F("47",N,6.2O(I),8(r,U){l(F)F(6.3G(r,B),U)})},1E:0,5K:8(1E){6.1E=1E},2U:{},2F:8(B,N,I,O,1I){l(!N){O=B.1m;q 2c=B.2c;q 25=B.25;I=B.I;N=B.N;B=B.B}l(!6.3g++)6.L.1z("4a");q 3T=15;q K=12 3s();K.5Y(B||"3R",N,14);l(I)K.2I("66-67","6a/x-6f-6i-6k");l(1I)K.2I("6m-3j-6o",6.2U[N]||"6s, 6t 6u 6x 3o:3o:3o 6z");K.2I("X-6D-6E","3s");l(K.6I)K.2I("6M","6P");q 2n=8(3h){l(K&&(K.2H==4||3h=="1E")){3T=14;q U=6.5f(K)&&3h!="1E"?1I&&6.58(K,N)?"4N":"2c":"25";l(U!="25"){q 3B=K.3I("4h-3j");l(1I&&3B)6.2U[N]=3B;l(2c)2c(K,U);6.L.1z("4U")}G{l(25)25(K,U);6.L.1z("4Y")}6.L.1z("51");l(!--6.3g)6.L.1z("53");l(O)O(K,U);K.2n=8(){};K=P}};K.2n=2n;l(6.1E>0)7s(8(){l(K){K.7x();l(!3T)2n("1E");K=P}},6.1E);K.5o(I)},3g:0,5f:8(r){4g{u!r.U&&5C.5I=="5L:"||(r.U>=49&&r.U<5Z)||r.U==5g||6.1k.2W&&r.U==17}4J(e){}u 15},58:8(K,N){4g{q 4o=K.3I("4h-3j");u K.U==5g||4o==6.2U[N]||6.1k.2W&&K.U==17}4J(e){}u 15},3G:8(r,B){q 3O=r.3I("7h-B");q I=!B&&3O&&3O.16("K")>=0;I=B=="K"||I?r.5m:r.2V;l(B=="21")3W.4i(1F,I);u I},2O:8(a){q s=[];l(a.H==2g){E(q i=0;i<a.C;i++)s.18(a[i].3Z+"="+4l(a[i].1M))}G{E(q j 1r a)s.18(j+"="+4l(a[j]))}u s.7k("&")}});',62,477,'||||||jQuery|this|function|||||||||||||if|||||var||||return|||||||type|length|fn|for|callback|else|constructor|data|prop|xml|event|element|url|ret|null||each||el|status|speed|document||obj|||apply|new||true|false|indexOf|undefined|push|context|css|style|filter|arguments|table|className|Function|replace|queue|get|browser|display|complete|hide|opacity|events|div|in|args|String|orig|last|key|sibling|parentNode|trigger|now|attr|params|curCSS|timeout|window|height|elem|ifModified|firstChild|extend|old|value|add|ready|animate|childNodes|none|test|msie|tbody|show|handler|merge|nodeType|num|find|script|fix|hidden|macros|error|pushStack|map|remove|cur|oldblock|width|success|options|step|re|Array|to|done|expr|while|readyList|guid|onreadystatechange|fx|load|duration|insertBefore|domManip|on|tmp|grep|handlers|global|substr|dir|bind|opera|id|overflow|has|ajax|parseInt|readyState|setRequestHeader|RegExp|next|token|parents|returnValue|param|toUpperCase|currentStyle|exec|not|trim|lastModified|responseText|safari|getAttribute|disabled|stack|custom|oWidth|val|self|src|jquery|oldComplete|tr|res|innerHTML|isReady|clean|oHeight|mouseover|mozilla|firstNum|active|istimeout|shift|Modified|block|parseFloat|from|appendChild|00|clone|_|cloneNode|XMLHttpRequest|timer|setInterval|Number|oid|getAll|startTime|re2|visibility|modRes|foundToken|prev|lastNum|nodeName|httpData|child|getResponseHeader|safariTimer|td|preventDefault|thead|handleHover|ct|defaultView|text|GET|swap|requestDone|deep|split|eval|unbind|count|name|scrollHeight|getElementById|size|gt|selected|_show|_hide|POST|initDone|200|ajaxStart|auto|notAuto|ss|createElement|dequeue|try|Last|call|documentElement|getElementsByTagName|encodeURIComponent|max|setAttribute|xmlRes|parse|even|odd|z0|delete|Date|getTime|clearInterval|handle|stopPropagation|toLowerCase|oldOverflow|append|px|prepend|before|setAuto|after|position|float|catch|eq|lt|contains|notmodified|checked|axis|getScript|parent|Math|first|ajaxSuccess|400|__ie_init|html|ajaxError|empty|removeChild|ajaxComplete|_toggle|ajaxStop|ActiveXObject|navigator|getComputedStyle|userAgent|httpNotModified|click|force|scrollWidth|init|mouseout|XMLHTTP|httpSuccess|304|keydown|keypress|keyup|un|one|responseXML|addEventListener|send|DOMContentLoaded|write|scr|ipt|defer|getIfModified|Rev|221|loaded|nextSibling|end|pop|is|location|TABLE|THEAD|post|slideDown|slideUp|protocol|fadeIn|ajaxTimeout|file|Top|fadeTo|Bottom|Right|Left|padding|border|Width|offsetHeight|offsetWidth|clientHeight|clientWidth|open|300|fadeOut|slow|getPropertyValue|600|th|fast|Content|Type|createTextNode|toString|application|nth|only|innerText|visible|www|enabled|9999|form|alpha|urlencoded|100|If|htmlFor|Since|class|cssFloat|ig|Thu|01|Jan|9_|1px|1970|break|GMT|hasLayout|zoom|oldOverlay|Requested|With|unshift|target|typeof|overrideMimeType|cancelBubble|webkit|compatible|Connection|boxModel|compatMode|close|CSS1Compat|appendTo|prependTo|insertAfter|top|left|color|background|Boolean|title|href|cos|rel|wrap|ancestors|PI|siblings|children|removeAttr|removeAttribute|loadIfModified|addClass|removeClass|toggleClass|nodeValue|toggle|textContent|content|hover|fromElement|join|toElement|relatedTarget|prototype|blur|focus|resize|scroll|setTimeout|unload|MSIE|dblclick|mousedown|abort|mouseup|mousemove|Microsoft|Msxml2|change|absolute|reset|select|submit'.split('|'),0,{}))
\ No newline at end of file
Index: misc/progress.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/progress.js,v
retrieving revision 1.10
diff -u -d -F^\s*function -r1.10 progress.js
--- misc/progress.js	28 Mar 2006 09:29:23 -0000	1.10
+++ misc/progress.js	23 Aug 2006 11:02:00 -0000
@@ -5,45 +5,35 @@
  * the DOM afterwards through progressBar.element.
  *
  * method is the function which will perform the HTTP request to get the
- * progress bar state. Either HTTPGet or HTTPPost.
+ * progress bar state. Either "GET" or "POST".
  *
  * e.g. pb = new progressBar('myProgressBar');
  *      some_element.appendChild(pb.element);
  */
-function progressBar(id, updateCallback, method, errorCallback) {
+Drupal.progressBar = function (id, updateCallback, method, errorCallback) {
   var pb = this;
   this.id = id;
-  this.method = method ? method : HTTPGet;
+  this.method = method || "GET";
   this.updateCallback = updateCallback;
   this.errorCallback = errorCallback;
 
   this.element = document.createElement('div');
   this.element.id = id;
   this.element.className = 'progress';
-  this.element.innerHTML = '<div class="percentage"></div>'+
-                           '<div class="message">&nbsp;</div>'+
-                           '<div class="bar"><div class="filled"></div></div>';
+  $(this.element).html('<div class="percentage"></div>'+
+                       '<div class="message">&nbsp;</div>'+
+                       '<div class="bar"><div class="filled"></div></div>');
 }
 
 /**
  * Set the percentage and status message for the progressbar.
  */
-progressBar.prototype.setProgress = function (percentage, message) {
-  var divs = this.element.getElementsByTagName('div');
-  var div;
-  for (var i = 0; div = divs[i]; ++i) {
-    if (percentage >= 0) {
-      if (hasClass(divs[i], 'filled')) {
-        divs[i].style.width = percentage + '%';
-      }
-      if (hasClass(divs[i], 'percentage')) {
-        divs[i].innerHTML = percentage + '%';
-      }
-    }
-    if (hasClass(divs[i], 'message')) {
-      divs[i].innerHTML = message;
-    }
+Drupal.progressBar.prototype.setProgress = function (percentage, message) {
+  if (percentage >= 0 && percentage <= 100) {
+    $('div.filled', this.element).css('width', percentage +'%');
+    $('div.percentage', this.element).html(percentage +'%');
   }
+  $('div.message', this.element).html(message);
   if (this.updateCallback) {
     this.updateCallback(percentage, message, this);
   }
@@ -52,7 +42,7 @@ function progressBar(id, updateCallback,
 /**
  * Start monitoring progress via Ajax.
  */
-progressBar.prototype.startMonitoring = function (uri, delay) {
+Drupal.progressBar.prototype.startMonitoring = function (uri, delay) {
   this.delay = delay;
   this.uri = uri;
   this.sendPing();
@@ -61,7 +51,7 @@ function progressBar(id, updateCallback,
 /**
  * Stop monitoring progress via Ajax.
  */
-progressBar.prototype.stopMonitoring = function () {
+Drupal.progressBar.prototype.stopMonitoring = function () {
   clearTimeout(this.timer);
   // This allows monitoring to be stopped from within the callback
   this.uri = null;
@@ -70,47 +60,44 @@ function progressBar(id, updateCallback,
 /**
  * Request progress data from server.
  */
-progressBar.prototype.sendPing = function () {
+Drupal.progressBar.prototype.sendPing = function () {
   if (this.timer) {
     clearTimeout(this.timer);
   }
   if (this.uri) {
-    this.method(this.uri, this.receivePing, this, '');
-  }
-}
-
-/**
- * HTTP callback function. Passes data back to the progressbar and sets a new
- * timer for the next ping.
- */
-progressBar.prototype.receivePing = function (string, xmlhttp, pb) {
-  if (xmlhttp.status != 200) {
-    return pb.displayError('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri);
-  }
-  // Parse response
-  var progress = parseJson(string);
-  // Display errors
-  if (progress.status == 0) {
-    pb.displayError(progress.data);
-    return;
+    var pb = this;
+    $.ajax({
+      type: this.method,
+      url: this.uri,
+      success: function (xmlhttp) {
+        // Parse response
+        var progress = Drupal.parseJson(xmlhttp.responseText);
+        // Display errors
+        if (progress.status == 0) {
+          pb.displayError(progress.data);
+          return;
+        }
+        // Update display
+        pb.setProgress(progress.percentage, progress.message);
+        // Schedule next timer
+        pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay);
+      },
+      error: function (xmlhttp) {
+        pb.displayError('An HTTP error '+ xmlhttp.status +' occured.\n'+ pb.uri);
+      }
+    });
   }
-
-  // Update display
-  pb.setProgress(progress.percentage, progress.message);
-  // Schedule next timer
-  pb.timer = setTimeout(function() { pb.sendPing(); }, pb.delay);
 }
 
 /**
  * Display errors on the page.
  */
-progressBar.prototype.displayError = function (string) {
+Drupal.progressBar.prototype.displayError = function (string) {
   var error = document.createElement('div');
   error.className = 'error';
   error.innerHTML = string;
 
-  this.element.style.display = 'none';
-  this.element.parentNode.insertBefore(error, this.element);
+  $(this.element).before(error).hide();
 
   if (this.errorCallback) {
     this.errorCallback(this);
Index: misc/textarea.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/textarea.js,v
retrieving revision 1.9
diff -u -d -F^\s*function -r1.9 textarea.js
--- misc/textarea.js	14 Apr 2006 13:48:56 -0000	1.9
+++ misc/textarea.js	23 Aug 2006 11:02:00 -0000
@@ -1,122 +1,31 @@
 // $Id: textarea.js,v 1.9 2006/04/14 13:48:56 killes Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(textAreaAutoAttach);
-}
-
-function textAreaAutoAttach(event, parent) {
-  if (typeof parent == 'undefined') {
-    // Attach to all visible textareas.
-    textareas = document.getElementsByTagName('textarea');
-  }
-  else {
-    // Attach to all visible textareas inside parent.
-    textareas = parent.getElementsByTagName('textarea');
-  }
-  var textarea;
-  for (var i = 0; textarea = textareas[i]; ++i) {
-    if (hasClass(textarea, 'resizable') && !hasClass(textarea.nextSibling, 'grippie')) {
-      if (typeof dimensions(textarea).width != 'undefined' && dimensions(textarea).width != 0) {
-        new textArea(textarea);
-      }
+Drupal.textareaAttach = function() {
+  $('textarea.resizable:not(.processed)').each(function() {
+    var textarea = $(this).addClass('processed'), staticOffset = null;
+    
+    $(this).wrap('<div class="resizable-textarea"></div>')
+      .parent().append($('<div class="grippie"></div>').mousedown(startDrag));
+    
+    function startDrag(e) {
+      staticOffset = textarea.height() - Drupal.mousePosition(e).y;
+      textarea.animate({ opacity: 0.25 });
+      $(document).mousemove(performDrag).mouseup(endDrag);
+      return false;
     }
-  }
-}
-
-function textArea(element) {
-  var ta = this;
-  this.element = element;
-  this.parent = this.element.parentNode;
-  this.dimensions = dimensions(element);
-
-  // Prepare wrapper
-  this.wrapper = document.createElement('div');
-  this.wrapper.className = 'resizable-textarea';
-  this.parent.insertBefore(this.wrapper, this.element);
 
-  // Add grippie and measure it
-  this.grippie = document.createElement('div');
-  this.grippie.className = 'grippie';
-  this.wrapper.appendChild(this.grippie);
-  this.grippie.dimensions = dimensions(this.grippie);
-  this.grippie.onmousedown = function (e) { ta.beginDrag(e); };
-
-  // Set wrapper and textarea dimensions
-  this.wrapper.style.height = this.dimensions.height + this.grippie.dimensions.height + 1 +'px';
-  this.element.style.marginBottom = '0px';
-  this.element.style.width = '100%';
-  this.element.style.height = this.dimensions.height +'px';
-
-  // Wrap textarea
-  removeNode(this.element);
-  this.wrapper.insertBefore(this.element, this.grippie);
-
-  // Measure difference between desired and actual textarea dimensions to account for padding/borders
-  this.widthOffset = dimensions(this.wrapper).width - this.dimensions.width;
-
-  // Make the grippie line up in various browsers
-  if (window.opera) {
-    // Opera
-    this.grippie.style.marginRight = '4px';
-  }
-  if (document.all && !window.opera) {
-    // IE
-    this.grippie.style.width = '100%';
-    this.grippie.style.paddingLeft = '2px';
-  }
-  // Mozilla
-  this.element.style.MozBoxSizing = 'border-box';
-
-  this.heightOffset = absolutePosition(this.grippie).y - absolutePosition(this.element).y - this.dimensions.height;
-}
-
-textArea.prototype.beginDrag = function (event) {
-  if (document.isDragging) {
-    return;
-  }
-  document.isDragging = true;
-
-  event = event || window.event;
-  // Capture mouse
-  var cp = this;
-  this.oldMoveHandler = document.onmousemove;
-  document.onmousemove = function(e) { cp.handleDrag(e); };
-  this.oldUpHandler = document.onmouseup;
-  document.onmouseup = function(e) { cp.endDrag(e); };
-
-  // Store drag offset from grippie top
-  var pos = absolutePosition(this.grippie);
-  this.dragOffset = event.clientY - pos.y;
-
-  // Make transparent
-  this.element.style.opacity = 0.5;
-
-  // Process
-  this.handleDrag(event);
-}
-
-textArea.prototype.handleDrag = function (event) {
-  event = event || window.event;
-  // Get coordinates relative to text area
-  var pos = absolutePosition(this.element);
-  var y = event.clientY - pos.y;
-
-  // Set new height
-  var height = Math.max(32, y - this.dragOffset - this.heightOffset);
-  this.wrapper.style.height = height + this.grippie.dimensions.height + 1 + 'px';
-  this.element.style.height = height + 'px';
-
-  // Avoid text selection
-  stopEvent(event);
-}
-
-textArea.prototype.endDrag = function (event) {
-  // Uncapture mouse
-  document.onmousemove = this.oldMoveHandler;
-  document.onmouseup = this.oldUpHandler;
+    function performDrag(e) {
+      textarea.height(Math.max(32, staticOffset + Drupal.mousePosition(e).y) + 'px');
+      return false;
+    }
 
-  // Restore opacity
-  this.element.style.opacity = 1.0;
-  document.isDragging = false;
+    function endDrag(e) {
+      $(document).unmousemove(performDrag).unmouseup(endDrag);
+      textarea.animate({ opacity: 1 });
+    }
+  });
 }
 
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.textareaAttach);
+}
\ No newline at end of file
Index: misc/update.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/update.js,v
retrieving revision 1.8
diff -u -d -F^\s*function -r1.8 update.js
--- misc/update.js	28 Mar 2006 09:29:23 -0000	1.8
+++ misc/update.js	23 Aug 2006 11:02:00 -0000
@@ -1,12 +1,11 @@
 // $Id: update.js,v 1.8 2006/03/28 09:29:23 killes Exp $
 
-if (isJsEnabled()) {
-  addLoadEvent(function() {
-    if ($('edit-has_js')) {
-      $('edit-has_js').value = 1;
-    }
+if (Drupal.jsEnabled) {
+  $(document).ready(function() {
+    $('#edit-has_js').each(function() { this.value = 1; });
+    $('#progress').each(function () {
+      var holder = this;
 
-    if ($('progress')) {
       // Success: redirect to the summary.
       var updateCallback = function (progress, status, pb) {
         if (progress == 100) {
@@ -19,15 +18,15 @@
       var errorCallback = function (pb) {
         var div = document.createElement('p');
         div.className = 'error';
-        div.innerHTML = 'An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>';
-        $('progress').insertBefore(div, $('progress').firstChild);
-        $('wait').style.display = 'none';
+        $(div).html('An unrecoverable error has occured. You can find the error message below. It is advised to copy it to the clipboard for reference. Please continue to the <a href="update.php?op=error">update summary</a>');
+        $(holder).prepend(div);
+        $('#wait').hide();
       }
 
-      var progress = new progressBar('updateprogress', updateCallback, HTTPPost, errorCallback);
+      var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback);
       progress.setProgress(-1, 'Starting updates');
-      $('progress').appendChild(progress.element);
+      $(holder).append(progress.element);
       progress.startMonitoring('update.php?op=do_update', 0);
-    }
+    });
   });
 }
Index: misc/upload.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/upload.js,v
retrieving revision 1.9
diff -u -d -F^\s*function -r1.9 upload.js
--- misc/upload.js	5 May 2006 10:47:20 -0000	1.9
+++ misc/upload.js	23 Aug 2006 11:02:00 -0000
@@ -1,75 +1,119 @@
 // $Id: upload.js,v 1.9 2006/05/05 10:47:20 drumm Exp $
 
-// Global killswitch
-if (isJsEnabled()) {
-  addLoadEvent(uploadAutoAttach);
-}
-
 /**
  * Attaches the upload behaviour to the upload form.
  */
-function uploadAutoAttach() {
-  var inputs = document.getElementsByTagName('input');
-  for (i = 0; input = inputs[i]; i++) {
-    if (input && hasClass(input, 'upload')) {
-      var uri = input.value;
-      // Extract the button ID based on a substring of the input name: edit[foo][bar] -> foo-bar
-      var button = input.name.substr(5, input.name.length - 6).replace('][', '-');
-      var wrapper = button + '-wrapper';
-      var hide = button + '-hide';
-      var upload = new jsUpload(uri, button, wrapper, hide);
-    }
-  }
+Drupal.uploadAutoAttach = function() {
+  $('input.upload').each(function () {
+    var uri = this.value;
+    // Extract the button ID based on a substring of the input name: edit[foo][bar] -> foo-bar
+    var button = this.name.substr(5, this.name.length - 6).replace('][', '-');
+    var wrapper = button + '-wrapper';
+    var hide = button + '-hide';
+    var upload = new Drupal.jsUpload(uri, button, wrapper, hide);
+  });
 }
 
 /**
  * JS upload object.
  */
-function jsUpload(uri, button, wrapper, hide) {
-  this.button = button;
-  this.wrapper = wrapper;
-  this.hide = hide;
-  redirectFormButton(uri, $(button), this);
+Drupal.jsUpload = function(uri, button, wrapper, hide) {
+  // Note: these elements are replaced after an upload, so we re-select them
+  // everytime they are needed.
+  this.button = '#'+ button;
+  this.wrapper = '#'+ wrapper;
+  this.hide = '#'+ hide;
+  Drupal.redirectFormButton(uri, $(this.button).get(0), this);
 }
 
 /**
  * Handler for the form redirection submission.
  */
-jsUpload.prototype.onsubmit = function () {
-  var hide = $(this.hide);
+Drupal.jsUpload.prototype.onsubmit = function () {
   // Insert progressbar and stretch to take the same space.
-  this.progress = new progressBar('uploadprogress');
+  this.progress = new Drupal.progressBar('uploadprogress');
   this.progress.setProgress(-1, 'Uploading file');
-  this.progress.element.style.width = '28em';
-  this.progress.element.style.height = hide.offsetHeight +'px';
-  hide.parentNode.insertBefore(this.progress.element, hide);
-  // Hide file form (cannot use display: none, this mysteriously aborts form
-  // submission in Konqueror)
-  hide.style.position = 'absolute';
-  hide.style.left = '-2000px';
+  $(this.progress.element).css({
+    width: '28em',
+    height: ($(this.hide).get(0).offsetHeight - 10) +'px',
+    marginBottom: -$(this.hide).get(0).offsetHeight +'px',
+    paddingTop: '10px',
+    display: 'none'
+  });
+
+  // Hide file form and replace by progress bar (cannot use display: none,
+  // this mysteriously aborts form submission in Konqueror)
+/*  $(this.hide)
+    .css({
+      position: 'absolute',
+      left: '-2000px'
+    })
+    .before(this.progress.element);
+*/
+  $(this.hide).before(this.progress.element).fadeOut('slow');
+  $(this.progress.element).fadeIn('slow');
 }
 
 /**
  * Handler for the form redirection completion.
  */
-jsUpload.prototype.oncomplete = function (data) {
-  // Remove progressbar
-  removeNode(this.progress.element);
-  this.progress = null;
-  // Replace form and re-attach behaviour
-  $(this.wrapper).innerHTML = data;
-  uploadAutoAttach();
+Drupal.jsUpload.prototype.oncomplete = function (data) {
+  // Remove old form
+  Drupal.freezeHeight(); // Avoid unnecessary scrolling
+  $(this.wrapper).html('');
+
+  // Place HTML into temporary div
+  var div = document.createElement('div');
+  $(div).html(data);
+
+  // If uploading the first attachment fade in everything
+  if ($('tr', div).size() == 2) {
+    // Replace form and re-attach behaviour
+    $(div).hide();
+    $(this.wrapper).append(div);
+    $(div).fadeIn('slow');
+    Drupal.uploadAutoAttach();
+  }
+  // Else fade in only the last table row
+  else {
+    // Hide form and last table row
+    $('table tr:last-of-type td', div).hide();
+
+    // Note: workaround because jQuery's #id selector does not work outside of 'document'
+    // Should be: $(this.hide, div).hide();
+    var hide = this.hide;
+    $('div', div).each(function() {
+      if (('#'+ this.id) == hide) {
+        this.style.display = 'none';
+      }
+    });
+
+    // Replace form, fade in items and re-attach behaviour
+    $(this.wrapper).append(div);
+    $('table tr:last-of-type td', div).fadeIn('slow');
+    $(this.hide, div).fadeIn('slow');
+    Drupal.uploadAutoAttach();
+  }
+  Drupal.unfreezeHeight();
 }
 
 /**
  * Handler for the form redirection error.
  */
-jsUpload.prototype.onerror = function (error) {
+Drupal.jsUpload.prototype.onerror = function (error) {
   alert('An error occurred:\n\n'+ error);
   // Remove progressbar
-  removeNode(this.progress.element);
+  $(this.progress.element).remove();
   this.progress = null;
   // Undo hide
-  $(this.hide).style.position = 'static';
-  $(this.hide).style.left = '0px';
+  $(this.hide).css({
+    position: 'static',
+    left: '0px'
+  });
+}
+
+
+// Global killswitch
+if (Drupal.jsEnabled) {
+  $(document).ready(Drupal.uploadAutoAttach);
 }
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.5
diff -u -d -F^\s*function -r1.5 system.css
--- modules/system/system.css	21 Aug 2006 07:33:26 -0000	1.5
+++ modules/system/system.css	23 Aug 2006 11:02:01 -0000
@@ -232,24 +232,29 @@
   border-left-width: 0;
   border-right-width: 0;
   margin-bottom: 0;
+  height: 1em;
 }
 html.js fieldset.collapsed * {
   display: none;
 }
-html.js fieldset.collapsed table *,
-html.js fieldset.collapsed legend,
-html.js fieldset.collapsed legend * {
-  display: inline;
+html.js fieldset.collapsed legend {
+  display: block;
 }
 html.js fieldset.collapsible legend a {
   padding-left: 15px;
-  background: url(../../misc/menu-expanded.png) 5px 50% no-repeat;
+  background: url(../../misc/menu-expanded.png) 5px 75% no-repeat;
 }
 html.js fieldset.collapsed legend a {
   background-image: url(../../misc/menu-collapsed.png);
+  background-position: 5px 50%;
 }
 /* Note: IE-only fix due to '* html' (breaks Konqueror otherwise). */
-* html.js fieldset.collapsible legend a {
+* html.js fieldset.collapsed legend,
+* html.js fieldset.collapsed legend *,
+* html.js fieldset.collapsed table * {
+  display: inline;
+}
+html.js fieldset.collapsible legend a {
   display: block;
 }
 
@@ -261,11 +266,16 @@
 }
 .resizable-textarea .grippie {
   height: 14px;
+  width: 100%;
   background: #eee url(../../misc/grippie.png) no-repeat 100% 100%;
   border: 1px solid #ddd;
   border-top-width: 0;
   cursor: s-resize;
 }
+html.js .resizable-textarea textarea {
+  margin-bottom: 0;
+  width: 100%;
+}
 
 /*
 ** Progressbar styles
