<!--

var examLsnInfo = "";
function examPageInit() {
	document.getElementById("lsnInfoSpan").innerHTML = "&nbsp;(" + examLsnInfo + ")";
	document.getElementById("headerSpan").innerHTML = "Question " + parent.examQNum + " of 40";
	document.getElementById("pageNumberSpan").innerHTML = "Page " + parent.examQNum + " of 41";
	if (parent.examResp[parent.examQNum] > 0) {
		examQdone();
	} else {
		disableNextButton();
	}
}

function examQdone() {
	var x = "";
	for (var i=1; i<11; i++)
		if (document.getElementById("examDistSpan"+i) != null) {
			var x = document.getElementById("examDistSpan"+i).innerHTML;
			x = x.substring(x.indexOf(">") + 1); // remove A tag left
			x = x.replace("</a>","");
			x = x.replace("</A>","");
			if (i == parent.examCA[parent.examQs[parent.examQNum]]) {
				x = "<img src='" + topPath + "images/checkmark_Green.gif' alt='checkmark' align='bottom' width='20' height='19' style=' margin-right: 2px; margin-top: 2px;'>" + x;
			} else {
				if (i == parent.examResp[parent.examQNum])
					x = "<img src='" + topPath + "images/x_Red.gif' alt='X' align='bottom' width='20' height='19' style=' margin-right: 2px; margin-top: 2px;'>" + x;
			}
			document.getElementById("examDistSpan"+i).innerHTML = x;
		}
	document.getElementById("instructions").innerHTML = "<p>Select Next to continue.</p>"
	enableNextButton();
}

function examAns(s) {
	parent.examResp[parent.examQNum] = s;
	examQdone();
	if (s == parent.examCA[parent.examQs[parent.examQNum]]) {
		alert("Correct.");
	} else {
		alert("Incorrect.");
	}
}

function examStart() {
	parent.examQNum = 0;
	examNext();
}

function examNext() {
	parent.examQNum++;
	var z = "exam";
	if (parent.examQNum > 40) {
		z = "score.html";
	} else {
		var q = parent.examQs[parent.examQNum];
		if (q < 100) z += "0";
		if (q < 10) z += "0";
		z += q.toString() + ".html"
	}
	document.location.href = z;
}

function examBack() {
	parent.examQNum--;
	var z = "exam";
	if (parent.examQNum < 1) {
		z = "index.html";
	} else {
		var q = parent.examQs[parent.examQNum];
		if (q < 100) z += "0";
		if (q < 10) z += "0";
		z += q.toString() + ".html"
	}
	document.location.href = z;
}

function examScore() {
	disableNextButton();
	parent.examNumCorrect = 0;
	for (var i=1; i<=40; i++) {
		if (parent.examResp[i] == parent.examCA[parent.examQs[i]])
			parent.examNumCorrect += 1;
	}
	parent.score = Math.round(parent.examNumCorrect / 40 * 100);
	var txt = "You got " + parent.examNumCorrect + " questions correct out of 40, for a score of " + parent.score + "%.<br><br>";
	if (parent.score >= 70) {
		txt += "Congratulations, you have passed the course!";
		setComplete();
	} else {
		txt += "Sorry, but this score is not high enough to pass the course, but you can <a href='JavaScript:examRetake();'>take the exam again</a>.";
		document.getElementById("instructions").innerHTML = "<p>Select the link to take the exam again, or Exit to leave the course.</p>";
	}
	document.getElementById("examText").innerHTML = txt;
}

function examRetake() {
	parent.examInit();
	document.location.href = "index.html";
}

function examLoad() {
/*
	document.write("<font color='red'>Q:" + parent.examQs[parent.examQNum] + ", CA:" + parent.examCA[parent.examQs[parent.examQNum]] + "</font>");
	var examQstring = "";
	for (i=1; i<=40; i++)
		examQstring += parent.examQs[i] + ",";
	examQstring = examQstring.substring(0, examQstring.length - 1);
	document.write("<br><font color='blue' size='-1'>Questions: " + examQstring + "</font>");
*/
}

-->
