function noticia(titular,texto,fecha, enlace, target, title){
	    this.titular = titular;
	    this.texto = texto;
	    this.fecha = fecha;
	    this.enlace = enlace;
	    this.target = target;
	    this.title = title;
	}
	
	var det = false;
	desp = 1;
	var cont = 1;
	var pos,pos2;
	var cuantos;
	var tiempo;
	
	
	function escribe(i){
	
	cuantos=i;
	if(i == 1)
	{cont=0;}
	
	document.write ('<div id="noticias_roll">');
	document.write('<table><tr><td>');
	
	for(h=0; h<2; h++){
		document.write ('<div id="noticias'+h+'" class="noticia">');
		for(j=0; j<i; j++){
			document.write ('<div id="item'+h+'_'+j+'" class="item">');
			document.write ('<div class="fecha">');
			document.write (noticias[j].fecha);
			document.write ('</div>');
			document.write ('<div class="titular">');
			document.write ('<a href="');
			document.write (noticias[j].enlace);
			document.write ('"');
			if(noticias[j].target != 0){
				document.write ('target="_blank"');
			}
			document.write(' title="');
			document.write(noticias[j].title);
			document.write('"');
			document.write ('>');
			document.write (noticias[j].titular);
			document.write ('</a>');
			document.write ('</div>');
			document.write ('<div class="texto">');
			document.write (noticias[j].texto);
			document.write ('</div>');
			document.write ('</div>');
		}
		document.write ('</div>');
	}
	
	document.write('</td></tr></table>');
	document.write ('</div>');
	
	var alto =document.getElementById('noticias_roll').clientHeight;
	var altoItems=0;
	for(h=0; h<2; h++){
		document.getElementById('noticias'+h).style.top = alto + "px"
		alto= alto+document.getElementById('noticias'+h).clientHeight;
		/*altoItems=0;
		for(j=0; j<i; j++){
			document.getElementById('item'+h+'_'+j).style.top = altoItems + "px"
			altoItems= altoItems+document.getElementById('item'+h+'_'+j).clientHeight;
		}*/
	}
		
	for(j=0; j<2; j++){
		document.getElementById('noticias'+j).onmouseover =function(){
		    det = true;
		    clearTimeout(tiempo);
		    }
		document.getElementById('noticias'+j).onmouseout =function(){
		    det = false;
		    clearTimeout(tiempo);
		    escrolea();
		    }
	}
	
	}
	
	function escrolea(){
		pos = document.getElementById('noticias0').offsetTop;
		pos2 = document.getElementById('noticias1').offsetTop;
		
		pos -= desp;
		pos2 -= desp;
		
		var alto =document.getElementById('noticias0').clientHeight;
		var totalAlto =document.getElementById('noticias_roll').clientHeight;
		if (pos == desp){
			  document.getElementById('noticias0').style.top = 0+ "px";
			  document.getElementById('noticias1').style.top = document.getElementById('noticias0').clientHeight+ "px";
			  pausa();
			  return false;
		}
		else{
			if (pos2 == desp){
				document.getElementById('noticias1').style.top = 0+ "px";
				document.getElementById('noticias0').style.top = document.getElementById('noticias1').clientHeight+ "px";
				pausa();
				return false;
			}
			else{
				
				document.getElementById('noticias0').style.top = pos + "px"
		        document.getElementById('noticias1').style.top = pos2 + "px"
		        for(j=0; j<2;j++){
			        for(k=0;k<cuantos;k++){
						if(document.getElementById('noticias'+j).offsetTop == -document.getElementById('item'+j+'_'+k).offsetTop){
							pausa();
							return false;
						}
					}
				}
			}
		}
		tiempo = window.setTimeout('escrolea()',50);
		
	}

	function pausa()
	{
	clearTimeout(tiempo)
	if (det == false){
	    tiempo = setTimeout ('continuar()',2000)
	    }
	}
	function continuar()
	{
	if(det == false)
	    {escrolea()}
	}
