function hide(elemID){ ( ( document.getElementById ) ? ( document.getElementById(elemID).style.display = 'none' ) : false );}
function submitQuiz(){
	var bChecked = false;
	if(document.getElementById('a1').checked){
		bChecked = true;
		document.getElementById('answer').innerHTML = showAnswer(1);
	}
	if(document.getElementById('a2').checked){
		bChecked = true;
		document.getElementById('answer').innerHTML = showAnswer(2);
	}
	if(document.getElementById('a3').checked){
		bChecked = true;
		document.getElementById('answer').innerHTML = showAnswer(3);
	}
	if(!bChecked){
		document.getElementById('answer').innerHTML = 'Select an answer from the choices listed above.';
	}
	
	return false;
}

function showAnswer(intAnswer){
	var strOut = '';
	switch(intAnswer){
	case 1:
		strOut = '<p><b>Right answer!</b><br /> The 1906 San Francisco quake was caused by a 290-mile-long rupture along the San Andreas fault, stretching from Shelter Cove in northernmost California south through San Francisco to San Juan Bautista. Displacement, or the amount the earth shifted, along the fault ranged from eight to 20 feet.</p>';
		strOut += '<p><a href="quiz_02.html">Next Question</a></p>';
		hide('submit');
		break;
	case 2:
		strOut = '<p>No. The Vasquez Creek fault is located near Los Angeles.</p>';
		break;
	case 3:
		strOut = '<p>Sorry. Try again. While the Hayward fault runs along the eastern side of San Francisco Bay, it did not cause the 1906 earthquake.</p>';
		break;
	}
	return strOut;
}
document.write('<form action="" method="get">');
document.write('<p><label accesskey="1"><input type="radio" id="a1" name="q1" value="1" /> The San Andreas fault</label></p>');
document.write('<p><label accesskey="2"><input type="radio" id="a2" name="q1" value="2" /> The Vasquez Creek fault</label></p>');
document.write('<p><label accesskey="3"><input type="radio" id="a3" name="q1" value="3" /> The Hayward fault</label></p>');
document.write('<p><input type="button" id="submit" name="submit" value="Submit" onclick="submitQuiz();" /></p>');
document.write('</form>');