﻿// JScript File to count the time after last mousemove and last keypress on the page
/// use 1000 per second for timeout - 900000 is 15 mins
var anik, bnik; 

function Anik() 
{ 
    bnik = 0;
    if(document.getElementById("ctl00_HidisLoggedIn").value != "False")// set the loggedin flug in hidden control named "HidisLoggedIn" from server side 
    {
        if(document.getElementById("ctl00_Hidpagename").value.indexOf("Login.aspx") == -1 )//set the current page name in "Hidpagename" from server side in page load event and check if the current page is not the login page
        {
            anik = window.setInterval("cnik()",60000); //set for count after every minute that is 60 second.
        }
    }
} 

function cnik() //Counts the time fraction using Anik()
{ 
    bnik++;
    if(document.all)//Check if the browser is IE
    {
        document.getElementById("enik").value = bnik; 
    }
    if (bnik == "30")
    {
//        alert(bnik);
        window.location = "LogOut.aspx?e=1"; // redirects to Login.aspx page when counter goes to 10 minutes.
    }
} 

function fnik() //sets the timer to zero.
{ 
    bnik = 0;
} 

