//=================================
//	CONSTRUCTEUR
//=================================
function Defilement( p, d, o )
{
	// Propriétés
	this.objet 		= (document.getElementById) ? document.getElementById("photos_contenu") : document.all["photos_contenu"];
	this.timer 		= null;
	this.pas 		= 3;
	this.direction 	= 'right';
	//--------------
	
	// Méthodes
	this.clearTimer = clearTimer;
	this.autoMove = autoMove;
	//---------------
	
	// Au chargement de la page
	//this.autoMove();
}

//=================================
//	MOUVEMENT AUTOMATIQUE
//=================================
function autoMove()
{
	// MOUVEMENT
	try
	{
		if( this.direction == 'right' )
			// A DROITE
			this.objet.style.left = ( parseInt( this.objet.style.left ) - 1 ) + "px";
		else
			// A GAUCHE
			this.objet.style.left = ( parseInt( this.objet.style.left ) + 1 ) + "px";
	}
	catch( exception ) { }
	//----------------------------
	
	
	// EXTREMITES
	if( parseInt( this.objet.style.left ) <= -largeurMax )
	{
		// ON REPART A GAUCHE
		this.direction = 'left';
	}
	else if( parseInt( this.objet.style.left ) >= 0 )
	{
		// ON REPART A DROITE
		this.direction = 'right';
	}
	//----------------------------
	
	this.clearTimer();
	this.timer = setTimeout( "autoMove();", 30 );
}

//=================================
//	DEPLACEMENT A GAUCHE
//=================================
function moveLeft()
{
	if( parseInt( this.objet.style.left ) < 0 )
	{
		this.objet.style.left = ( parseInt( this.objet.style.left ) + 556 ) + "px";
	}
	
	/*
	this.clearTimer();
	this.timer = setTimeout( "moveLeft();", 30 );
	*/
}

//=================================
//	DEPLACEMENT A DROITE
//=================================
function moveRight()
{
	if( parseInt( this.objet.style.left ) > ( -largeurMax + 556 ))
	{
		this.objet.style.left = ( parseInt( this.objet.style.left ) - 556 ) + "px";
	}
	
	/*
	this.clearTimer();
	this.timer = setTimeout( "moveRight();", 30 );
	*/
}

//=================================
//	ARRET DU TIMER
//=================================
function clearTimer()
{
	clearTimeout( this.timer );
}



//=================================
//	LANCEMENT DU DEFILEMENT
//=================================
function loadDefilement( func )
{	
	var oldonload = window.onload;
	if ( typeof window.onload != 'function' )
	{
    	window.onload = func;
	} 
	else 
	{
		window.onload = function()
		{
			oldonload();
			func();
		}
	}
}
//=================================
//	CHARGEMENT
//=================================
loadDefilement( Defilement );