/*-------------------------------------------------------------------- 
 * JQuery Plugin: "EqualHeights"
 * Beaconfire Consulting
 * 
 * Original idea from the Filament Group
 * by:	Scott Jehl, Todd Parker, Maggie Costello Wachs (http://www.filamentgroup.com)
 * 
 * Description: Compares the heights or widths of the top-level children of a provided element 
 *		and sets their min-height to the tallest height (or width to widest width). Sets in em units 
 *		by default if pxToEm() method is available.
 * Usage Example: $(element).equalHeights();
 * 		Optional: to set the height on an inner child of the grid item. pass in a selector
--------------------------------------------------------------------*/

;(function($) {
    $.fn.equalHeights = function(sel) {
	    $(this).each(function(){
		    var currentTallest = 0;
		    var $children = $(this).children();
            if(sel) {
                $children = $children.find(sel);
            }
            $children.each(function(i){
			    if ($(this).height() > currentTallest) {
                    currentTallest = $(this).height();
                }
		    });
		    // for ie6, set height since min-height isn't supported
		    if ($.browser.msie && $.browser.version == 6.0) { $children.css({'height': currentTallest}); }
		    $children.css({'min-height': currentTallest});
	    });
	    return this;
    };
})(jQuery);

