﻿var secs
var timerID = null
var timerRunning = false
var delay = 1000

var count = 0

var quantos_segundos_e_que_e_preciso_para_isto_mudar = 15

var myTextPT = new Array("Escolher a melhor peça para colocar no centro do seu negócio nem sempre é fácil. Conheça as nossas e decida o jogo.", "Colocamos no seu computador as ferramentas que o ajudam a tomar decisões acertadas..", "Não prevemos o futuro mas criamos software que melhora processos e prepara a sua empresa para crescer...")
var myTextEN = new Array("Choosing the best piece to be the center of your business is not always easy. Meet ours and decide the game.", "We put inside your computer the tools to help you doing the best decisions..", "We do not foresee the future but we create software that improves processes and prepares your company to grow ...")
var myTextES = new Array("Elegir la mejor pieza de ser el centro de su negocio no siempre es fácil. Conoce nuestro y decidir el partido. ", " Colocamos el interior del equipo las herramientas para ayudarle a hacer las mejores decisiones .. ", " No prevemos el futuro, sino que creamos un software que mejora los procesos y prepara su empresa para crecer ..")
var myText;

function InitializeTimer(lang)
{
   switch (lang) {
      case "PT": myText = myTextPT; break;
      case "EN": myText = myTextEN; break;
      case "ES": myText = myTextES; break;
      default: break;
   }
   // Set the length of the timer, in seconds
   secs = quantos_segundos_e_que_e_preciso_para_isto_mudar
   StopTheClock()
   StartTheTimer()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0) {
      secs = quantos_segundos_e_que_e_preciso_para_isto_mudar;
      document.getElementById("m_slogan").innerText = myText[count];
      document.getElementById("m_img_" + count).style.display = "none";
      count++;
      if (count >= myText.length)
         count = 0;
      document.getElementById("m_img_" + count).style.display = "";
   } 
   secs = secs - 1;
   timerRunning = true;
   timerID = self.setTimeout("StartTheTimer()", delay);
}

