Javascript Updated

Added a sanity check that should stop errors when a block is missing. It's a bit of a trade-off. You may want a warning when a dom element you're expecting to be there isn't there. But I found it useful for a situation where an admin might be changing the active blocks for a region.

// balance doms
/*
  balance n sibling elements.  argument must be js array.  sample usage:
  balance_doms(['id1', 'id2', 'id3']);
*/
/*____________________________________________________________________________*/
function balance_doms(ArrayIds)
{
  var Doms = new Array();
  var DomHeights = new Array();
  for ( i=0; i<ArrayIds.length; i++ )
  {
    if ( document.getElementById(ArrayIds[i]) )
    {
      Doms[i] = document.getElementById(ArrayIds[i]);
      DomHeights[i] = Doms[i].offsetHeight;
    }
  }

  var max_ht = get_max(DomHeights);

  for ( i=0; i<Doms.length; i++ )
  {
    Doms[i].style.height = max_ht + "px";
  }
  
  // debug
  //alert("max ht is " + max_ht);
  
  return;  
}
/*____________________________________________________________________________*/