/**
 * align heights of specified boxes
 * 
 * $('.box').align_height();
 * 
 * Released under the MIT licence:
 * http://www.opensource.org/licenses/mit-license.php
 */
(function ($) {
	$.fn.align_height = function ($options) {
		var defaults = {
			type: 'value'
		};
		var conf = $.extend(defaults, $options);
		var ua = navigator.userAgent;
		var isFF = /Firefox/.test(ua);
		var css = /MSIE 6/.test(ua) ? ['height', 'auto'] : ['minHeight', 0];
		var max = 0;
		switch (conf.type) {
			case 'value':
				this.each(function () {
					var self = $(this);
					if (isFF) {
						var overflow = self.css('overflow');
						var isHidden = (overflow == 'hidden') ? true : false;
					}
					if (isFF && !isHidden) self.css('overflow', 'hidden');
					var h = self.css(css[0], css[1]).height();
					if (isFF && !isHidden) self.css('overflow', overflow);
					if (max < h) max = h;
				})
				.css(css[0], max);
				break;
			case 'class':
				break;
		}
		return this;
	};
})(jQuery);

