
 function movE(i){
 	var top = i * pxToInt($("#masque").css("height"));
 	  $("#texte").animate({ 
			top: "-" + top + "px"
		  }, 500,'easeInSine' );
 }
 
function nbPage(){
	
	// Math.round() + 1
	var nbPage = pxToInt($("#texte").css("height")) / pxToInt($("#masque").css("height"));
	//alert($("#texte").css("height"));
	
	if ($("#texte").css("height") == 'auto'){
		nbPage = 6;
	}
	
	var i = 0;
	var navigate = "";
	if (nbPage != 1){
		while(i < nbPage){
			i2 = i + 1;
			navigate += "<a href='javascript:movE("+i+")'>"+i2+"</a>&nbsp;";
			//
			
		
		//document.getElementById('navigation').innerHTML = navigate;
		

			
			
			i++;
		}
		$("#navigation").html(navigate);
//		alert(navigate+"--");
	}
}


function pxToInt(valeur){
	 if (valeur.substr(0, 1 ) == "-"){
		 valeur = valeur.substr(1, valeur.length-1 );
	 }
	 return parseInt(valeur.substr(0, valeur.length-2 )) ;
} 

function down(){

	var diff = pxToInt($("#texte").css("top")) - pxToInt($("#texte").css("height"));
	
	diff = diff / pxToInt($("#masque").css("height")) + "-";
	diff = diff.substr(0,2);
	
	if (   diff !="-0"   ){
	  var topPx =  pxToInt( $("#texte").css("top") ) + pxToInt($("#masque").css("height")) ;
	  $("#texte").animate({ 
			top: "-" + topPx + "px"
		  }, 500 );
	}	  
}

function up(){
  var topPx =  pxToInt( $("#texte").css("top") ) - pxToInt($("#masque").css("height"));
 
  $("#texte").animate({ 
        top: "-" + topPx + "px"
      }, 500 );
} 
 
nbPage();
