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

function Swap(position) {
	document.images[position].src = Image2.src;
	return true;
}

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

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


	win.document.write('<HTML>\n<HEAD>\n');
	win.document.write('<TITLE>Letters Lost in Space</TITLE>');
	win.document.write('</HEAD>\n');
	win.document.write('<BODY BACKGROUND="',myURL,'images/level1_background.gif" BGCOLOR="#000000" TEXT="#FFFFFF" LINK="#66FFFF" \n');
	win.document.write('VLINK="#33FF33" ALINK="#FF0000">\n');
	win.document.write('<BASEFONT SIZE=5>\n');
	win.document.write('<P ALIGN="CENTER"><FONT SIZE=7>Letters Lost in Space</FONT></P><P>\n');
	win.document.write('<FONT SIZE=5>\n');

Image1 = new Image();
Image1.src = "images/blank.gif";
Image2 = new Image();
Image2.src = "images/star.gif";

var section1 = 0;
var section2 = 0;

var answer = new Array(8);

var correct1 = new Array(8);
for (i = 0; i < 8; i++) {
	correct1[i] = 0;
}

var correct2 = new Array(8);
for (i = 0; i < 8; i++) {
	correct2[i] = 0;
}

var one = new Array(10);
for (i =0; i < 10; i++) {
	one[i] = document.lost_letters.elements[i].value;
	if (!one[i]) {one[i] = "Blank";}
	one[i] = one[i].toUpperCase();
}
answer[1] = one.join(""); 

var two = new Array(7);
for (i = 0; i < 7; i++) {
	two[i] = document.lost_letters.elements[i+10].value;
	if (!two[i]) {two[i] = "Blank";}
	two[i] = two[i].toUpperCase();
}
answer[2] = two.join("");

var three = new Array(6);
for (i = 0; i < 6; i++) {
	three[i] = document.lost_letters.elements[i+17].value;
	if (!three[i]) {three[i] = "Blank";}
	three[i] = three[i].toUpperCase();
}
answer[3] = three.join("");

var four = new Array(6);
for (i = 0; i < 6; i++) {
	four[i] = document.lost_letters.elements[i+23].value;
	if (!four[i]) {four[i] = "Blank";}
	four[i] = four[i].toUpperCase();
}
answer[4] = four.join("");

var five = new Array(9);
for (i = 0; i < 9; i++) {
	five[i] = document.lost_letters.elements[i+29].value;
	if (!five[i]) {five[i] = "Blank";}
	five[i] = five[i].toUpperCase();
}
answer[5] = five.join("");

var six = new Array(7);
for (i = 0; i < 7; i++) {
	six[i] = document.lost_letters.elements[i+38].value;
	if (!six[i]) {six[i] = "Blank";}
	six[i] = six[i].toUpperCase();
}
answer[6] = six.join("");

var seven = new Array(9);
for (i = 0; i < 9; i++) {
	seven[i] = document.lost_letters.elements[i+45].value;
	if (!seven[i]) {seven[i] = "Blank";}
	seven[i] = seven[i].toUpperCase();
}
answer[7] = seven.join("");

var word = new Array(7);
for (i = 0; i < 7; i++) {
	word[i] = document.lost_letters.elements[i+54].value;
	if (!word[i]) {word[i] = "Blank";}
	word[i] = word[i].toUpperCase();
}

if (answer[1] == "ASTRONOMER") {section1++; correct1[1] = 1; Swap(0);}
if (answer[2] == "BIGBANG") {section1++; correct1[2] = 1; Swap(1);}
if (answer[3] == "QUASAR") {section1++; correct1[3] = 1; Swap(2);}
if (answer[4] == "GALAXY") {section1++; correct1[4] = 1; Swap(3);}
if (answer[5] == "PROTOSTAR") {section1++; correct1[5] = 1; Swap(4);}
if (answer[6] == "GRAVITY") {section1++; correct1[6] = 1; Swap(5);}
if (answer[7] == "LIGHTYEAR") {section1++; correct1[7] = 2; Swap(6);}

if ((word[0] == "LIGHT YEAR")|| (word[0] == "LIGHTYEAR")||(word[0] == "LIGHT-YEAR")) {section2++; correct2[1] = 1; Swap(7);}
if (word[1] == "ASTRONOMER") {section2++; correct2[2] = 1; Swap(8);}
if (word[2] == "GALAXY") {section2++; correct2[3] = 1; Swap(9);}
if (word[3] == "GRAVITY") {section2++; correct2[4] = 1; Swap(10);}
if (word[4] == "PROTOSTAR") {section2++; correct2[5] = 1; Swap(11);}
if (word[5] == "BIG BANG") {section2++; correct2[6] = 1; Swap(12);}
if (word[6] == "QUASAR") {section2++; correct2[7] = 1; Swap(13);}

if ((section1 == 7) && (section2 == 7)) {
	win.document.write('<IMG SRC="',myURL,'images/star.gif">\n');
	win.document.write('You got them all correct!\n');
	win.document.write('<IMG SRC="',myURL,'images/star.gif"><P></P>\n');
}
else {
	win.document.write('You got ' + section1 + ' out of 7 ');
	win.document.write('scrambled words correct!</P><P>\n');
	win.document.write('You got ' + section2 + ' out of 7 ');
	win.document.write('definitions correct!</P><P>\n');
}
win.document.write('<BR>\n');

win.document.write('<CENTER>\n');
win.document.write('</FONT>\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()">\n');
win.document.write('</TD></TR>\n</TABLE>\n</FORM>\n</CENTER>\n');
win.document.write('</BODY>\n</HTML>\n')
win.document.close();

}

