function position_site() {
    var site = $('#siteWrapper');
    var win_height = $(window).height();
    var page_height = site.outerHeight() + 90;
    if (win_height > (page_height + 20)) {
        var top_margin = (win_height - page_height) / 2;
        site.css("margin-top", top_margin);
    }
    else {
        site.css("margin-top", "20px");
    }
}

function ajax_page(page, update_id) {
    $.ajax({
        type: "GET",
        url: "news/" + page + ".html",
        success: function(response) {
            $("#" + update_id).html(response);
        }
    });
}

function close_popup(el) {
    $('#newsItemHolder').html('');
    $('#newsPopup .close').addClass('hidden');
    $("#newsPopup .inner").animate({
        height: 0,
        paddingTop: 0,
        paddingBottom: 0
    }, 200)
    .animate({
        width: 0
    }, 200);
    $("#" + el).fadeOut("slow", function () { $('#' + el).addClass('hidden'); });
}

$(document).ready(function() {

    position_site();
    $(window).resize( function() { position_site(); });
    
});