this.activateTabs = function(tabsTarget, wrapperTarget, totalTabs, contentWidth, defaultTab, animated){	
	if(defaultTab !== undefined)
	{
		if (defaultTab == parseInt(defaultTab)) // test if default tab parameter is a numeric value or a string
			var startTab = defaultTab;
		else
		{
			var tabClass = $('li[rel=' + defaultTab + ']').attr('class').split(' '); // get class attribute of the default tab (ex: 'tab1', 'tab2')
			var startTab = tabClass[0].slice(3); 
		}
	}
	else
		var startTab = 1;
	
	// reset tabs
	$(wrapperTarget).scrollLeft(contentWidth * (startTab - 1));
	$(tabsTarget).removeClass('active');
	$('.tab'+startTab).addClass('active');
	
	
	// click on a tab
	$(tabsTarget).click(function(){
		if($(this).hasClass('active') == false)
		{
			$(tabsTarget).removeClass('active');
			$(this).addClass('active');
			
			for(i = 1; i <= totalTabs; i++)
				if($(this).hasClass('exempt') == true)
					window.location = $(this).attr("rel"); // go to link in rel attribute
				else
					if($(this).hasClass('tab'+i) == true)
					{
						if(animated)
							$(wrapperTarget).stop().animate({scrollLeft: contentWidth * (i - 1)}, 200); // animated scrolling
						else
							$(wrapperTarget).scrollLeft(contentWidth * (i - 1)); //instant scrolling
					}
		}
	});
	
	//target tabs from links
	$("a[rel=tabs]").click(function(){
		var tabNo = $(this).attr("target"); 
		
		if($('.tab'+tabNo).hasClass('active') == false)
		{
			$(tabsTarget).removeClass('active');
			$('.tab'+tabNo).addClass('active');
			
			if(animated)
				$(wrapperTarget).stop().animate({scrollLeft: contentWidth * (tabNo - 1)}, 200); // animated scrolling
			else
				$(wrapperTarget).scrollLeft(contentWidth * (tabNo - 1)); //instant scrolling 
		} 
		return false;
	});
};