function getElementsByStyleClass (className) {
  var all = document.all ? document.all :
    document.getElementsByTagName('*');
  var elements = new Array();
  for (var e = 0; e < all.length; e++)
    if (all[e].className == className)
      elements[elements.length] = all[e];
  return elements;
}

function hideAllAnswers() {

	for (ques = 1; ques <= 10; ques++) {
		for (ans = 1; ans <= 4; ans++) {
			answer_id = ("ans" + ques + "-" + ans);
			hideLayer(answer_id);
		}
	}

	
}


function showAnswer(question_number, answer_number) {
	// Hide all answers for this question
	
	for (ans = 1; ans <= 4; ans++) {
		answer_id = ("ans" + question_number + "-" + ans);
		hideLayer(answer_id);
	}
	
	// Show the selected answer
	answer_id = ("ans" + question_number + "-" + answer_number);
	showLayer(answer_id);
	
}


function hideLayer(whichLayer) {

	if (document.getElementById) {
	// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "none";
	} else if (document.all) {
	// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "none";
	} else if (document.layers) {
	// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "none";
	}
	
}


function showLayer(whichLayer) {

	if (document.getElementById) {
	// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = "block";
	} else if (document.all) {
	// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = "block";
	} else if (document.layers) {
	// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = "block";
	}

}

function resetAnswers(){

	hideAllAnswers()
	for(question=1; question<11; question++){
		elements = document.getElementsByName('q'+question)
		for(i=0; i<4; i++){
			elements[i].checked = false
		}
	}
	
}