//Objeto ticker.
function ticker(arrayNoticias,arrayEnlacesNoticias,ancho,alto,nombre,velocidad){
	//Propiedades
	this.arrayNoticias=arrayNoticias
	this.arrayEnlacesNoticias=arrayEnlacesNoticias
	this.ancho=ancho
	this.alto=alto
	this.margen=0
	this.nombre=nombre
	this.velocidad=velocidad
	this.continuar=1
	this.paso=1
	this.capa=new Object()
	//Metodos
	this.construir=construir
	this.pasar=pasar
	this.detener=detener
	this.comprobarH=comprobarH
}
	function comprobarH (nombreP) {
		
		olseTon = document.getElementById('bottom_div').offsetTop;
		hin = this.alto;
		
		if (olseTon >= hin) {
		texto=''
		texto+='<div id="'+this.nombre+'" name="'+this.nombre+'" style="position:relative; overflow:hidden; width:'+this.ancho+'; height:'+this.alto+'; left:0; top:0;">'
		
		for (j=0;j<2;j++){
			for (i=0;i<this.arrayNoticias.length;i++){
				texto+='<img src="/parques/imagenes/cuadraditosMenu.gif"> <a href="'+this.arrayEnlacesNoticias[i]+'" class="textoNegro2" onMouseOver="'+this.nombre+'.detener()" onMouseOut="'+this.nombre+'.detener()" target="_blank">'+this.arrayNoticias[i]+'</a><br><br>'
			}
		}
		
		texto+='<div id=\"bottom_div\" name=\"bottom_div\"> </div></div> '
		
		tdContenedor = document.getElementById(nombreP);
		
		tdContenedor.innerHTML=texto;
		this.capa=document.getElementById(this.nombre)
		}
		
		setInterval(this.nombre+'.pasar()',this.velocidad)
		
	}
	function construir(nombreP){
		texto=''
		texto+='<div id="'+this.nombre+'" name="'+this.nombre+'" style="position:relative; overflow:hidden; width:'+this.ancho+'; height:'+this.alto+'; left:0; top:0;">'
		
		for (i=0;i<this.arrayNoticias.length;i++){
			texto+='<img src="/parques/imagenes/cuadraditosMenu.gif"> <a href="'+this.arrayEnlacesNoticias[i]+'" class="textoNegro2" onMouseOver="'+this.nombre+'.detener()" onMouseOut="'+this.nombre+'.detener()" target="_blank">'+this.arrayNoticias[i]+'</a><br><br>'
		}
		
		texto+='<div id=\"bottom_div\" name=\"bottom_div\"> </div></div> '
		tdContenedor = document.getElementById(nombreP);
		tdContenedor.innerHTML=texto;
		this.capa=document.getElementById(this.nombre)
		
		setTimeout(this.nombre+".comprobarH('"+nombreP+"')",200);
		
	}
	function pasar(){

		var offsetScroll;

		if (!document.all && document.getElementById) offsetScroll = document.getElementById('bottom_div').offsetTop;
		else offsetScroll = this.capa.scrollHeight;
		
		if (this.continuar==1){
			this.margen+=this.paso
			this.capa.scrollTop=this.margen
			if (this.margen>=(offsetScroll/2))  this.margen=0;
		}
	}
	function detener(){
		this.continuar*=-1
	}


