function WriteLayer(ID,parentID,sText) {
 if (document.layers) {
   var oLayer;
   if(parentID){
     oLayer = eval('document.' + parentID + '.document.' + ID + '.document');
   }else{
     oLayer = document.layers[ID].document;
   }
   oLayer.open();
   oLayer.write(sText);
   oLayer.close();
 }
 else if (parseInt(navigator.appVersion)>=5&&navigator.
appName=='Netscape') {
   document.getElementById(ID).innerHTML = sText;
 }
 else if (document.all) document.all[ID].innerHTML = sText
}

var posicao_atual = 0;
var tempo = 0;
var tempo_troca = 10000; // Tempo de troca entre notícias em milissegundos 

var news_texto = new Array(5);
news_texto[1]="<a href='http://unesp.br/int_noticia_imgesq.php?artigo=8021' target='_blank' >Estudo de Rio Preto sobre girinos atrai estudioso americano</a>";
news_texto[2]="<a href='http://unesp.br/int_noticia_imgesq.php?artigo=8022' target='_blank' >Universidade recebe homenagem da Polícia Militar</a>";
news_texto[3]="<a href='http://unesp.br/int_noticia_imgesq.php?artigo=8020' target='_blank' >Pesquisadores da Espanha visitam Araraquara em busca de parcerias</a>";
news_texto[4]="<a href='http://unesp.br/int_noticia_imgesq.php?artigo=8012' target='_blank' >Unesp é primeira parceira da Wikipedia no Brasil</a>";
news_texto[5]="<a href='http://unesp.br/int_noticia_imgesq.php?artigo=8018' target='_blank' >Aprovados no Vestibular 2012 fazem matrícula dias 8 e 9</a>";

function UpdateNews() {

	posicao_atual=posicao_atual+1;
	if (posicao_atual==6) { posicao_atual=1; }

	WriteLayer('texto_news',null,news_texto[posicao_atual]);

	tempo = setTimeout('UpdateNews()', tempo_troca);

}

function AvancaNews() {

	clearTimeout(tempo);

	posicao_atual=posicao_atual+1;
	if (posicao_atual==6) { posicao_atual=1; }

	WriteLayer('texto_news',null,news_texto[posicao_atual]);

	tempo = setTimeout('UpdateNews()', tempo_troca);

}

function VoltaNews() {

	clearTimeout(tempo);

	posicao_atual=posicao_atual-1;
	if (posicao_atual<=0) { posicao_atual=5; }

	WriteLayer('texto_news',null,news_texto[posicao_atual]);

	tempo = setTimeout('UpdateNews()', tempo_troca);

}

function NumeroNews(nova_posicao) {

	clearTimeout(tempo);

	posicao_atual=nova_posicao;

	WriteLayer('texto_news',null,news_texto[posicao_atual]);

	tempo = setTimeout('UpdateNews()', tempo_troca);

}

