$(document).ready(function() {

$.fn.doTabSet = function(){ 
	//Default Action
	$(this).find(".tabContent").hide(); //Hide all content
	$(this).find("ul.tabs li:first").addClass("first active").show(); //Activate first tab WI: add "first" class
	$(this).find("ul.tabs li:first").next().addClass("afterActive"); //WI: add "afterActive" class
	$(this).find("ul.tabs li:last").addClass("last"); //WI: add "last" class
	$(this).find(".tabContent:first").show(); //Show first tab content
	
	// On Click Event
	$("ul.tabs li").click(function() {
		// Remove existing classes that we are about to update
		$(this).parent().parent().find("ul.tabs li").removeClass("active afterActive activeLast");
		// Check if the selected tab is the last one or not, and add the appropriate class
		if($(this).hasClass("last")){
			$(this).addClass("activeLast");
		} else {
			$(this).addClass("active");
		}
		// Add "afterActive" class to tab AFTER the selected tab
		$(this).next().addClass("afterActive");
		
		
		$(this).parent().parent().find(".tabContent").hide(); //Hide all tab content
		var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
		$(activeTab).show(); //Fade in the active content
		return false;
	});
};//end function

$("div[class^='tabSet']").doTabSet(); //Run function on any div with class name of "tabSet"


});

