/**
 * Adjust height according to css selector
 *   Uses Prototype JS Framework
 *   @param: string selector : CSS style selector
 *   @param (optional): boolean usePaddingValue : Wheter to take padding (top and bottom) values into account when comparing heights
 *   @param (optional): int minHeight : The Minimum height to be set    
 *   @author: Gulam Moledina 
 *   
 *   @todo: check wheter the border-width affects the height or not  
 */ 
function adjustHeight(selector, usePaddingValue, minHeight)
{
  if(usePaddingValue == undefined) usePaddingValue = false; else usePaddingValue = Boolean(usePaddingValue);
  if(minHeight == undefined) minHeight = 0; else minHeight = parseInt(minHeight);

  var elements = $$(selector);
  var maxHeight = minHeight;
  var currentElementHeight = 0;
  
  for(var i = 0; i < elements.length; i++)
  {
    if(usePaddingValue)
    {
      currentElementHeight = $(elements[i]).getHeight();
    }
    else
    {
      currentElementHeight = $(elements[i]).getHeight() 
                            - parseInt($(elements[i]).getStyle('padding-bottom')) 
                            - parseInt($(elements[i]).getStyle('padding-top'));
    }
    
    if(maxHeight < currentElementHeight)
    {
      maxHeight = currentElementHeight;
    }
  }
  
  for(i = 0; i < elements.length; i++) elements[i].style.height = maxHeight + 'px';
}
