/* Stefan Jongejan - Sjongejan.eu */
$(document).ready(function() {
    var document_height = $(document).height();
    
    /* Status */
    var status_height   = $("#status").height();
    var fromTop         = (document_height / 2) - (status_height / 2);
    var margin_set      = false;
    
    $("#status").animate({marginTop: fromTop + "px"}, "slow", function() { margin_set = true; });
    
    function edit_margin() {
        if(margin_set) {
            if(document_height != $(document).height()) {
                margin_set = false;
                document_height = $(document).height();
                fromTop         = (document_height / 2) - (status_height / 2);
                $("#status").animate({marginTop: fromTop + "px"}, "slow", function() { margin_set = true; });
            }
        }
        setTimeout(edit_margin, 100);
    }
    edit_margin();
});
