function checkAnswer(quizID, questionID, answerID) {
	/*	Define arrays of random ways to say yes and no	*/
	var niceWaysToSayYes = new Array('Yes!', 'Correct.', 'That\'s right.', 'Yep.', 'You\'re right.', 'Right!');
	var niceWaysToSayNo = new Array('Incorrect.', 'Not quite.', 'Nope.', 'Wrong.', 'Not really.', 'No!');

	/*	Disable the radio boxes and dim the wrong answers	*/
	disableBoxes(questionID);
	
	/*	Figure out the DOM ID of the box that the explanation goes in	*/
	var notice = $('answer_' + questionID);

	/*	Update it to show that we're checking the answer	*/
	notice.update('<img src="images/quiz_indicator.gif" alt="Checking..." style="margin-right:5px;" /> Checking...').setStyle({ padding:'10px', border: '1px solid #aaa', background:'#ddd' });

	/*	Define the URL to send the AJAX request to	*/
	var url = 'CheckQuizAnswer.cfm?theQuiz=' + quizID + '&theQuestion=' + questionID + '&theChoice=' + answerID;

	/*	Make the AJAX request with Prototype's Ajax object	*/
	new Ajax.Request(url, {
	  method: 'get',
	  onSuccess: function(transport) {
			/*	Split the responseText into the correct answer and the explanation	*/
			var trimmedText = trim(transport.responseText);	
			var splitResponse = trimmedText.split(';');

			/*	Dim the wrong answers	*/
			dimAnswers(questionID, splitResponse[1]);

			/*	Figure out which responsePhrases we're going to use */
			var now = new Date();			
			randomYes = Math.floor(Math.random(now.getSeconds()) * (niceWaysToSayYes.length - 1));
			randomNo = Math.floor(Math.random(now.getSeconds()) * (niceWaysToSayNo.length - 1));

			/*	If the answer is correct...	*/
			if (splitResponse[0] == 'TRUE') {
				/*	Pick a random way to say correct	*/
				responsePhrase = niceWaysToSayYes[randomYes];

				/*	If there's a link to learn more...	*/
				if(splitResponse[3] != '') {
					/*	Update the info box with the explanatory text	and the link	*/
	      	notice.update('<strong>' + responsePhrase + '</strong> ' + splitResponse[2] + ' <small><em>(<a href="' + splitResponse[3] + '">Learn more</a>)</em></small>').setStyle({ padding:'10px', border:'1px solid #aaa', background: '#dfd' });
				} else {
					/*	Otherwise just the text...	*/
	      	notice.update('<strong>' + responsePhrase + '</strong> ' + splitResponse[2]).setStyle({ padding:'10px', border: '1px solid #aaa', background: '#dfd' });				
				}
				/*	Update the score to reflect the correct answer	*/
				updateScore();
			/*	If the answer is wrong...	*/
	    } else {
				/*	Pick a random way to say WRONG!	*/
				responsePhrase = niceWaysToSayNo[randomNo];
				/*	If there's a link for more...	*/
				if(splitResponse[3] != '') {
					/*	Display the explanation and the more info link	*/
	      	notice.update('<strong>' + responsePhrase + '</strong> ' + splitResponse[2] + ' <small><em>(<a href="' + splitResponse[3] + '">Learn more</a>)</em></small>').setStyle({ padding:'10px', border: '1px solid #aaa', background: '#fdd' });
				} else {
					/*	Show just the explanation	*/
	      	notice.update('<strong>' + responsePhrase + '</strong> ' + splitResponse[2]).setStyle({ padding:'10px', border: '1px solid #aaa', background: '#fdd' });
				}
			}
	  }
	});
}

function updateScore() {
	/*	Find the DOM ID of the score box using Prototype's $() shortcut (equivalent to document.GetElementById)	*/
	var scoreBox = $('scoreBox');

	/*	Find the current score...	*/
	var currentScore = parseInt(scoreBox.innerHTML);

	/*	And increment it.	*/
	scoreBox.update(currentScore+1);
}

function dimAnswers(questionID, correctAnswer) {
	/*	Declare a loop counter	*/
	var i;

	/*	Array of possible values that are used in the ID of the radio box	*/
	var questionAnswers = new Array('A', 'B', 'C', 'D', 'E', 'T', 'F', 'Y', 'N');

	/*	Loop through all of the answers in the array	*/
		for(i = 0; i < questionAnswers.length; i++) {
			/*	If there exists a label for the question of the array we're on...	*/
			if ($('label_' + questionID + '_' + questionAnswers[i])!=null) {
				/*	And it's not the correct answer...	*/
				if(questionAnswers[i] != correctAnswer) {
					/*	Dim it by setting its foreground color to a light grey	*/
					$('label_' + questionID + '_' + questionAnswers[i]).setStyle({color:'#aaa'});
				}
				else {
					/*	Bold the correct answer	*/
					$('label_' + questionID + '_' + questionAnswers[i]).setStyle({color:'blue'});
				}					
			}
		}
}

/*	disableBoxes() is essentially the same as dimAnswers()	*/
function disableBoxes(questionID) {
	var i;
	var questionAnswers = new Array('A', 'B', 'C', 'D', 'E', 'T', 'F', 'Y', 'N');
		for(i = 0; i < questionAnswers.length; i++) {
			if ($('Q_' + questionID + '_' + questionAnswers[i])!=null) {
				$('Q_' + questionID + '_' + questionAnswers[i]).setAttribute('disabled', 'disabled');
			}
		}
}

function trim(str) {
	/*	Generic regular expression to trim whitespace from a string	*/
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}