/*******************************
 *                             *
 *  By Omar Carrillo           *
 *                             *          New Mexico State University
 *    SouthWest                *          ---------------------------
 *      Technology             *
 *        Development          *
 *         Institute           *          Nov. 8, 2001
 *                             *
 *                             *          omar@solar.nmsu.edu
 *******************************/

/************************************************************
    Random Picture Display Program
 ************************************************************/

	<!-- Hide...
	if (navigator.appName == "Netscape") {
		window.onresize = resizenow; }
	function resizenow() {
		if (navigator.platform.subscr(0,3) == "Mac") {
			window.location.reload(); }
		}
	var numGraphics = 36;	// <=== Adjust the number of image files here
	var theGraphics = null;
	function getRandomNumber(n) {
		//Returns a pseudorandom number between 1 and n
		today = new Date();
		var bigNum = today.getSeconds() * today.getTime() * Math.sqrt(today.getMinutes());
		var randNum = (bigNum % n) + 1;
		return Math.floor(randNum);
		}
	function initArray(n) {
		this.length = n;
		for(var i = 1; i <= n; i++) {
			this[i] = "";
			}
		return this;
		}
	function initGraphics() {
		theGraphics = new initArray(numGraphics);
		for(i = 1; i <= numGraphics; i++) {
			if (i < 10) {
				theGraphics[i] = "home_photo.0" + i + ".jpg" }
			else {
			theGraphics[i] = "home_photo." + i + ".jpg"}
			}
		}
	function getRandomGraphic() {
		var theIndex = getRandomNumber(numGraphics);
		return theGraphics[theIndex];
		}
	function getGraphic() {
		var theGraphicName = getRandomGraphic();
		theGraphic = "images/" + theGraphicName
		return theGraphic
		}
	function loadGraphic() {
		theGraphic = getGraphic();
		var theTag = '<A HREF="" onMouseClick="getGraphic()">';
		theTag += ' <IMG SRC= "' + theGraphic + '"';
		theTag += ' WIDTH="240" HEIGHT="240" BORDER="0"';
		theTag += ' ALT="Renewable Energy in Action. Energ&iacute;a Renovable en Acci&oacute;n"></A>';
		document.write(theTag);
		}		

	initGraphics();
	// -->
