function ThumbRandomizer(tgtContainerId, srcSizerId, tgtFrameId)
{
  var t, i, c, td, content, hSrc, hTgt, cutoffFlag;
  if ((tgtContainerId != null) && document.getElementById)
  {
    this.tableCells = new Array();
    this.tableCellContents = new Array();
    this.rowHeights = new Array();
    this.walkContainer(document.getElementById(tgtContainerId));
    this.randomizeArray(this.tableCellContents, 0);

    for (j = 0, i = 0, c = this.tableCells.length, d = this.tableCellContents.length; i < c; i++, j++)
    {
      td = this.tableCells[i];
      
      if (j >= d)
      {
        j = 0;
      }
      
      if (content = this.tableCellContents[j])
      {
        td.innerHTML = content;
      }
    }
    
    // Re-walk to get current cell heights
    this.tableCells = new Array();
    this.tableCellContents = new Array();
    this.rowHeights = new Array();
    this.walkContainer(document.getElementById(tgtContainerId));

    hSrc = window.parent.document.getElementById(srcSizerId).offsetHeight;
    hTgt = 0;
    for (i = 0, c = this.rowHeights.length, cutoffFlag = false; i < c; i += 2)
    {
      hInc = 
       (this.rowHeights[i] > this.rowHeights[i + 1]) ?
       this.rowHeights[i] :
       this.rowHeights[i + 1];

      if (cutoffFlag)
      {
        this.tableCells[i].style.display = "none";
        this.tableCells[i + 1].style.display = "none";
      }
      else if ((hInc + hTgt) < hSrc)
      {
        hTgt += hInc;
      }
      else
      {
        cutoffFlag = true;
        this.tableCells[i].style.display = "none";
        this.tableCells[i + 1].style.display = "none";
      }
    }
    
    if (hTgt)
    {
      window.parent.document.getElementById(tgtFrameId).style.height = hTgt+"px";
    }
  }
  ThumbRandomizer.done = true;
}
new ThumbRandomizer(null, null);

ThumbRandomizer.prototype.walkContainer = function(n)
{
  var i, c;
  if (n.nodeType == 1)
  {
    if (n.nodeName.toLowerCase() == 'td')
    {
      this.tableCells.push(n);
      this.tableCellContents.push(n.innerHTML);
      this.rowHeights.push(n.offsetHeight);
    }
    else if (n.hasChildNodes())
    {
      for (i = 0, c = n.childNodes.length; i < c; i++)
      {
        this.walkContainer(n.childNodes[i]);
      }
    }
  }
}

ThumbRandomizer.prototype.randomizeArray = function(list, iter)
{
  var n, r;
  if (iter > 2)
  {
    return;
  }

  for (i = 0, c = list.length; i < c; i++)
  {
    r = Math.round(Math.random() * (c - 1));
    n = list[r];
    list[r] = list[i];
    list[i] = n;
  }
  this.randomizeArray(list, ++iter);
}
