// JavaScript Document

var tailleDefil = 150;
var mult = 0;




function defil(sens){
	
	var obj = document.getElementById("div_2");	
	var posActuel = parseInt(mult) * parseInt(tailleDefil);
	
	if(sens == "h"){
		mult = parseInt(mult) - 1;
	} 
	if(sens == "b"){
		mult = parseInt(mult) + 1;
	}
	var newPos = parseInt(mult) *  parseInt(tailleDefil) ;
	newpos = parseInt(newPos);
	
	sizeTween = new Tween(obj.style,'top',Tween.regularEaseInOut,parseInt(posActuel),newPos,0.9,'px');
	sizeTween.start();
	
	posActuel = obj.style.top;
	posActuel = parseInt(posActuel.substring(0, posActuel.indexOf("px")));
	
	if(newPos >= 0) {
		sens = 'h';
	} else if(-(newPos - parseInt(tailleDefil)) >= obj.offsetHeight) {
		sens = 'b';
	} 
	window.setTimeout("defil('" + sens + "')",4000);
	
}

function start_defil (){
	//alert ('start');
	window.setTimeout("defil('h')",4000);
}
