var windowWidth = 630
var windowHeight = 460;
var headerHeight = 0;
var footerHeight = 0;

if (parseInt(navigator.appVersion)>3) 
{
    if (navigator.appName.toLowerCase().indexOf("microsoft") !=- 1) 
    {
        windowWidth = document.body.offsetWidth - 25; // Scroll bar
        windowHeight = document.body.offsetHeight;
    }
    else
    {
        if (navigator.appName.toLowerCase().indexOf("opera") != -1)
        {
            windowWidth = document.body.offsetWidth - 5;
            windowHeight = document.body.offsetHeight;
        }
        else
        {
            if (navigator.appName.toLowerCase() == "netscape")
            {
                windowWidth = window.innerWidth - 5;  // Scroll bar
                windowHeight = window.innerHeight;
            }
            else
            {
                if (navigator.appName.toLowerCase().indexOf("blackberry") !=- 1)
                {
                    windowWidth = document.width;
                    windowHeight = document.height;
                }
                else
                {
                    if (document.body.offsetWidth)
                    {
                        windowWidth = document.body.offsetWidth - 25;
                    }
                    if (document.body.offsetHeight)
                    {
                        windowHeight = document.body.offsetHeight;
                    }
                }
            }
        }
    }
}

if (windowWidth < 0 || isNaN(windowWidth))
{
    windowWidth = screen.width;
    windowHeight = screen.height;
}
var windowWidthPrevious = readCookie("vkpiclientwidth");
var windowHeightPrevious = readCookie("vkpiclientheight");

if (AreCookiesEnabled() && !isNaN(windowWidth) && windowWidth > 0)
{
    var resizeCookie = readCookie("vkpiresize");

    if (resizeCookie == null || resizeCookie == "1")
    {
        if (windowWidthPrevious == null || windowWidthPrevious != windowWidth || windowHeightPrevious == null || windowHeightPrevious != windowHeight)
        {
            if (IsResizePage())
            {
                window.location.reload();
            }
        }
    }
    
    if (resizeCookie != null && resizeCookie == "0")
    {
        createCookiePermanent("vkpiclientwidth", windowWidth, 365);
        createCookiePermanent("vkpiclientheight", windowHeight, 365);
    }
    else
    {
        createCookie("vkpiclientwidth", windowWidth);
        createCookie("vkpiclientheight", windowHeight);   
    }
}