var i = 1;
var interval;

jQuery(function($){
	$(".thumbs a").click(function(){
		var id = $(this).attr('id');
		fadeImage(id);
		clearInterval(interval);
		return false;
	});
	
	interval = setInterval(function(){
		var id = 'feature-' + (i % 3 + 1);
		fadeImage(id);
		i++;
	}, 5000);
	
});

function fadeImage(id) {
	var headerId = id.replace(/feature-/, '');
	var headerText = $(”#headerScrollFeature #header-” +
    headerId).clone();
	$('<div class="feature-overlay" />').addClass(id).append(headerText).hide().insertBefore(".thumbs").fadeIn(function(){
		$("#headerScrollFeature").attr('class', '').addClass(id);
		$(this).remove();
	});
}


/*

jQuery(function($){
	$(".scroller").thumbScroller({ speed: 5 }); // 5 seconds
});

$.fn.thumbScroller = function(options){
	return $(this).each(function(){
		var scroller = $(this);
		var thumbWidth = 109;
		var thumbCount = $(this).find('li').size();
		var contentWidth = thumbCount * thumbWidth;
		scroller.find('.scroller-content').data('current', 0).width(contentWidth);
		setInterval(function(){
			scroller.find('.scroller-content').fadeOut(function(){
				var current = $(this).data('current');
				var next = current + 3;
				var count = scroller.find('li').size();
				current = next >= count ? 0 : next;
				$(this).data('current', current);
				$(this).css({ marginLeft: -current*thumbWidth }).fadeIn();
			});
		}, options.speed*1000);
	});
}

*/