var delay = 5000
var imgLocation = '#featured img';
var imgCount;
var imgInterval;
var curImg = 0;
var oldImg = 0;

$(document).ready(function(){
	imgCount = $(imgLocation).size();
	$(imgLocation+':not(:first)').css('display', 'none');
	imgInterval = setInterval(featuredRotate, delay);
	$(imgLocation).hover(function () {
		clearInterval(imgInterval);
	}, function () {
		imgInterval = setInterval(featuredRotate, delay/3);
	});
});

featuredRotate = function () {
	clearInterval(imgInterval);
	curImg = (oldImg + 1) % imgCount;
	$(imgLocation+':eq('+oldImg+')').fadeOut('slow');
	$(imgLocation+':eq('+curImg+')').fadeIn('slow');
	oldImg = curImg;
	imgInterval = setInterval(featuredRotate, delay);
}