function ScrollObject(contenido,contenedor,contenedor2,speed) { 
	this.objContainer=new ConstructObject(contenedor,contenedor2,null); 
	this.objScroller=new ConstructObject(contenido,contenedor,contenedor2); 
	this.objScroller.moveTo(0,0);
	this.objContainer.css.visibility='visible';
	this.MoveAreaUp=MoveAreaUp;this.MoveAreaDown=MoveAreaDown;
	this.MoveAreaLeft=MoveAreaLeft;this.MoveAreaRight=MoveAreaRight;  
	this.PerformScroll=PerformScroll;
	this.PerformScrollH=PerformScrollH;
	this.CeaseScroll=CeaseScroll;
	this.controlScroll=controlScroll;
	this.timer = null;
	this.loop = false;
	this.speed = (speed)?speed:50;

	this.obj = contenedor + "ScrollObject";
	eval(this.obj + "=this");
	return this 
} 

function MoveAreaDown(move) {
	if(this.objScroller.y>0-this.objScroller.el.scrollHeight+this.objContainer.clipHeight){
		this.objScroller.moveTo(0,this.objScroller.y-move) 
		if(this.loop) setTimeout(this.obj+".MoveAreaDown("+move+")",this.speed) 
	} 
} 
	
function MoveAreaUp(move) { 
	if(this.objScroller.y<0){ 
		this.objScroller.moveTo(0,this.objScroller.y-move) 
		if(this.loop) setTimeout(this.obj+".MoveAreaUp("+move+")",this.speed) 
	} 
}
function PerformScroll(move) { 
	this.loop=true; 
	if(move>0) this.MoveAreaDown(move) 
	else this.MoveAreaUp(move) 
}

function MoveAreaRight(move) {
	if(this.objScroller.x>-this.objScroller.w+this.objContainer.clipWidth){
		this.objScroller.moveTo(this.objScroller.x-move,0) 
		if(this.loop) setTimeout(this.obj+".MoveAreaRight("+move+")",this.speed) 
	} 
} 
	
function MoveAreaLeft(move) { 
	if(this.objScroller.x<0){ 
		this.objScroller.moveTo(this.objScroller.x-move,0) 
		if(this.loop) setTimeout(this.obj+".MoveAreaLeft("+move+")",this.speed) 
	} 
}

function PerformScrollH(move) { 
	this.loop=true; 
	if(move>0) this.MoveAreaRight(move) 
	else this.MoveAreaLeft(move) 
} 
	 
function CeaseScroll() { 
	this.loop=false 
	if(this.timer) clearTimeout(this.timer) 
}
function controlScroll(obj){
	//alert(this.objScroller.y)
	//alert(0-this.objScroller.el.scrollHeight+this.objContainer.clipHeight)
	if(this.objScroller.y>=0-this.objScroller.el.scrollHeight+this.objContainer.clipHeight){
		document.getElementById(obj).style.visibility='visible'
	}else{
		this.objScroller.moveTo(0,0)
		document.getElementById(obj).style.visibility='hidden'
	}
}