var theImages = new Array()
theImages[0] = 'images/rotating-photos/photo01.gif'
theImages[1] = 'images/rotating-photos/photo02.gif'
theImages[2] = 'images/rotating-photos/photo03.gif'
theImages[3] = 'images/rotating-photos/photo04.gif'
theImages[4] = 'images/rotating-photos/photo05.gif'
theImages[5] = 'images/rotating-photos/photo06.gif'
theImages[6] = 'images/rotating-photos/photo07.gif'
theImages[7] = 'images/rotating-photos/photo08.gif'
theImages[8] = 'images/rotating-photos/photo09.gif'
theImages[9] = 'images/rotating-photos/photo10.gif'
theImages[10] = 'images/rotating-photos/photo11.gif'
theImages[11] = 'images/rotating-photos/photo12.gif'
theImages[12] = 'images/rotating-photos/photo13.gif'
theImages[13] = 'images/rotating-photos/photo14.gif'
theImages[14] = 'images/rotating-photos/photo15.gif'
theImages[15] = 'images/rotating-photos/photo16.gif'
theImages[16] = 'images/rotating-photos/photo17.gif'
theImages[17] = 'images/rotating-photos/photo18.gif'
theImages[18] = 'images/rotating-photos/photo19.gif'
theImages[19] = 'images/rotating-photos/photo20.gif'

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]+'">');
}