

//////////////----*************************************************** ---------
//////////////----Fonctions de gestion defilement horizontal contenu des etapes
//////////////----*************************************************** ---------
/*



@todo revenir position 0 quand on arrive a la fin du defilement horizontal

*/
//interval pour scroller
var movingScrollableAreaInterval   = 0;
var movingScrollableAreaCurrentWay = '';
var movingScrollableAreaSpeed      = 200;
var movingScrollableAreaDistance   = 50;

//Timer pour commencer scrolling apres mouseover de 1 seconde
var delayToRunCommand              = 0;
//Temp du timer precedent
var mouseOverDelayBeforeAction     = 400;

var containerScrollable            = 'internal';

///Mettre en commentaire pour desactiver
function seeControlFlow( inooo )
{
//$('infobottom_style').innerHTML +=inooo+'<br />';
}

function delayMouseOverArrow( ldirection, lidofscroll )
{
  seeControlFlow( 'start timer mouse on' );
  delayToRunCommand = setTimeout( "moveScrollableArea( '"+ldirection+"', '"+lidofscroll+"' );", mouseOverDelayBeforeAction );
}

function moveScrollableArea( ldirection, lidofscroll )
{	

	if( movingScrollableAreaInterval == 0 )
	{
		switch( ldirection )
		{
		case 'left' :
		
			 movingScrollableAreaInterval   = setInterval( "moveAreaToLeft( '"+lidofscroll+"' )", movingScrollableAreaSpeed );
			 movingScrollableAreaCurrentWay = 'left';
		break;
		
		case 'right' :
		
			movingScrollableAreaInterval   = setInterval( "moveAreaToRight( '"+lidofscroll+"' )", movingScrollableAreaSpeed );
			movingScrollableAreaCurrentWay = 'right';
		break;
		}
	}
}

function moveAreaToLeft( larea )
{
  var leftPos = Math.abs( parseInt( $(larea).style.left.replace('px','') ) );
  var totalWidth = $(larea).scrollWidth;
  
  if( leftPos < totalWidth - 250 ) {
    new Effect.MoveBy(larea, 0, 0 - movingScrollableAreaDistance , { duration: 0.2 });
  }
}

function moveAreaToRight( larea )
{
  var leftPos = parseInt( $(larea).style.left.replace('px','') );
  if( leftPos < 0 ) {
    new Effect.MoveBy(larea, 0, movingScrollableAreaDistance , { duration: 0.2 });
  }
}

function stopMovingScrollableArea()
{
	if( movingScrollableAreaInterval != 0 )
	{
	clearInterval( movingScrollableAreaInterval );
	movingScrollableAreaCurrentWay = '';
	movingScrollableAreaInterval   = 0
	seeControlFlow( 'STOP moving' );
	}
	else
	{
	seeControlFlow( 'moving delayed' );
		if( delayToRunCommand != 0 )
		{
		clearTimeout( delayToRunCommand );
		delayToRunCommand = 0;
		}
	}
}



//////////////----*************************************************** ---------
//////////////----Fin fonctions de gestion defilement horizontal contenu des etapes
//////////////----*************************************************** ---------
