var theImages = new Array() // do not change this


theImages[0] = 'media/img/bg_1.jpg'
theImages[1] = 'media/img/bg_2.jpg'
theImages[2] = 'media/img/bg_3.jpg'
theImages[3] = 'media/img/bg_4.jpg'
theImages[4] = 'media/img/bg_5.jpg'
theImages[5] = 'media/img/bg_6.jpg'
theImages[6] = 'media/img/bg_7.jpg'
theImages[7] = 'media/img/bg_8.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]+'">');
}