1// Set timeout variables.
2var timoutWarning = 840000; // Display warning in 14 Mins.
3var timoutNow = 900000; // Timeout in 15 mins.
4var logoutUrl = 'http://domain.com/logout.aspx'; // URL to logout page.
5
6var warningTimer;
7var timeoutTimer;
8
9// Start timers.
10function StartTimers() {
11 warningTimer = setTimeout("IdleWarning()", timoutWarning);
12 timeoutTimer = setTimeout("IdleTimeout()", timoutNow);
13}
14
15// Reset timers.
16function ResetTimers() {
17 clearTimeout(warningTimer);
18 clearTimeout(timeoutTimer);
19 StartTimers();
20 $("#timeout").dialog('close');
21}
22
23// Show idle timeout warning dialog.
24function IdleWarning() {
25 $("#timeout").dialog({
26 modal: true
27 });
28}
29
30// Logout the user.
31function IdleTimeout() {
32 window.location = logoutUrl;
33}