/*function initialiseCarouselBandeau() {	
	
	if($('carousel-container')){
		var crsl = new Carousel('carousel-wrapper',
			$$('#carousel-content .slide'),
			$$('a.carousel-control'),{
				auto: true,
				duration:0.8,
				circular:true,
				frequency: 4,
				wheel: false,
				resumeAutoAfterClick: 4
				
			});
	}
}*/


function initialiseZoom(){
	if($('zoom')){
		var url = 'gestionDeContenu/zoomDyn.php?url=' + encodeURIComponent(document.location.href);

		new Ajax.Request(url, {
		  method: 'get',
		  onSuccess: function(transport) {
		    if(transport.responseText){
		    	$('zoom').insert({after:transport.responseText});
		    	$('zoom').remove();
		    }
		  }
		});
	}
}
document.observe('dom:loaded' , initialiseZoom);

function actionImage(action) {
	clearInterval(horloge);
	var currentImage = $(containerId).getAttribute("rel");
	var step; if(action == "next") { step = 1; } else { step = -1; }
	$(slideName+currentImage).style.display = 'none';
	nextImage = parseInt(currentImage) + parseInt(step);
	if(nextImage < 0) { nextImage = parseInt(nbImages) - 1; }
	if(nextImage > (nbImages - 1)) { nextImage = 0; }
	$(slideName+nextImage).style.display = 'block';
	$(containerId).setAttribute("rel", nextImage);
	slideTo(action, parseInt(nextImage*-imageWidth));
	horloge = window.setInterval("actionImage('next');" , 5000);
	return false;
}
function slideTo(action,margx){
	var element = $(containerId);
	var posx = $(containerId).style.marginLeft.split('px')[0];
	if(posx=="") { posx = 0 };
	if(action=="next"){
		element.style.marginLeft = posx-25+'px';
		if (posx>margx){
			setTimeout('slideTo("'+action+'", '+margx+')' , 3);
		} else {
			element.style.marginLeft = margx+'px';
		}
	} else {
		element.style.marginLeft = parseInt(posx)+25+'px';
		if (posx<margx){
			setTimeout('slideTo("'+action+'", '+margx+')' , 3);
		} else {
			element.style.marginLeft = margx+'px';
		}
	}
}

