/**
 * Equal Heights Plugin
 * Equalize the heights of elements. Great for columns or any elements
 * that need to be the same size (floats, etc).
 * 
 * Version 1.0
 * Updated 12/10/2008
 *
 * Copyright (c) 2008 Rob Glazebrook (cssnewbie.com) 
 *
 * Usage: $(object).equalHeights([minHeight], [maxHeight]);
 * 
 * Example 1: $(".cols").equalHeights(); Sets all columns to the same height.
 * Example 2: $(".cols").equalHeights(400); Sets all cols to at least 400px tall.
 * Example 3: $(".cols").equalHeights(100,300); Cols are at least 100 but no more
 * than 300 pixels tall. Elements with too much content will gain a scrollbar.
 * 
 */

(function($) {
    $.fn.equalHeights = function(minHeight, maxHeight) {
        tallest = (minHeight) ? minHeight : 0;
        msg = "";
        this.each(function() {
            
            msg += "id: " + $(this).attr('id') + "\n";
            
            if($(this).height() > tallest) {
                tallest = $(this).height();
            }
        });
        
        if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
        return this.each(function() {
            $(this).height(tallest).css("overflow","auto");
        });
    }
})(jQuery);
/* cc equal heights by me 4/11/11 */
(function($) {
    $.fn.cc_equalHeights = function() {
        var biggest_height = 0;
         this.each(function() {
            if($(this).height() > biggest_height) {
                biggest_height = $(this).height();
            }
        });
        this.each(function() {
            $(this).css('height', biggest_height+'px');
        });
    }
})(jQuery);
/*
* Match Heights Plugin
* Match the heights of targeted elements
*
* Version 1.3
* Updated 4/7/2010
* Copyright (c) 2010 Mike Avello
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Usage: $(object).matchHeights({
* minHeight: [optional],
* maxHeight: [optional]
* });
*
*/
(function($) {
	$.fn.matchHeights = function(settings) {
		settings = jQuery.extend(this,{
			minHeight: null, // optional minimum height setting
			maxHeight: null // optional maximum height setting, forced height instead of min-height
	}, settings);
	
	tallest = (settings.minHeight) ? settings.minHeight : 0;
	this.each(function() {
		if($(this).innerHeight() > tallest) {
			tallest = $(this).outerHeight();
		}
	});
	if((settings.maxHeight) && tallest > settings.maxHeight) tallest = settings.maxHeight;
	
	return this.each(function() {
		extra = $(this).innerHeight() - $(this).height();
		
		//if ($(this).outerHeight() - $(this).innerHeight() == 0)
		extra = extra + ($(this).outerHeight() - $(this).innerHeight());
		
		($.browser.msie && $.browser.version == 6.0 || (settings.maxHeight)) ? $(this).css({'height': tallest - extra}) : $(this).css({'min-height': tallest - extra});
		});
	}
})(jQuery);


