/* This function takes an FAQ with collapsed answers, and upon clicking the question
    bolds the link, shows the answer, and closes any other visible answers. */
   
function toggleFAQ(element) {
	// Set variable to the current question's <li>
	var currentQuestion = element.parentNode

	// Set a variable to capture all of the other <li>'s in the <ul> with the id "FAQ"
	var entireList = document.getElementById("FAQ").getElementsByTagName("li")
	
	// Go through the entire list of <li>'s and deactivate all of them
	for (var i = 0; i < entireList.length; i++) {
		if(entireList[i].className == "questionActive_fmt"){
			entireList[i].className = "question_fmt"
		}
		if(entireList[i].className == "answerActive_fmt"){
			entireList[i].className = "answer_fmt"
		}
	}
	
	// Bold the current question
	currentQuestion.className = "questionActive_fmt"

	// Check to make sure the next element in the list is an <li> (FireFox DOM problem)
	if (currentQuestion.nextSibling.nodeType == 3){
		currentQuestion = currentQuestion.nextSibling
	}
	
	// Activate the answer!
	currentQuestion.nextSibling.className = "answerActive_fmt"
}

/* This function finds the <ul> with the id "FAQ", and makes all answers within it hidden */
function closeFAQ() {
	// Set variable to the array of <li>'s within "FAQ"
	var entireList = document.getElementById("FAQ").getElementsByTagName("li")

	// Sift through the array and hide any visible answers
	for (var i = 0; i < entireList.length; i++) {
		if(entireList[i].className == "questionActive_fmt"){
			entireList[i].className = "question_fmt"
		}
		if(entireList[i].className == "answerActive_fmt"){
			entireList[i].className = "answer_fmt"
		}
	}
}