// original script: clikpix.js by jeff katris.
// no-cache version (only cache one image, not entire array)

// How many random pix? say so at numBanners and put the pix in 
// the directory 'img/randompix/'. call them random0.jpg, random1.jpg, etc.
var numBanners = 3

// numBanners is the length of the array as specified above in var numBanners.
var rndBannersArray = new Array(numBanners);

// define, but do not populate (don't cache), array.
for (i = 0; i < numBanners; i++) {
   rndBannersArray[i] = new Image()
}

function PickRndBanner() {
	// get a random number. floor rounds down to nearest integer, thereby offsetting 0-codebase.	
	randomNum = Math.floor(Math.random() * numBanners);
	// cache the picture identified by randomNum, not the entire array.
	rndBannersArray[randomNum].src = '/img/splashes/splash' + randomNum + '.jpg';
	// place image.
	document.rndbanner.src = rndBannersArray[randomNum].src;
}

//if (window.attachEvent) window.attachEvent("onload", getPic);
