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

//Begin random image

var numGraphics = 17;	// <=== 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);
}

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 "01" to "999"
	theGraphics = new initArray(numGraphics);
	for(i = 1; i <= numGraphics; i++) {
		if (i < 10) {

			theGraphics[i] =  "test"
		} else {
			theGraphics[i] =  "<table border=0 width=800 cellpadding=0 cellspacing=2 background=http://www.sport-touring.net/images/site/fp_splash/fp_splash_" + i + ".jpg height=329>"
		}
	}
}

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 - -->
