Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.24
diff -u -r1.24 overlay-parent.js
--- modules/overlay/overlay-parent.js	30 Jan 2010 07:59:25 -0000	1.24
+++ modules/overlay/overlay-parent.js	6 Feb 2010 12:54:08 -0000
@@ -401,7 +401,7 @@
   // @see http://dev.jqueryui.com/ticket/4671
   // @see https://bugs.webkit.org/show_bug.cgi?id=19033
   // Do the same for the click handler as prevents default handling of clicks in
-  // displaced regions (e.g. opening a link in a new browser tab when CTRL was
+  // displaced elements (e.g. opening a link in a new browser tab when CTRL was
   // pressed while clicking).
   $(document).unbind('mousedown.dialog-overlay click.dialog-overlay');
   $('.ui-widget-overlay').bind('mousedown.dialog-overlay click.dialog-overlay', function (){return false;});
@@ -615,15 +615,17 @@
     return;
   }
 
-  // Consider any region that should be visible above the overlay (such as
+  // Consider any element that should be visible above the overlay (such as
   // an admin toolbar).
-  var $displaceTop = $('.overlay-displace-top');
-  var displaceTopHeight = 0;
-  $displaceTop.each(function () {
-    displaceTopHeight += $(this).height();
+  var displaceTop = 0, displaceBottom = 0;
+  $('.overlay-displace-top').each(function () {
+    displaceTop += $(this).height();
+  });
+  $('.overlay-displace-bottom').each(function () {
+    displaceBottom += $(this).height();
   });
 
-  self.$wrapper.css('top', displaceTopHeight);
+  self.$wrapper.css({ marginTop: displaceTop, marginBottom: displaceBottom });
 
   // When the overlay has no height yet, make it fit exactly in the window,
   // or the configured height when autoFit is disabled.
@@ -631,7 +633,7 @@
     var titleBarHeight = self.$dialogTitlebar.outerHeight(true);
 
     if (self.options.autoFit || self.options.height == undefined ||!isNan(self.options.height)) {
-      self.lastHeight = parseInt($(window).height() - displaceTopHeight - titleBarHeight - 45);
+      self.lastHeight = parseInt($(window).height() - displaceTop - titleBarHeight - 45 - displaceBottom);
     }
     else {
       self.lastHeight = self.options.height;
@@ -655,7 +657,7 @@
  * document and handle events that bubble up. This allows other scripts to bind
  * their own handlers to links and also to prevent overlay's handling.
  *
- * This handler makes links in displaced regions work correctly, even when the
+ * This handler makes links in displaced elements work correctly, even when the
  * overlay is open.
  *
  * This click event handler should be bound any document (for example the
@@ -669,7 +671,7 @@
   var $target = $(event.target);
 
   if (self.isOpen && $target.closest('.overlay-displace-top, .overlay-displace-bottom').length) {
-    // Click events in displaced regions could potentionally change the size of
+    // Click events in displaced elements could potentionally change the size of
     // that region (e.g. the toggle button of the toolbar module). Trigger the
     // resize event to force a recalculation of overlay's size/position.
     $(window).triggerHandler('resize.overlay-event');
@@ -886,7 +888,7 @@
 };
 
 /**
- * Reset the active class on links in displaced regions according to given path.
+ * Reset the active class on links in displaced elements according to given path.
  *
  * @param activePath
  *   Path to match links against.
@@ -896,7 +898,7 @@
 
   $('.overlay-displace-top, .overlay-displace-bottom')
   .find('a[href]')
-  // Remove active class from all links in displaced regions.
+  // Remove active class from all links in displaced elements.
   .removeClass('active')
   // Add active class to links that match activePath.
   .each(function () {
