﻿// JScript File

var arrDivs = new Array(".quote_1",".quote_2");
var currentShowingDivIDIndex = 0;
var currentlyExecuting;

function initFade()
{
  currentlyExecuting = setTimeout('loopFade()',15000)
}

function loopFade()
{
  clearTimeout(currentlyExecuting);
  var nextShowingDivIDIndex;
  if(currentShowingDivIDIndex == arrDivs.length-1)
    nextShowingDivIDIndex = 0;
  else
    nextShowingDivIDIndex = currentShowingDivIDIndex+1;
  
  $(arrDivs[currentShowingDivIDIndex]).fadeOut(2000);
  $(arrDivs[nextShowingDivIDIndex]).fadeIn(2000);
  
  currentShowingDivIDIndex = nextShowingDivIDIndex;
  
  currentlyExecuting = setTimeout('loopFade()',15000)
}
