$(document).ready(function() {
    	
		$(".faq h3").click(function() { // Select elements to interact with.
						
			$(".faq h3").removeClass("hilite");
			$(this).addClass("hilite");

			var sum = $(this).next("div").children().outerHeight(true); // Determine their combined height.
			
			$(".open > *").fadeOut(250); // Hide previously visible children.
			$(".faq").children(".open").animate({height: "0px"}, "500").removeClass("open"); // Close the div.
			
 			$(this).next("div").children().fadeIn(1000); // Slowly fade in children...
			$(this).next(".faq div").animate({"height": sum + "px"}, "500").addClass("open"); // ...while opening div ~ total height.
			
			$("p.test").text("The height is " + sum + "px"); // Test to make sure height is correct
			
		});
		
		$(".verticals h3").click(function() { // Select elements to interact with.

			$(".verticals h3").removeClass("hilite");
			$(this).addClass("hilite");
			
			var sum = $(this).next("div").children().outerHeight(true); // Determine their combined height.
			
			$(".open > *").fadeOut(250); // Hide previously visible children.
			$(".verticals").children(".open").animate({height: "0px"}, "500").removeClass("open"); // Close the div.
			
 			$(this).next("div").children().fadeIn(1000); // Slowly fade in children...
			$(this).next(".verticals div").animate({"height": sum + "px"}, "500").addClass("open"); // ...while opening div ~ total height.
			
			// $("p.test").text("The height is " + sum + "px"); // Test to make sure height is correct
			
		});
		
});