jQuery.fn.equalize = function(options) {
    var elements = $(this), settings = jQuery.extend({
        hw: 'height'
    }, options), max = 0;
    elements.height('').each( function() {
        var c = parseInt($(this).outerHeight());
        if (c > max) {
            max = c
        }
    });
    if (max) {
        elements.each( function() {
        	if ('none' === $(this).css('display')) {
        		return;
        	}
			var c = $(this).height();
			if (parseInt($(this).outerHeight()) < max) {
				$(this).height(max);
			}
			else if (parseInt($(this).outerHeight()) > max) {
				$(this).height(c);
			}
        }).parents().first().addClass('equal');
    }
    return $(this);
};
jQuery(document).ready( function($) {
	var eq_elements = [];
	if ( $('body').hasClass('home') ) {
		eq_elements.push($('.box .content'));
	} else {
		$('.box.first').each(function(i){eq_elements.push($(this).nextUntil('.box.first').andSelf());});
	}
	$(eq_elements).each(jQuery.fn.equalize);
	$(window).resize(function(){$(eq_elements).each(jQuery.fn.equalize);}).resize();
});
