// File: its_a_fact.js
/* Description:
		A javascript to display information delivered using
		graphic formats and distributed across multiple 
		graphic files.
		
	How to use:
	File naming – all the graphic files to be displayed
		needs to have a "photo" prefix followed by a number
		with no spaces in-between.  Single digit numbers 
		should no have a "0" in front of the number.  The
		numbering of the files also needs to be continous
		from "1" and on.
		
	Script modifcation – The only thing needed to be
		changed on the script (this file) is the number
		of facts to display.  In the "Declaring variables"
		section below, edit the line
		
			var numberOfFacts = x;
			
		and replace the "x" with the number of facts to 
		display. The value of "x" should be less than or
		equal to the largest number used in the file 
		naming. If "x" is less than the largest numbered
		fact, any fact from that point on will not be 
		displayed.
		
		Note: Do not alter "fact0.gif." This is a placeholder
		      file.
			  
	File placement – Store all graphic files for "It's a fact"
		in the "img_facts" folder on the root directory of the
		site.

*/



// Declaring variables
var numberOfFacts = 13;			//Total number of facts
var curNum = 0;					//Indicate the current fact being displayed
var imgArray = new Array();		//Store the list of graphic names for the facts

//Construct the list of graphics filenames associated with the 
//facts.
function initFacts()
{
	for( i = 1; i <= numberOfFacts; i++ )
	{
		imgArray[i] = new Image();
		imgArray[i].src = "img_facts/fact" + i + ".gif";
	}//for
	scrollFacts();
} //initFact

//Display the next fact.
function scrollFacts()
{
	if( (++curNum) > numberOfFacts )
	{
		curNum = 1;
	}
	document.facts.src = imgArray[curNum].src;
	
	var fncRecall = setTimeout( "scrollFacts()", 5000 );
	
}//scrollFact