/*****************************************************************************
Autor Helena j.H.
21/12/05 
Script no autorizado para uso ni distribución
http://javascript.tunait.com/
tunait@yahoo.com 
******************************************************************************/
var pausilla = 3000 

function noticia(titular,texto,fecha,enlace,destino, cni){
	this.titular = titular
	this.texto = texto
	this.fecha= fecha
	this.enlace = enlace
	this.destino = destino
	this.cni = cni;
}
var noticias = new Array()
var det = false
desp = 1
var cont = 1
var pos,pos2
var tiempo
function pausa()
{
clearTimeout(tiempo)
if (det == false){
	tiempo = setTimeout ('continuar()',2000)
	}
}
function continuar()
{
if(det == false)
	{tunEscrolea()}
}
var obj
var despla = 5
var iniciado = false
function cValores(id){
	if(cont > noticias.length-1){cont = 0}
	document.getElementById(id).style.top = alto + "px"
	f = document.getElementById('fecha' + id)
	t = document.getElementById('titulo' + id)
	t.style.color = noticias[cont].cni ? '#00342D' : '#ffffff';
	a = document.getElementById('ampliar' + id)
	f.firstChild.nodeValue = noticias[cont].fecha
	t.href = noticias[cont].enlace
	t.firstChild.nodeValue = noticias[cont].titular
	if(noticias[cont].texto != ""){
		a.style.display = "block"
	}
	else{
		a.style.display = "none"
	}
	a.href = noticias[cont].texto 
	if(cont == noticias.length-1)
		{cont=0}
	else{cont++}
}
function tunEscrolea(){
	tunObj1 = document.getElementById('uno')
	tunObj2 = document.getElementById('dos')
	pos = tunObj1.style.top
	pos = pos.replace(/px/,"");
	pos = pos.replace(/pt/,"");
	pos = new Number(pos);
	pos2 = tunObj2.style.top
	pos2 = pos2.replace(/px/,"");
	pos2 = pos2.replace(/pt/,"");
	pos2 = new Number(pos2);
	if(!iniciado){ 
		pos = 0; pos = alto; iniciado = true
		tunObj1.onmouseover =function(){
			det = true
			clearTimeout(tiempo)
		}
		tunObj1.onmouseout =function(){
			det = false;
			clearTimeout(tiempo)
			tunEscrolea()
		}
		tunObj2.onmouseover =function(){
			det = true
			clearTimeout(tiempo)
			}
		tunObj2.onmouseout =function(){
			det = false;
			clearTimeout(tiempo)
			tunEscrolea()
			}
	}
	pos -= desp
	pos2 -= desp
	if (Math.abs(pos) > alto){
		tunObj1.style.zIndex = 100;
		tunObj2.style.zIndex = 99;
		cValores('uno')
		pausa()
		return false
	}
	if (Math.abs(pos2) > alto){
		tunObj2.style.zIndex = 100;
		tunObj1.style.zIndex = 99;
		cValores('dos')
		pausa()
		return false
	}
	tunObj1.style.top = pos+ "px"
	tunObj2.style.top = pos2+ "px"
	//document.getElementById("visorpo1").value = pos
	//document.getElementById("visorpo2").value = pos2
	tiempo = window.setTimeout('tunEscrolea()',50)
}
