/**
 * EqualHeight 1.0
 *
 * Copyright (c) 2007 Andreas Lagerkvist (exscale.se)
 */
jQuery.fn.equalHeight = function() { var height = 0, maxHeight = 0;

// Store the tallest element's height
this.each(function() {
    var t = jQuery(this);
    //height = t.height() + parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + parseInt(t.css('borderTopWidth'), 10) + parseInt(t.css('borderBottomWidth'), 10);

    var border_top = ( isNaN(parseInt(t.css('borderTopWidth'),10)) ? 0 : parseInt(t.css('borderTopWidth'),10) );
    var border_bottom = ( isNaN(parseInt(t.css('borderBottomWidth'),10)) ? 0 : parseInt(t.css('borderBottomWidth'),10) );
    height = t.height() + parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + border_top + border_bottom;
    maxHeight = (height > maxHeight) ? height : maxHeight;
	var pad=t.height();
});

// Set element's min-height to tallest element's height
return this.each(function() {
    var t = jQuery(this);
        var border_top = ( isNaN(parseInt(t.css('borderTopWidth'),10)) ? 0 : parseInt(t.css('borderTopWidth'),10) );
        var border_bottom = ( isNaN(parseInt(t.css('borderBottomWidth'),10)) ? 0 : parseInt(t.css('borderBottomWidth'),10) );

        mh = maxHeight - (parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10) + border_top + border_bottom );
        //mh = maxHeight - (parseInt(t.css('padding-top'), 10) + parseInt(t.css('padding-bottom'), 10) + parseInt(t.css('border-top-width'), 10) + parseInt(t.css('border-bottom-width'), 10));
		//alert(t.height() + " - " + mh  + " - " + t.html());
		var padd =parseInt((maxHeight - t.height())/2);
		t.css('paddingTop', padd +'px');
		t.css('paddingBottom', padd +'px');
        //t.height(mh - padd + 2);
        //t.css({minHeight: mh +'px'});
});
};

