/*
  This script and many more are available free online at
  The JavaScript Source :: http://javascript.internet.com
  Created by: Mike Hudson :: http://www.afrozeus.com
  Customized by Olegario :: http://www.oesistemas.com.br

  To change the values in the setupLinks function below.
  You will notice there are two arrays for each of Titles and
  Links. Currently there are 3 items in each array, but you can easily
  expand on that by adding to the array. For example, to add a 4th record,
  you would simply include the following 2 lines at the end of setupLinks
  function:
*/
function setupLinks() {
  arrLinks[0] = "http://www.controlaobra.com.br";
  arrTitles[0] = "Controle os gastos da sua obra gratuitamente.<br>Est&aacute; no ar a todo vapor,<br>o site <br><strong><ins>www.controlaobra.com.br</ins></strong><br>Acesse agora mesmo !";
  arrLinks[1] = "http://www.oesistemas.com.br/fotosconstruvale2008.html";
  arrTitles[1] = "Foi um sucesso total,<br>a participação<br>da O&amp;E Sistemas<br>na <strong><ins>Construvale2008</ins></strong><br>Agradecemos a todos<br>pela visita !<br>Clique para v&ecirc;r as fotos.";
  arrLinks[2] = "http://www.controlaobra.com.br/ReportagemTheBusiness.html";
  arrTitles[2] = "O site <b>ControlaObra</b><br>foi not&iacute;cia<br>de primeira p&aacute;gina<br>no jornal<br><b>The Business</b><br>de Outubro de 2008.<br>Clique para l&ecirc;-la.";
}

var m_iInterval;
var m_Height;
var iScroll=0;

var arrLinks;
var arrTitles;

var arrCursor = 0;

var arrMax;
window.onload=wl;

function wl() {
  m_iInterval = setInterval(ontimer, 10);
  var base = document.getElementById("jump_base");

  m_Height = base.offsetHeight;

  var divi = parseInt(m_Height/5);
  m_Height = divi*5;

  var td1 = document.getElementById("td1");
  var td2 = document.getElementById("td2");
  var td3 = document.getElementById("td3");
  td1.height = m_Height-5;
  td2.height = m_Height-5;
  td3.height = m_Height-5;

  arrLinks = new Array();
  arrTitles = new Array();

  setupLinks();
  arrMax = arrLinks.length-1;
  setLink();
}
function setLink() {
  var ilink = document.getElementById("jump_link");
  ilink.innerHTML = arrTitles[arrCursor];
}
function ontimer() {
  var base = document.getElementById("jump_base");
  iScroll+=5;
  if (iScroll>(m_Height*2)) {
    iScroll=0;
    arrCursor++;
    if (arrCursor>arrMax)
      arrCursor=0;
    setLink();
  }
  if (iScroll==m_Height) {
    pause();
    m_iInterval = setTimeout(resume, 5000);
  }
  base.scrollTop=iScroll;
}
function pause() {
  clearInterval(m_iInterval);
}
function resume() {
  m_iInterval = setInterval(ontimer, 10);
}
function navigate() {
  window.open( arrLinks[arrCursor], "");
}
