﻿var settings = { gap: 30, width: 200, easing: 'easeInOutQuart', duration: 500, speed: 1 };
$(function () {
    $('#boxes').hide();
    $(window).bind('resize', function () {
        //if (resizeTimer) clearTimeout(resizeTimer);
        resizeTimer = setTimeout(function () {
            if ($('#boxes > div').length > 0) {
                $('#boxes').grid(settings, '', false, true);
            }
        }, 100);

    });
});

$(window).load(
    function () {
        $('#boxes').show();
        if ($('#boxes > div').length > 0) {
            $('#boxes').grid(settings, '', false, true, function () { // runs asynchronly so the height has to be set when it's done executing.
                getHeightOfBoxes();
            });
        }
    });
function getHeightOfBoxes() {
    var height = $("#boxes").height();
    var heightLeft = $("div#venstre").height();
    if (heightLeft > height) { // if the boxes are smaller than the left menu
        $('div#container').height(heightLeft + 150); // some extra margin on the bottom        
    } else {
        $('div#container').height(height + 150); // some extra margin on the bottom
    }
    $('div#innerRamme').width(1084);
    $('div#meny1').width(1084);
    $('div#bunn').width(1084);
}

