function ScrollVert(nameOfThis,pas,id,tdName,nbVisible,butLeft,butRight) { 
    this.nameOfThis = nameOfThis; 
    this.pas = pas; 
    this.id = id; 
	this.object = document.getElementById(id);
	this.offset = 0;
	this.tdName = tdName;
	this.nbVisible = nbVisible;
	this.butLeft = butLeft;
	this.butRight = butRight;
	this.object.style.marginLeft="0px";
	this.activate=1;
	this.updateButton();
} 
 
ScrollVert.prototype = { 	
    getRealSize:function(size){ 
       //récupération de la taille sans l'unité
		return size=size.substr(0, (size.length - 2));
    }, 
	
	activateAllButton:function(){
		this.activate=1;
	},

	desactivateAllButton:function(){
		this.activate=0;
	},
	
	scrollright:function(){
		margin=parseInt(this.getRealSize(this.object.style.marginLeft))-parseInt(this.pas);
		this.desactivateAllButton(); //permet d'éviter le double clic
		tmp=this;
		$("#"+this.id).animate( {marginLeft:margin},"slow",function(){
			tmp.activateAllButton();
		});
	},

	scrollleft:function(){			
		margin=parseInt(this.getRealSize(this.object.style.marginLeft))+parseInt(this.pas);
		this.desactivateAllButton(); //permet d'éviter le double clic
		tmp=this;
		$("#"+this.id).animate( {marginLeft:margin},"slow",function(){
			tmp.activateAllButton();
		});
	},
	
	updateButton:function(){
		max=document.getElementsByTagName(this.tdName).length-this.nbVisible; //nombre max de scroll
	
		if(this.offset < max){
			document.getElementById(this.butRight).src="images/Ractive.png";
		}
		else{
			document.getElementById(this.butRight).src="images/Rinactive.png";
		}
		
		if(this.offset > 0){
			document.getElementById(this.butLeft).src="images/Lactive.png";
		}
		else{
			document.getElementById(this.butLeft).src="images/Linactive.png";
		}
	},
	
	scroll:function(sens){
		if(this.activate==0)
			return 0;
		max=document.getElementsByTagName(this.tdName).length-this.nbVisible; //nombre max de scroll

		if(sens=="right" && this.offset < max){
			//si on est pas à la fin du document
			this.scrollright();
			this.offset+=1;
		}
		else if(sens=="left" && this.offset > 0){
			//si on est pas au début du document
			this.scrollleft();
			this.offset-=1;
		}	
		
		//modification des boutons de scroll
		this.updateButton();
	}
	
	
} 
