
function Scroll(id,cr,cn) {
	this.cCtr=new Capa(cr)
	this.cCtr.mostrar()
	this.cCnt=new Capa(cn)
	this.cCnt.mostrar()
	this.cCnt.pnY(0)
	var al=this.cCnt.al-this.cCtr.al
	this.nY=(al<0?0:-5-al)
	this.oTO=0
	this.obj=id
	eval(this.obj+'=this')
}

Scroll.prototype.goTop=function() {
	if (this.cCnt.y<0) {
		this.stop()
		this.cCnt.pnY(0)
	}
}

Scroll.prototype.goDown=function() {
	if (this.cCnt.y<0) {
		this.cCnt.mvV(5)
		this.oTO=setTimeout(this.obj+'.goDown()',50)
	}
	else this.stop()
}

Scroll.prototype.goBottom=function() {
	if (this.cCnt.y>this.nY) {
		this.stop()
		this.cCnt.pnY(this.nY)
	}
}

Scroll.prototype.goUp=function() {
	if (this.cCnt.y>this.nY) {
		this.cCnt.mvV(-5)
		this.oTO=setTimeout(this.obj+'.goUp()',50)
	}
	else this.stop()
}

Scroll.prototype.stop=function() {
	if (this.oTO!=0) {
		clearTimeout(this.oTO)
		this.oTO=0
	}
}