var homeItemsRoundabout = $('#roundabout_bloc .item');
homeItemsRoundabout.each(function(){
	var e = $(this);
	var img = e.find('img');
	var imgHeight = parseInt(img.height());
	var imgWidth = parseInt(img.width());
	if(imgWidth >= imgHeight){ 
		e.find('img').css('width', '100%');				
	}
	else { e.find('img').css('height', '100%');} 
});

$('#roundabout_bloc li').focus(function() {
	var useText = $(this).find('.infos_item').html();
	$('#description').html(useText);
});


$(document).ready(function() {
		if ( $('ul#roundabout_bloc').children().size() > 0 )
		{
			
			var interval;
			var interval2;
			
			$('ul#roundabout_bloc').roundabout({
					reflect: true,
					minOpacity: 1.0,
					duration: 1000
			});
			$('ul#roundabout_bloc').hover(
				 function() {
					// oh no, it's the cops!
					clearInterval(interval);
				 },
				 function() {
					// false alarm: PARTY!
					interval = startAutoPlay('roundabout_bloc', 750);
				 }
			 );
					
			// let's get this party started
			interval = startAutoPlay('roundabout_bloc', 750);
		}

});



function startAutoPlay(block, duration) {
	return setInterval(function() {
		$('ul#'+block).roundabout_animateToNextChild();
	},duration);
}
