function gradeanswers()
{
var correctans=0
if (document.checker.variable.value!="1") {
document.checker.variable.value=1;
var tempans1=document.quiz.question1.value;
var sig1=document.quiz.sigfig1.value;
var tempans2=document.quiz.question2.value;
var sig2=document.quiz.sigfig2.value;
var tempans3=document.quiz.question3.value;
var sig3=document.quiz.sigfig3.value;
var tempans4=document.quiz.question4.value;
var sig4=document.quiz.sigfig4.value;
var tempans5=document.quiz.question5.value;
var sig5=document.quiz.sigfig5.value;
var tempans6=document.quiz.question6.value;

if(tempans1=="")
	{
	var tempans1="-----";
	}
if(sig1=="")
	{
	var sig1="-----";
	}
if(tempans2=="")
	{
	var tempans2="-----";
	}
if(sig2=="")
	{
	var sig2="-----";
	}
if(tempans3=="")
	{
	var tempans3="-----";
	}
if(sig3=="")
	{
	var sig3="-----";
	}
if(tempans4=="")
	{
	var tempans4="-----";
	}
if(sig4=="")
	{
	var sig4="-----";
	}
if(tempans5=="")
	{
	var tempans5="-----";
	}
if(sig5=="")
	{
	var sig5="-----";
	}
if(tempans6=="")
	{
	var tempans6="-----";
	}

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((tempans1==truevalue1 || tempans1==truevalue1a || tempans1==truevalue1b) && (sig1==sigfig1))
	{
	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>' + truevalue1 + 'with ' + sigfig1 + '</b> significant figures.</p>');
	}

msg.document.writeln("<hr><br><p>Problem 2.</p>");

if((tempans2==truevalue2 || tempans2==truevalue2a || tempans2==truevalue2b) && (sig2==sigfig2))
	{
	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>' + truevalue2 + ' </b>with<b> ' + sigfig2 + '</b> significant figures.</p>');
	}

msg.document.writeln("<hr><br><p>Problem 3.</p>");

if((tempans3==truevalue3 || tempans3==truevalue3a || tempans3==truevalue3b) && (sig3==sigfig3))
	{
	var outcome="correct";
	correctans++;
	}
else{
	var outcome="incorrect";
	}
msg.document.write('<p>Your answer of <B>' + tempans3 + '</B> is <B>' + outcome + '</B>.</p>');
if(outcome=="incorrect")
	{
	msg.document.writeln('<p>The correct answer is <b>' + truevalue3 + ' </b>with<b> ' + sigfig3 + '</b> significant figures.</p>');
	}
	
msg.document.writeln("<hr><br><p>Problem 4.</p>");

if((tempans4==truevalue4 || tempans4==truevalue4a || tempans4==truevalue4b) && (sig4==sigfig4))
	{
	var outcome="correct";
	correctans++;
	}
else{
	var outcome="incorrect";
	}
msg.document.write('<p>Your answer of <B>' + tempans4 + '</B> is <B>' + outcome + '</B>.</p>');
if(outcome=="incorrect")
	{
	msg.document.writeln('<p>The correct answer is <b>' + truevalue4 + ' </b>with<b> ' + sigfig4 + '</b> significant figures.</p>');
	}

msg.document.writeln("<hr><br><p>Problem 5.</p>");

if((tempans5==truevalue5[index5] || tempans5==truevalue5a[index5] || tempans5==truevalue5b[index5]) && (sig5==sigfig5[index5]))
	{
	var outcome="correct";
	correctans++;
	}
else{
	var outcome="incorrect";
	}
msg.document.write('<p>Your answer of <B>' + tempans5 + '</B> is <B>' + outcome + '</B>.</p>');
if(outcome=="incorrect")
	{
	msg.document.writeln('<p>The correct answer is <b>' + truevalue5[index5] + ' </b>with<b> ' + sigfig5[index5] + '</b> significant figures.</p>');
	}

msg.document.writeln("<hr><br><p>Problem 6.</p>");

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

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

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