var order = new Array(16);
var index;

index = window.opener.document.moonlight.elements[0].selectedIndex;
order[0] = window.opener.document.moonlight.elements[0].options[index].value;

index = window.opener.document.moonlight.elements[1].selectedIndex;
order[1] = window.opener.document.moonlight.elements[1].options[index].value;

index = window.opener.document.moonlight.elements[2].selectedIndex;
order[2] = window.opener.document.moonlight.elements[2].options[index].value;

index = window.opener.document.moonlight.elements[6].selectedIndex;
order[6] = window.opener.document.moonlight.elements[6].options[index].value;

index = window.opener.document.moonlight.elements[7].selectedIndex;
order[7] = window.opener.document.moonlight.elements[7].options[index].value;

index = window.opener.document.moonlight.elements[8].selectedIndex;
order[8] = window.opener.document.moonlight.elements[8].options[index].value;

index = window.opener.document.moonlight.elements[12].selectedIndex;
order[12] = window.opener.document.moonlight.elements[12].options[index].value;

index = window.opener.document.moonlight.elements[13].selectedIndex;
order[13] = window.opener.document.moonlight.elements[13].options[index].value;



function printanswer(answer,correct) {
	if (answer == correct) {
		document.write('<TD ALIGN="CENTER"><FONT COLOR="#66FFFF">');
	}
	else {
		document.write('<TD ALIGN="CENTER"><FONT COLOR="#FF0000">');
	}
	document.write(answer + '</FONT></TD>\n');
}

for (i = 0; i < 16; i++) {
	if (!order[i]) {
		order[i] = window.opener.document.moonlight.elements[i].value;
	}
	if (!order[i]) {order[i] = "Blank";}
}
		
document.write('<HTML>\n<HEAD>\n<TITLE>Moonlight Madness - Results');
document.write('</TITLE>\n</HEAD>\n');
document.write('<BODY BACKGROUND="/Images/heasarc/icons/bgstars.gif"\n');
document.write('BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#66FFFF" \n');
document.write('VLINK="#33FF33" ALINK="#FF0000">\n');
document.write('<H1 ALIGN="CENTER">Moonlight Madness - Results</H1>\n');
document.write('<!--=====================================================-->\n');
document.write('<P ALIGN="CENTER"><IMG SRC="/Images/heasarc/icons/shut_l.gif">');
document.write('</P><P>\n\n');
	
document.write('<CENTER>\n');
document.write('<TABLE BORDER=5 CELLPADDING=5 CELLSPACING=0>\n');
document.write('<TR><TD ROWSPAN=2>&nbsp;</TD><TH>A</TH><TH>B</TH><TH>C</TH><TH>D</TH></TR>\n');
document.write('<TR><TD ALIGN="center">\n');
    document.write('<IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 1"\n');
         document.write('SRC="/Images/StarChild/solar_system_level2/moon1.gif"><BR></TD>\n');
    document.write('<TD ALIGN="center">\n');
    document.write('<IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 2"\n');
         document.write('SRC="/Images/StarChild/solar_system_level2/moon2.gif"><BR></TD>\n');
    document.write('<TD ALIGN="center">\n');
    document.write('<IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 3"\n');
             document.write('SRC="/Images/StarChild/solar_system_level2/moon3.gif"><BR></TD>\n');
    document.write('<TD ALIGN="center">\n');
    document.write('<IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 4"\n');
             document.write('SRC="/Images/StarChild/solar_system_level2/moon4.gif"><BR></TD></TR>\n');
    document.write('<TR><TH ALIGN="left">Correct Phase</TH>\n');
    document.write('<TD ALIGN="center">Third quarter<BR></TD>\n');
    document.write('<TD ALIGN="center">Waxing gibbous<BR></TD>\n');
    document.write('<TD ALIGN="center">Waning crescent<BR></TD>\n');
    document.write('<TD ALIGN="center">First quarter<BR></TD></TR>\n');
    document.write('<TR><TH ALIGN="left">Your Answer</TH>\n');


document.write('<!--=====================================================-->\n');
printanswer(order[0], "Third quarter");
printanswer(order[1], "Waxing gibbous");
printanswer(order[2], "Waning crescent");
printanswer(order[6], "First quarter");
document.write('</TR>\n');
document.write('<TR><TH ALIGN="left">Correct Order</TH>\n');
document.write('    <TD ALIGN="center">7<BR></TD>\n');
document.write('    <TD ALIGN="center">4<BR></TD>\n');
document.write('    <TD ALIGN="center">8<BR></TD>\n');
document.write('    <TD ALIGN="center">3<BR></TD></TR>\n');
document.write('<TR><TH ALIGN="left">Your Order</TH>\n');
printanswer(order[3],"7");
printanswer(order[4],"4");
printanswer(order[5],"8");
printanswer(order[9],"3");
document.write('<TR></TR>\n');
document.write('<TR><TD ROWSPAN=2>&nbsp;</TD><TH>E</TH><TH>F</TH><TH>G</TH><TH>H</TH></TR>\n');
document.write('<TR><TD ALIGN="center">\n');
document.write('    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 5"\n');
document.write('         SRC="/Images/StarChild/solar_system_level2/moon5.gif"><BR></TD>\n');
document.write('    <TD ALIGN="center">\n');
document.write('    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 6"\n');
document.write('         SRC="/Images/StarChild/solar_system_level2/moon6.gif"><BR></TD>\n');
document.write('    <TD ALIGN="center">\n');
document.write('    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 7"\n');
document.write('         SRC="/Images/StarChild/solar_system_level2/moon7.gif"><BR></TD>\n');
document.write('    <TD ALIGN="center">\n');
document.write('    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT="Lunar Phase Diagram 8"\n');
document.write('         SRC="/Images/StarChild/solar_system_level2/moon8.gif"><BR></TD></TR>\n');
document.write('<TR><TH ALIGN="left">Correct Phase</TH>\n');
document.write('    <TD ALIGN="center">Waxing crescent<BR></TD>\n');
document.write('    <TD ALIGN="center">New moon<BR></TD>\n');
document.write('    <TD ALIGN="center">Waning gibbous<BR></TD>\n');
document.write('    <TD ALIGN="center">Full moon<BR></TD></TR>\n');
document.write('<TR><TH ALIGN="left">Your Phase</TH>\n');
printanswer(order[7],"Waxing crescent");
printanswer(order[8],"New moon");
printanswer(order[12],"Waning gibbous");
printanswer(order[13],"Full moon");
document.write('</TR>\n');
document.write('<TR><TH ALIGN="left">Correct Order</TH>\n');
document.write('    <TD ALIGN="center">2<BR></TD>\n');
document.write('    <TD ALIGN="center">1<BR></TD>\n');
document.write('    <TD ALIGN="center">6<BR></TD>\n');
document.write('    <TD ALIGN="center">5<BR></TD></TR>\n');
document.write('<TR><TH ALIGN="left">Your Order</TH>\n');
printanswer(order[10],"2");
printanswer(order[11],"1");
printanswer(order[14],"6");
printanswer(order[15],"5");
document.write('</TR>\n');
document.write('</TABLE>\n');
document.write('</CENTER>\n');

document.write('<CENTER>\n')
document.write('<FORM>\n');
document.write('<TABLE BORDER=5 CELLPADDING=10>\n');
document.write('<TR><TD ALIGN="CENTER">\n');
document.write('<INPUT TYPE=button VALUE="Close" onClick="window.close()"></TD></TR>\n');
document.write('</TABLE>\n');
document.write('</FORM>\n');
document.write('</CENTER>\n');
document.write('</P><P>\n');

document.write('</BODY>\n</HTML>\n');
document.close();

