/**
 * 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'] )
 */
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);
	for (i in columns) {
		c = jQuery(columns[i]);
		if (c.outerHeight() < max){ c.height( max - (c.outerHeight() - c.height()) ); }
	}
}
