function pageLoad()
{
    placeUpdate();
}

window.onscroll = function()
{
    placeUpdate();
}

window.onresize = placeUpdate;


function placeUpdate()
{
    //Get the div to be centered
    var divObject = document.getElementById("loading");

    //Get width and height for this div
    var divWidth = 300;//divObject.clientWidth;
    var divHeight = 110;//divObject.clientHeight;

    var windowWidth;
    var windowHeight;

    //Get width and height for the current window
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        windowWidth = window.innerWidth;
        windowHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        windowWidth = document.documentElement.clientWidth;
        windowHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        windowWidth = document.body.clientWidth;
        windowHeight = document.body.clientHeight;
    }

    //Get Scroll positions
    var scrOfX = 0;
    var scrOfY = 0;
    if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }
      
    //Calculate margins for div to be centered        
    var topMarg = ((windowHeight/2) - (divHeight/2));
    var leftMarg = ((windowWidth/2) - (divWidth/2));
    topMarg = topMarg - (topMarg%2) + scrOfY;
    leftMarg = leftMarg - (leftMarg%2) + scrOfX;

    //Apply margins
    divObject.style.top = topMarg+"px";
    divObject.style.left = leftMarg+"px";

    //Get Background-DIV
    var divFill = document.getElementById("divFill");

    //Set width and height = the size of current window
    divFill.style.width = document.body.clientWidth+"px"; //(windowWidth)+"px"; //document.documentElement.clientWidth+"px";
    divFill.style.height = (windowHeight)+"px";
    divFill.style.top = (scrOfY)+"px";
    divFill.style.left = (scrOfX)+"px";
}
