$(function() {
	
	//tabbed content
	$("div.tabbed-content").each(function(){
		var tabContentHeight = $(this).children("div.tab-content:first").outerHeight() + 20;
		$(this).css("height",tabContentHeight);
		
		if ($(this).children("a").hasClass("show-first")) {
			var thisTab = $(this).children("a.show-first").attr("hash");
			$(this).children("a.show-first").addClass("active");
			$(this).children("div.tab-content").not(thisTab).hide();
		} else {
			$(this).children("a.tab:first").addClass("active");
			$(this).children("div.tab-content").not("div.tab-content:first").hide();
		}
	});
	
	
	$("dl.toggler dd").hide();
	$("dl.toggler dt").click(function(){
	
		$(this).toggleClass("open").next("dd").toggle();
	
	});
	
	
	$("div.tabbed-content a.tab").click(function(){
		
		var thisTab = $(this).attr("hash");
		
		var tabContentHeight = $(thisTab).outerHeight() + 20;
		$(this).parent("div.tabbed-content").css({height: tabContentHeight});
		
		$(this).parent("div.tabbed-content").children("a.tab").removeClass("active");
		$(this).addClass("active");
		
		$(this).parent("div.tabbed-content").children("div.tab-content").hide();
		$(thisTab).show();
		
		return false;
	
	});
	
});