// Global variable
var IPRT = {};

IPRT.FACT = {INDEX:0, CYCLE:10};

IPRT.DATA = [];
IPRT.DATA [0] = 'IPRT Company Assistance worked with 431 organizations in 137 Iowa cities and towns in 81 of Iowa\'s 99 ' + 
	'counties from 2005 to 2009.<br />';
IPRT.DATA [1] = 'IPRT Company Assistance had an impact of $14.5 million on Iowa companies in FY2009, according to surveys of IPRT clients. <br />';
IPRT.DATA [2] = 'IPRT has spun-off or directly assisted in development of more than 45 new business ventures.<br />';
IPRT.DATA [3] = 'Fifty-six graduates from IPRT\'s Science Bound program now hold degrees from Iowa State University.<br />';

//'IPRT research centers have participated in almost 700 research contracts in the last five years. <br />';
//IPRT Company Assistance worked with 625 organizations in 173 Iowa cities and towns in 88 of Iowa\'s 99 counties from 2004 to 2008

// On load
IPRT.initHome = function () {
	IPRT.FACT.INDEX = IPRT.getRandomInt(IPRT.DATA.length - 1);
	IPRT.showFacts();
	setInterval(IPRT.showFacts, (IPRT.FACT.CYCLE * 1000) );
};

// Choose fact and show it
IPRT.showFacts = function () {
	
	// Inject into fact element
	document.getElementById('facts').innerHTML = IPRT.DATA[IPRT.FACT.INDEX];

	// Indcrement INDEX and loop
	IPRT.FACT.INDEX++;
	if (IPRT.FACT.INDEX > (IPRT.DATA.length - 1)) {IPRT.FACT.INDEX = 0;}
};

// Return random integer between 0 and inLimit
IPRT.getRandomInt = function (inLimit) { return ( Math.floor(Math.random() * (inLimit + 1) ) );};