// The id of the div or other container with text to fade in/out.
var containerId = 'attentionid';

// In the color mask, put an 0 for the color digits that will change and otherwise for digits that will remain static.
var colorMask = '#000000';

// Specify the number of milliseconds to wait between each fade in/out step.
var fadePause = 150;

var currentContentIdx = 1;
var totalContentItems = 3;
var previousContentIdx = totalContentItems;
var pointer = 25;
var numlist = "00000000000123456789ABCDEF".split("");
var direction = 'up';
var counter = 0;
var maxChanges = 0;

if( fadePause < 1 )
	{ fadePause = 1; }

// This function handles fading the content in and out
function fadeContentInOut() {
	if( pointer == 25 )
		{ direction = 'down'; contentRotate(); }
	else if( pointer == 0 )
		{ direction = 'up'; }
	if( direction == 'up' )
		{ pointer++; }
	else
		{ pointer--; }
	counter++;
	if( maxChanges > 0 && counter > maxChanges )
		{ clearInterval(Changing); }
	re = /0/g;
	var thiscolor = colorMask.replace(re,numlist[pointer]);
	document.getElementById(containerId).style.color = thiscolor;
}

// This function hides the previous content, then displays the next one
function contentRotate() {
	var cid = "placeholderdiv_" + currentContentIdx;
	document.getElementById(cid).style.display = 'block';
	var lid = "placeholderdiv_" + previousContentIdx;
	document.getElementById(lid).style.display = 'none';
	previousContentIdx = currentContentIdx;
    	currentContentIdx = (currentContentIdx == totalContentItems ) ? 1 : currentContentIdx + 1;
}

setInterval("fadeContentInOut()", fadePause);
