// JavaScript Document

	// pageTimeout object
	function pageTimeout(action, delay){
		this.timeoutId = -1;
		this.action = action;
		this.timeout  = delay;
	
		function startTimer(){
			if(this.timeoutId >= 0){
				this.stopTimer();
			}
			this.timeoutId = window.setTimeout(this.action, this.timeout);
		}
		
		function stopTimer(){
			if(this.timeoutId >= 0){
				window.clearTimeout(this.timeoutId);
				this.timeoutId = -1;
			}
		}
		
		function resetTimer(){
			this.stopTimer();
			this.startTimer();
		}
		
		function getId(){
			return this.timeoutId;
		}
		
		function clear(){
			this.stopTimer();
			this.timeoutId = -1;
		}
		
		this.startTimer = startTimer;
		this.stopTimer = stopTimer;
		this.resetTimer = resetTimer;
		this.getId = getId;
		this.clear = clear;
	}


	var timeout = 600 * 60 * 1000; // mins * 60 sec * 1000 ms
	
	function logoff(){
		window.location = "?action=log_out";
	}
	
	function startLogoffTimer(){
		pto.startTimer();
	}
	
	function resetLogoffTimer(){
		pto.resetTimer();
	}
	
	function stopLogoffTimer(){
		pto.stopTimer();
	}

	var pto = new pageTimeout("logoff();", timeout);

