<!--
javascript:window.history.forward(1);
var divs = 4;

/*document.onselectstart = new Function('return false');

function noCtrlN (nKeyCode){
	if((78==nKeyCode)&&(event.ctrlKey)){
		event.returnValue=false;
	}
	if((80==nKeyCode)&&(event.ctrlKey)){
		event.returnValue=false;
		alert ("Key Sequence Disabled.");
	}
	if(nKeyCode==13){
		event.returnValue=false;
	}
	}*/

	var counter = 0;
	var qtime = 0;
	var ttime = qtime * (divs-2);
	var counter = ttime;
	var ID;
	addEventSimple(window,'load', startTimer);

function startTimer() {	
	if (qtime != 0){ID=window.setTimeout("Update();",1000);}	
}	

function addEventSimple(obj,evt,fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evt,fn,false);
	} else if (obj.attachEvent) {
		obj.attachEvent('on'+evt,fn);
	}
}
	//ci = setInterval("clearImage()", 10);
	//function clearImage(){r = window.clipboardData.clearData("Image");}

function Update() {
	var removed;
	counter --;
	minutes = Math.floor(counter / 60);
	seconds = counter % 60;
	if (seconds < 10){seconds = "0" + seconds;}
	if ((counter<0)&&(qtime!=0)) { 
		var thePanel = document.getElementById("tPanel");
		document.body.removeChild(thePanel);
		alert ("Time has expired. Your responses will now be submitted.");
		GradeNow();
		return;
	} else {
		ID=window.setTimeout("Update();",1000);
	}
	if (minutes < 1){msg_suffix = " seconds";}else{msg_suffix = " minutes";}
	// window.status="Time Remaining: " + minutes + ":" + seconds + msg_suffix;	
	
	var mColor = "#0000cc";
	var tColor = "white";
	if (minutes < 1) {
		if (seconds % 2 == 0){mColor="#ff0000"; tColor="white";}else{mColor = "#ffffff";tColor="black";}
	} else if (minutes < 5){
		mColor = "#cc0000";
	}
	var strDisp = "<div align='center' style='font-size: 70%; color: " + tColor + ";'>Time Remaining : <strong>";
	strDisp = strDisp + minutes + ":" + seconds + msg_suffix + "</div>";
	var thePanel;
	try {
		thePanel = document.getElementById("tPanel");
		thePanel.style.backgroundColor = mColor;
		thePanel.innerHTML = strDisp;
		if (window.innerWidth) {
			thePanel.style.top = window.pageYOffset;
		} else {
			thePanel.style.top = document.body.scrollTop;		
		}
	} catch(e) {
		thePanel = document.createElement("div");
		thePanel.id = "tPanel";
		thePanel.style.position = "absolute";
		thePanel.style.backgroundColor = mColor;
		thePanel.style.width = "100%";
		thePanel.style.height = "16px";
		thePanel.style.left = "1";
		thePanel.style.zIndex = "1";
		thePanel.style.top = "1";
		document.body.appendChild(thePanel);
		window.onscroll = doScroll;
	}
	// ==================================================================
}

function supressMenu(e) {
	//event.returnValue=false;
}	

function hideAll() {
	for (i=0; i<divs; i++) {
	 divElement = document.getElementsByTagName("DIV").item(i);
	 divElement.style.left = -2000;
	 divElement.style.top = -2000;
	 resizeHandler();
	}
}
	
function showLogin() {
	divElement = document.getElementsByTagName("DIV").item(0);
	divElement.style.left = +10;
	divElement.style.top = +20;
	resizeHandler();
}

function donext() {
	var tmp;
	var last;
	tmp = eval(document.nav.qn.value);
	last = tmp;
	tmp = tmp +1;
	document.nav.qn.value = tmp;

	if (tmp != divs) {
		hideLast(last);
		divElement = document.getElementsByTagName("DIV").item(tmp);
		divElement.style.left = +10;
		divElement.style.top = +20;
		resizeHandler();
	} else {
		alert ("There are no more questions.");
		tmp = tmp -1;
		document.nav.qn.value = tmp;
	}
}

function doprev() {
	var tmp;
	var last;
	tmp = eval(document.nav.qn.value);
	last = tmp;
	tmp = tmp -1;
	document.nav.qn.value = tmp;

	if (tmp >= 0) {
		hideLast(last);
		divElement = document.getElementsByTagName("DIV").item(tmp);
		divElement.style.left = +10;
		divElement.style.top = +20;
		resizeHandler();
	} else {
		alert ("You are at the beginning of the survey.");
		tmp = tmp +1;
		document.nav.qn.value = tmp;
	}
}

function hideLast(i) {
	divElement = document.getElementsByTagName("DIV").item(i);
	divElement.style.left = -2000;
	divElement.style.top = -2000;
	resizeHandler();
}

function resizeHandler() {	
	if (navigator.appName.indexOf("Explorer") < 1) {
		document.getElementById('tq999').style.top=document.body.clientHeight - 100;
	} else {
		document.getElementById('tq999').style.top=document.body.clientHeight - 60;
	}
	document.getElementById('tq999').style.left=10;
}

function doScroll() {
	var navPanel;
	try {
		navPanel = document.getElementById('tq999')
		navPanel.style.top=document.body.scrollTop+document.body.clientHeight - 60;
		navPanel.style.left=10;
	} catch(e) {}
	var thePanel;	
	try {
		thePanel = document.getElementById("tPanel");
		if (window.innerWidth) {
			thePanel.style.top = window.pageYOffset;
		} else {
			thePanel.style.top = document.body.scrollTop;		
		}
	} catch(e) {}		
}

function endTest() { 
	if (confirm('Are you sure you want to Submit your responses and exit now?'))  { 
		if (GradeNow()==true) {
			try{document.MAILFORM.submit();}catch(e){}
		}
	} 
} 

function doGrade() {
	GradeNow();
}

// THIS MUST BE THE LAST FUNCTION 
function GradeNow() {

	function doP(sst) {
		tts='';
		for (i=1; i <= sst.length; i++) {
			if(sst.substring(i-1,i) == ' ') {
				tts=tts+String.fromCharCode(i+64)+' ';
			}
		}
		tts=tts+'/ ';
		return tts;
	}

	function trim(str) {
   		return str.replace(/^\s*|\s*$/g,"");
	}

	function doConvert(strName) {
		return tagChoice(strName);
	}

	function tagChoice(newTempStr) {
		newTempStr = trim(newTempStr);
		if (newTempStr==''){newTempStr='~skipped~';}
		newTempStr = ' Your Response: <tp_selans>' + newTempStr + '</tp_selans>';
		return newTempStr;
	}
	
	function evaluate(rExp, sAns) {	
		var tmpRE = new RegExp(rExp,"i"); 
		return tmpRE.test(sAns);
	}
	
	function ufn(smt) {
		cr=' ';
		if (smt){cr=' ';}
		return cr;
	}
	
	function round(number,X) {
		X = (!X ? 2 : X);
		return Math.round(number*Math.pow(10,X))/Math.pow(10,X);
	}

	var vScore=0;
	var ca=0;
	var finalOut = '';
	var sCan='';
	var ust;
	var mst;
	var ttlust;
	var tOut;
	var finalOut;


	if('yes'=='no'){}else{

		ust='';
		ust='';ust=document.QUESTION1.tb.value; if(ust==''){ust='~required~';}finalOut = finalOut + '1062|~|' + ust + '|~~|';ust='';ust=document.QUESTION2.tb.value; if(ust==''){ust='~required~';}finalOut = finalOut + '1063|~|' + ust + '|~~|';
		
		// ALL REQUIRED FIELDS FILLED OUT?
		var all_complete = finalOut.indexOf("~required~");
		if (all_complete != -1) {
			// THIS WILL OCCUR IF THERE ARE REQUIRED QUESTIONS
			// NOT FILLED OUT -
			
			// 1. split it out
			var p_responses = finalOut.split("|~~|");
			
			// 2. iterate through it
			var isneeded = 0;
			var reqlist = '';
			var qn ;
			
			for (r in p_responses) {
				isneeded = p_responses[r].indexOf("~required~");
				if (isneeded != -1) {
					// THIS IS ONE THAT NEEDS TO BE COMPLETED
					qn = parseInt(r) + 1;
					try {
						var theObject = eval('document.QUESTION' + qn + '.qtext');
						var theText = theObject.value;
						theText = theText.replace(/(<([^>]+)>)/ig,"");
						reqlist = reqlist + qn + ". " + theText + "\n";
					} catch(e){}
				}
			}

			// GENERIC MESSAGE
			alert('One or more required questions have not been completed (shown below):.\n\n' + reqlist);
			return false;
		} else {
			try{
				document.getElementById('submitstatus').innerHTML = "Submitting Now ... Please Do Not Click Button Again";
			}catch(e){}
			try{
				document.getElementById('B1').value = " Submitting Now .. (DO NOT CLICK) ";
			}catch(e){}
			document.MAILFORM.custom_output.value=finalOut;document.MAILFORM.submit(); 
		}
		
	// END IF YES+YES
	}

// END GRADE FUNCTION
}

//-->










