$(document).ready(function() {
	// Check to see if the homepage has webparts, if it doesn't, hide the sidebar that would contain them.
	if ($('.homepagesidebar div').length == 0) {
    	$(".homepagesidebar").hide();
  	}

	//When page loads...
	$(".tabcontentbox div.tabcontent").hide(); //Hide all content
	$("ul.tablist li:first").addClass("active first"); //Activate first tab and add the "first" attribute to it
	$("ul.tablist li:last").addClass("last"); //Add he "last" attribute to it
	$(".tabcontentbox div.tabcontent:first").show(); //Show first tab content

	//On Click Event
	$("ul.tablist li").click(function() {
		$("ul.tablist li").removeClass("active"); //Remove any "active" class
		$(this).addClass("active"); //Add "active" class to selected tab
		$(".tabcontentbox div.tabcontent").hide(); //Hide all tab content

		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		$(activeTab).fadeIn(); //Fade in the active ID content
		return false;
	});
});
