﻿
    var browserName=navigator.appName; 

    if(browserName=="Microsoft Internet Explorer") // For IE 
        window.onload=centerContent; 
    else 
    { 
        if (document.addEventListener) // For Firefox     
            document.addEventListener("DOMContentLoaded", centerContent, false); 
    } 


    window.onresize = centerContent;
    function centerContent()
    {
        var wide = document.body.clientWidth;
        var high = document.body.clientHeight;

        var maxh = 0 // your max height here; enter 0 if not used
        var maxw = 852 // your max width here; enter 0 if not used
        var content = document.getElementById('content');
        content.style.position = 'absolute';

        if(maxh > 0 && high <= maxh)
            content.style.height = high + "px";

        if(maxw > 0 && wide <= maxw)
            content.style.height = high + "px";

        if(maxh > 0 && high > maxh)
        {
            content.style.height = maxh + "px";
            high = (high - maxh) / 2;
            content.style.top = high + "px";
        }
        if(maxw > 0 && wide > maxw)
        {
            content.style.width = maxw + "px";
            wide = (wide - maxw) / 2;
            content.style.left = wide + "px";
        }
        
    }

