function quizResult(form,questionArray){
	totalQuestions=form.totalQuestions.value;
	totalCorrect=0;
	checkedValue=new Array();
	quiz.style.visibility="hidden";
	for(counter1=0;counter1<totalQuestions;counter1++){
		currentQuestion=eval("form.Q"+String(counter1));
		currentAnswer=eval("form.A"+String(counter1));
		checkedValue[counter1]="NA";
		for(counter2=0;counter2<4;counter2++){
			if(currentQuestion[counter2].checked){
				checkedValue[counter1]=currentQuestion[counter2].value;
			}
		}
		formComplete=true;
		if (checkedValue[counter1]==currentAnswer.value){
			totalCorrect++;
		}
		else if(checkedValue[counter1]=="NA"){
			formComplete=false;
			break;
		}
	}
	if(formComplete){


document.write("<html><head><link rel=stylesheet href=\"thompson.css\" type=\"text/css\"><title>The David Thompson Phenomenon: quiz result</title></head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\"><table width=\"100%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"14\" border=\"0\"><tr><td colspan=\"2\" class=\"head\" height=\"90\">THE &nbsp;<font class=\"dt\">DAVID THOMPSON</font>&nbsp; PHENOMENON</td></tr><tr><td colspan=\"2\" class=\"nav\" height=\"45\"><a href=\"index.html\" title=\"The David Thompson Phenomenon homepage\" class=\"nav\">Home</a> | <a href=\"siteindex.html\" title=\"Index of David Thompsons\" class=\"nav\">Index</a> | <a href=\"guestbook.html\" title=\"Let me know what you think of this site\" class=\"nav\">Guestbook</a></td></tr><tr><td class=\"main\" width=\"75%\"><h1>Quiz result</h1>");

for(counter3=0;counter3<totalQuestions;counter3++){
			document.write("<p>");
			document.write(questionArray[counter3][0]+"<br>");
			if(questionArray[counter3][5]==checkedValue[counter3]){
				document.write("You said: "+questionArray[counter3][checkedValue[counter3]]+"<br>That's the right answer<br>");
			}
			else{
				document.write("You said: "+questionArray[counter3][checkedValue[counter3]]+"<br>");
				document.write("The correct answer is: "+questionArray[counter3][questionArray[counter3][5]]+"<br>");
			}
			document.write("</p>");
		}
		totalIncorrect=totalQuestions-totalCorrect;
		percentage=Math.floor((totalCorrect/totalQuestions*100));
			document.write("<p><strong>You scored "+totalCorrect);
		document.write(" out of "+totalQuestions);
			document.write(" ("+percentage+"%)</strong></p></td><td class=\"side\" width=\"25%\">&nbsp;</td></tr></table></body></html>");
	}
	else{
		alert("You haven't answered all the questions!");
		quiz.style.visibility="visible";
	}
}