﻿/*
    JavaScript för timeout
*/

var timer1;

if(isPageAffectedByTimer())
{
    resetTimer();
}

function resetTimer()
{
    clearTimeout(timer1);
    timer1 = setTimeout("logout()", (60000 * loginSessionTimeout) - 120000);
}

function logout()
{
    if(isPageAffectedByTimer())
    {
        window.location.href = autoLogoutUrl.replace(/&amp;/g, "&");
    }
}

function isPageAffectedByTimer() 
{
    return window.location.toString().lastIndexOf('module=16&content=0') == -1 && isAuthenticated == 'True';
} 

function clientClose(sender,args) 
{ 
    window.navigate(clientCloseUrl.replace(/&amp;/g, "&"));
}

window.onload = resetTimer;
