// **********************************************
// JavaScript questions show/hide function for Chemistry in your cupboard
// @author  - Simon Pollard for Deckchair UK Ltd
// @version - 1.0
// @date    - November '09
// Requires jQuery

function questions() {
	
	// Set all the answers as hidden
	$(".answer h3").removeClass("open");
	$(".answer h3").addClass("closed");
	$(".question h3, .answer h3").css("cursor","pointer");
	$(".answer div.show_hide").css("display","none");
	
	// When clicking on a question or answer header
	$(".question h3, .answer h3").click(function() {
		
		// If it is closed, then open it (show the p)
		if ($(this).hasClass("closed")==true)
		{
			$("#"+$(this).parent().attr("id")+" div.show_hide").css("display","block");
			$(this).removeClass("closed");
			$(this).addClass("open");
		}
		// If it is open, then close it (hide the p)
		else
		{
			$("#"+$(this).parent().attr("id")+" div.show_hide").css("display","none");
			$(this).removeClass("open");
			$(this).addClass("closed");
		}
	});  
	
	//name = $("#3Dobject").attr("name");
	
}

