// JavaScript by ikadu.net | Edited
var news = new Array(

/*1*/[ "Pacotes especiais para atores" , "blog/?p=64" ] ,
/*2*/[ "Quintas In Cena - Inscrições!" , "blog/?p=415" ] ,
/*3*/[ "Curso de Teatro para todas as idades ", "modalidades.html" ] ,
/*4*/[ "A estrutura do Atores in Cena... ainda não conhece?" , "companhia.html" ] ,
/*5*/[ "Veja nossa galeria de imagens e fotos" , "blog/?cat=3" ] ,



[]
) ;

var ticker_layer = false ;
var step_time = 25 ;
var freeze_time = 2000 ;
var news_index = 0 ;
var title_index = 0 ;
var end_title = "_" ; //caracter responsavel em 'formar' outros caracteres
var title_max_size = 175 ;

for (var i=0;i<news.length-1;i++){
	t=news[i][0].replace(/\&quot;/gi,'"');
	if (t.length>title_max_size){
		t = t.substring( 0 , title_max_size ) ;
		t=t.substring(0,t.lastIndexOf(' '));
		t+='...';
	}
	news[i][0]=t;
}

function funcao_noticias(){
	window.setTimeout( "roll_ticker()" , step_time ) ;
}

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 ) ;
	}
	else{
		news.length == news_index + 2 ? news_index = 0 : news_index++ ;
		title_index = 0 ;
		window.setTimeout( "roll_ticker()" , freeze_time ) ;
	}
}

