﻿/*
 *  When DOM is loaded
 */
$(document).ready(function()
{
    // Calculate padding
    var paddingTop = Math.floor(($('.citat .contentRight').height() / 2) - ($('.randomQuote').height() / 2));
    // Set top padding (if larger than zero)
    if (paddingTop > 0) $('.randomQuote').css('paddingTop', paddingTop);
});
/*
 *  When document is loaded
 */
$(window).load(function()
{
    // Fix row heights
    $('.row').each(function(index, element)
    {
        // Init new height
        var newHeight = 0;
        // Find largest height
        $(element).find('.contentRight').each(function (index, element2)
        {
            // If detected height is larger
            if ($(element2).height() > newHeight) {
                // Assign it
                newHeight = $(element2).height();
            }
        });
        // Set height for all content elements
        $(element).find('.contentRight').each(function(index, element2)
        {
            // Set new height
            $(element2).height(newHeight);
        });
    });
});
