diff -urp --strip-trailing-cr ../drupal-6.x-dev/includes/theme.inc ./includes/theme.inc
--- ../drupal-6.x-dev/includes/theme.inc	2008-01-09 23:01:29.000000000 +0100
+++ ./includes/theme.inc	2008-01-11 21:17:31.000000000 +0100
@@ -1228,6 +1228,16 @@ function theme_submenu($links) {
  *   An HTML string representing the table.
  */
 function theme_table($header, $rows, $attributes = array(), $caption = NULL) {
+
+  // Add sticky headers, if applicable.
+  if (count($header)) {
+    drupal_add_js('misc/tableheader.js');
+    // Add 'sticky-enabled' class to the table, to identify it for JS.
+    // This is needed to avoid messing with other tables on the same page,
+    // such as tables in content or theme constructs.
+    $attributes['class'] = empty($attributes['class']) ? 'sticky-enabled' : $attributes['class'] .' sticky-enabled';
+  }
+
   $output = '<table'. drupal_attributes($attributes) .">\n";
 
   if (isset($caption)) {
@@ -1236,9 +1246,6 @@ function theme_table($header, $rows, $at
 
   // Format the table header:
   if (count($header)) {
-    // Include JS for sticky headers.
-    drupal_add_js('misc/tableheader.js');
-
     $ts = tablesort_init($header);
     // HTML requires that the thead tag has tr tags in it follwed by tbody
     // tags. Using ternary operator to check and see if we have any rows.
Pouze v ./includes: theme.inc~
diff -urp --strip-trailing-cr ../drupal-6.x-dev/misc/tableheader.js ./misc/tableheader.js
--- ../drupal-6.x-dev/misc/tableheader.js	2008-01-10 18:59:38.000000000 +0100
+++ ./misc/tableheader.js	2008-01-11 21:02:12.000000000 +0100
@@ -9,7 +9,7 @@ Drupal.behaviors.tableHeader = function 
   // Keep track of all cloned table headers.
   var headers = [];
 
-  $('table thead:not(.tableHeader-processed)', context).each(function () {
+  $('table.sticky-enabled thead:not(.tableHeader-processed)', context).each(function () {
     // Clone table and remove unwanted elements so it inherits original properties.
     var headerClone = $(this.parentNode).clone(true).insertBefore(this.parentNode).addClass('sticky-header').css({
       position: 'fixed',
@@ -23,9 +23,10 @@ Drupal.behaviors.tableHeader = function 
       headerClone.attr('id', headerID + '-header');
     }
 
-    // Everything except thead must be removed. See theme_table().
+    // Everything except thead must be removed.
     $('tbody', headerClone).remove();
     $('caption', headerClone).remove();
+    $('tfoot', headerClone).remove();
 
     var headerClone = $(headerClone)[0];
     headers.push(headerClone);
