Index: admin_menu.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin_menu/admin_menu.js,v
retrieving revision 1.7.2.7.2.8
diff -u -p -r1.7.2.7.2.8 admin_menu.js
--- admin_menu.js	4 Apr 2009 15:23:18 -0000	1.7.2.7.2.8
+++ admin_menu.js	21 Apr 2009 13:57:18 -0000
@@ -113,10 +113,32 @@ Drupal.admin.attachBehaviors = function 
 
 /**
  * Apply 'position: fixed'.
+ *
+ * This will also adjust all other 'fixed' positioned elements accordingly so
+ * they don't overlap with us.
+ *
+ * @TODO For optimal results, this should came after other JS files.
+ * For example, this won't adjust sticky table headers unless it has been
+ * executed after tableHeader (tableheader.js) behavior.
  */
 Drupal.admin.behaviors.positionFixed = function (context, $adminMenu) {
   if (Drupal.settings.admin_menu.position_fixed) {
     $adminMenu.css('position', 'fixed');
+
+    // Re-position other elements accordingly
+
+    // Extend jQuery with ':fixed' selector.
+    jQuery.extend(jQuery.expr[':'], {
+      fixed: 'jQuery(a).css("position") == "fixed"',
+    });
+    var height = parseInt($adminMenu.height());
+    // Offset fixed positioned element with our height.
+    $(':fixed').not($adminMenu).each(function () {
+      var top = $(this).css('top');
+      if (top != 'auto' && top != 'inherit') {
+        $(this).css('top', (parseInt(top) + height) + 'px');
+      }
+    });
   }
 };
 
@@ -185,6 +207,54 @@ Drupal.admin.behaviors.hover = function 
 };
 
 /**
+ * If margin-top is applied, this will reposition all absolute positioned
+ * elements as well as the <body> background image, if set, so they don't
+ * overlap with us.
+ */
+Drupal.admin.behaviors.repositionLayout = function (context, $adminMenu) {
+  if (Drupal.settings.admin_menu.margin_top) {
+    // Extend jQuery with ':absolute' and ':relative' selectors.
+    jQuery.extend(jQuery.expr[':'], {
+      absolute: 'jQuery(a).css("position") == "absolute"',
+      relative: 'jQuery(a).css("position") == "relative"'
+    });
+    var height = parseInt($adminMenu.height());
+    // Offset every absolute positioned element with our height.
+    $(':absolute').not($adminMenu.find('*').andSelf()).each(function () {
+      if (!$(this).parents(':relative').size()) {
+        var top = $(this).css('top');
+        if (top != 'auto' && top != 'inherit') {
+          $(this).css('top', (parseInt(top) + height) + 'px');
+        }
+      }
+    });
+    // Offset body background with our height.
+    if ($('body').css('background-image')) {
+      var background_position = $('body').css('background-position').split(' ');
+      var vertical_position = background_position[1];
+      // Unlikely, but if the unit is something other than px, convert it.
+      var unit = vertical_position.match(/^[-+]?\d+\.?\d*([a-z%]+)?$/i);
+      if (unit && unit[1] != 'px' && vertical_position != '0%') {
+        unit = unit[1];
+        if (unit == '%') {
+	  vertical_position = $('body').height() * (parseInt(vertical_position) / 100);
+        }
+        else {
+          // Very unlikely that we get here.
+          return;
+        }
+      }
+      else {
+        vertical_position = parseInt(vertical_position);
+      }
+      // Add the offset
+      vertical_position += height;
+      $('body').css('background-position', background_position[0] + ' ' + vertical_position + 'px');
+    }
+  }
+};
+
+/**
  * @} End of "defgroup admin_behaviors".
  */
 
