/**
 * @author Kevin Thompson
 * @copyright The Automaters 2007
 * @version 1.0.1
 * 
 * Usage:
 * function window_load(){
 *     new equalColumns(minheight,'columnid1','columnid2','columnidN');
 * }
 * 
 * Event.observe(window,'load',window_load);
 */
var equalColumns = Class.create();
equalColumns.prototype = {
	initialize: function(){
		var $elements = $.apply(this,arguments);
		var maxh = $elements.max(function(el){if(el == parseInt(el)){return el;}else{return $(el).getHeight();}});
		
		$elements.each(function(el){
			if(el == parseInt(el)) return;			
			var spacer;
			if(spacer=el.down('p.spacer')){
				var h = el.getHeight();
				var sh = spacer.getHeight();							
				if(h!=maxh){
					var nh = (maxh-h-sh)+'px';							
					spacer.setStyle({height:nh});
				}
			}else{									
				var nh = maxh+'px';				
				el.setStyle({height:nh});
			}
		});
	}
};