$.cycleTabs = function(o){
	
	$.cycleTabs.defaults = {
		switchSpeed : 1000,
		timeout : 4000,
		tabCount : 3
	};
	o = $.extend({}, $.cycleTabs.defaults, o);

	function loadTab(tabID){
		var targetab = $('#swap-'+tabID);
		
		if(!$('.tab-content').hasClass('active')) $('.tab-content').stop().fadeTo(100,0);
		
		if(!targetab.hasClass('active')){
			$('.tab-content.active').stop().animate({"opacity":0}, o['switchSpeed']).removeClass('active').fadeOut();
			$('#swap-'+tabID).css({"display":"block"}).stop().animate({"opacity":1}, o['switchSpeed']).addClass('active');
		};
		
		$('#tabs li.active').removeClass('active');
		$('#tabs li#tab-'+tabID).addClass('active');
	};
	
	// set the timeout
	var i = 0 ;
	function runCycle(){
		setTimeout(function(){
			runCycle();
		}, o['timeout']);
		i++;
		loadTab(i);
		if(i==o['tabCount']) i = 0;
	};
	runCycle();
}
