var thepImages = new Array() 

thepImages[0] = '../Images/p1.jpg'
thepImages[1] = '../Images/p2.jpg'
thepImages[2] = '../Images/p3.jpg'
thepImages[3] = '../Images/p4.jpg'
thepImages[4] = '../Images/p5.jpg'

var p = thepImages.length;

var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = thepImages[i]
}

var whichpImage = Math.round(Math.random()*(p-1));

function showpImage(){
document.write('<img src="'+thepImages[whichpImage]+'">');
}

