var timer_move=null;
var pas = 3;

/**
 * Move a layer block to create a text moving effect
 *
 * @author Richard Marc, <marc@belenvol.fr>
 * @param sens int 1 to go on the top, -1 to go bottom
 * @param container id of the bloc which contain the bloc to move
 * @param contenu id of the Bloc to move
 * @return void
 */
function moveLayer(sens,container,contenu,adjust){
	var object = document.getElementById(contenu);
	
	if( object ){
		if( !parseInt(object.style.marginTop) ){
			object.style.marginTop = "0px";
		}
		
	    if( sens == 1 && parseInt(object.style.marginTop) + (pas*sens) > 0 ){ //end top
			clearTimeout(timer_move);
		}else if( sens == -1 && parseInt(object.style.marginTop) + (pas*sens) <  -((document.getElementById(contenu).offsetHeight/2) + parseInt(adjust)) ){ //end bottom
			clearTimeout(timer_move);
		}else{ //move it
	        object.style.marginTop = (parseInt(object.style.marginTop) + (pas*sens)) + "px";
			timer_move = setTimeout("moveLayer(" + sens + ",'" + container + "','" + contenu +"');", 30);
		}
	}
}

/**
 * Stop the moving
 *
 * @author Richard Marc, <marc@belenvol.fr>
 * @return void
 */
function stopMoveLayer(){
	clearTimeout(timer_move);
}
