var questions = document.getElementsByTagName('dt');
var answers = document.getElementsByTagName('dd');

function toggleAllOff(){
	for (var i = 0; i < answers.length; i++) {  // turns off all the dd's
		answers[i].className = 'hide';
		
	}

}

function toggleAllOn(){
	for (var i = 0; i < answers.length; i++) {  // turn on all the dd's
		answers[i].className = 'show';
		
	}
	
}


function toggleNext(element) {
	var next = element.nextSibling;
	while(next.nodeType != 1) next=next.nextSibling; // if it gets to a non-element node, like sub heading go to the next one
	next.className=((next.className=="hide") ? "show" : "hide");
	

}


//makes the definition lists click-able
function displayToggle(){
	
	toggleAllOff(); // all off when the page is loaded	
	 
	 for (i=0; i<questions.length; i++) { // loops through the questions 
		 questions[i].onclick=function() { // shows the answers onclick
		 	toggleNext(this);
		}
	 }
	 
}

// enables clickable dt's when page loads
window.onload=function() {
	displayToggle();
	}
