// La fonction qui fait défiler le menu vers la gauche
cpt1=0;
var timer=null;
function SL(texte, nbimages)
{
    var intvar = 0;
    var stringA;
    var speed;
    if (nbimages >= 20) {
    	nbimages = 19;
    }
    var numberimages = ((nbimages + 1) * -161) + 802;
    a=document.getElementById(texte).style;

    if(a.left != "")
        intvar = parseInt(a.left);
	// width of 161 pixel for each picture.
	if (intvar >= numberimages){
		// Vitesse du déplacement
		speed = 6;
	    stringA = intvar - speed;
	    a.left = stringA + "px";
	}
	else {
		return;
	}
	t=texte;
	l=nbimages;
	timer = setTimeout('SL(t,l,a)', 1);
}
// La fonction qui fait défiler le menu vers la droite et arrete au px 0;
cpt2=0;
function SR(texte)
{
	var intvar = 0;
	var stringA;
	var speed;
    a=document.getElementById(texte).style;
    if(a.left != "") {
        intvar = parseInt(a.left);
    }
	if (intvar<=0) {
		// Vitesse du déplacement
		speed = 6;
	    stringA = intvar + speed;
		a.left = stringA + "px";
	}
	else
		return;
	t=texte;
	timer = setTimeout('SR(t)', 1);
}
	
function stop()
{
    clearTimeout(timer);
}


/*FUNCTION WHEN WE CLIC ON A BUTTON AND SCROLL 1 COMPLETED IMAGE*/
function SL2(texte, nbimages, action)
{
    var intvar = 0;
    var stringA;
    var speed;
    if (nbimages >= 20) {
    	nbimages = 19;
    }
    var numberimages = ((nbimages + 1) * -161) + 802;
    a=document.getElementById(texte).style;
	//while (action <= 136) {
	    if(a.left != "")
	        intvar = parseInt(a.left);
		// width of 161 pixel for each picture.
		if (intvar >= (numberimages + 163)){
			// Vitesse du déplacement
			speed = 163;
		    stringA = intvar - speed;
		    a.left = stringA + "px";
		}
		else
			return;
		//action = action + speed;
	//}
}
// La fonction qui fait défiler le menu vers la droite et arrete au px 0;
function SR2(texte, nbimages, action)
{
	var intvar = 0;
	var stringA;
	var speed;
    a=document.getElementById(texte).style;
    //while (action <= 136) {
	    if(a.left != "") {
	        intvar = parseInt(a.left);
	    }
		if (intvar<=0) {
			// Vitesse du déplacement
			speed = 163;
		    stringA = intvar + speed;
			a.left = stringA + "px";
		}
		else
			return;
		//action = action + speed;
	//}
}