Index: modules/overlay/overlay-parent.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/overlay/overlay-parent.js,v
retrieving revision 1.30
diff -u -r1.30 overlay-parent.js
--- modules/overlay/overlay-parent.js	7 Mar 2010 06:31:48 -0000	1.30
+++ modules/overlay/overlay-parent.js	8 Mar 2010 01:56:47 -0000
@@ -259,6 +259,7 @@
   // Cache dialog selector.
   self.$dialog = self.$container.parents('.' + dialogOptions.dialogClass);
   self.$dialogTitlebar = self.$dialog.find('.ui-dialog-titlebar');
+  self.$dialogContent = self.$dialog.find('.ui-dialog-content');
 };
 
 /**
@@ -287,14 +288,31 @@
   // Remove any existing tabs in the title section, but only if requested url
   // is not one of those tabs. If the latter, set that tab active.
   var urlPath = self.getPath(url);
+  
+  // Get the primary tabs
   var $tabs = self.$dialogTitlebar.find('ul');
   var $tabsLinks = $tabs.find('> li > a');
+  
+  // Get the secondary tabs
+  var $tabsSecondary = self.$dialogContent.find('#overlay-element').contents().find('ul.secondary');
+  var $tabsLinksSecondary = $tabsSecondary.find('> li > a');
+  
+  // Check if clicked on a primary tab
   var $activeLink = $tabsLinks.filter(function () { return self.getPath(this) == urlPath; });
+  
+  // Check if clicked on a secondary tab
+  var $activeLinkSecondary = $tabsLinksSecondary.filter(function () { return self.getPath(this) == urlPath; });
+	  
   if ($activeLink.length) {
     var active_tab = Drupal.t('(active tab)');
     $tabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLink);
     $activeLink.parent().addClass('active');
   }
+  else if ($activeLinkSecondary.length) {
+    var active_tab = Drupal.t('(active tab)');
+    $secondaryTabsLinks.parent().removeClass('active').find('element-invisible:contains(' + active_tab + ')').appendTo($activeLinkSecondary);
+    $activeLinkSecondary.parent().addClass('active');
+  }
   else {
     $tabs.remove();
   }
