
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

jQuery(document).ready(function() {

    jQuery('#mycarousel').jcarousel({
        auto: 50,
        wrap: 'circular',
        initCallback: mycarousel_initCallback
    });
		
		
		jQuery('a:first').click(function() {
			location.reload();
			return false;
		});

		// set opacity to nill on page load
		jQuery(".social a span").css("opacity","0");
		// on mouse over
		jQuery(".social a span").hover(function () {
			// animate opacity to full
			jQuery(this).stop().animate({
				opacity: 1
			}, 'slow');
		},
		// on mouse out
		function () {
			// animate opacity to nill
			jQuery(this).stop().animate({
				opacity: 0
			}, 'slow');
		});		
		
		var buttons = { previous:jQuery('#lofslidecontent45 .lof-previous') ,
						next:jQuery('#lofslidecontent45 .lof-next') };
						
		jQueryobj = jQuery('#lofslidecontent45').lofJSidernews( { interval : 6000,
												direction		: 'opacitys',	
											 	easing			: 'easeInOutExpo',
												duration		: 1200,
												auto		 	: true,
												maxItemDisplay  : 4,
												navPosition     : 'horizontal', // horizontal
												navigatorHeight : 32,
												navigatorWidth  : 80,
												mainWidth:995,
												buttons			: buttons} );	
												
				var interval;

				jQuery('ul#myRoundabout').roundabout({
					minScale: 1, // inclinaison du cercle		
					minOpacity: 0, // invisible!
					btnNext: '#next',
					btnPrev: '#previous'
				}).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() {
		jQuery('ul#myRoundabout').roundabout_animateToNextChild();
	}, 3000);
}
