function getRandomImage() {
	var headerImg = new Array();
	headerImg.push("images/smallHeader3.png")
	headerImg.push("images/smallHeader7.png")
	headerImg.push("images/smallHeader8.png")
	headerImg.push("images/holt.png")
	var randomNum = Math.floor(Math.random() * headerImg.length);
	var pElement = document.getElementById('smallHeader');
	pElement.src = headerImg[randomNum];
}

function getRandomFact() {
	var didYouKnow = new Array();
	/* Anthropology */
	didYouKnow.push("<p>ISU's Anthropology department was the department that began serious experimental studies of the manufacture of lithic (stone) tools in the United States.</p>");
	/* Art & Pre-Architecture */
	/* Biological Sciences */
	/* Chemistry */
	/* Communication & Rhetorical Studies */
	didYouKnow.push("<p>The Communication & Rhetorical Studies department is home to the James M. and Sharon E. Rupp Debate Society, which is consistently ranked as one of the top debate programs in the nation.</p>");
	/* Economics */
	didYouKnow.push("<p>The Department of Economics publishes the peer-reviewed journal, <a href='http://www.isu.edu/peer/'>Perspectives on Economic Education Research</a>.</p>");
	/* English */
	didYouKnow.push("<p>The English doctoral program has placed 90 percent of graduates in tenure-track college-level positions. The national average for such placement in English is only 50 percent.</p>");
	didYouKnow.push("<p><span style='font-style:italic;'>Black Rock & Sage</span> is a journal of creative works produced, written, and recorded by students of ISU. For more information or if you would like to submit a creative work, visit <a href='http://www.isu.edu/blackrock/' target='_blank'>http://www.isu.edu/blackrock/</a></p>");
	/* Foreign Languages */
	/* Geosciences */
	didYouKnow.push("<p>Every Geoscience undergraduate student has an opportunity to work on faculty research.</p>");
	/* History */
	didYouKnow.push("<p>The Department of History announced the advent of a new cooperative publication venture, <span style='font-style:italic;font-weight:bold;'>Idaho Landscapes: The Magazine of Idaho History, Culture, Art and Science</span>, with the Idaho State Historical Society and the Center for Idaho History and Politics at Boise State University.</p>");
	/* Mass Communication */
	/* Mathematics */
	didYouKnow.push("<p>ISU is one of the few remaining universities to offer a Doctor of Arts in Mathematics that prepares students for a successful teaching career at the college level.</p>");
	/* Music */
	didYouKnow.push("<p>The ISU Chamber Choir performed six concerts in the South American country of Peru in May 2008.</p>");
	/* Physics */
	didYouKnow.push("<p>Approximately 85% of the regular, tenure track faculty in the Physics department have external funding, averaging about $8 million last year, resulting in a prolific record of scientific publications.</p>");
	/* Political Science */
	didYouKnow.push("<p>The department of Political Science's student run Pi Sigma Alpha Honor Society hosts the annual Idaho Statesman of the Year Banquet. The 2009 recipient is Senator Mike Crapo.</p>");
	/* Psychology */
	didYouKnow.push("<p><span style='font-style:italic;font-weight:bold;'>Psychological Reports</span> ranked ISU's Ph.D. program in clinical psychology <strong>FIRST</strong> out of 207.<br /><a href='http://www2.isu.edu/headlines/?p=1656' target='blank'>Read more</a></p>");	
	/* Sociology */
	didYouKnow.push("<p>The pass rate for ISU's Social Work graduates on the Idaho licensure exam is higher than the national average.</p>");
	/* Theatre & Dance */
	didYouKnow.push("<p>Julie Rowe, an ISU graduate who received the Professional Achievement Award for Arts and Humanities in 2005, was named the new Director of Education for the Conservatory of Performing Arts (COPA).<br /><a href='http://www.jupitertheatre.org/index.php?option=com_content&view=article&id=186:dramatic-announcement&catid=4:press-releases&Itemid=25' target='blank'>Read more</a></p>");
	
	var randomNum = Math.floor(Math.random() * didYouKnow.length);
	var pElement = document.getElementById('divRandomFact');
	pElement.innerHTML = didYouKnow[randomNum];
}

var BGIndex;
var pics = new Array();
var links = new Array();

/*=========================================
This section can be edited to add a new
picture to the rotation. Copy a pics.push()
and link.push() pair, paste, and then fill
pics.push() with the filename of the image
(must be in the images directory), and
fill link.push() with a fully-qualified
URL. Both filename and URL must be
enclosed in quotation marks--make sure
the quotation marks are there even if they
are empty!
=========================================*/
pics.push("anthro.jpg");
pics.push("biology.jpg");
pics.push("chemistry.jpg");
pics.push("comm&rhet.jpg");
pics.push("economics.jpg");
pics.push("english.jpg");
pics.push("languages.jpg");
pics.push("frazier.jpg");
pics.push("geosciences.jpg");
pics.push("history.jpg");
pics.push("massComm.jpg");
pics.push("math.jpg");
pics.push("music.jpg");
pics.push("physics.jpg");
pics.push("politicalScience.jpg");
pics.push("sociology.jpg");
pics.push("stephens.jpg");
pics.push("theatre.jpg");
pics.push("art.jpg");

links.push("http://www.isu.edu/anthro/");
links.push("http://www.isu.edu/bios/");
links.push("http://www.isu.edu/chem/");
links.push("http://www.isu.edu/commrhet/");
links.push("http://www.isu.edu/econ/");
links.push("http://www.isu.edu/english/");
links.push("http://www.isu.edu/foreign/");
links.push("http://www.isu.edu/isutour/build-descrip/frazier-hall.html");
links.push("http://geology.isu.edu/");
links.push("http://www.isu.edu/history/");
links.push("http://www.isu.edu/masscomm/");
links.push("http://www.isu.edu/math/");
links.push("http://www.isu.edu/music/");
links.push("http://www.physics.isu.edu/");
links.push("http://www.isu.edu/polsci/");
links.push("http://www.isu.edu/sociolog/");
links.push("http://www.isu.edu/stephens/");
links.push("http://www.isu.edu/departments/theadanc/");
links.push("http://www.isu.edu/art/");

function nextPic() {
	if (BGIndex < pics.length - 1) {
		BGIndex = BGIndex + 1;
	}else{
		BGIndex = 0;
	}
	swapfade(document.getElementById('imgRotate'), 'images/' + pics[BGIndex] + '', '2');
	document.getElementById('hypDept').href = links[BGIndex];
	setTimeout("nextPic()", 8000);
}


// ISF1.11 :: Image swap-fade 
// *****************************************************
// DOM scripting by brothercake -- http://www.brothercake.com/
//******************************************************
//global object
var isf = { 'clock' : null, 'fade' : true, 'count' : 1 }
/*******************************************************/

//swapfade setup function
function swapfade()
{
	//if the timer is not already going
	if(isf.clock == null)
	{
		//copy the image object 
		isf.obj = arguments[0];
		
		//copy the image src argument 
		isf.src = arguments[1];
		
		//store the supported form of opacity
		if(typeof isf.obj.style.opacity != 'undefined')
		{
			isf.type = 'w3c';
		}
		else if(typeof isf.obj.style.MozOpacity != 'undefined')
		{
			isf.type = 'moz';
		}
		else if(typeof isf.obj.style.KhtmlOpacity != 'undefined')
		{
			isf.type = 'khtml';
		}
		else if(typeof isf.obj.filters == 'object')
		{
			//weed out win/ie5.0 by testing the length of the filters collection (where filters is an object with no data)
			//then weed out mac/ie5 by testing first the existence of the alpha object (to prevent errors in win/ie5.0)
			//then the returned value type, which should be a number, but in mac/ie5 is an empty string
			isf.type = (isf.obj.filters.length > 0 && typeof isf.obj.filters.alpha == 'object' && typeof isf.obj.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		}
		else
		{
			isf.type = 'none';
		}
		
		//change the image alt text if defined
		if(typeof arguments[3] != 'undefined' && arguments[3] != '')
		{
			isf.obj.alt = arguments[3];
		}
		
		//if any kind of opacity is supported
		if(isf.type != 'none')
		{
			//copy and convert fade duration argument 
			//the duration specifies the whole transition
			//but the swapfade is two distinct transitions
			isf.length = parseInt(arguments[2], 10) * 500;
			
			//create fade resolution argument as 20 steps per transition
			//again, split for the two distrinct transitions
			isf.resolution = parseInt(arguments[2], 10) * 10;
			
			//start the timer
			isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution);
		}
		
		//otherwise if opacity is not supported
		else
		{
			//just do the image swap
			isf.obj.src = isf.src;
		}
		
	}
};


//swapfade timer function
isf.swapfade = function()
{
	//increase or reduce the counter on an exponential scale
	isf.count = (isf.fade) ? isf.count * 0.9 : (isf.count * (1/0.9)); 
	
	//if the counter has reached the bottom
	if(isf.count < (1 / isf.resolution))
	{
		//clear the timer
		clearInterval(isf.clock);
		isf.clock = null;

		//do the image swap
		isf.obj.src = isf.src;

		//reverse the fade direction flag
		isf.fade = false;
		
		//restart the timer
		isf.clock = setInterval('isf.swapfade()', isf.length/isf.resolution);

	}
	
	//if the counter has reached the top
	if(isf.count > (1 - (1 / isf.resolution)))
	{
		//clear the timer
		clearInterval(isf.clock);
		isf.clock = null;

		//reset the fade direction flag
		isf.fade = true;
		
		//reset the counter
		isf.count = 1;
	}

	//set new opacity value on element
	//using whatever method is supported
	switch(isf.type)
	{
		case 'ie' :
			isf.obj.filters.alpha.opacity = isf.count * 100;
			break;
			
		case 'khtml' :
			isf.obj.style.KhtmlOpacity = isf.count;
			break;
			
		case 'moz' : 
			//restrict max opacity to prevent a visual popping effect in firefox
			isf.obj.style.MozOpacity = (isf.count == 1 ? 0.9999999 : isf.count);
			break;
			
		default : 
			//restrict max opacity to prevent a visual popping effect in firefox
			isf.obj.style.opacity = (isf.count == 1 ? 0.9999999 : isf.count);
	}
};


