// jQuery functionality for tabbed content at the bottom of the homepage

$().ready(function() {

	// Set tab placement
	$(".tabs_prefix, .tab_label").addClass('js');
	$("#tab_2").insertAfter('#tab_1');

	// Set tab 1 as active
	$('#tab_1').addClass('active');
	$("#tab_pane_2").hide();

	// Show contents of tab 2 when clicked
	$("#tab_2").click(function(){
		$("#tab_pane_1").hide();
		$("#tab_pane_2").show();
		$('.tab_label').removeClass('active');
		$(this).addClass('active');
	});

	// Show contents of tab 1 when clicked
	$("#tab_1").click(function(){
		$("#tab_pane_1").show();
		$("#tab_pane_2").hide();
		$('.tab_label').removeClass('active');
		$(this).addClass('active');
	});


	//Hide (Collapse) the toggle containers on load
	$(".toggle_container").hide(); 

	//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
	$("span.trigger").click(function(){
		$("span.trigger a").hide();
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});

	$("span.trigger2").click(function(){
		$("span.trigger2 a").hide();
		$(this).toggleClass("active").next().slideToggle("slow");
		return false; //Prevent the browser jump to the link anchor
	});

});
