var randnum = Math.random();
var inum = 3;// Change this number to the number of images you are using.
var rand1 = Math.round(randnum * (inum-1)) + 1;
images = new Array
images[1] = "bg.gif"
images[2] = "bg1.gif" // Ensure you have an array item for every image you are using.
images[3] = "bg2.gif"
var image = images[rand1]