function setPageHeight() {
    if ($("#main").height() >= $("#sb-left").height() && $("#main").height() >= $("#sb-right").height()) {
        trueHeight= $("#main").outerHeight(true);
    } else {
        if ($("#sb-left").height() > $("#sb-right").height()) {
            trueHeight = $("#sb-left").outerHeight(true);
        } else {
            trueHeight= $("#sb-right").outerHeight(true);
        }
    }
    
    totalIfLess = trueHeight + $("#content > ul").height() + $("#footer").height() + 20;
    
    topValue=$("#logo").outerHeight(true);

    totalIfMore = $(window).height() - (topValue + 20);
    
    if ($(window).height() <= (topValue + totalIfLess)) {
        $("#content").height(totalIfLess);
    } else {
        $("#content").height(totalIfMore);
    }
}

$(window).bind("load", function() {
    setPageHeight();
    
    $("#background").css("min-height", $("#window").height());
    $(".sidebar").height($("#content").height()-($("#footer").outerHeight(true)+$("#main-menu").outerHeight(true)+20));
    $(window).trigger("loadSideImages");
});
