678f761f34cf28f84c9a967a0b90bb7fd5a1451f
tdreszer
  Fri Dec 9 13:05:54 2011 -0800
Fixed the tableSort.  insertBefore is effective BUT you shouldn't insert before yourself, at least in IE8.
diff --git src/hg/js/utils.js src/hg/js/utils.js
index 0a256df..8c360e8 100644
--- src/hg/js/utils.js
+++ src/hg/js/utils.js
@@ -1264,31 +1264,33 @@
 
     // Create array of the primary sort column's text
     var cols = new Array();
     var trs = tbody.rows;
     $(trs).each(function(ix) {
         var th = this.cells[sortColumns.cellIxs[0]];
         if(sortColumns.useAbbr[0])
             cols.push(new sortField(th.abbr,sortColumns.reverse[0],this));
         else
             cols.push(new sortField($(th).text(),sortColumns.reverse[0],this));
     });
 
     // Sort the array
     cols.sort(sortFieldCmp);
 
+    var topIndex = tbody.rows[0].rowIndex; // This could vary depending upon header rows
     for(var cIx=cols.length-1;cIx>=0;cIx--) {
+        if (cols[cIx].row.rowIndex > topIndex) // Inserting before onesself will delete row
         $( cols[cIx].row ).insertBefore( tbody.rows[0]);
     }
 
     gTbody=tbody;
     gSortColumns=sortColumns;
     setTimeout('tableSortFinish(gTbody,gSortColumns)',5); // Avoid javascript timeouts!
 }
 
 function tableSortFinish(tbody,sortColumns)
 {// Additional sort cleanup.
  // This is in a separate function to allow calling with setTimeout() which will prevent javascript timeouts (I hope)
     tableSetPositions(tbody);
     if ($(tbody).hasClass('altColors'))
         sortedTableAlternateColors(tbody,sortColumns);
     $(tbody).parents("table.tableWithDragAndDrop").each(function (ix) {