var spamQuestion = new Array();

spamQuestion[spamQuestion.length] = {	question: "13 + 7 = ", 
										answer: "20" };

spamQuestion[spamQuestion.length] = {	question: "What color is a banana?", 
										answer: "yellow" };

spamQuestion[spamQuestion.length] = {	question: "10 - 2 = ", 
										answer: "8" };

spamQuestion[spamQuestion.length] = {	question: "What color is an orange?",
										answer: "orange" };

spamQuestion[spamQuestion.length] = {	question: "8 + 15 = ", 
										answer: "23" };

spamQuestion[spamQuestion.length] = {	question: "What color is a strawberry?", 
										answer: "red" };

spamQuestion[spamQuestion.length] = {	question: "11 + 3 = ", 
										answer: "14" };

spamQuestion[spamQuestion.length] = {	question: "9 + 9 = ", 
										answer: "18" };

spamQuestion[spamQuestion.length] = {	question: "24 - 5 = ", 
										answer: "19" };

spamQuestion[spamQuestion.length] = {	question: "17 - 6 = ", 
										answer: "11" };

function printQuestion() {
	var currIndex = Math.floor(Math.random() * (spamQuestion.length));
	var output = '<p>' + spamQuestion[currIndex].question + '</p><p><input type="text" name="spamTest" id="spamTest" /></p>';
	output += '<input type="hidden" name="spamTestQuestionNumber" id="spamTestQuestionNumber" value="' + currIndex + '" />';
    document.write(output);
}

function getAnswer() {
	var qNumber = document.getElementById('spamTestQuestionNumber').value;
	var correctAnswer = spamQuestion[qNumber].answer;
	var userProvidedAnswer = document.getElementById('spamTest').value;
	if(correctAnswer == userProvidedAnswer) {
		return true;
	}
	return false;
}

