﻿"use strict";
/*global $, jQuery, document*/ //define here all the globals you might have or want

$(document).ready(function () {
    if (!Array.prototype.push || !document.getElementById) {

    }
    else {
        var KTLehti = {};
        $(function () {
            KTLehti.ui = {
                initEqualHeights: function () {
                    //$(".twocols .column").equalHeights();
                },
                init: function () {
                    KTLehti.ui.initEqualHeights();
                }
            }
            KTLehti.ui.init();
        });
    }
});

(function ($) {
    $.fn.equalHeights = function (customSettings) {
        var config = { 'isHeader': 'false' }
        if (customSettings) $.extend(config, customSettings);

        var maxHeight = 0;
        this.each(function () {
            if (this.offsetHeight > maxHeight) { maxHeight = this.offsetHeight; }
        });

        this.each(function () {
            if (customSettings) {
                if (this.offsetHeight < maxHeight) {
                    var padding = maxHeight - this.offsetHeight;
                    $(this).css("padding-top", padding);
                }
            } else {
                if (this.offsetHeight > maxHeight) { maxHeight = this.offsetHeight; }
                $(this).height(maxHeight + "px");
                if (this.offsetHeight > maxHeight) {
                    $(this).height((maxHeight - (this.offsetHeight - maxHeight)) + "px");
                }
            }
        });

        return this;
    };

})(jQuery);


