﻿var interval = 7000;
var mTimer = 0;
var currentId = 0;

function nextPic(forcePos) {
  if (total == 0) {
    return true;
  }
  if (forcePos == -1) {
    currentPos = (currentPos+1) % total;
  }
  else {
    currentPos = forcePos;
  }
  document.getElementById('offerBox').src = pictures[currentPos];
  /*currentId = ids[currentPos];
  highlightButton(currentPos);*/
  clearTimeout(mTimer);
  mTimer = setTimeout('nextPic(-1)', interval);
}


var logoTimer = 0;
var currentLogoId = 0;
var logoInterval = 12000;

function nextLogo(forcePos) {
  if (totalLogo == 0) {
    return true;
  }
  if (forcePos == -1) {
    curLogoPos = (curLogoPos+1) % totalLogo;
  }
  else {
    curLogoPos = forcePos;
  }
  document.getElementById('imgLogo').src = arrLogo[curLogoPos];
  clearTimeout(logoTimer);
  logoTimer = setTimeout('nextLogo(-1)', logoInterval);
}


var quoteTimer = 0;
var currentQuoteId = 0;
var quoteInterval = 10000;

function nextQuote(forcePos) {
  if (totalQuote == 0) {
    return true;
  }
  if (forcePos == -1) {
    curQuotePos = (curQuotePos+1) % totalQuote;
  }
  else {
    curQuotePos = forcePos;
  }
  document.getElementById('customerQuote').innerHTML = arrQuote[curQuotePos];
  clearTimeout(quoteTimer);
  quoteTimer = setTimeout('nextQuote(-1)', quoteInterval);
}

arrBox = new Array();

function changeTab(tabId)
{
    if(tabId==''){
        return true;
    }
    for(var i = 0;i<totalTab;i++)
    {
        if(arrBox[i]==tabId)
        {
            document.getElementById(arrBox[i]).style.visibility = "visible";
            document.getElementById('m' + arrBox[i]).style.background = "url()";
        }else{
            document.getElementById(arrBox[i]).style.visibility = "hidden";
            document.getElementById('m' + arrBox[i]).style.background = "url()";
        }
    }
}