Index: modules/toolbar/toolbar.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.css,v
retrieving revision 1.3
diff -u -r1.3 toolbar.css
--- modules/toolbar/toolbar.css	11 Sep 2009 00:37:38 -0000	1.3
+++ modules/toolbar/toolbar.css	11 Sep 2009 07:34:12 -0000
@@ -41,6 +41,7 @@
 
 div#toolbar .collapsed {
   display: none;
+  visibility: hidden;
 }  
 
 div#toolbar div.shadow {
@@ -81,17 +82,10 @@
 
 div#toolbar div.toolbar-menu #toolbar-menu {
   position: absolute;
-  left: 10px;
-}
-
-/**
- * Give space for the shortcuts visibility toggling element when it is added.
- */
-div#toolbar.toolbar-processed div.toolbar-menu #toolbar-menu {
   left: 45px;
 }
 
-div#toolbar div.toolbar-menu span.toggle {
+div#toolbar div.toolbar-menu a.toggle {
   position: absolute;
   left: 10px;
   cursor: pointer;
@@ -102,7 +96,7 @@
   height: 25px;
 }
 
-div#toolbar div.toolbar-menu span.toggle-active {
+div#toolbar div.toolbar-menu a.toggle-active {
   background-position:  -25px -60px;
 }
 
Index: modules/toolbar/toolbar.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.js,v
retrieving revision 1.4
diff -u -r1.4 toolbar.js
--- modules/toolbar/toolbar.js	11 Sep 2009 00:37:38 -0000	1.4
+++ modules/toolbar/toolbar.js	11 Sep 2009 07:30:44 -0000
@@ -7,14 +7,11 @@
 Drupal.behaviors.admin = {
   attach: function(context) {
 
-    // Set the intial state of the toolbar.
+    // Set the initial state of the toolbar.
     $('#toolbar', context).once('toolbar', Drupal.admin.toolbar.init);
 
-    // Add the toggling element for shortcuts visibility.
-    $('#toolbar div.toolbar-menu').prepend('<span class="toggle toggle-active"><a href="#">' + Drupal.t('Show shortcuts') + '</a></span>');
-
     // Toggling of admin shortcuts visibility.
-    $('#toolbar span.toggle', context).once('toolbar-toggle').click(function() {
+    $('#toolbar a.toggle', context).once('toolbar-toggle').click(function() {
       Drupal.admin.toolbar.toggle();
       return false;
     });
@@ -47,8 +44,12 @@
  * Collapse the admin toolbar.
  */
 Drupal.admin.toolbar.collapse = function() {
+  var toggle_text = Drupal.t('Show') + ' ' + Drupal.settings.toolbar.shortcuts_menu_name;
   $('#toolbar div.toolbar-shortcuts').addClass('collapsed');
-  $('#toolbar span.toggle').removeClass('toggle-active');
+  $('#toolbar a.toggle')
+    .removeClass('toggle-active')
+    .attr('title',  toggle_text)
+    .html(toggle_text);
   $('body').removeClass('toolbar-shortcuts');
   $.cookie(
     'Drupal.admin.toolbar.collapsed', 
@@ -61,8 +62,12 @@
  * Expand the admin toolbar.
  */
 Drupal.admin.toolbar.expand = function() {
+  var toggle_text = Drupal.t('Hide') + ' ' + Drupal.settings.toolbar.shortcuts_menu_name;
   $('#toolbar div.toolbar-shortcuts').removeClass('collapsed');
-  $('#toolbar span.toggle').addClass('toggle-active');
+  $('#toolbar a.toggle')
+    .addClass('toggle-active')
+    .attr('title',  toggle_text)
+    .html(toggle_text);
   $('body').addClass('toolbar-shortcuts');
   $.cookie(
     'Drupal.admin.toolbar.collapsed', 
@@ -75,7 +80,7 @@
  * Toggle the admin toolbar.
  */
 Drupal.admin.toolbar.toggle = function() {
-  if ($('#toolbar div.toolbar-shortcuts').is('.collapsed')) {
+  if ($('#toolbar div.toolbar-shortcuts').hasClass('collapsed')) {
     Drupal.admin.toolbar.expand();
   }
   else {
Index: modules/toolbar/toolbar.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.module,v
retrieving revision 1.10
diff -u -r1.10 toolbar.module
--- modules/toolbar/toolbar.module	5 Sep 2009 15:05:05 -0000	1.10
+++ modules/toolbar/toolbar.module	11 Sep 2009 07:07:05 -0000
@@ -27,10 +27,84 @@
     'template' => 'toolbar',
     'path' => drupal_get_path('module', 'toolbar'),
   );
+  $items['toolbar_toggle'] = array(
+    'arguments' => array(
+      'collapsed' => NULL,
+      'shortcuts_menu_name' => NULL,
+      'attributes' => array()
+    ),
+  );
+  return $items;
+}
+
+/**
+ * Implement hook_menu().
+ */
+function toolbar_menu() {
+  $items['toolbar/toggle'] = array(
+    'title' => 'Toggle shortcuts visibility',
+    'type' => MENU_CALLBACK,
+    'page callback' => 'toolbar_toggle_page',
+    'access arguments' => array('access toolbar'),
+  );
   return $items;
 }
 
 /**
+ * Menu callback; toggles the visibility of the toolbar shortcuts.
+ */
+function toolbar_toggle_page() {
+  global $base_path;
+  // Toggle the value in the cookie.
+  setcookie('Drupal.admin.toolbar.collapsed', !_toolbar_is_collapsed(), NULL, $base_path);
+  // Redirect the user from where he used the toggle element.
+  drupal_goto();
+}
+
+/**
+ * Formats an element used to toggle the visibility of the shortcut links.
+ * 
+ * @param $element
+ *   An associative array containing the properties of the element.
+ *   Property used:
+ *     - #collapsed
+ *       A boolean value indicating the current state of the visibility of the
+ *       shortcut links.
+ * @return
+ *   An HTML string representing the element for toggling.
+ *
+ * @ingroup themable
+ */
+function theme_toolbar_toggle($collapsed, $shortcuts_menu_name = '', $attributes = array()) {
+  drupal_add_js(array(
+    'toolbar' => array('shortcuts_menu_name' => $shortcuts_menu_name)),
+    array('type' => 'setting')
+  );
+  if ($collapsed) {
+    $toggle_text = t('Show') . (!empty($shortcuts_menu_name) ? ' ' . $shortcuts_menu_name : '');
+    return '<a href="' . url('toolbar/toggle', array('query' => drupal_get_destination())) . '" title="' . $toggle_text . '"' .  drupal_attributes($attributes) . '>' . $toggle_text . '</a>';
+  }
+  else {
+    $toggle_text = t('Hide') . (!empty($shortcuts_menu_name) ? ' ' . $shortcuts_menu_name : '');
+    $attributes['class'][] = 'toggle-active';
+    return '<a href="' . url('toolbar/toggle', array('query' => drupal_get_destination())) . '" title="' . $toggle_text . '"' .  drupal_attributes($attributes) . '>' . $toggle_text . '</a>';
+  }
+}
+
+/**
+ * Determines if the shortcut links are currently collapsed, if they are not it
+ * means they are expanded.
+ * 
+ * @return
+ *   A boolean value indicating if the 
+ */
+function _toolbar_is_collapsed() {
+  // PHP converts dots into underscores in cookie names to avoid problems with
+  // its parser, so we use a converted cookie name.
+  return isset($_COOKIE['Drupal_admin_toolbar_collapsed']) ? $_COOKIE['Drupal_admin_toolbar_collapsed'] : 0;
+}
+
+/**
  * Implement hook_page_build().
  * 
  * Add admin toolbar to the page_top region automatically.
@@ -48,7 +122,10 @@
  */
 function toolbar_preprocess_page(&$vars) {
   if (user_access('access toolbar')) {
-    $vars['classes_array'][] = 'toolbar toolbar-shortcuts';
+    $vars['classes_array'][] = 'toolbar';
+    if (!_toolbar_is_collapsed()) {
+      $vars['classes_array'][] = 'toolbar-shortcuts';
+    }
   }
 }
 
@@ -73,11 +150,13 @@
   );
 
   // Retrieve the admin menu from the database.
+  $main_menu = menu_load('management');
   $links = toolbar_menu_navigation_links(toolbar_get_menu_tree());
   $build['toolbar_menu'] = array(
     '#theme' => 'links',
     '#links' => $links,
     '#attributes' => array('id' => 'toolbar-menu'),
+    '#heading' => array('text' => $main_menu['title'], 'level' => 'h2', 'class' => 'element-invisible'),
   );
 
   // Add logout & user account links
@@ -98,12 +177,24 @@
   );
 
   // Add convenience shortcut links.
+  $shortcuts_menu = menu_load('admin_shortcuts');
   $shortcuts = menu_tree_all_data('admin_shortcuts');
   $shortcuts = toolbar_menu_navigation_links($shortcuts);
   $build['toolbar_shortcuts'] = array(
     '#theme' => 'links',
     '#links' => $shortcuts,
     '#attributes' => array('id' => 'toolbar-shortcuts'),
+    '#heading' => array('text' => $shortcuts_menu['title'], 'level' => 'h2', 'class' => 'element-invisible'),
+    '#prefix' => '<div class="toolbar-shortcuts clearfix' . (_toolbar_is_collapsed() ? ' collapsed' : '') . '">',
+    '#suffix' => '</div>',
+  );
+
+  // Add an anchor to be able to toggle the visibility of the shortcut links.
+  $build['toolbar_toggle'] = array(
+    '#theme' => 'toolbar_toggle',
+    '#collapsed' => _toolbar_is_collapsed(),
+    '#shortcuts_menu_name' => $shortcuts_menu['title'],
+    '#attributes' => array('class' => array('toggle')),
   );
 
   return $build;
Index: modules/toolbar/toolbar.tpl.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/toolbar/toolbar.tpl.php,v
retrieving revision 1.3
diff -u -r1.3 toolbar.tpl.php
--- modules/toolbar/toolbar.tpl.php	11 Sep 2009 00:37:38 -0000	1.3
+++ modules/toolbar/toolbar.tpl.php	11 Sep 2009 07:32:57 -0000
@@ -16,13 +16,12 @@
 ?>
 <div id="toolbar" class="clearfix">
   <div class="toolbar-menu clearfix">
-    <?php print render($toolbar['toolbar_menu']); ?>
     <?php print render($toolbar['toolbar_user']); ?>
+    <?php print render($toolbar['toolbar_menu']); ?>
+    <?php print render($toolbar['toolbar_toggle']); ?>
   </div>
 
-  <div class="toolbar-shortcuts clearfix">
-    <?php print render($toolbar['toolbar_shortcuts']); ?>
-  </div>
+  <?php print render($toolbar['toolbar_shortcuts']); ?>
 
   <div class="shadow"></div>
 </div>
