/* JavaScript Document

Developed by: 
	Mike McIntire
	Web Solutions
	April 2004
For:
	Rotating the image, caption, caption color and background color on the unh homepage.
Rights:
	May be used, modified, re-distributed freely dependant that alterations of the manner in which the code behaves
	is well documented to maintain ease of use.
*/

/* Enter width and height, respectively, for image being rotated */	
	var imgWidth = 523;
	var imgHeight = 227;

function imageToUse(picNum){			
/*The following code is where you name your images. .jpg will be automatically appended
so it is only necessary to use the file's name. Image names must be surrounded in quotes and commas must separate items.*/


		
	var randomPics = new Array("frey0803", "turtle0810", "pelagics0821", "odairy1005", "pridevideo1208");
	imageDisplayed = randomPics[picNum];
	return imageDisplayed;
			
}



function picsText(picNum){
	
/*place text within this array in the format in the example. Place them in the same order as the 
picture names in the above array. Captions must be surrounded in quotes and commas must separate items.*/	
	
	
var randomPicsText = new Array("Professor Serita Frey spent part of this academic year in Costa Rica to work on a number of projects related to her research.",
							   "Ph.D. candidate Kara Dodge is unlocking the mysteries of the leatherback turtle.",
							   "Leatherback turtles! Tuna! Find out what it takes to track these elusive giants of the sea at the UNH Large Pelagics Research Lab blog.",
							   "The Organic Dairy Research Farm (ODRF) hosted a fall gathering on September 23, 2009 to inform corporate and individual supporters about the progress of the facility.",
							   "Find out for yourself where the College of Life Sciences and Agriculture could take you."
						   );
	textToUse =randomPicsText[picNum];			
	return textToUse; 
}
	
/* Background color of filler div.*/
	var fillerBkgnd = new Array("#069", "#069", "#369", "#036", "#036");
						
/* Color of text in randomPicsText */
	var captionColor = new Array("#000", "#000", "#FFF", "#FFF", "#FFF");	
			
function picsLink(picNum){
	
/*place link within this array in the format in the example. Place them in the same order as the 
picture names in the above array. Links must be surrounded in quotes and commas must separate items.*/	
	
	
var randomPicsLink = new Array("http://www.unh.edu/cie/faculty_travel_reports/serita_frey.html",
							   "http://www.capecodchronicle.com/harnews/har080609_3.htm",
							   "http://unhtuna.blogspot.com/",
							   "http://www.organicdairy.unh.edu/news/fallgathering09.html",
							   "http://www.colsa.unh.edu/about/");
	linkToUse =randomPicsLink[picNum];			
	return linkToUse; 
}

/*  Make No Other Changes   */	


function getPicNum(){	
			var numItems = captionColor.length;
			var picNum = Math.floor(Math.random()*numItems) + 0;
			
			if(picNum >= numItems){
				picNum = 0;
				}
return picNum;
}
			//document.write("<div id='filler' style='background-color:" + fillerBkgnd[picNum] +";'><div id='holder'><div id='content'><img src=images/i/" + randomPics[picNum] + ".jpg border='0' width='" + imgWidth + "' height='"+ imgHeight + "' >  </div><div id='sidebar-b'><p style='color:" + captionColor[picNum] +"'>" +  randomPicsText[picNum] +"</p><p align='right'><a href='../js/%22%20+%20randomPicsLink%5BpicNum%5D%20+%20%22'>Read more...</a></p>");
			//document.write("<div id='filler'><div id='content'><img src=images/i/" + randomPics[picNum] + ".jpg border=0 width='" + imgWidth + "' height='"+ imgHeight + "' >  </div><div id='sidebar-b'><p>" +  randomPicsText[picNum] +"</p><p align='right'><a href='../js/%22%20+%20randomPicsLink%5BpicNum%5D%20+%20%22'>Read more...</a></p>");





