// -------------------------------------------------------------------------
// Controls all functions related to the FAQ page.
// -------------------------------------------------------------------------

var lastQuestionNum = -1;		// What was the last FAQ question clicked?

// -------------------------------------------------------------------------
// The user has clicked on a question to expand/contract.
// @param questionNum	The question number that has been clicked
// -------------------------------------------------------------------------
function expandFaq(questionNum)
{
	// Hide the previous FAQ
	if(lastQuestionNum != -1)
	{
		setQuestionVisible(lastQuestionNum, false);
	}
	// Show this FAQ question
	if(questionNum != lastQuestionNum)
	{
		setQuestionVisible(questionNum, true);
		lastQuestionNum = questionNum;
	}
	else
	{
		lastQuestionNum = -1;	
	}
}

// -------------------------------------------------------------------------
// Sets if a question is visible to the user.
// @param questionNum	The question number
// @param isVisible		True if the question should be visible on the screen.
// -------------------------------------------------------------------------
function setQuestionVisible(questionNum, isVisible)
{
	var myTitle = document.getElementById("title-" + questionNum);
	var myAnswer = document.getElementById("answer-" + questionNum);
	
	if(isVisible)
	{
		myTitle.style.fontWeight = 'bold';
		myAnswer.style.display = 'block';	
	}
	else
	{
		myTitle.style.fontWeight = '';
		myAnswer.style.display = 'none';
	}
}
