Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.542
diff -u -F^function -r1.542 common.inc
--- includes/common.inc	8 Jun 2006 21:23:40 -0000	1.542
+++ includes/common.inc	27 Jun 2006 06:01:16 -0000
@@ -1202,17 +1202,22 @@ function drupal_add_link($attributes) {
  * Add a JavaScript file to the output.
  *
  * The first time this function is invoked per page request,
- * it adds "misc/drupal.js" to the output. Other scripts
- * depends on the 'killswitch' inside it.
+ * it adds "misc/drupal.js" and "misc/jquery.js" to the output for other
+ * scripts to use.
  */
 function drupal_add_js($file, $nocache = FALSE) {
+  _drupal_add_js('misc/jquery.js', FALSE);
+  _drupal_add_js('misc/drupal.js', FALSE); 
+  _drupal_add_js($file, $nocache);
+}
+
+/**
+ * Helper function for drupal_add_js()
+ */
+function _drupal_add_js($file, $nocache) {
   static $sent = array();
 
   $postfix = $nocache ? '?'. time() : '';
-  if (!isset($sent['misc/drupal.js'])) {
-    drupal_set_html_head('<script type="text/javascript" src="'. base_path() .'misc/drupal.js'. $postfix .'"></script>');
-    $sent['misc/drupal.js'] = true;
-  }
   if (!isset($sent[$file])) {
     drupal_set_html_head('<script type="text/javascript" src="'. check_url(base_path() . $file) . $postfix .'"></script>');
     $sent[$file] = true;
Index: misc/autocomplete.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/autocomplete.js,v
retrieving revision 1.12
diff -u -F^function -r1.12 autocomplete.js
--- misc/autocomplete.js	20 May 2006 07:23:47 -0000	1.12
+++ misc/autocomplete.js	27 Jun 2006 06:01:16 -0000
@@ -17,7 +17,7 @@ function autocompleteAutoAttach() {
       if (!acdb[uri]) {
         acdb[uri] = new ACDB(uri);
       }
-      input = $(input.id.substr(0, input.id.length - 13));
+      input = $('#' + input.id.substr(0, input.id.length - 13)).get(0);
       input.setAttribute('autocomplete', 'OFF');
       addSubmitEvent(input.form, autocompleteSubmit);
       new jsAC(input, acdb[uri]);
Index: misc/drupal.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.js,v
retrieving revision 1.24
diff -u -F^function -r1.24 drupal.js
--- misc/drupal.js	7 Jun 2006 09:34:11 -0000	1.24
+++ misc/drupal.js	27 Jun 2006 06:01:17 -0000
@@ -22,22 +22,6 @@ function isJsEnabled() {
 }
 
 /**
- * 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().
@@ -172,37 +156,6 @@ function redirectFormButton(uri, button,
 }
 
 /**
- * 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();
-    }
-  }
-}
-
-/**
- * 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
  */
 function absolutePosition(el) {
@@ -228,53 +181,6 @@ function dimensions(el) {
 }
 
 /**
- * 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;
-}
-
-/**
- * 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;
-}
-
-/**
  * Emulate PHP's ereg_replace function in javascript
  */
 function eregReplace(search, replace, subject) {
@@ -282,21 +188,6 @@ function eregReplace(search, replace, su
 }
 
 /**
- * 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;
-  }
-}
-
-/**
  * Prevents an event from propagating.
  */
 function stopEvent(event) {
@@ -349,19 +240,13 @@ function createIframe() {
   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);
-}
+// Legacy functions
+function addLoadEvent(func) { $(document).ready(func); }
+function addSubmitEvent(form, func) { $(form).submit(func); }
+function hasClass(node, className) { return $.hasWord(node, className); }
+function addClass(node, className) { $(node).addClass(className); }
+function toggleClass(node, className) { $(node).toggleClass(className); }
+function removeClass(node, className) { $(node).removeClass(className); }
+function removeNode(node) { $(node).remove(); }
+function deleteIframe() { $('#redirect-holder').remove(); }
\ No newline at end of file
