--- vertical_tabs.css	Sun Aug 17 13:55:00 2008
+++ vertical_tabs.css	Mon Sep 22 11:55:37 2008
@@ -97,4 +97,9 @@
 
 #edit-book-bid-wrapper .description {
   clear:none;
-}
\ No newline at end of file
+}
+
+/* Hide fielset's first legends -- context is given by tab */
+.vertical-tabs fieldset.vertical-tabs-fieldset > legend {
+  display: none;
+}
--- vertical_tabs.info	Wed Aug 20 20:14:46 2008
+++ vertical_tabs.info	Mon Sep 22 11:43:07 2008
@@ -1,3 +1,3 @@
-name = Vertical Tabs
-description = Provdes vertical tabs for the node form
-core = 6.x
+name = Vertical Tabs
+description = Provides vertical tabs for the node form
+dependencies = jstools
--- vertical_tabs.js	Sun Aug 17 13:55:00 2008
+++ vertical_tabs.js	Mon Sep 22 11:49:54 2008
@@ -1,6 +1,9 @@
 Drupal.verticalTabs = Drupal.verticalTabs || {};
 
 Drupal.behaviors.verticalTabs = function() {
+  $('.vertical-tabs-fieldset').each(function(i){
+    $(this).removeClass('collapsible collapsed');
+  });
   if (!$('.vertical-tabs-list').size()) {
     var ul = $('<div class="vertical-tabs"><ul class="vertical-tabs-list"></ul></div>').find('ul');
     $.each(Drupal.settings.verticalTabs, function(k, v) {
@@ -16,7 +19,7 @@
           .bind('click', function() { $(this).parent().addClass('selected').siblings().removeClass('selected'); $('.vertical-tabs-' + k).show().siblings('.vertical-tabs-div').hide(); return false; })
           .end())
         .end()
-        .append($('.vertical-tabs-' + k + ' > .fieldset-wrapper')
+        .append($('.vertical-tabs-' + k)
         .addClass('vertical-tabs-' + k)
         .addClass('vertical-tabs-div'));
       if (v.callback && Drupal.verticalTabs[v.callback]) {
--- vertical_tabs.module	Sun Aug 17 13:58:44 2008
+++ vertical_tabs.module	Mon Sep 22 11:55:19 2008
@@ -6,47 +6,9 @@
  */
 
 /**
- * Implementation of hook_menu_alter().
- */
-function vertical_tabs_menu_alter(&$items) {
-  $overridden_items = array();
-  $blacklist = array('admin/settings/performance' => TRUE, 'admin/settings/site-information' => TRUE);
-  foreach ($items as $path => $item) {
-    if (strpos($path, 'admin/settings/') === 0) {
-      $root_item = implode('/', array_slice(explode('/', $path), 0, 3));
-      if (count(explode('/', $path)) > 3) {
-        if (isset($overridden_items[$root_item])) {
-          unset($overridden_items[$root_item]);
-        }
-        $blacklist[$root_item] = TRUE;
-      }
-      elseif (!isset($blacklist[$root_item]) && $item['page callback'] == 'drupal_get_form' && !isset($item['title callback'])) {
-        $overridden_items[$path] = $item;
-      }
-    }
-  }
-  $variable = array();
-  foreach ($overridden_items as $path => $item) {
-    unset($items[$path]);
-    $variable[$path]['arguments'] = $item['page arguments'];
-    $variable[$path]['title'] = $item['title'];
-    $variable[$path]['title arguments'] = (isset($item['title arguments']) ? $item['title arguments'] : array());
-    $variable[$path]['description'] = (isset($item['description']) ? $item['description'] : array());
-    $variable[$path]['file'] = (isset($item['file']) ? drupal_get_path('module', $item['module']) .'/'. $item['file'] : '');
-  }
-  variable_set('vertical_tabs_settings_form', $variable);
-  $items['admin/settings/main'] = array(
-    'title' => 'Main configuration',
-    'page callback' => 'drupal_get_form',
-    'page arguments' => array('vertical_tabs_settings_form'),
-    'access arguments' => array('administer site configuration'),
-  );
-}
-
-/**
  * Implementation of hook_form_alter.
  */
-function vertical_tabs_form_alter(&$form, $form_state, $form_id) {
+function vertical_tabs_form_alter($form_id, &$form) {
   $fieldsets = array();
   $node_form = FALSE;
   // Check to see which form we are in. Since the node form's form id is not
@@ -92,73 +54,23 @@
       }
     }
     // A <div> for easier placement of the tab element.
-    $form['buttons']['#prefix'] = '<div class="buttons">';
-    $form['buttons']['#suffix'] = '</div>';
+    if ($form['submit']) {  // preview optional
+      $form['preview']['#prefix'] = '<div class="buttons">';
+      $form['submit']['#suffix'] = '</div>';
+    }
+    else {  // preview required
+      $form['preview']['#prefix'] = '<div class="buttons">';
+      $form['preview']['#suffix'] = '</div>';
+    }
+
     // Add the JavaScript.
     drupal_add_js(array('verticalTabs' => $javascript), 'setting');
-    // Indicate that the JavaScript should be added later. We do this so that
-    // our JavaScript gets added after collapse.js.
-    $form['#post_render'][] = 'vertical_tabs_add_js_css';
+    // Drupal 5.x: remove collapsible classes using js
+    jstools_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.js');
+    drupal_add_css(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.css');
   }
   if ($node_form) {
-    $form['#post_render'][] = 'vertical_tabs_add_node_form_js';
-  }
-  else if ($form_id == 'vertical_tabs_settings_form') {
-    $form['#post_render'][] = 'vertical_tabs_add_settings_js';
+    jstools_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.node_form.js');
   }
 }
 
-/**
- * Form callback - main settings page.
- */
-function vertical_tabs_settings_form(&$form_state) {
-  $form = array();
-  $variable = variable_get('vertical_tabs_settings_form', array());
-  foreach ($variable as $item) {
-    $key = preg_replace('/[^a-z0-9]/', '', strtolower($item['title']));
-    $form[$key] = array(
-      '#type' => 'fieldset',
-      '#title' => t($item['title'], $item['title arguments']),
-      '#description' => t($item['description']),
-      '#collapsible' => TRUE,
-    );
-    $callback = array_shift($item['arguments']);
-    if (isset($item['file']) && !empty($item['file'])) {
-      include_once $item['file'];
-    }
-    array_unshift($item['arguments'], array());
-    $fs = array();
-    $form[$key] += drupal_retrieve_form($callback, $fs, $item['arguments']);
-    if (isset($form[$key]['buttons'])) {
-      unset($form[$key]['buttons']);
-    }
-    $form[$key]['#summary_callback'] = $key;
-  }
-
-  return system_settings_form($form);
-}
-
-/**
- * Add the JavaScript and CSS.
- */
-function vertical_tabs_add_js_css($form) {
-  drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.js');
-  drupal_add_css(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.css');
-  return $form;
-}
-
-/**
- * Add the JavaScript for the node form.
- */
-function vertical_tabs_add_node_form_js($form) {
-  drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.node_form.js');
-  return $form;
-}
-
-/**
- * Add the JavaScript for the settings form.
- */
-function vertical_tabs_add_settings_js($form) {
-  drupal_add_js(drupal_get_path('module', 'vertical_tabs') .'/vertical_tabs.settings.js');
-  return $form;
-}
--- vertical_tabs.node_form.js	Sat Aug 16 22:11:48 2008
+++ vertical_tabs.node_form.js	Mon Sep 22 11:55:16 2008
@@ -78,4 +78,65 @@
   else {
     return Drupal.t('No alias');
   }
-}
\ No newline at end of file
+}
+
+/**
+ * Backported from Drupal 6.x
+ */
+Drupal.checkPlain = function(str) {
+  str = String(str);
+  var replace = { '&': '&amp;', '"': '&quot;', '<': '&lt;', '>': '&gt;' };
+  for (var character in replace) {
+    var regex = new RegExp(character, 'g');
+    str = str.replace(regex, replace[character]);
+  }
+  return str;
+};
+
+Drupal.t = function(str, args) {
+  // Fetch the localized version of the string.
+//  if (Drupal.locale.strings && Drupal.locale.strings[str]) {
+//    str = Drupal.locale.strings[str];
+//  }
+
+  if (args) {
+    // Transform arguments before inserting them
+    for (var key in args) {
+      switch (key.charAt(0)) {
+        // Escaped only
+        case '@':
+          args[key] = Drupal.checkPlain(args[key]);
+        break;
+        // Pass-through
+        case '!':
+          break;
+        // Escaped and placeholder
+        case '%':
+        default:
+          args[key] = Drupal.theme('placeholder', args[key]);
+          break;
+      }
+      str = str.replace(key, args[key]);
+    }
+  }
+  return str;
+};
+
+Drupal.formatPlural = function(count, singular, plural, args) {
+  var args = args || {};
+  args['@count'] = count;
+  // Determine the index of the plural form.
+  var index = /*Drupal.locale.pluralFormula ? Drupal.locale.pluralFormula(args['@count']) : */((args['@count'] == 1) ? 0 : 1);
+
+  if (index == 0) {
+    return Drupal.t(singular, args);
+  }
+  else if (index == 1) {
+    return Drupal.t(plural, args);
+  }
+  else {
+    args['@count['+ index +']'] = args['@count'];
+    delete args['@count'];
+    return Drupal.t(plural.replace('@count', '@count['+ index +']'));
+  }
+};
\ No newline at end of file
