var scrollTimers = new Array();
var scrollPositions = new Array();

function scrollCheckPositions(id,positions)
{

    if(!scrollPositions[id])
    {

        scrollPositions[id] = new Array();

    }

    scrollPositions[id][0] = (!scrollPositions[id][0] || scrollPositions[id][0] > positions)?0:scrollPositions[id][0];
    

}

function scrollCheckTimer(id)
{

    if(!scrollTimers[id])
    {

        scrollTimers[id] = new Array();
        
    }

}

function scrollDiv(id,mode,step,position,amount)
{

    scrollCheckTimer(id);
    
    switch(mode)
    {
    
        case "left" :

            position = document.getElementById(id).scrollLeft + amount;
    
            scrollDivLeft(id,step,position);

            break;
    
        case "right" :

            position = document.getElementById(id).scrollLeft - amount;
    
            scrollDivRight(id,step,position);

            break;

        case "position" :

            clearTimeout(scrollTimers[id][1]);

        case "auto" :

            var move = document.getElementById(id).scrollLeft - position;
            
            switch(true)
            {
            
                case (move < 0) :

                    scrollDivLeft(id,step,position);

                    break;
            
                case (move > 0) :

                    scrollDivRight(id,step,position);

                    break;

                case (move == 0) :

                    break;

                default :

            }

            break;

        default :

    }

}

function scrollDivLeft(id,step,position)
{

    clearTimeout(scrollTimers[id][0]);

    if(document.getElementById(id).scrollLeft < position)
    {

        document.getElementById(id).scrollLeft = (document.getElementById(id).scrollLeft + step <= position)?(document.getElementById(id).scrollLeft + step):position;

        scrollTimers[id][0] = setTimeout("scrollDivLeft('" + id + "'," + step + "," + position + ")", 10);

    }
    
}

function scrollDivRight(id,step,position)
{

    clearTimeout(scrollTimers[id][0]);

    if(document.getElementById(id).scrollLeft > position)
    {

        document.getElementById(id).scrollLeft = (document.getElementById(id).scrollLeft - step >= position)?(document.getElementById(id).scrollLeft - step):position;

        scrollTimers[id][0] = setTimeout("scrollDivRight('" + id + "'," + step + "," + position + ")", 10);

    }
    
}

function scrollAutoslide(id,step,width,positions,tempo)
{

    scrollCheckTimer(id);
    scrollCheckPositions(id,positions);

    var slideto = scrollPositions[id][0] * width;

    ++scrollPositions[id][0];

    scrollDiv(id,"auto",step,slideto);

    scrollTimers[id][1] = setTimeout("scrollAutoslide('" + id + "'," + step + "," + width + "," + positions + "," + tempo + ")", tempo);
   
}
function show(thingId1,thingId2){
	document.getElementById(thingId1).setAttribute("className", "droite_multimedia visible");
	document.getElementById(thingId2).setAttribute("className", "droite_multimedia invisible");	
	document.getElementById(thingId1).setAttribute("class", "droite_multimedia visible");
	document.getElementById(thingId2).setAttribute("class", "droite_multimedia invisible");	

}
function show2(thingId1,total_page){
	for(i=1;i <= total_page;i++){
		if(thingId1==i){
			document.getElementById('actu_' + thingId1).setAttribute("className", "visible");
			document.getElementById('actu_' + thingId1).setAttribute("class", "visible");
			document.getElementById('pagination_' + thingId1).setAttribute("className", "class_pagination1");
			document.getElementById('pagination_' + thingId1).setAttribute("class", "class_pagination1");

			
		}else{
			document.getElementById('actu_' + i).setAttribute("className", "invisible");
			document.getElementById('actu_' + i).setAttribute("class", "invisible");				
			document.getElementById('pagination_' + i).setAttribute("className", "class_pagination2");
			document.getElementById('pagination_' + i).setAttribute("class", "class_pagination2");
			
		}	
	}
}
function show3(thingId1){
	document.getElementById(thingId1).setAttribute("className", "visible");
	document.getElementById(thingId1).setAttribute("class", "visible");	

}
function visibilite(thingId)
{
	var targetElement;
	targetElement = document.getElementById(thingId) ;
	if (targetElement.style.display == "none")
	{
		targetElement.style.display = "" ;
	} else {
		targetElement.style.display = "none" ;
	}
}

function changerTaille(modif) {
var str=document.getElementById("texte").style.fontSize;
	if(str=='') str="10px";
	var t  = str.substr(0,2)
	t = parseInt(t) + parseInt(modif);	
	document.getElementById("texte").style.fontSize = t + "px";
}



function montre_div(div1,div2)
{
		document.getElementById(div1).style.display = "" ;
		document.getElementById(div2).style.display = "none" ;
}	

