var Stoper = new Object;
Stoper.time = 0;
Stoper.lastTime = 0;
Stoper.on = false;
Stoper.lesson_location = 1;
Stoper.lastPage = 999;

function StoperStart(){
	if(!this.on){
		this.on = true;
		today = new Date();
		this.lastTime = today.getTime();
	}
}
function StoperStop(){
	if(this.on){
		this.on = false;
		today = new Date();
		this.time = this.time + (today.getTime()-this.lastTime);
	}
}

// these functions are primarily for storing cf session variables as js object variables so that they do not time out after 20 minutes
function StoperSetVar(varName, varValue){
	eval("Stoper." + varName + "= '" + varValue + "';");
}

function StoperGetVar(varName){
	return eval("Stoper." + varName);
}

function setLessonLocation(){
	if(document.formPages){
		var location = parseInt(document.formPages.intPageNum.value);
		if(location > 1){
			Stoper.setVar('lesson_location',location);
			if(location >= parseInt(Stoper.getVar('lastPage'))){
				Stoper.setVar('lesson_location','end');
			}
		}
	}
}

Stoper.start = StoperStart;
Stoper.stop = StoperStop;
Stoper.setVar = StoperSetVar;
Stoper.getVar = StoperGetVar;

var locInt = window.setInterval("setLessonLocation();",2000);

