var ancho = 221 //anchura del cuadro
var alto = 200 //altura del cuadro
var marco = 0 //escribe 0 si no quieres borde
var fondo = '#f1f6ef' //color de fondo del cuadro
var pausilla = 4000 //tiempo de la pausa entre noticia en milisegundos (2000 = 2 segundos)
var destino = "_blank" //_blank para abrir enlaces en nueva ventana, _self en la misma.
var cursor = "default;"
var colTitular = '#749777' //color del texto del titular
var colTexto = '#999999' // color del texto de la noticia
var colFecha = '#797A76' //color del texto de la fecha
var colEnlace = '#660000' //color del texto del enlace
var fuente = "verdana" //fuente para los todos los textos
var tamTitular = '11' //tama&ntilde;o de la fuente del titular
var tamTexto = '10' //tama&ntilde;o de la fuente del texto de la noticia
var tamFecha = '9' // tama&ntilde;o de la fuente de la fecha
var tamEnlace = '8' // tama&ntilde;o de la fuente del enlace
var masInfo = true //Determina si se usa o no el enlace. true para usarlo. false para omitirlo
var poneFecha = true //true para poner fecha. false para omitirla. Si no se quiere fecha, dejar las comillas vacías ""

function noticia(titular,texto,fecha,enlace,destino)
{
	this.titular = titular
	this.texto = texto
	this.fecha= fecha
	this.enlace = enlace
	this.destino = destino
}

var det = false
var noticias = new Array()

//tildes -> http://es.wikipedia.org/wiki/Codificaci%C3%B3n_de_caracteres  á   \u00e1      é   \u00e9     í	\u00ed    ó \u00f3    ñ \u00f1  ú \u00fa  Á \u00c1  É \u00c9  Í \u00cd  Ó \u00d3   Ú \u00da salto de linea \u000D

noticias[0]= new noticia("Tren tur\u00edstico del Camino Natural de La  Alfranca","Hasta el 17 de octubre se podr\u00e1 realizar, en tren tur\u00edstico, el recorrido de 15,6 Km que une el barrio de Las Fuentes de Zaragoza con la finca de La Alfranca, donde se encuentra el Centro Internacional del Agua y el Medio Ambiente (CIAMA). Este recorrido, que tambi\u00e9n se puede realizar en bici o a pie, comienza en el \u00c1rea B\u00e1sica de Zaragoza, ubicada debajo del puente de Gim\u00e9nez Abad.","Agosto 2010","http://portal.aragon.es/portal/page/portal/MEDIOAMBIENTE/CIAMA/CaminoNatural","_blank")

noticias[1]= new noticia("Arag\u00f3n: la fuerza del Territorio",
"Bajo este lema el Gobierno de Arag\u00f3n ha elaborado un folleto divulgativo para explicar la ejecuci\u00f3n del Programa de Desarrollo Rural Sostenible 2010-2014, a trav\u00e9s de los Planes Comarcales. Dicho folleto est\u00e1 disponible en el nuevo sitio web habilitado por los Departamentos de Medio Ambiente y Presidencia en el portal de Internet del Gobierno de Arag\u00f3n.","Agosto 2010","http://portal.aragon.es/portal/page/portal/PDRS ","_blank")

noticias[2]= new noticia("M\u00e1xima activaci\u00f3n del operativo de prevenci\u00f3n y extinci\u00f3n de incendios." ,
"Desde el 1 de junio est\u00e1 desplegado \u000D el operativo contra incendios forestales para la campa\u00f1a de 2010, siendo los meses de julio, agosto y septiembre los de mayor activaci\u00f3n." ,"Agosto 2010","http://www.boa.aragon.es/cgi-bin/BoaAA/BRSCGI?CMD=VEROBJ&MLKOB=522691800404","_blank")





function escribe()
{
	document.write ('<div id="mami" style="width:' + ancho + 'px; height:' + alto + 'px; position:relative; overflow:hidden ">')
	document.write('<table background="images/pruebanoticias1.jpg" border = "' + marco + '" width="' + ancho + 'px" height="100%"><tr><td valign="top">')
	document.write ('<div id="uno" style="top:' + alto +'px; width:' + ancho + 'px; height:' + alto + 'px; ">')
	document.write ('<div class="titular">')
	document.write (noticias[0].titular)
	document.write ('</div>')
	document.write ('<div class="fecha">')
	document.write (noticias[0].fecha)
	document.write ('</div>')
	document.write ('<div class="texto">')
	document.write (noticias[0].texto)
	document.write ('</div>')
	if(masInfo == true)
	{
		document.write ('<a class="enlace" href="')
		document.write (noticias[0].enlace)
		document.write ('" target="' + destino + '">M\u00e1s informaci\u00f3n...</a>')
	}
	document.write ('</div>')
	document.write ('<div id="dos" style="top:' + (alto*2) +'px; width:' + ancho + 'px; height:' + alto + 'px; ">')
	document.write ('<div class="titular">')
	document.write (noticias[1].titular)
	document.write ('</div>')
	document.write ('<div class="fecha">')
	document.write (noticias[1].fecha)
	document.write ('</div>')
	document.write ('<div class="texto">')
	document.write (noticias[1].texto)
	document.write ('</div>')
	if(masInfo == true)
	{
		document.write ('<a class="enlace" href="')
		document.write (noticias[1].enlace)
		document.write ('" target = "' + destino + '">M\u00e1s informaci\u00f3n</a>')
	}
	document.write ('</div>')
	document.write('</td></tr></table>')
	document.write ('</div>')
	if(navigator.appName == "Netscape")
	{
		altoUno = document.getElementById('uno').offsetHeight
	}
	else
	{
		altoUno = document.getElementById('uno').clientHeight
	}
	document.getElementById('uno').onmouseover = 
		function()
		{
			det = true
			clearTimeout(tiempo)
		}
	document.getElementById('uno').onmouseout = 
		function()
		{
			det = false;
			clearTimeout(tiempo)
			escrolea()
		}
	document.getElementById('dos').onmouseover = 
		function()
		{
			det = true
			clearTimeout(tiempo)
		}
	document.getElementById('dos').onmouseout = 
		function()
		{
			det = false;
			clearTimeout(tiempo)
			escrolea()
		}
}

desp = 1
var cont = 1
var pos,pos2

function escrolea()
{
	pos = document.getElementById('uno').style.top
	pos = pos.replace(/px/,"");
	pos = pos.replace(/pt/,"");
	pos = new Number(pos);
	pos2 = document.getElementById('dos').style.top
	pos2 = pos2.replace(/px/,"");
	pos2 = pos2.replace(/pt/,"");
	pos2 = new Number(pos2);
	pos -= desp
	pos2 -= desp
	
	if (pos == desp)
	{
		var contenidos = ""
		document.getElementById('dos').style.top = alto + "px"
		document.getElementById('dos').childNodes[0].firstChild.nodeValue = noticias[cont].titular
		if(poneFecha == true)
		{
			document.getElementById('dos').childNodes[1].firstChild.nodeValue = noticias[cont].fecha
		}
		document.getElementById('dos').childNodes[2].firstChild.nodeValue = noticias[cont].texto
		if(masInfo == true)
		{
			document.getElementById('dos').childNodes[3].href = noticias[cont].enlace
		}
		document.getElementById('uno').style.top = 0
		
		if(cont == noticias.length-1)
		{
			cont=0
		}
		else
		{
			cont++
		}
		
		pausa()
		return false
	}
	else
	{
		if (pos2 == desp)
		{
			var contenidos = ""
			document.getElementById('uno').style.top = alto + "px"
			document.getElementById('uno').childNodes[0].firstChild.nodeValue = noticias[cont].titular
			if(poneFecha == true)
			{
				document.getElementById('uno').childNodes[1].firstChild.nodeValue = noticias[cont].fecha
			}
			document.getElementById('uno').childNodes[2].firstChild.nodeValue = noticias[cont].texto
			if(masInfo == true)
			{
				document.getElementById('uno').childNodes[3].href = noticias[cont].enlace
			}
			document.getElementById('dos').style.top = 0
			if(cont == noticias.length-1)
			{
				cont=0
			}
			else
			{
				cont++
			}
			pausa()
			return false
		}
		else
		{
			document.getElementById('uno').style.top = pos + "px"
			document.getElementById('dos').style.top = pos2 + "px"
		}
	}
	tiempo = window.setTimeout('escrolea()',60)
}

var tiempo
function pausa()
{
clearTimeout(tiempo)
if (det == false){
tiempo = setTimeout ('continuar()',1000)
}
}
function continuar()
{
if(det == false)
{escrolea()}
}

document.write('<style type="text/css">')
document.write ('#uno {')
document.write ('color: #006699;')
if(cursor == "pointer" || cursor == "hand"){
cursor = (navigator.appName == "Netscape")?'pointer;':'hand;';
}
document.write ('cursor:' + cursor + ";")
document.write ('position:absolute;}')
document.write ('#dos {')
document.write ('color: #006699;')
document.write ('cursor:' + cursor + ";")
document.write ('position:absolute;}')
document.write ('.titular{')
document.write ('color:' + colTitular +';')
document.write ('font-family:' + fuente + ';')
document.write ('font-size :' + tamTitular + 'px;font-weight:bold}')
document.write ('.texto{')
document.write ('color:' + colTexto + ';')
document.write ('font-family:' + fuente + ';')
document.write ('font-size:' + tamTexto + 'px;}')
if(poneFecha == true){
document.write ('.fecha{')
document.write ('color:' + colFecha +';')
document.write ('font-family:' + fuente + ';')
document.write ('font-size :' + tamFecha + 'px;font-weight:bold}')
}
else{
document.write ('.fecha{display: none;}')
}
document.write ('.enlace{')
document.write ('color:' + colEnlace + ';')
document.write ('font-family:' + fuente + ';')
document.write ('font-size:' + tamEnlace + 'px;}')
document.write ('</style>')
