// this script is intended to create equal heights between
// the package price block and package specs

jQuery.fn.equalHeight = function () {
    var height        = 0;
    var maxHeight    = 0;

    // Store the tallest element's height
    this.each(function () {
        height        = jQuery(this).outerHeight();
        maxHeight    = (height > maxHeight) ? height : maxHeight;
    });

    // Set element's min-height to tallest element's height
    return this.each(function () {
        var t            = jQuery(this);
        var minHeight    = maxHeight - (t.outerHeight() - t.height());
        var property    = jQuery.browser.msie && jQuery.browser.version < 7 ? 'height' : 'min-height';

        t.css(property, (minHeight - 20 ) + 'px'); // -20 compensates for padding in .pkg_specs_inner
    });
};

$(document).ready(function() {

	// equal heights
	$('.premier #premier_block, .premier .pkg_specs_inner').equalHeight();
	$('.premier .pkg_specs_inner, .premier .pkg_specs_inner ul, .premier .pkg_info').equalHeight();
	$('.ultimate #ultimate_block, .ultimate .pkg_specs_inner').equalHeight();
	$('.ultimate .pkg_specs_inner, .ultimate .pkg_specs_inner ul, .ultimate .pkg_info').equalHeight();
	$('.xtra #xtra_block, .xtra .pkg_specs_inner').equalHeight();
	$('.xtra .pkg_specs_inner, .xtra .pkg_specs_inner ul, .xtra .pkg_info').equalHeight();
	$('.choice #choice_block, .choice .pkg_specs_inner').equalHeight();
	$('.choice .pkg_specs_inner, .choice .pkg_specs_inner ul, .choice .pkg_info').equalHeight();
	$('.family #family_block, .family .pkg_specs_inner').equalHeight();
	$('.family .pkg_specs_inner, .family .pkg_specs_inner ul, .family .pkg_info').equalHeight();
	
	// loop through element and grab the height after running equalHeight()
	// then subtract 25px from that so that pkg_specs_inner box does not
	// grow taller than price block
	$('.pkg_specs_inner').each(function() {
		
		var equalHeight = $(this).outerHeight();
		$(this).css('height', (equalHeight - 25) + 'px');
	});

	//$('.pkg_info').css('padding-bottom', '15px');
});
