	var $slideshow;
	var $slideshow_img;
	var tempsSlide;
	var $slideshow_controls;
	
	// duplique le array d'images afin de toutes les loader et de les supprimer au fur et à mesure.
	var imagesPreload;
	var indexSlide;
	var timerSlide;
	
	var preventUpdateSlideshow = false;


	function slideshowSetup(){
		if($slideshow_img.length == 0){
			$slideshow_img = $("<img>");
			$slideshow.html($slideshow_img);
		}
	}

	function slideshowUpdate(){
		$("div.detail").fadeOut(500);
		$slideshow_img.fadeOut(500, function(){
			$(this).attr("src", photosCarrousel[indexSlide]['path']).fadeIn(500);
			$("div.detail").fadeIn(500);
			$slideshow_controls.removeClass("active");
			$("#pc_ball"+indexSlide).addClass("active");
			
			if(photosCarrousel[indexSlide]["info"] && is_object(photosCarrousel[indexSlide]["info"])){
				$slideshow_type.attr("src", photosCarrousel[indexSlide]['info']['typePicture']);
				if(indexSlide >= 1){
					$slideshow_link.removeClass("type"+photosCarrousel[indexSlide-1]['info']['type']);
				}else{
					$slideshow_link.removeClass("type"+photosCarrousel[photosCarrousel.length-1]['info']['type']);
				}
				$slideshow_link.attr("href", photosCarrousel[indexSlide]['info']['link']);
				if(photosCarrousel[indexSlide]['info']['blank']){
					$slideshow_link.attr("onclick", "window.open(this.href); return false;");
					$slideshow_dlink.attr("onclick", "window.open('"+photosCarrousel[indexSlide]['info']['link']+"');");
				}else{
					$slideshow_link.attr("onclick", "return true;");
					$slideshow_dlink.attr("onclick", "document.location = '"+photosCarrousel[indexSlide]['info']['link']+"'; return false;");
				}
				
				$slideshow_link.html(photosCarrousel[indexSlide]['info']['text']);
				$slideshow_link.addClass("type"+photosCarrousel[indexSlide]['info']['type']);
			}else{
				$slideshow_desc.html(photosCarrousel[indexSlide]['info']);
			}
			
			indexSlide++;
			if(indexSlide == photosCarrousel.length) indexSlide = 0;
		});
		
	}

	function preloadImages(){
		$('<img>').attr("src", imagesPreload.shift().path).load(function(){
			if(imagesPreload.length){
				preloadImages();
			}
		});
		
	}

	function slideshowNav(type, slide){
		clearInterval(timerSlide);
		timerSlide = setInterval(slideshowUpdate, tempsSlide);
		switch(type){
			case 'direction':
				if(slide == 'next'){
					slideshowUpdate();
				}else if(slide == 'prev'){
					if(indexSlide >= 1){
						indexSlide-2;
					}else{
						indexSlide = photosCarrousel.length-1;
					}
					slideshowUpdate();
				}
				break;
			case 'navigation':
				$slideshow_img.stop(true, true);
				indexSlide = slide;
				slideshowUpdate();
				break;
			default:
		}
	}
	
	function is_object(input){
		return typeof(input) == "object";
	}
