function scrollbarWidth() {
    var div = $('<div style="width:50px;height:50px;overflow:hidden;position:absolute;top:-200px;left:-200px;"><div style="height:100px;"></div>');
    // Append our div, do our calculation and then remove it
    $('body').append(div);
    var w1 = $('div', div).innerWidth();
    div.css('overflow-y', 'scroll');
    var w2 = $('div', div).innerWidth();
    $(div).remove();
    return (w1 - w2);
}

function posisjonerBunn() {
    var infoboxHeight = parseInt($("#infobox").height());
    var startFree = infoboxHeight + 75 + 120;

    var behov = 279;
    var harScroll;
    var inner;

    if (typeof window.innerHeight == 'function') {
    // Firefox, Opera etc
        inner = window.innerHeight;
    } else {
    // IE
        inner = document.body.offsetHeight;
    }

    var spacerHeight;

    if((inner-startFree) < behov) {
        spacerHeight = "0px";
    } else {
        spacerHeight = (inner-startFree-behov-10-35);
        if(spacerHeight < 0) {
            spacerHeight = 0;
        }

        spacerHeight = spacerHeight + "px";
    }
    $('#spacer').css("height", spacerHeight);


    //alert((inner-startFree) + " < " + behov + " - " + harScroll);
}

$(window).resize(function() {
        var width = parseInt(screen.width);
        var docWidth = parseInt($(document).width());
        var newWidth = "100%";

        // Resize background loop
        if(width <= docWidth) {
            newWidth = "100%";
            $('#loop1').css("width", newWidth);
            $('#loop2').css("width", newWidth);
            $('#sideToppBakgrunn').css("width", newWidth);
            $('#sideBakgrunn').css("width", newWidth);
        } else {
            newWidth = docWidth + "px";
            $('#loop1').css("width", newWidth);
            $('#loop2').css("width", newWidth);
            $('#sideToppBakgrunn').css("width", newWidth);
            $('#sideBakgrunn').css("width", newWidth);
        }

        // Resize if small resolution
        if(width < 1200) {
            newWidth = docWidth + "px";
            $('#loop1').css("width", newWidth);
            $('#loop2').css("width", newWidth);
            $('#sideToppBakgrunn').css("width", newWidth);
            $('#sideBakgrunn').css("width", newWidth);
        }

        posisjonerBunn();

    });

function setLeftVAlue() {
    
}

