function gradeanswers()
{
var correctans=0
if (document.checker.variable.value!="1") {
document.checker.variable.value=1;
var tempans=window.document.quiz.question1.value;
var tempans1=window.document.quiz.question2.value;
var tempans2=window.document.quiz.question3.value;
if(tempans=="")
	{
	var tempans="-----";
	}
if(tempans1=="")
	{
	var tempans1="-----";
	}
if(tempans2=="")
	{
	var tempans1="-----";
	} 

var msg=open("","DisplayWindow");
msg.document.write("<head>");
msg.document.write("<STYLE TYPE='text/css'>" 
+"<!--"+
"BODY    {font-family: Arial, sans-serif}"+
"P       {font-family: Arial, sans-serif}"+
"TD      {font-family: Arial, sans-serif}"+
"UL      {font-family: Arial, sans-serif}"+
"OL      {font-family: Arial, sans-serif}"+
"DL      {font-family: Arial, sans-serif}"+
"H1      {font-family: Arial, sans-serif}"+
"H2      {font-family: Arial, sans-serif}"+
"H3      {font-family: Arial, sans-serif}"+
"H4      {font-family: Arial, sans-serif}"+
"H5      {font-family: Arial, sans-serif}"+
"H6      {font-family: Arial, sans-serif}"+
"-->"+
"</STYLE>"+
"</head>");

msg.document.write("<BODY  bgcolor='#FFFFFF'><HR noshade><b>Your results:</b>");
msg.document.writeln("<hr><br><p>Problem 1.</p>");

if(tempans==truevalue[index1])
	{
	var outcome="correct";
	correctans++;
	}
else{
	var outcome="incorrect";
	}
msg.document.write('<p>Your answer of <B>' + tempans + '</B> is <B>' + outcome + '</B>.</p>');
if(outcome=="incorrect")
	{
	msg.document.writeln("<p>The correct answer is <b>" + truevalue[index1] + "</b>.</p>");
	}
msg.document.writeln("<hr><br><p>Problem 2.</p>");

var right_ans=truevalue_1[index2];
if(index2=='5')
	{
	var exp_ans=window.document.quiz.exponent.value;
	if(tempans1==right_ans && exp_ans==exp)
		{
		var outcome="correct";
		correctans++;
		}
	else{
		var outcome="incorrect";
		}
	msg.document.write('<p>Your answer of <B>' + tempans1 + ' x 10 <SUP>' + exp_ans + '</SUP></B> is <B>' + outcome + '</B>.</p>');
	if(outcome=="incorrect")
		{
		msg.document.writeln("<p>The correct answer is <b>1.65 x 10<SUP>-40</SUP></b>.</p>");
		}
	}
else{
	if(tempans1==right_ans)
		{
		var outcome="correct";
		correctans++;
		}
	else{
		var outcome="incorrect";
		}
	msg.document.write('<p>Your answer of <B>' + tempans1 + '</B> is <B>' + outcome + '</B>.</p>');
	if(outcome=="incorrect")
		{
		msg.document.writeln("<p>The correct answer is <b>" + truevalue_1[index2] + "</b>.</p>");
		}
	}
msg.document.writeln("<hr><br><p>Problem 3.</p>");

if(tempans2==truevalue_2[index3])
	{
	var outcome="correct";
	correctans++;
	}
else{
	var outcome="incorrect";
	}
msg.document.write('<p>Your answer of <B>' + tempans2 + '</B> is <B>' + outcome + '</B>.</p>');
if(outcome=="incorrect")
	{
	msg.document.writeln("<p>The correct answer is <b>" + truevalue_2[index3] + "</b>.</p>");
	}

msg.document.writeln("<hr><br><p>Your Total score is: <font color='#FF0000'><b>" + correctans + "</b></font> out of 3.</p>");
msg.document.close();

} else {
	alert("Sorry, you cannot resubmit your answers. Click \"Start\" at the top of the page to start over.");
}
}
