function reset() {
	location = "moonlight.html";
}

function checkme() {
	var win = window.open("","solution","width=600,height=300,scrollbars,resizable");

	var myURL = window.location.pathname.match(/^.*\//);
	if (navigator.appName == "Microsoft Internet Explorer") {myURL = "";}


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

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

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

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

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

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

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

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

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



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

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


win.document.write("<!--=====================================================-->\n");
printanswer(order[0], "Third quarter");
printanswer(order[1], "Waxing gibbous");
printanswer(order[2], "Waning crescent");
printanswer(order[6], "First quarter");
win.document.write("</TR>\n");
win.document.write("<TR><TH ALIGN=\"left\">Correct Order</TH>\n");
win.document.write("    <TD ALIGN=\"center\">7<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">4<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">8<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">3<BR></TD></TR>\n");
win.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");
win.document.write("<TR></TR>\n");
win.document.write("<TR><TD ROWSPAN=2>&nbsp;</TD><TH>E</TH><TH>F</TH><TH>G</TH><TH>H</TH></TR>\n");
win.document.write("<TR><TD ALIGN=\"center\">\n");
win.document.write("    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT=\"Lunar Phase Diagram 5\"\n");
win.document.write("         SRC=\"",myURL,"images/moon5.gif\"><BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">\n");
win.document.write("    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT=\"Lunar Phase Diagram 6\"\n");
win.document.write("         SRC=\"",myURL,"images/moon6.gif\"><BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">\n");
win.document.write("    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT=\"Lunar Phase Diagram 7\"\n");
win.document.write("         SRC=\"",myURL,"images/moon7.gif\"><BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">\n");
win.document.write("    <IMG BORDER=0 WIDTH=100 HEIGHT=100 ALT=\"Lunar Phase Diagram 8\"\n");
win.document.write("         SRC=\"",myURL,"images/moon8.gif\"><BR></TD></TR>\n");
win.document.write("<TR><TH ALIGN=\"left\">Correct Phase</TH>\n");
win.document.write("    <TD ALIGN=\"center\">Waxing crescent<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">New moon<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">Waning gibbous<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">Full moon<BR></TD></TR>\n");
win.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");
win.document.write("</TR>\n");
win.document.write("<TR><TH ALIGN=\"left\">Correct Order</TH>\n");
win.document.write("    <TD ALIGN=\"center\">2<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">1<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">6<BR></TD>\n");
win.document.write("    <TD ALIGN=\"center\">5<BR></TD></TR>\n");
win.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");
win.document.write("</TR>\n");
win.document.write("</TABLE>\n");
win.document.write("</CENTER>\n");

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

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

}



