$(document).ready(function() {
	//hide all divs with class of answer					   
	$("div.answer").hide();
	
	/*
	get all div's that are links with the class of questionAnchor and run the function on each of them (.each is jquery specific) 
	using an array to add +1 each time it runs so matches up the q and A. Index increments each time the loop is run
	*/
	  $('a.questionAnchor').each( function(index) {
										   
		//$(this) equals the current anchor								  
		$(this).click(function() {
			
			//remove on state class  
			$('a.questionAnchor').parent().removeClass("on");
			
			//add on state class
			$(this).parent().addClass("on");
			
			//hide all open divs with class of answer
			 $("div.answer").hide();
			 
			 //get the corrsponding div from array referenced by Index and show it
			 $('div.answer:eq(' + index + ')').show();
			 
		});
	  });
});