var strCenter = null;

function setCenter(strCenterParam)
{
   strCenter = strCenterParam;
}

function getWindowHeight() 
{
    var windowHeight = 0;

    if (typeof(window.innerHeight) == 'number') 
    {
        windowHeight = window.innerHeight;
    }
    else 
    {
        if (document.documentElement && document.documentElement.clientHeight) 
        {
            windowHeight = document.documentElement.clientHeight;
        }
        else 
        {
            if (document.body && document.body.clientHeight) 
            {
                windowHeight = document.body.clientHeight;
            }
        }
    }

    return windowHeight;
}

function centerContent() 
{
    if (strCenter == null)
        return;

    if (document.getElementById) 
    {
        var windowHeight = getWindowHeight();
        var contentElement = document.getElementById(strCenter);

        if (windowHeight > 0) 
        {
            var contentHeight = contentElement.offsetHeight;

            if (windowHeight - contentHeight > 0) 
            {
                contentElement.style.position = 'relative';
                contentElement.style.top = ((windowHeight / 2) - (contentHeight / 2)) + 'px';
            }
            else 
            {
                contentElement.style.position = 'static';
            }
        }

    contentElement.style.visibility = 'visible';
    }
}

window.onload = function()
{
    centerContent();
}

window.onresize = function()
{
    centerContent();
}

