////////////////////////// REFERENCE PACK
var nbclign = SlideShow.length;
var v_nbclign=0;
var timerOff = null;
var timerOn = null;
var Passe = 0;
//////////////////////////
function ShowSlide(mode){
	if(v_nbclign===undefined) v_nbclign=0;
	var type = EffectType;
	if( mode == "on" ) {
		$("div#SlideReferent").empty();
		data = '<img src="'+PathIMG+'/'+SlideShow[v_nbclign]+'" alt="" />';
		$("div#SlideReferent").html(data);
		
		if( SlideShow[v_nbclign+1] ) $("#PreloadImg").attr("src",PathIMG+"/"+SlideShow[v_nbclign+1]);
		
		if( type == "fade" ) { $("div#SlideReferent").fadeIn(TransIn); }
		else if( type == "slide" ) { $("div#SlideReferent").slideDown(TransIn); }
		
		v_nbclign++;	
		if(AfficheNavi == 1) {
			$("div#SlideNavi").empty();
			navi = NavigSlide(v_nbclign);
			$("div#SlideNavi").append(navi);
		}
		if(v_nbclign >= nbclign){ v_nbclign=0; }
		clearTimeout(timerOff);
		timerOn=null;
		if( nbclign>1 ) timerOn = setTimeout("ShowSlide('off')", RefTemps);

	}
	
	else if( mode == "off" ) {
	
		if( type == "fade" ) { $("div#SlideReferent").fadeOut(TransOut); }
		else if( type == "slide" ) { $("div#SlideReferent").slideUp(TransOut); }
		
		clearTimeout(timerOn);
		timerOff = null;
		timerOff = setTimeout("ShowSlide('on')", RefTemps2);
		
	}
	
}

function ChangeHeight(h) {
	h=parseFloat(h);
	$("#SlideShow").animate({height: h},"slow");
}

function ChangeSlide(id) {
	var type = EffectType;
	clearTimeout(timerOn);
	clearTimeout(timerOff);
	v_nbclign = id-1;
	if( type == "fade" ) { $("div#SlideReferent").fadeOut(TransOut); }
	else if( type == "slide" ) { $("div#SlideReferent").slideUp(TransOut); }
	setTimeout( function() {
	
		$("div#SlideReferent").empty();	
		data = '<img src="'+PathIMG+'/'+SlideShow[v_nbclign]+'" alt="" />';
		$("div#SlideReferent").html(data);
		if( SlideShow[v_nbclign+1] ) $("#PreloadImg").attr("src",PathIMG+"/"+SlideShow[v_nbclign+1]);
	
		if( type == "fade" ) { $("div#SlideReferent").fadeIn(TransIn); }
		else if( type == "slide" ) { $("div#SlideReferent").slideDown(TransIn); }
		EnRoute = 0; Passe = 1;
		if(AfficheNavi == 1) {
			$("div#SlideNavi").empty();
			navi = NavigSlide(id);
			$("div#SlideNavi").append(navi);
		}
		EnRoute = 0;
		
	}, TransOut);
}

function ReplaySlide(id) {
	if(Passe==1) {
		v_nbclign++;
		id++;
	}
	if( EnRoute == 0 ) {
		EnRoute = 1;
		timerOn = setTimeout("ShowSlide('off')",700);
	}
	else {
		EnRoute = 0;
		if(timerOn) clearTimeout(timerOn);
		if(timerOff) clearTimeout(timerOff);
	}
	Passe=0;
	$("div#SlideNavi").empty();
	navi = NavigSlide(id);
	$("div#SlideNavi").append(navi);
	
}

function NavigSlide(opt) {
	if( opt<=1 ) { prec = nbclign; } else { prec = opt-1; }
	if( opt>=nbclign ) { suiv = 1; } else { suiv = opt+1; }
	
	var cont = "<a href='javascript:ChangeSlide("+(prec)+");' class='ref'><img src='../images/prev.gif' style='margin-right:5px;'  alt='' /></a> ";
/*	for( i=1; i<nbclign+1; i++ ) {
		
		if( opt == i )
			cont += "<a href='javascript:ChangeSlide("+i+");' class='select'>"+i+"</a> ";
		else
			cont += "<a href='javascript:ChangeSlide("+i+");'>"+i+"</a> ";
		
	}*/
	cont += " <a href='javascript:ChangeSlide("+(suiv)+");' class='ref'><img src='../images/next.gif' style='margin-right:5px;'  alt='' /></a>";
	
	cont+= "<span>";
	if( EnRoute == 1 ) { cont += "<a href='javascript:ReplaySlide("+opt+");' class='ref'><img src='../images/stop.gif' style='margin-right:5px;' alt='' /></a>"; }
	else { cont += "<a href='javascript:ReplaySlide("+opt+");' class='ref'><img src='../images/play.gif'   style='margin-right:5px;' alt='' /></a>"; }
	cont+= "</span>";
	
	return cont;
}
//////////////////////////FIN REFERENCE PACK