//Use this to call
//<script src="/ran_image.js" type="text/javascript"></script>

//Begin random image

var numGraphics = 34;	// <=== Adjust the number of image files here
var theGraphics = null;
var theTag = 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);
	return Math.floor(Math.random()*n) + 1;
}

function initArray(n) {
	this.length = n;
	for(var i = 1; i <= n; i++) {
		this[i] = "";
		}
	return this;
}

function initGraphics() {
	//Name Graphics: graphicnn where nnn is a whole number
	//in the format "1" to "999"
	theGraphics = new initArray(numGraphics);
	for(i = 1; i <= numGraphics; i++) {
		theGraphics[i] =  "<img src=http://www.MosaicAndStainedGlass.org/banners/" + i + ".jpg width=400 height=75 alt='Mosaic and Stained Glass.'>"
	}
}

function getRandomGraphic() {
	var theIndex = getRandomNumber(numGraphics);
	return theGraphics[theIndex];
}

function getGraphic() {
	var theGraphicName = getRandomGraphic();
	theGraphic = theGraphicName
	return theGraphic
}

initGraphics();
	theGraphic = getGraphic();
	var theTag = theGraphic;

	document.write(theTag);

// - End of JavaScript - -->
