/**
 * Same Height, jQuery plug-in.
 *
 * This plug-in allows you to automatically have all of the elements marked
 * with a particular class to be the same height, either by smallest or
 * largest.
 * 
 * By default, 'samemaxheight' and 'sameminheight' will be used.
 *
 * Examples of use:
 *
 *     $(document).ready(function() {
 *         $('body').sameheight();
 *     });
 *
 *     $(document).ready(function() {
 *         $('#mainContent').sameheight({
 *             max: 'mymaxclass',
 *             min: 'myminclass'
 *         });
 *     });
 *     
 *     $.fn.sameheight.defaults.max = 'mymaxclass';
 *     $.fn.sameheight.defaults.min = 'myminclass';
 *     $('body').sameheight();
 *
 * @copyright Copyright (c) 2009 Andrew Collington <andy@amnuts.com>
 * @version $Id: jquery.sameheight.js 3691 2009-06-30 11:17:40Z apc23 $
 */
(function($) {
    $.fn.sameheight = function(userOptions) {
        var options = $.extend({}, $.fn.sameheight.defaults, userOptions);

        var maxH = 0;
        $('.' + options.max, $(this)).each(function(){
            var h = $(this).height();
            maxH = (h > maxH) ? h : maxH;
        });
        $('.' + options.max, $(this)).each(function(){
        	$(this).css({
        		'height'   : maxH + 'px',
        		'overflow' : 'hidden'
        	});
        });
        
        var minH = 0;
        $('.' + options.min, $(this)).each(function(){
            var h = nodes[i].height();
            minH = ((h < minH) || !minH) ? h : minH; 
        });
        $('.' + options.min, $(this)).each(function(){
        	$(this).css({
        		'height'   : minH + 'px',
        		'overflow' : 'hidden'
        	});
        });
    };
 
    $.fn.sameheight.defaults = {
        max: 'samemaxheight',
        min: 'sameminheight'
    };
})(jQuery);
