//<!--- *************************************************************************
// Template: logout.js
// Author: Bill Strathearn
//
// Description:  Included at the top of the little pop-up window which apears after
// set interval.  Examines the nature of the HTTP_REFERER upon loading to see if the
// person has submitted the form on the pop-up to itself.  If that is true then the
// must have hit the "stay logged in" button.  If they want to stay logged in, they
// have effectivley reset theier session, so all we have to do is reset the timer on
// the calling main window so that this thing pops-up in another n minutes.  We then
// close this window so they can resume thier work. 
//************************************************************************** --->

pageRoot="http://sadev.ucsc.edu/op/";
var hasResetSession=false;
resetTimer();

function openWarningWindow(warningPage){
	warningpage = open(pageRoot+warningPage,'timeoutWin','height=175,width=300,resize=0,status=1,scrollbar=1');
    clearTimeout();
	setTimeout("replaceParent(pageRoot+'login/index.cfm?action=logout',warningpage);",1000 * 60 * 5);
}

function replaceParent(url,popup){
	if(hasResetSession == false){
		window.location.replace(pageRoot+url);
	}
	popup.close();
}

function resetTimer(){
	setTimeout("openWarningWindow('login/timeout.cfm');",60 * 55 * 1000);
}
