// Function that return a number between 0 and "nums - 1"
function getRandom(nums)
{
var ranNum= Math.round(Math.random()*nums);
return ranNum;
}
 
// Tells us how many images we have available.
var numberOfImages    = 10;
var randomNumber        = getRandom(numberOfImages);

// Create an array to hold the names of all images.
var image = new Array(numberOfImages);
image[0]="pic1.jpg";
image[1]="pic2.jpg";
image[2]="pic3.jpg";
image[3]="pic4.jpg";
image[4]="pic5.jpg";
image[5]="pic6.jpg";
image[6]="pic7.jpg";
image[7]="pic8.jpg";
image[8]="pic9.jpg";
image[9]="pic10.jpg";
image[10]="pic11.jpg";

// Write the img tag with a random image name.
document.write("<img src='images/" + image[randomNumber] + "' width=924 height=355 />");
