// JavaScript Document
function funcao_noticias(){
	//window.setTimeout( "roll_ticker()" , step_time ) ;
	window.setTimeout( "roll_ticker()" , 25 ) ;
}

function roll_ticker(){
	var title ;
	if ( title_index == 0 ){
		while ( document.getElementById('noticias').lastChild != null ){
			child = document.getElementById('noticias').lastChild ;
			document.getElementById('noticias').removeChild( child ) ;
		}
	}

	if ( news.length > news_index + 1 && news[news_index][0].length >= title_index ){
		title = news[ news_index ] ;
		document.getElementById('sistema_noticias').setAttribute( "href" , title[1] ) ;

		s_text = title[0].substring( title_index  , title_index + 1 ) ;
		title_index++ ;

		if ( document.getElementById('noticias').lastChild != null ){
			if ( document.getElementById('noticias').lastChild.nodeValue == "_" ){
				child = document.getElementById('noticias').lastChild ;
				document.getElementById('noticias').removeChild( child ) ;
			}
		}

		txt = document.createTextNode( s_text ) ;
		document.getElementById('noticias').appendChild( txt ) ;

		if ( title[0].length > title_index ) {
			if ( title_index % 10 != 0 ){
				txt = document.createTextNode( "_" ) ;
				document.getElementById('noticias').appendChild( txt ) ;
			}
		}
//		window.setTimeout( "roll_ticker()" , step_time ) ;
		window.setTimeout( "roll_ticker()" , 25 ) ;
	}
	else{
		news.length == news_index + 2 ? news_index = 0 : news_index++ ;
		title_index = 0 ;
//		window.setTimeout( "roll_ticker()" , freeze_time ) ;
		window.setTimeout( "roll_ticker()" , 2000 ) ;		
	}
}

