/**
 * Makes several columns identically tall
 *
 * When working with multicolumn layouts, the height of each column may
 * vary from page to page.  Website designs often intend for each 
 * column to be exactly the same height as the next, but with varying
 * amounts of text on each page, we need something that is determines
 * height based on content length.  Unfortunately, the CSS3 Columns
 * specification has not been adopted yet, and there is not a great
 * way of making one column exactly as tall as the next using CSS.
 * Instead, we resort to Javascript...
 *
 *
 * Date Created: 2008-10-31
 *
 * @author   Sean McCann
 * @requires jQuery This function requires the jQuery library [http://jQuery.com]
 *
 * @param columns An array of selectors identifying each column to be resized (e.g. ['#nav-column', '#content-column', '#sidebar'] )
 * @return object An associative array of selectors and the amount by which each selector was resized
 */
function fix_column_height( columns ) {
	function get_max_height( elements ) {
		var i, max = 0;
		for (i in elements) {
			max = (jQuery(elements[i]).outerHeight() > max) ? jQuery(elements[i]).outerHeight() : max;
		}
		return max;
	}

	var c, i, max = get_max_height(columns);
	var oldHeight, resized = {};
	for (i in columns) {
		c = jQuery(columns[i]);
//		alert ("max: " + max + "\nsel:" + columns[i] + "\nheight:" + c.height() + "\nouter:" + c.outerHeight() + "\ninner:" + c.innerHeight());
		oldHeight = c.height();
		if (c.outerHeight() < max){ c.height( max - (c.outerHeight() - c.height()) ); }
		resized[columns[i]] = c.height() - oldHeight;
	}
	return resized;
}

