function animaBanner() {
  trocaTextoDoBanner(3000, 80, "/imagens/banner_texto2.gif");
}

function trocaTextoDoBanner(tempoDeInicio, tempoDeTransicao, novoTexto) {
  trocaRetangulo(4, tempoDeInicio, novoTexto);
  trocaRetangulo(7, tempoDeInicio + tempoDeTransicao, novoTexto);
  trocaRetangulo(1, tempoDeInicio + (tempoDeTransicao * 2), novoTexto);
  trocaRetangulo(6, tempoDeInicio + (tempoDeTransicao * 3), novoTexto);
  trocaRetangulo(5, tempoDeInicio + (tempoDeTransicao * 4), novoTexto);
  trocaRetangulo(8, tempoDeInicio + (tempoDeTransicao * 5), novoTexto);
  trocaRetangulo(2, tempoDeInicio + (tempoDeTransicao * 6), novoTexto);
  trocaRetangulo(10, tempoDeInicio + (tempoDeTransicao * 7), novoTexto);
  trocaRetangulo(9, tempoDeInicio + (tempoDeTransicao * 8), novoTexto);
  trocaRetangulo(3, tempoDeInicio + (tempoDeTransicao * 9), novoTexto);
  if (novoTexto == "/imagens/banner_texto2.gif") {
    novoTexto = "/imagens/banner_texto.gif";
  } else {
    novoTexto = "/imagens/banner_texto2.gif"
  }
  setTimeout("trocaTextoDoBanner(6000, 100, '" + novoTexto + "')", ((tempoDeInicio*2) + (tempoDeTransicao*10)));
}

function trocaRetangulo(id, tempo, novoTexto) {
  retangulo = "bannerRetangulo" + id;
  setTimeout("setaEstiloBackground('" + retangulo + "', '" + novoTexto + "')", tempo);
}

function setaEstiloBackground(id, novaImagem) {
  document.getElementById(id).style.backgroundImage = "url('" + novaImagem + "')";
}

function setaClass(id, novaClass) {
  document.getElementById(id).className = novaClass;
}

function opacity(id, opacStart, opacEnd, millisec) {
  //speed for each frame
  var speed = Math.round(millisec / 100);
  var timer = 0;

  //determine the direction for the blending, if start and end are the same nothing happens
  if(opacStart > opacEnd) {
    for(i = opacStart; i >= opacEnd; i--) {
      setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
      timer++;
    }
  } else if(opacStart < opacEnd) {
    for(i = opacStart; i <= opacEnd; i++) {
      setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
      timer++;
    }
  }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
  var object = document.getElementById(id).style;
  object.opacity = (opacity / 101);
  object.MozOpacity = (opacity / 100);
  object.KhtmlOpacity = (opacity / 100);
  object.filter = "alpha(opacity=" + opacity + ")";
} 

function currentOpac(id, opacEnd, millisec) {
  //standard opacity is 100
  var currentOpac = 100;
    
  //if the element has an opacity set, get it
  if(document.getElementById(id).style.opacity < 100) {
    currentOpac = document.getElementById(id).style.opacity * 100;
  }

  //call for the function that changes the opacity
  opacity(id, currentOpac, opacEnd, millisec)
} 
