var cSeqEnd = 20;         //Keep track of number of steps in animation
var cTimeToSwitch = 3000; //Keep track of milliseconds before switching to next div
var cAnimateTime = 50;    //Keep track of milliseconds between steps in animation
var cFadeIncrement = 1 / cSeqEnd;

var vCurDiv = 1;
var vSeq = 0;

function FadeDivOut() {
   if (vSeq < cSeqEnd) {
	  vSeq++;
	  var vOpacity = 1 - (vSeq * cFadeIncrement);
	  document.getElementById('job' + vCurDiv).style.opacity = vOpacity;
	  document.getElementById('job' + vCurDiv).style.filter = 'alpha(opacity=' + (vOpacity * 100) + ')';
	  setTimeout(FadeDivOut, cAnimateTime);
   }
   else {
	  vSeq = 0;
	  document.getElementById('job' + vCurDiv).style.display = 'none';
	  document.getElementById('job' + vCurDiv).style.opacity = 1;
	  document.getElementById('job' + vCurDiv).style.filter = 'alpha(opacity=100)';
	  AdvanceDiv();
	  document.getElementById('job' + vCurDiv).style.opacity = 0;
	  document.getElementById('job' + vCurDiv).style.filter = 'alpha(opacity=0)';
	  document.getElementById('job' + vCurDiv).style.display = 'block';
	  setTimeout(FadeDivIn, cAnimateTime);
   }
}
function FadeDivIn() {
   if (vSeq < cSeqEnd) {
	  vSeq++;
	  var vOpacity = vSeq * cFadeIncrement;
	  document.getElementById('job' + vCurDiv).style.opacity = vOpacity;
	  document.getElementById('job' + vCurDiv).style.filter = 'alpha(opacity=' + (vOpacity * 100) + ')';
	  setTimeout(FadeDivIn, cAnimateTime);
   }
   else {
	  vSeq = 0;
	  document.getElementById('job' + vCurDiv).style.opacity = 1;  //Just in case animation was a tad off
	  document.getElementById('job' + vCurDiv).style.filter = 'alpha(opacity=100)';
	  setTimeout(FadeDivOut, cTimeToSwitch);    //Start timer to switch again in X seconds
   }
}
function AdvanceDiv() {
   if (vCurDiv == cDivCount)
	  vCurDiv = 1;
   else
	  vCurDiv++;
}

window.onload = function(){
	setTimeout(FadeDivOut, cTimeToSwitch);
}
/*
window.addEvent('domready',function(){
	setTimeout(FadeDivOut, cTimeToSwitch);
});
*/