$(function() {
	// Calcul des largeurs des div des nouveautes en fonction de la largeur de la couverture
	// Ceci doit venir avant l'appel ˆ stepcarousel
	$("#recent div.panel").each(function() {
		largeur = $(this).find("img").width();
		if (largeur>0) $(this).css('width',largeur+10);
	});
});

// Initialisation du carousel
stepcarousel.setup({
	galleryid: 'carousel', //id of carousel DIV
	beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
	panelclass: 'panel', //class of panel DIVs each holding content
	autostep: {enable:true, moveby:1, pause:3500},
	panelbehavior: {speed:200, wraparound:true, persist:false},
	defaultbuttons: {enable: true, moveby: 1, leftnav: ['images/left.gif', -20, 65], rightnav: ['images/right.gif', 10, 65]},
	contenttype: ['inline'] //content setting ['inline'] or ['external', 'path_to_external_file']
})


$(function() {
	// Activation du scroll sur les actualitŽs
	$("div.scrollable").scrollable({vertical:true,size:3,nextPage:'a.down',prevPage:'a.up'});
	
	// Tooltips sur les nouveautes
	$("#recent img").each(function() {
		$(this).qtip({
			content: {
				text: $(this).parent().parent().children("div.tip").html()
			},
			show: {
				event: 'mouseover',
				effect: {
					length: 300
				}
			},
			hide: {
				delay: 100,
				fixed: true,
				when: {
					event: 'mouseout'
				},
				effect: {
					length: 600
				}
			},
			position: {
				corner: {
					target: 'bottomMiddle',
					tooltip: 'topMiddle'
				},
				adjust: {
					y: -4
				}
			},
			style: { 
				width: 200,
				padding: 5,
				background: '#fff',
				color: 'black',
				border: {
					 width: 3,
					 radius: 10,
					 color: '#d6d6d6'
				},
				tip: {
					corner: 'topMiddle',
					size: {
						x: 20,
						y: 10
					}
				},
				name: 'light' // Inherit the rest of the attributes from the preset dark style
		 }
		});
	});

});