jQuery(document).ready(function(){
	
	// SHORTCODE: Toggle Content
	jQuery(".sc-togglecontent .tc-switch").click(function(){
		jQuery(this).parent().find(".tc-content").slideToggle(100);
		if(jQuery(this).hasClass("close")){
			jQuery(this).removeClass("close").addClass("open");
			jQuery(this).parent().find(".tc-content").removeClass("close").addClass("open");
		} else {
			jQuery(this).removeClass("open").addClass("close");
			jQuery(this).parent().find(".tc-content").removeClass("open").addClass("close");
		}
	});
	
	// SHORTCODE: Tab Content
	jQuery(".sc-tab .tab-header").click(function(){
		jQuery(this).parents(".sc-tab").find(".tab-header").each(function(i, o){ jQuery(this).attr("rel", "totab" + i); });
		jQuery(this).parents(".sc-tab").find(".tab-content").each(function(i, o){ jQuery(this).attr("id", "totab" + i); });
		
		var totab = "#" + jQuery(this).attr("rel");
		
		jQuery(this).parents(".sc-tab").find(".tab-header").removeClass("active");
		jQuery(this).addClass("active");
		jQuery(this).parents(".sc-tab").find(".tab-content").css("display", "none");
		jQuery(this).parents(".sc-tab").find(totab).css("display", "block");
	}).filter(":first").click();
	
	// SHORTCODE: Slideshow
	jQuery(".sc-tab.slideshow, .sc-tab.imagetab").slides({
		container: "tab-container",
		autoHeight : true,
		generatePagination: false
	});
	
});
