/*
	jQuery Version:				jQuery 1.3.2
	Plugin Name:				EqualHeights V 1.0
	Plugin by: 					Jeff Waterfall: http://www.threeformed.com
	License:					EqualHeights is licensed under a Creative Commons Attribution 3.0 Unported License
								Read more about this license at --> http://creativecommons.org/licenses/by/3.0/		
*/
(function($) {
    $.fn.equalHeights = function(options) {
    	
    	// setup default settings
    	var defaults = {
    		linked:		0
    	},
    	settings = $.extend({}, defaults, options);
		
		if(settings.linked) {
			var groupNum = this.size();
			var tallest = new Array();
			var mostPad = 0;
			var row = 0;
			this.each(function(i) {
				if(i % settings.linked == 0) {
					row++;
					tallest[row] = 0;
				}	
				thisHeight = $(this).outerHeight();
				if(thisHeight > tallest[row]) {
					tallest[row] = thisHeight;
				}
			});
			row = 0;
			this.each(function(i) {
				if(i % settings.linked == 0) {
					row++;
				}
				var thisPad = $(this).outerHeight() - $(this).height();
				if ($.browser.msie && $.browser.version < 7) {
					// Cause IE6 Sucks
					$(this).css({'height': tallest[row] - thisPad });
				}
				$(this).css({'min-height': tallest[row] - thisPad });
			});
			
		} else {
			var tallest = 0;
			var mostPad = 0;
			this.each(function() {
				thisHeight = $(this).outerHeight();
				if(thisHeight > tallest) {
					tallest = thisHeight;
				}
			});
			this.each(function() {
				var thisPad = $(this).outerHeight() - $(this).height();
				if ($.browser.msie && $.browser.version < 7) {
					// Cause IE6 Sucks
					$(this).css({'height': tallest - thisPad});
				}
				$(this).css({'min-height': tallest - thisPad});				
			});
		}
		// end if
    };
})(jQuery);