var current;
var next;
var myTimer;

function rotateDivs(){
	clearTimeout(myTimer);

	current = $('#homeFeature img.current');
	next = $(current).next().length > 0 ? $(current).next() : $('#homeFeature img:first');
	
	$(current).trigger('fadeBack');
	$(next).trigger('fadeFront');

	myTimer = setTimeout('rotateDivs()',4000);
}

$(document).ready( function(){
	myTimer = setTimeout('rotateDivs()',4000);
	
 	$('#homeFeature img').bind( 'fadeBack', function(){
		
		$(this).fadeOut('slow', function(){
			$(this).removeClass('current').addClass('next');
		});
		
 	}).bind( 'fadeFront', function(){
 	
		$(this).fadeIn('slow', function(){
			$(this).removeClass('next').addClass('current');
		}); 	
		
 	});
});
