        function resize() {
            var width;
            var mainDiv = document.getElementById("MainDiv");
            var left;
            var divWidth;

            if (document.all)
                width = document.body.clientWidth;
            else
                width = window.innerWidth;
            
            if (document.all)
               divWidth = mainDiv.style.width;
            else
               divWidth = mainDiv.clientWidth;

            if (width > divWidth) {
                left = (width - 780) / 2;
            }

            if (left < 0)
                left = 0;
            
            mainDiv.style.position = "absolute";
            mainDiv.style.left = left + 'px';
	    mainDiv.style.visibility = "visible";
        }

        function delayResize() {
            setTimeout(resize, 10);
        }
        
        window.onresize = resize;