<!-- hide this script from non-javascript-enabled browsers
	////////////////////////////////////////////////////////////////////////////////
	//Javascript functions to support a timeout warning for the session:
	// Display a warning with 60 seconds to go before the timeout will occur. 
	// Allow the user to continue the session by selecting continue. At that point,
	// refresh the session and reset the timer.
	////////////////////////////////////////////////////////////////////////////////
	
	//page initialization
	var sessionTimeoutMs = 1800000;	  // Session timeout (milliseconds) 
	var logoutTimeoutMs =  300000;  // force a logout after total session time has elapsed (milliseconds). 
	var warningTimeoutMs = sessionTimeoutMs - logoutTimeoutMs;	//how long to wait before showing warning window (milliseconds). 
	
	var ABRMWindow = true;  //identify the window as a application window to be possibly closed
	var promptUser = true;
	var warningWin = null;
	var warningTimerID = null;
	var sessionTimeoutMinutes = Math.round(sessionTimeoutMs/60000);
	var warningTimeoutMinutes = Math.round(warningTimeoutMs/60000);
	var logoutTimeoutSeconds = Math.round(logoutTimeoutMs/1000);
	
	//functions
	function startWarningTimer() {	
		//This is the starting point of the timer
		resetTimerFromParent = false;	
		if ( window.opener ) {	
			if ( window.opener.ABRMWindow != null )	{	
				//being called from a child window of the parent window, so reset parent's timer
				window.opener.startWarningTimer();
			} else {	//in the main application window 
				resetTimerFromParent = true;
			}
		} else {	//in the main application window
			resetTimerFromParent = true;
		}
		
		if ( resetTimerFromParent )	{
			resetWarningTimer();
			if ( warningWin != null ) {	//close the warning window if it exists
				warningWin.close();	
				warningWin = null;
			}
		}
	}
	
	function resetWarningTimer() {
		if ( warningTimerID != null ) {
			clearTimeout(warningTimerID); //clear the timer, if it exists
			warningTimerID = null;
		}
		warningTimerID = setTimeout("showWarning();",warningTimeoutMs);
		promptUser = true; //make sure the user makes a decision
	}
	
	function showWarning() {
		//load the initial page which includes the javascript include, so it is loaded. Note: The javascript include will not load in the browser with a direct document.write();
		window.focus();
		warningWin = window.open("timeoutWarning.do","warningwindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=360,top=100,left=100");
		warningWin.focus();
	}
	
	function refresh()
	{	//called when selecting 'Ok' on the final javascript prompt in confirmDecision()
		window.focus();
		warningWin = window.open("timeoutRefresh.do","warningwindow","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=400,height=360,top=100,left=100");
		warningWin.focus();
	}
	
	function showLogout() {
		var html = new String("");
		html += "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
		html += "<html>";
		html += "<head>";
		html += "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
		html += "<title>Login Expired</title>";
		html += "</head>";
		html += "<body marginwidth='0' marginheight='0' topmargin='0' leftmargin='0' onLoad=\"window.setInterval(\'self.close();\',10000);\">";
		html += "<form><table width='400' cellspacing='0' cellpadding='0' border='0'>";
		html += "<tr><td>";
		html += "</td></tr>";
		html += "</table>";
		html += "<table width='400' cellpadding='2' cellspacing='2' border='0'>";
		html += "<tr><td colspan='2'><font size='-1' face='Verdana'>For your protection, login sessions are automatically timed out after " + sessionTimeoutMinutes + " minutes of inactivity.</font></td></tr>";
		html += "<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>";
		html += "<tr><td><font size='+1' face='Verdana' color='red'><b>Your login session is no longer valid.</b></font></td></tr>";
		html += "<tr><td>&nbsp;</td></tr><tr><td>&nbsp;</td></tr>";
		html += "<tr><td align='center'><input type='button' name='Ok' value='Close Window' onClick='self.close();'></td></tr>";
		html += "</table>";
		html += "</form></body>";
		html += "</html>";
		if ( window.opener ) {
			var tmppromptUser = true;//default
			if ( window.opener.promptUser != null )	{
				tmppromptUser = window.opener.promptUser; //save it
				window.opener.promptUser = false;
			}
			window.document.open();		//clear previous window contents
			window.document.write(html);
			window.document.close();	//flush it
			window.opener.promptUser = tmppromptUser;  //restore it
		}
	}//end logout()
	
	function remote(url) {	//called from Warning window
		if ( window.opener != null ) {
			window.opener.location=url;
			window.opener.focus();
		}
	}
	
	function closeChildWin() {	
		if ( window.opener ) {
			if ( window.opener.ABRMWindow  != null ) {
				//if a child window hits the login page, close it so we don't leave these hanging out there.
				if ( this.navigator.appVersion.indexOf("WebTV") == -1)
					//This is not WebTV so show the logout function.
					//Don't execute this function here in Web TV. The window.opener object has a 
					//value when running in frames on WebTV. So this would cause the login page to show the logout message.
					showLogout();
			}
		}
	}
	
	function confirmDecision() {
		//Check to make sure the user picked one of the two choices and did not just close the window
		if ( window.opener.promptUser == true ) {
			window.opener.promptUser = false;
			var msg = "Warning: You did not choose to update the status of your login session.\n\nSelect \"Ok\" to continue your login session.\n\nSelect \"Cancel\" to end your session and logout.";
			if ( confirm(msg) )
				window.opener.refresh();
			else
				remote('logout.do');
		}
	}
	
	function countDown() {	//this is called from the initial load of the timeoutWarning page
  		this.dom=document.getElementById?1:0
		window.setInterval("self.focus();document.refresh.RefreshSession.focus();",500);
		warningTimerID =  setTimeout("showLogout();if ( window.opener ) window.opener.location='logout.do';", logoutTimeoutMs );
	}
	
// stop hiding -->	
