$(function() {
	// current FAQ showning question and answer
	var curFAQ = null;

	// set initial FAQ to display
	setSelectedFAQ($("div.faq")[0]);
	
	// event for when a .question is clicked
	$(".question").click(function() {			
		setSelectedFAQ($(this).parent());
	});
	
	// returns current selected FAQ to normal state
	// then sets the @param FAQDiv to the selected state
	function setSelectedFAQ(FAQDiv)
	{
		// hide current shown answer and remove .selected class from FAQ div
		$(curFAQ).find(".answer").hide();
		$(curFAQ).removeClass("selected");
				
		// add .selected class to FAQ div
		$(FAQDiv).addClass("selected");
		// show answer
		$(FAQDiv).find(".answer").show();
		// store new FAQ selected
		curFAQ = FAQDiv;
	}	
});