// Randomly display up to 4 images on a page

<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.

theImages[0] = 'stockists/1.gif'
theImages[1] = 'stockists/2.gif'
theImages[2] = 'stockists/3.gif'
theImages[3] = 'stockists/4.gif'
theImages[4] = 'stockists/5.gif'
theImages[5] = 'stockists/6.gif'
theImages[6] = 'stockists/7.gif'
theImages[7] = 'stockists/8.gif'
theImages[8] = 'stockists/9.gif'
theImages[9] = 'stockists/10.gif'
theImages[10] = 'stockists/11.gif'
theImages[11] = 'stockists/12.gif'
theImages[12] = 'stockists/13.gif'
theImages[13] = 'stockists/14.gif'
theImages[14] = 'stockists/15.gif'
theImages[15] = 'stockists/16.gif'
theImages[16] = 'stockists/17.gif'
theImages[17] = 'stockists/18.gif'
theImages[18] = 'stockists/19.gif'
theImages[19] = 'stockists/20.gif'

// do not edit anything below this line

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image();
   preBuffer[i].src = theImages[i];
}

// Select 4 random images
var whichImage = Math.round(Math.random()*(p-1));
image1 = '<img src="'+theImages[whichImage]+'">';
image1Rand = whichImage;

while (whichImage==image1Rand) {
	whichImage = Math.round(Math.random()*(p-1));	
}
image2 = '<img src="'+theImages[whichImage]+'">';
image2Rand = whichImage;

while (whichImage==image2Rand || whichImage==image1Rand) {
	whichImage = Math.round(Math.random()*(p-1));	
}
image3 = '<img src="'+theImages[whichImage]+'">';
image3Rand = whichImage;

while (whichImage==image3Rand || whichImage==image2Rand || whichImage==image1Rand) {
	whichImage = Math.round(Math.random()*(p-1));	
}
image4 = '<img src="'+theImages[whichImage]+'">';
image4Rand = whichImage;

function showImage1(){
	document.write(image1);
}
function showImage2(){
	document.write(image2);
}
function showImage3(){
	document.write(image3);
}
function showImage4(){
	document.write(image4);
}

//  End -->

