function carousel_initCallback(carousel) {
	// Click sur down
	jQuery('#actu-scroll #actu-bottom').bind('click', function() {
		if (carousel.last < carousel.size()) {
			carousel.next();
		}
		
		return false;
	});
 
	// Click sur up
	jQuery('#actu-scroll #actu-top').bind('click', function() {
		carousel.prev();
		
		return false;
	});
};
	
// Shadowbox agenda
function shadowbox(href) {
	Shadowbox.open({
		content:    jQuery.ajax ({ url: href, async: false}).responseText,
		player:     "html",
		height:     500,
		width:      600,
		options: {
			displayNav: false
		}
	});
	
	return false;
};

jQuery(document).ready(function() {
	//jQuery('#slide-carousel img').corner('10px');
	
	// alert(jQuery('#slide-carousel img').attr('src'));
	
	// Carousel slide
	// jQuery("#slide #slide-carousel").jcarousel({
		// visible: 1,
		// scroll: 1,
		// animation: 2000,
		// auto: 1,
		// easing: 'fade',
		// wrap: "last"
	// });
	
	// Fonction qui se déclenche avant la transition
	function onBefore(curr, next, opts, fwd) {
		//curr.classname = "corner iradius10";
		jQuery('#slide-carousel img[src|="typo3temp/pics/2c3413b4c5.jpg"]').addClass('corner');
		jQuery('#slide-carousel img[src|="typo3temp/pics/2c3413b4c5.jpg"]').addClass('iradius10');
		//alert('#slide-carousel img[src|="' + curr.src + '"]');
	}
	
	// Carousel actus
	jQuery("#actu #carousel").jcarousel({
		vertical: true,
		visible: 2,
		scroll: 1,
		animation: 1000,
		auto: 10,
		wrap: 'circular'
		// initCallback: carousel_initCallback,
		// buttonNextHTML: null,
		// buttonPrevHTML: null
	});
	
	// Infobulle agenda
	jQuery('#agenda .eventDay .num-jour').each(function(i) {
		jQuery(this).parent().find('div.event-item').wrapAll('<ul class="agenda-bulle-list" />');
		jQuery(this).parent().find('div.event-item').each(function(i) {
			jQuery(this).replaceWith('<li>' +  jQuery(this).html() + '</li>');
		});
		
		jQuery(this).qtip ({		
			position: {
				corner: {
				 target: 'topRight',
				 tooltip: 'topLeft'
				},
				adjust: {
					y: -5
				}
			},
			show: {
				when: {
					event: 'mouseover'
				}
			},
			hide: {
				fixed: true,
				when: {
					event: 'mouseout'
				}
			},
			style: {
				'background': 'none',
				'color': 'white',
				'padding' : '0px',
				width: {
					min: 147,
					max: 147
				},
				border: {
					radius: 1,
					color: 'transparent'
				}
			},
			content: jQuery(this).parent().children('.agenda_bulle').html()
		});
	});
	
	Shadowbox.init({
		troubleElements: false,
		displayNav: false,
		displayCounter: false,
		autoplayMovies: false,
		viewportPadding: 0,
		handleOversize: 'none',
		enableKeys: false,
		modal: false
	});
});
