﻿$(document).ready(function() {
	var interval;
	var itemCount = $('.animation > li').size();
	
	if (itemCount == 1)
	{
		$('.animation')
		.roundabout({			 
			 minOpacity: 0.0			 		
		});
	}
	else
	{
		$('.animation')
			.roundabout({			 
				 minOpacity: 0.0			 		
			}) 
			.hover(
				function() {
					// oh no, it's the cops!
					clearInterval(interval);
				},
				function() {
					// false alarm: PARTY!
					interval = startAutoPlay();
				}
			);
		
		
		// let's get this party started	
		interval = startAutoPlay();
	}
});

function startAutoPlay() {
	return setInterval(function() {
		$('.animation').roundabout_animateToNextChild();
	}, 5000);
}
