function compute() {
	var a;
	var answers;
	var page = document.forms.trivia["level"].value * 1;
	var pages = [0,"level1","lvl2","lev3","answers"];

	if (page == 1) {
		a = 3;
		answers = new Array(0, 'a', 'b', 'c', 'b', 'c', 'b', 'a', 'b', 'b', 'a');
	} else if (page == 2) {
		a = 4;
		answers = new Array(0, 'd', 'a', 'c', 'b', 'a', 'c', 'c', 'c', 'd', 'b');
	} else if (page == 3) {
		a = 5;
		answers = new Array(0, 'b', 'd', 'a', 'c', 'e', 'a', 'd', 'b', 'a', 'c');
	} else {
		return false;
	}

	var tot = 0;
	for (i = 1; i < 11; i++) {
		for (j = 0; j < a; j++) {
			if (eval('document.trivia.question' + i + '[' + j + '].checked')) {
				if (eval('document.trivia.question' + i + '[' + j + '].value') == answers[i]) {
					tot++;
				}
			}
		}
	}

	if (tot == 0) {
		alert("You got " + tot  + " out of 10\nDid you even try?");
	}

	if (tot == 1 || tot == 2 || tot == 3 || tot == 4) {
		alert("You got " + tot + " out of 10\nYou call yourself an Astro Fan?");
	}

	if (tot == 5 || tot == 6) {
		alert("You got " + tot + " out of 10\nNot bad. Try Again.");
	}

	if (tot == 7 || tot == 8) {
		alert("You got " + tot + " out of 10\nAlmost there!");
	}
 
	if (tot == 9 || tot == 10) {
		alert("You got " + tot + " out of 10\nExcellent!\nYou may proceed to the next level!");
		page++;
	}
	location = "triv_" + pages[page] + ".php";
}

