Index: ajax_load.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ajax_load/ajax_load.js,v
retrieving revision 1.7
diff -u -r1.7 ajax_load.js
--- ajax_load.js	17 Dec 2008 21:16:17 -0000	1.7
+++ ajax_load.js	23 Mar 2009 13:26:57 -0000
@@ -6,6 +6,13 @@
 Drupal.AjaxLoad.loadFiles = function (target, response) {
   // Handle scripts.
 
+  // Initialize the list of currently loaded external scripts.
+  if (!Drupal.AjaxLoad.externalScripts) {
+    Drupal.AjaxLoad.externalScripts = [];
+    $('script[src]').each(function() {
+      Drupal.AjaxLoad.externalScripts[Drupal.AjaxLoad.externalScripts.length] = $(this).attr('src');
+    });
+  }
   // See if we have any settings to extend. Do this first so that behaviors
   // can access the new settings easily.
   if (response.scripts) {
@@ -16,6 +23,7 @@
     // Each Ajax operation needs its own counter.
     var index = parseInt(Drupal.settings.ajaxLoad.loadPending.length);
     Drupal.settings.ajaxLoad.loadPending[index] = 0;
+    var new_external_scripts = 0;
     if (!response.__customSettings && response.scripts.setting) {
       $.extend(Drupal.settings, response.scripts.setting);
     }
@@ -27,8 +35,17 @@
           // Load scripts.
           src = Drupal.settings.basePath + src;
           // Test if the script already exists.
-          if (!$('script[src*=' + src + ']').size()) {
+          var found = false;
+          for (var j = 0; j < Drupal.AjaxLoad.externalScripts.length; j++) {
+            if (Drupal.AjaxLoad.externalScripts[j].indexOf(src) == 0) {
+              found = true;
+              break;
+            }
+          }
+          if (!found) {
             $.getScript(src, function () {
+              new_external_scripts++;
+              Drupal.AjaxLoad.externalScripts[Drupal.AjaxLoad.externalScripts.length] = src;
               Drupal.AjaxLoad.loadComplete(index, target, response);
             });
             Drupal.settings.ajaxLoad.loadPending[index]++;
@@ -36,6 +53,13 @@
         });
       }
     });
+    // Ensure Drupal behaviors are attached to new content, even when no
+    // new external scripts have been loaded.
+    if (new_external_scripts == 0) {
+      Drupal.attachBehaviors(target);
+      // Ensure inline scripts are parsed after all external scripts have loaded.
+      Drupal.AjaxLoad.loadInline(response);
+    }
   }
   if (response.css) {
     // Handle stylesheets.
Index: ajax_load.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/ajax_load/ajax_load.module,v
retrieving revision 1.4
diff -u -r1.4 ajax_load.module
--- ajax_load.module	16 Mar 2009 14:59:56 -0000	1.4
+++ ajax_load.module	23 Mar 2009 13:26:57 -0000
@@ -66,5 +66,45 @@
     _color_page_alter($return);
   }
 
+  // Deal with jQuery Update module, if exists.
+  if (module_exists('jquery_update')) {
+    ajax_data_jquery_update_replacements($return);
+  }
+
   return $return;
 }
+
+/**
+ * Replace Drupal core's jquery.js with the new one from jQuery Update module.
+ *
+ * @see jquery_update_preprocess_page()
+ */
+function ajax_data_jquery_update_replacements(&$variables) {
+  // Only do this for pages that have JavaScript on them.
+  if (!empty($variables['scripts'])) {
+  
+    // Perform the logic if either jQuery Update's jquery.js is newer than
+    // core's, or if we're using a different compression type.
+    if (variable_get('jquery_update_replace', TRUE) ||
+        variable_get('jquery_update_compression_type', 'pack') != 'pack') {
+
+      // Replace jquery.js first.
+      $new_jquery = array(jquery_update_jquery_path() => $variables['scripts']['core']['misc/jquery.js']);
+      $variables['scripts']['core'] = array_merge($new_jquery, $variables['scripts']['core']);
+      unset($variables['scripts']['core']['misc/jquery.js']);
+
+      // Loop through each of the required replacements.
+      foreach (jquery_update_get_replacements() as $type => $replacements) {
+        foreach ($replacements as $find => $replace) {
+          // If the file to replace is loaded on this page...
+          if (isset($variables['scripts'][$type][$find])) {
+            // Create a new entry for the replacement file, and unset the original one.
+            $replace = JQUERY_UPDATE_REPLACE_PATH . '/' . $replace;
+            $variables['scripts'][$type][$replace] = $variables['scripts'][$type][$find];
+            unset($variables['scripts'][$type][$find]);
+          }
+        }
+      } 
+    }
+  }
+}
