var theImages = new Array();

theImages[0] = 'pic/home-1.JPG';
theImages[1] = 'pic/home-2.JPG';
theImages[2] = 'pic/home-3.JPG';
theImages[3] = 'pic/home-4.JPG';
theImages[4] = 'pic/home-5.JPG';
theImages[5] = 'pic/home-6.JPG';
theImages[6] = 'pic/home-7.JPG';
theImages[7] = 'pic/home-8.JPG';
theImages[8] = 'pic/home-9.JPG';

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];
}

var whichImage = Math.round(Math.random()*(p-1));

function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

