// JavaScript to interpolate random images into a page.
// Used only on the home page
function swap()
{
var ic = 24; // Number of alternative images
var i = new Array(ic); // Array to hold filenames
i[0] = "./images/hp01.jpg";
i[1] = "./images/hp02.jpg";
i[2] = "./images/hp03.jpg";
i[3] = "./images/hp04.jpg";
i[4] = "./images/hp05.jpg";
i[5] = "./images/hp06.jpg";
i[6] = "./images/hp07.jpg";
i[7] = "./images/hp08.jpg";
i[8] = "./images/hp09.jpg";
i[9] = "./images/hp10.jpg";
i[10] = "./images/hp11.jpg";
i[11] = "./images/hp12.jpg";
i[12] = "./images/hp13.jpg";
i[13] = "./images/hp14.jpg";
i[14] = "./images/hp15.jpg";
i[15] = "./images/hp16.jpg";
i[16] = "./images/hp17.jpg";
i[17] = "./images/hp18.jpg";
i[18] = "./images/hp19.jpg";
i[19] = "./images/hp20.jpg";
i[20] = "./images/hp21.jpg";
i[21] = "./images/hp22.jpg";
i[22] = "./images/hp23.jpg";
i[23] = "./images/hp24.jpg";
// pickRandom - Return a random number in a given range. If we're running
// on an older browser that doesn't support 'Math.random()', we can fake
// it by using the current time. This isn't ideal for mission-critical
// security applications, but it's fine here. Note that we divide the
// current time by 1000 to get rid of the milliseconds which Navigator
// doesn't seem to take into account.
function pickRandom(range) {
 if (Math.random)
  return Math.round(Math.random() * (range-1));
 else {
  var now = new Date();
  return (now.getTime() / 1000) % range;
 }
}
// Write out an IMG tag, using a randomly-chosen image name.
var choice = pickRandom(ic);
// Swap in the new image
document.hp_image.src = i[choice];
// Eliminate dotted line around new image in Mozilla
document.hp_image.blur();
}
