diff -urp --strip-trailing-cr ../drupal-6.x-dev/misc/tableheader.js ./misc/tableheader.js
--- ../drupal-6.x-dev/misc/tableheader.js	2007-10-02 09:09:51.000000000 +0200
+++ ./misc/tableheader.js	2008-01-08 23:36:15.000000000 +0100
@@ -6,65 +6,73 @@ Drupal.behaviors.tableHeader = function 
     return;
   }
 
-  // Keep track of all header cells.
-  var cells = [];
+  // Keep track of all cloned table headers.
+  var headers = [];
 
-  var z = 0;
   $('table thead:not(.tableHeader-processed)', context).each(function () {
-    // Find table height.
-    var table = $(this).parent('table')[0];
-    var height = $(table).addClass('sticky-table').height();
-    var i = 0;
-
-    // Find all header cells.
-    $('th', this).each(function () {
+    // Clone table and remove body so it inherits original properties.
+    var headerClone = $(this.parentNode).clone(true).insertBefore(this.parentNode).addClass('sticky-header').css({
+      position: 'fixed',
+      visibility: 'hidden',
+      top: '0px'
+    });
+    $('tbody', headerClone).remove();
 
-      // Ensure each cell has an element in it.
-      var html = $(this).html();
-      if (html == ' ') {
-        html = '&nbsp;';
-      }
-      if ($(this).children().size() == 0) {
-        html = '<span>'+ html +'</span>';
-      }
+    var headerClone = $(headerClone)[0];
+    headers.push(headerClone);
 
-      // Clone and wrap cell contents in sticky wrapper that overlaps the cell's padding.
-      $('<div class="sticky-header" style="position: fixed; visibility: hidden; top: 0px;">'+ html +'</div>').prependTo(this);
-      var div = $('div.sticky-header', this).css({
-        'marginLeft': '-'+ $(this).css('paddingLeft'),
-        'marginRight': '-'+ $(this).css('paddingRight'),
-        'paddingLeft': $(this).css('paddingLeft'),
-        'paddingTop': $(this).css('paddingTop'),
-        'paddingBottom': $(this).css('paddingBottom'),
-        'z-index': ++z
-      })[0];
-      cells.push(div);
-
-      // Adjust width to fit cell/table.
-      var ref = this;
-      if (!i++) {
-        // The first cell is as wide as the table to prevent gaps.
-        ref = table;
-        div.wide = true;
-      }
-      $(div).width(Math.max(0, $(ref).width() - parseInt($(div).css('paddingLeft'))));
+    // Store parent table.
+    var table = $(this).parent('table')[0];
+    headerClone.table = table;
+    // Correct positioning.
+    headerClone.resizeWidths = true;
+    setPosition(headerClone);
 
-      // Get position and store.
-      div.cell = this;
-      div.table = table;
-      div.stickyMax = height;
-      div.stickyPosition = $(this).offset().top;
-    });
+    $(table).addClass('sticky-table');
     $(this).addClass('tableHeader-processed');
   });
 
+  // Adjust positioning.
+  function setPosition(e) {
+    // Save positioning data.
+    var viewHeight = document.documentElement.scrollHeight || document.body.scrollHeight;
+    if (e.viewHeight != viewHeight || e.resizeWidths) {
+      e.viewHeight = viewHeight;
+      e.vPosition = $(e.table).offset().top;
+      e.hPosition = $(e.table).offset().left;
+      e.vLength = $(e.table).height();
+      e.resizeWidths = true;
+    }
+
+    // Track horizontal positioning relative to the viewport.
+    var hscroll = document.documentElement.scrollLeft || document.body.scrollLeft;
+    $(e).css('left', -hscroll + e.hPosition +'px');
+
+    // Resize cell widths.
+    if (e.resizeWidths) {
+      var cellCount = 0;
+      $('th', e).each(function() {
+        var cellWidth = parseInt($('th', e.table).eq(cellCount).css('width'));
+        // Exception for IE7.
+        if (!cellWidth) {
+          var cellWidth = $('th', e.table).eq(cellCount).width();
+        }
+        cellCount++;
+        $(this).css('width', cellWidth +'px');
+      });
+      $(e).css('width', $(e.table).width() +'px');
+      e.resizeWidths = false;
+    }
+  };
+
   // Track scrolling.
   var scroll = function() {
-    $(cells).each(function () {
+    $(headers).each(function () {
+      setPosition(this);
       // Fetch scrolling position.
       var scroll = document.documentElement.scrollTop || document.body.scrollTop;
-      var offset = scroll - this.stickyPosition - 4;
-      if (offset > 0 && offset < this.stickyMax - 100) {
+      var offset = scroll - this.vPosition - 4;
+      if (offset > 0 && offset < this.vLength - 50) {
         $(this).css('visibility', 'visible');
       }
       else {
@@ -83,26 +91,10 @@ Drupal.behaviors.tableHeader = function 
       return;
     }
     time = setTimeout(function () {
-
-      // Precalculate table heights
-      $('table.sticky-table').each(function () {
-        this.savedHeight = $(this).height();
+      $('table.sticky-header').each(function () {
+        this.resizeWidths = true;
       });
-
-      $('table.sticky-table div.sticky-header').each(function () {
-        // Get position.
-        this.stickyPosition = $(this.cell).offset().top;
-        this.stickyMax = this.table.savedHeight;
-
-        // Reflow the cell.
-        var ref = this.cell;
-        if (this.wide) {
-          // Resize the first cell to fit the table.
-          ref = this.table;
-        }
-        $(this).width(Math.max(0, $(ref).width() - parseInt($(this).css('paddingLeft'))));
-      });
-
+      $(scroll);
       // Reset timer
       time = null;
     }, 250);
diff -urp --strip-trailing-cr ../drupal-6.x-dev/modules/system/system.css ./modules/system/system.css
--- ../drupal-6.x-dev/modules/system/system.css	2007-12-22 23:25:50.000000000 +0100
+++ ./modules/system/system.css	2008-01-08 23:03:45.000000000 +0100
@@ -468,7 +468,9 @@ tr.selected td {
 /*
 ** Floating header for tableheader.js
 */
-thead div.sticky-header {
+table.sticky-header {
+  padding: 0;
+  margin: 0;
   background: #fff;
 }
 
diff -urp --strip-trailing-cr ../drupal-6.x-dev/themes/garland/style.css ./themes/garland/style.css
--- ../drupal-6.x-dev/themes/garland/style.css	2007-12-29 17:02:52.000000000 +0100
+++ ./themes/garland/style.css	2008-01-08 23:03:45.000000000 +0100
@@ -201,10 +201,6 @@ thead th {
   font-weight: bold;
 }
 
-thead div.sticky-header {
-  border-bottom: 2px solid #d3e7f4;
-}
-
 th a:link, th a:visited {
   color: #6f9dbd;
 }
