function GradeQuiz(keyArray)
{
	var i, numQuestions=keyArray.length/2;	//find out how many questions there are
	var rightWrongArray=new Array(numQuestions);	//create an array that will hold whether or not each question was answered correctly
	var rawScore=0;
	var missedString="";
	for(i=0; i<numQuestions; i++)	//look at each question (there is an element for each question and for each answer)
	{
		if(keyArray[i*2][keyArray[i*2+1]].checked==true)	//if this answer is correct
		{
			rawScore++;	//add one to the number of questions they got right
			rightWrongArray[i]=true;	//show that they got this question right
		}
		else	//if this answer is wrong
		{
			rightWrongArray[i]=false;	//show that they didn't get this question right
			missedString+=" "+(i+1)+",";		//add this question number to our list of missed questions
		}
			
	}
	var rawScoreString=""+rawScore+" out of "+numQuestions;	//make a string with their raw score information
	var percScoreString=""+Math.round(rawScore/numQuestions*1000)/10+"%";
	var scoreWindow=window.open('', 'QuizResults', 'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=350,height=300');
	var scoreWindowHTML="<HTML>";
	scoreWindowHTML+="<HEAD><TITLE>Quiz Results</TITLE></HEAD>";
	scoreWindowHTML+="<BODY>";
	scoreWindowHTML+="<H1><CENTER>Quiz Results</CENTER></H1>";
	scoreWindowHTML+="<P><B>Raw Score:</B> "+rawScoreString+"</P>";
	scoreWindowHTML+="<P><B>Percentage Correct:</B> "+percScoreString+"</P>";
	if(rawScore!=numQuestions)	//if they missed any questions at all
	{
		missedString[missedString.length-1]=".";	//change the last comma to a period G***fix
		scoreWindowHTML+="<P><B>Questions Missed:</B>"+missedString+"</P>";
	}
	scoreWindowHTML+="<I>You may switch back to the quiz window to review the questions and/or retake the quiz. Close this window when you are finished.</I>";
	scoreWindowHTML+="</BODY>";
	scoreWindowHTML+="</HTML>";
	scoreWindow.document.write(scoreWindowHTML);	//update the content of the window
	scoreWindow.focus();	//make sure the window is in front
	scoreWindow.document.close();
}

