﻿
(function ($) {

    $.fn.equalizeCols = function () {
        var height = 0,
			reset = $.browser.msie ? "1%" : "auto";

        return this
			.css("height", reset)
			.each(function () {
			    height = Math.max(height, this.offsetHeight);
			})
			.css("height", height)
			.each(function () {
			    var h = this.offsetHeight;
			    if (h > height) {
			        $(this).css("height", height - (h - height));
			    };

			});
    };

    $.fn.equalizeRightColumn = function (subractWidth) {
        if (!subractWidth) {
            subractWidth = 0;
        }

        var col1 = $(".col1", this);
        var col2 = $(".col2", this);
        var w = col1.width();
        if (w) col2.css("width", $(this).parent().width() - w - 6 - subractWidth);

        return this;
    };

})(jQuery);
