//***********************************************************
//	Clase scroll copyrigth ©2002 Gustavo Cerdá (tr3sw)
//***********************************************************
	var insScroll=0;
	function ScrollObj(objPadre,limiteObj,name){
	// Variables staticas o de clase
		this.instancia = insScroll++;

	// Variables privadas
		this.padre = objPadre;
		this.timer = 1;
		this.name = (name) ? name : "scroll";
		this.limite = (limiteObj) ? limiteObj : false;

	// Variables publicas
		this.velocidad = 100;
		this.incremento = 1;

	// Metodos de la clase
		this.stop = stopMethod;
		this.bajar = bajarMethod;
		this.subir = subirMethod;
		this.izda = izdaMethod;
		this.dcha = dchaMethod;
		this.calculaIncremento = calculaIncrementoMethod;
		
		function calculaIncrementoMethod(obj) {
			var retorno;
			retorno = Math.ceil(obj.getHeightContent()%10);
			//retorno = Math.ceil((this.limite.conti.getWidth()-obj.getHeightContent())%6);
			//alert(this.limite.conti.getWidth() + " - " + obj.getHeightContent() + " = " + retorno);
			if (retorno == 0){
				return 1;
			}else{
				return retorno;
			}
		}

		function stopMethod(){
			clearTimeout(this.timer);
		}

		function bajarMethod(){
			if(this.limite && !this.limite.desplazaB()){
				this.stop();
				return false;
			}
			clearTimeout(this.timer); var posicion = this.padre.getTop();
			posicion += this.incremento; this.padre.setTop(posicion);
			this.timer=setTimeout("document.getElementById(\"" +this.padre.id+ "\")."+this.name+".bajar()",this.velocidad);
		}

		function subirMethod(){
			if(this.limite && !this.limite.desplazaA()){
				this.stop();
				return false;
			}
			clearTimeout(this.timer); var posicion = this.padre.getTop();
			posicion -= this.incremento; this.padre.setTop(posicion);
			this.timer=setTimeout("document.getElementById(\"" +this.padre.id+ "\")."+this.name+".subir()",this.velocidad);
		}

		function izdaMethod(){
			if(this.limite){
				if(!this.limite.desplazaI()){
					this.stop();
					return false;
				}
			}
			clearTimeout(this.timer); var posicion = this.padre.getLeft();
			posicion -= this.incremento; this.padre.setLeft(posicion);
			this.timer=setTimeout("document.getElementById(\"" +this.padre.id+ "\")."+this.name+".izda()",this.velocidad);
		}

		function dchaMethod(){
			if(this.limite){
				if(!this.limite.desplazaD()){
					this.stop();
					return false;
				}
			}
			clearTimeout(this.timer); var posicion = this.padre.getLeft();
			posicion += this.incremento; this.padre.setLeft(posicion);
			this.timer=setTimeout("document.getElementById(\"" +this.padre.id+ "\")."+this.name+".dcha()",this.velocidad);
		}
		return this;
	}
//******************************************************************
// Fin del objeto Scroll
//******************************************************************

//***********************************************************
//	Clase Limites copyrigth ©2002 Gustavo Cerdá (tr3sw)
//***********************************************************
var insLimites = 0;
function Limites(continenteObj,contenidoObj){
	// Variables staticas o de clase
	this.instancia = insLimites++;
	
	// Variables privadas
	this.conti = continenteObj;
	this.conte = contenidoObj;
	
	// Variables publicas
	this.finalContinente = 0;
	this.finalContenido = 0;
	
	// Metodos de la clase
	this.desplazaA = desplazaAMethod;
	this.desplazaB = desplazaBMethod;
	this.desplazaI = desplazaIMethod;
	this.desplazaD = desplazaDMethod;
	
	function desplazaAMethod(){
		this.finalContinente = this.conti.getHeight();
		this.finalContenido = this.conte.getTop()+this.conte.getHeightContent();
		return (this.finalContenido > this.finalContinente);
	}
	
	function desplazaBMethod(){
		this.finalContinente = this.conti.getTop();
		this.finalContenido = this.conte.getTop();
		return ( this.finalContenido < 0 );
	}
	
	function desplazaIMethod(){
		this.finalContinente = this.conti.getWidth();
		this.finalContenido = this.conte.getLeft()+this.conte.getWidthContent();
		return (this.finalContenido > this.finalContinente);
	}
	
	function desplazaDMethod(){
		this.finalContinente = this.conti.getLeft();
		this.finalContenido = this.conte.getLeft();
		return (this.finalContenido < 0);
	}
	return this;
}
