function regalScroll(box){
if(document.getElementById(box)){
	this.box = document.getElementById(box);
	this.box.scrollObj = this;
	//alert("regalScroll(), this.box = " + this.box)
	this.divs = this.box.getElementsByTagName("div");
	for (var i=0; i<this.divs.length; i++){
		if(this.divs[i].className.indexOf("scrollbox_up_button") >= 0){
			this.up = this.divs[i];
		}
		if(this.divs[i].className.indexOf("scrollbox_down_button") >= 0){
			this.down = this.divs[i];
		}
		if(this.divs[i].className.indexOf("scrollbox_content") >= 0){
			this.content = this.divs[i];
		}
	}
	//this.maxtop = parseInt(this.box.offsetHeight) - parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight);
	this.setMaxtop = function(){
		this.maxtop = parseInt(this.box.offsetHeight) - parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight);
		if(this.maxtop > parseInt(this.up.offsetHeight)) this.maxtop = parseInt(this.up.offsetHeight);
	}
	this.setMaxtop();
	//alert(this.box.id + ".ul.height = " + parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight) + " && content: " + parseInt(this.box.offsetHeight));
	if(parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight) > parseInt(this.box.offsetHeight) - parseInt(this.up.offsetHeight)){
		//alert("scroll actif pour " + this.box.id)
		this.mintop = parseInt(this.up.offsetHeight);
		this.step = 20;
		this.interDown = ""
		this.interUp = "";
		this.up.box = this.box;
		this.up.parent = this;
		this.down.box = this.box;
		this.down.parent = this;
		// UP
		this.upOver = function (){
			//this.style.backgroundColor = "#7F9198";
			this.className += " scrollbox_over";
		}
		this.upOut = function (){
			this.parent.stopDown();
			this.parent.stopUp();
			//this.style.backgroundColor = "#B4BFC3";
			this.className = this.className.replace(" scrollbox_over", "");
		}
		this.initUp = function (){
			this.parent.stopUp();
			obj = this.parent;
			this.parent.interUp = setInterval("obj.getUp()", 100);
		}
		this.stopUp = function (){
			clearInterval(this.interUp);
		}
		this.stopUpBtn = function (){
			clearInterval(this.parent.interUp);
		}
		this.getUp = function (){
			if (parseInt(this.content.offsetTop) < this.mintop - this.step ){
				this.content.style.top = parseInt(this.content.offsetTop) + this.step + "px";
			}
			else{
				this.content.style.top = this.mintop + "px";
				this.stopUp();
			}
		}
		
		// DOWN
		this.downOver = function (){
			//this.style.backgroundColor = "#7F9198";
			this.className += " scrollbox_over";
		}
		this.downOut = function (){
			this.parent.stopDown();
			this.parent.stopUp();
			//this.style.backgroundColor = "#B4BFC3";
			this.className = this.className.replace("scrollbox_over", "");
		}
		this.initDown = function (){
			this.parent.stopDown();
			obj = this.parent;
			this.parent.interDown = setInterval("obj.getDown()", 100);
		}
		this.stopDown = function (){
			clearInterval(this.interDown);
		}
		this.stopDownBtn = function (){
			clearInterval(this.parent.interDown);
		}
		this.getDown = function (){
			if ( parseInt(this.content.offsetTop) > this.maxtop + this.step ){
				this.content.style.top = parseInt(this.content.offsetTop) - this.step + "px";
			}
			else{
				this.content.style.top = this.maxtop + "px";
				this.stopDown();
			}
		}
		
		this.up.onmouseover = this.upOver;
		this.up.onmouseout = this.upOut;
		this.up.onmousedown = this.initUp;
		this.up.onmouseup = this.stopUpBtn;
		
		this.down.onmouseover = this.downOver;
		this.down.onmouseout = this.downOut;
		this.down.onmousedown = this.initDown;
		this.down.onmouseup = this.stopDownBtn;
	}
	else{
		//alert("scroll inactif pour " + this.box.id);
		this.up.style.display = "none";
		this.down.style.display = "none";
	}
} else {
	this.setMaxtop = function(){
		
	}	
}
}


function regalScrollFamily(box){
if(document.getElementById(box)){
	this.box = document.getElementById(box);
	this.box.scrollObj = this;
	//alert("regalScroll(), this.box = " + this.box)
	this.divs = this.box.getElementsByTagName("div");
	for (var i=0; i<this.divs.length; i++){
		if(this.divs[i].className.indexOf("scrollbox_up_button") >= 0){
			this.up = this.divs[i];
		}
		if(this.divs[i].className.indexOf("scrollbox_down_button") >= 0){
			this.down = this.divs[i];
		}
		if(this.divs[i].className.indexOf("scrollbox_content") >= 0){
			this.content = this.divs[i];
		}
	}
	//this.maxtop = parseInt(this.box.offsetHeight) - parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight);
	this.setMaxtop = function(){
		this.maxtop = parseInt(this.box.offsetHeight) - parseInt(this.content.offsetHeight+20); //hack barbare
		if(this.maxtop > parseInt(this.up.offsetHeight)) this.maxtop = parseInt(this.up.offsetHeight);
	}
	this.setMaxtop();
	//alert(this.box.id + ".ul.height = " + parseInt(this.content.getElementsByTagName("ul")[0].offsetHeight) + " && content: " + parseInt(this.box.offsetHeight));
	if(parseInt(this.content.offsetHeight+20) > parseInt(this.box.offsetHeight) - parseInt(this.up.offsetHeight)){  //hack barbare
		//alert("scroll actif pour " + this.box.id)
		this.mintop = parseInt(this.up.offsetHeight);
		this.step = 20;
		this.interDown = ""
		this.interUp = "";
		this.up.box = this.box;
		this.up.parent = this;
		this.down.box = this.box;
		this.down.parent = this;
		// UP
		this.upOver = function (){
			//this.style.backgroundColor = "#7F9198";
			this.className += " scrollbox_over";
		}
		this.upOut = function (){
			this.parent.stopDown();
			this.parent.stopUp();
			//this.style.backgroundColor = "#B4BFC3";
			this.className = this.className.replace(" scrollbox_over", "");
		}
		this.initUp = function (){
			this.parent.stopUp();
			obj = this.parent;
			this.parent.interUp = setInterval("obj.getUp()", 100);
		}
		this.stopUp = function (){
			clearInterval(this.interUp);
		}
		this.stopUpBtn = function (){
			clearInterval(this.parent.interUp);
		}
		this.getUp = function (){
			if (parseInt(this.content.offsetTop) < this.mintop - this.step ){
				this.content.style.top = parseInt(this.content.offsetTop) + this.step + "px";
			}
			else{
				this.content.style.top = this.mintop + "px";
				this.stopUp();
			}
		}
		
		// DOWN
		this.downOver = function (){
			//this.style.backgroundColor = "#7F9198";
			this.className += " scrollbox_over";
		}
		this.downOut = function (){
			this.parent.stopDown();
			this.parent.stopUp();
			//this.style.backgroundColor = "#B4BFC3";
			this.className = this.className.replace("scrollbox_over", "");
		}
		this.initDown = function (){
			this.parent.stopDown();
			obj = this.parent;
			this.parent.interDown = setInterval("obj.getDown()", 100);
		}
		this.stopDown = function (){
			clearInterval(this.interDown);
		}
		this.stopDownBtn = function (){
			clearInterval(this.parent.interDown);
		}
		this.getDown = function (){
			if ( parseInt(this.content.offsetTop) > this.maxtop + this.step ){
				this.content.style.top = parseInt(this.content.offsetTop) - this.step + "px";
			}
			else{
				this.content.style.top = this.maxtop + "px";
				this.stopDown();
			}
		}
		
		this.up.onmouseover = this.upOver;
		this.up.onmouseout = this.upOut;
		this.up.onmousedown = this.initUp;
		this.up.onmouseup = this.stopUpBtn;
		
		this.down.onmouseover = this.downOver;
		this.down.onmouseout = this.downOut;
		this.down.onmousedown = this.initDown;
		this.down.onmouseup = this.stopDownBtn;
	}
	else{
		//alert("scroll inactif pour " + this.box.id);
		this.up.style.display = "none";
		this.down.style.display = "none";
	}
}
}