/* 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 seprate items.*/
	var randomPics = new Array("redesigndimond","blc","sso2");
	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 seprate items.*/
	var randomPicsText = new Array(
		"You told us we need more group and quiet study space, more computers, and more power and network outlets.</p><p>Based on your feedback, we're redesigning Dimond Library.</p><p><a href='/news/index.php/history/1754'>Find out more</a>",
		"While the site for borrowing through the Boston Library Consortium is under construction, you can still borrow materials from other libraries.</p><p><a href='/news/index.php/history/1739'>Find out more</a>",
		"Faculty and staff now use their UNH ID number instead of their Social Security number for renewing library books online.</p><p><a href='/news/index.php/history/1702'>Find out more</a>"
	);
	textToUse =randomPicsText[picNum];			
	return textToUse; 
}

/* Background color of filler div.*/
var fillerBkgnd = new Array("#4f749b","#72728e","#244466");

/* Color of text in randomPicsText */
var captionColor = new Array("#fff","#fff","#fff");
	
/* Color of links in randomPicsText */
var captionLinks = new Array("#cbdaea","#e4e4fc","#c9daf9"); 	
	
/* Colors of visited links in randomPicsText */
var captionVisited = captionLinks;

/*  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;
}
picNum = getPicNum();
document.write("<style type='text/css'>#filler {background-color:" + fillerBkgnd[picNum] + " !important;} #sidebar-b p {color:" + captionColor[picNum] + ";} #sidebar-b a:link {color:" + captionLinks[picNum] + " !important;} #sidebar-b a:visited {color:" + captionVisited[picNum] + " !important;} </style>");
var displayText = "<p>" + picsText(picNum) + "</p>";
var displayImage = "<img src='images/i/" +  imageToUse(picNum) + ".jpg' width='" + imgWidth +"' height='" + imgHeight + "' alt=''>";
