// STATS FADER
hex=0 // Initial color value.
var pause=6000 //SET PAUSE BETWEEN SLIDE (3000=3 seconds)

var textStrings=new Array()
textStrings[0]=["Online ads served all time: 2.75 trillion<br>In one day: 6.4 billion<br>Per second: 116,572"]
textStrings[1]=["Proprietary log files for reporting processed through super computer an hour: 30 TB (terabytes)"]
textStrings[2]=["Internet bandwidth from datacenters: 2.5 GB (gigabytes)"]
textStrings[3]=["From content distribution network: 5.2 GB"]
textStrings[4]=["Traffic growth per year for last 3 years = > 200% "]
textStrings[5]=["Average project releases per month: 6"]
textStrings[6]=["Average quantity of jelly-filled donuts consumed onsite in 2005: 312"]
textStrings[7]=["Number of times an employee has done the Worm to benefit the Leukemia & Lymphoma foundation: 1"]
textStrings[8]=["Number of Atlas employees who have run marathons and competed in triathlons: 6"]
textStrings[9]=["Number of Atlas employees who have imagined running marathons: 200"]
textStrings[10]=["Ultimate Frisbee players: 10"]
textStrings[11]=["Average # of computer monitors per Atlas employee: 2.75"]
textStrings[12]=["Members of Szechuan Noodle Bowl Fan Club: 15 and growing"]
textStrings[13]=["Ranking of favorite out of work activities with co-workers: 1) Karaoke, 2) First Wednesday Society, 3) Trivia contests, 4) Motorcycle riding, 5) Champ Karts"]

var cMax = textStrings.length - 1; //0 based max
var curPos=Math.floor((Math.random()*(cMax+1)));


myTimeout = setTimeout("rotateStats()",200);
	
function rotateStats() {
	if (curPos > cMax) {
		curPos = 0;
	}
	document.getElementById("tbStats").innerHTML = textStrings[curPos];
	fadetext();	
	myTimeout = setTimeout("curPos++;rotateStats()",pause);
}

function fadetext(){ 
	if(hex<255) { //If color is not black yet
	hex+=11; // increase color darkness

	document.getElementById("tbStats").style.color="rgb("+hex+","+hex+","+hex+")";
	setTimeout("fadetext()",20); 
}
else
	hex=0 //reset hex value
}

function incStat(dir) {
	clearTimeout(myTimeout);
	curPos = curPos + dir;
	if (curPos > cMax) {
		curPos = 0;
	}	
	if ((curPos - 1) < -1) {
		curPos = cMax;
	}
	rotateStats();
}
