﻿var timerStart = 20;
var showInStatusBar = true;
var redirectPath = "../logout.aspx?auto=1";
var countdown = (timerStart  * 60);
var IsAuthenticated = false;

function ResetTimer()
{
    countdown = timerStart*60;
}

function StartTimer()
{
    countdown = countdown - 1;

    if (showInStatusBar)
    {
        if (countdown <= 300)
            window.status = 'Automatic Logout In ' + countdown + ' Seconds Due to Inactivity...';
    }

    if(countdown > 0)
    {
        setTimeout("StartTimer()", 1000); //run every 1 second (1000 millisecs)
    }
    else
    {
        if (IsAuthenticated)
            location.replace(redirectPath);
        return;
    }
}

StartTimer();

