$OpenBSD: patch-includes_common_inc,v 1.4 2009/04/03 19:03:03 espie Exp $
--- includes/common.inc.orig	Fri Jan 16 20:26:09 2009
+++ includes/common.inc	Fri Apr  3 20:58:49 2009
@@ -1726,11 +1726,20 @@ function drupal_clear_css_cache() {
  *   far for $scope is returned.
  */
 function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer = FALSE, $cache = TRUE) {
+  $path = drupal_get_path('module', 'jquery_update');
   if (!is_null($data)) {
-    _drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
+    if (!is_null($path)) {
+      _drupal_add_js($path .'/misc/jquery.js', 'core', 'header', FALSE, $cache);
+    } else {
+      _drupal_add_js('misc/jquery.js', 'core', 'header', FALSE, $cache);
+    }
     _drupal_add_js('misc/drupal.js', 'core', 'header', FALSE, $cache);
   }
-  return _drupal_add_js($data, $type, $scope, $defer, $cache);
+  if (!is_null($path) && file_exists($path.'/'.$data)) {
+    return _drupal_add_js($path.'/'.$data, $type, $scope, $defer, $cache);
+  } else {
+    return _drupal_add_js($data, $type, $scope, $defer, $cache);
+  }
 }
 
 /**
