Index: includes/admin.toolbar.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/admin/includes/Attic/admin.toolbar.js,v
retrieving revision 1.1.2.9.2.2
diff -u -r1.1.2.9.2.2 admin.toolbar.js
--- includes/admin.toolbar.js	27 Sep 2010 07:32:25 -0000	1.1.2.9.2.2
+++ includes/admin.toolbar.js	31 Oct 2010 12:54:31 -0000
@@ -15,7 +15,26 @@
 
     // Admin tabs.
     $('div.admin-tab', this).click(function() { Drupal.adminToolbar.tab(toolbar, $(this), true); });
+
+    $(document).bind('drupalOverlayLoad', {adminToolbar: Drupal.adminToolbar, toolbar: toolbar}, function(event) {
+      var body = $(document.body);
+      var adminToolbar = event.data.adminToolbar;
+      var expand = parseInt(adminToolbar.getState('expanded'));
+      if (!expand) {
+        $('iframe.overlay-active').contents().find('body').css({marginLeft:0, marginTop: 0});
+        return;
+      }
+      var toolbar = event.data.toolbar;
+      var size = adminToolbar.SIZE + 'px';
+      if(toolbar.attr('class').split(' ')[1] === 'vertical') {
+        $('iframe.overlay-element').contents().find('body').css('marginLeft', size);
+      }
+      else {
+        $('iframe.overlay-element').contents().find('body').css('marginTop', size);
+      }
+    });
   });
+
   $('div.admin-panes:not(.processed)').each(function() {
     var panes = $(this);
     panes.addClass('processed');
@@ -37,12 +56,17 @@
 Drupal.adminToolbar = {};
 
 /**
+ * The width or height of the toolbar, depending on orientation.
+ */
+Drupal.adminToolbar.SIZE = 260;
+
+/**
  * Set the initial state of the toolbar.
  */
 Drupal.adminToolbar.init = function (toolbar) {
   // Set expanded state.
+  var expanded = this.getState('expanded');
   if (!$(document.body).hasClass('admin-ah')) {
-    var expanded = this.getState('expanded');
     if (expanded == 1) {
       $(document.body).addClass('admin-expanded');
     }
@@ -103,56 +127,75 @@
 };
 
 /**
+ * Set the width/height of the of the overlay body based on the state admin toolbar.
+ *
+ * @param vertical
+ *   A boolean indicating if the toolbar is vertical.
+ * @param expanded
+ *   A boolean indicating if the toolbar is expanded.
+ */
+Drupal.adminToolbar.setOverlayState = function(vertical, expanded) {
+  var width = this.SIZE;
+  if (!expanded) {
+    width = 0;
+  }
+  if (vertical) {
+    $('iframe.overlay-element').contents().find('body').animate({marginLeft: width+'px'}, 'fast');
+  }
+  else {
+    $('iframe.overlay-element').contents().find('body').animate({marginTop: width+'px'}, 'fast');
+  }
+};
+
+/**
  * Toggle the toolbar open or closed.
  */
 Drupal.adminToolbar.toggle = function (toolbar) {
+  var size = '0px';
   if ($(document.body).is('.admin-expanded')) {
     if ($(toolbar).is('.vertical')) {
-      $('div.admin-blocks', toolbar).animate({width:'0px'}, 'fast', function() { $(this).css('display', 'none'); });
+      $('div.admin-blocks', toolbar).animate({width:size}, 'fast', function() { $(this).css('display', 'none'); });
       if ($(toolbar).is('.nw') || $(toolbar).is('sw')) {
-        $('iframe.overlay-element').contents().find('body').animate({marginLeft:'0px'}, 'fast');
-        $(document.body).animate({marginLeft:'0px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginLeft:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
       else {
-        $('iframe.overlay-element').contents().find('body').animate({marginLeft:'0px'}, 'fast');
-        $(document.body).animate({marginRight:'0px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginRight:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
+      this.setOverlayState(true, false);
     }
     else {
-      $('div.admin-blocks', toolbar).animate({height:'0px'}, 'fast');
+      $('div.admin-blocks', toolbar).animate({height:size}, 'fast');
       if ($(toolbar).is('.nw') || $(toolbar).is('ne')) {
-        $('iframe.overlay-element').contents().find('body').animate({marginTop:'0px'}, 'fast');
-        $(document.body).animate({marginTop:'0px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginTop:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
       else {
-        $('iframe.overlay-element').contents().find('body').animate({marginTop:'0px'}, 'fast');
-        $(document.body).animate({marginBottom:'0px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginBottom:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
     }
+    this.setOverlayState(false, false);
     this.setState('expanded', 0);
   }
   else {
+    size = this.SIZE + 'px';
     if ($(toolbar).is('.vertical')) {
-      $('div.admin-blocks', toolbar).animate({width:'260px'}, 'fast');
+      $('div.admin-blocks', toolbar).animate({width:size}, 'fast');
       if ($(toolbar).is('.nw') || $(toolbar).is('sw')) {
-        $('iframe.overlay-element').contents().find('body').animate({marginLeft:'260px'}, 'fast');
-        $(document.body).animate({marginLeft:'260px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginLeft:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
       else {
-        $('iframe.overlay-element').contents().find('body').animate({marginLeft:'260px'}, 'fast');
-        $(document.body).animate({marginRight:'260px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginRight:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
+      this.setOverlayState(true, true);
     }
     else {
-      $('div.admin-blocks', toolbar).animate({height:'260px'}, 'fast');
+      $('div.admin-blocks', toolbar).animate({height:size}, 'fast');
       if ($(toolbar).is('.nw') || $(toolbar).is('ne')) {
-        $('iframe.overlay-element').contents().find('body').animate({marginTop:'260px'}, 'fast');
-        $(document.body).animate({marginTop:'260px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginTop:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
       else {
-        $('iframe.overlay-element').contents().find('body').animate({marginTop:'260px'}, 'fast');
-        $(document.body).animate({marginBottom:'260px'}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
+        $(document.body).animate({marginBottom:size}, 'fast', function() { $(this).toggleClass('admin-expanded'); });
       }
+      this.setOverlayState(false, true);
     }
     if ($(document.body).hasClass('admin-ah')) {
       this.setState('expanded', 0);
@@ -203,4 +246,4 @@
   }
 };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
