// Simple Slideshow Script 1.0 - By Chris// Note: Slideshow photo filenames must have two digit numbers.// For example, photo00.jpg is correct.  photo0.jpg is not.// The first photo displayed is always the one referenced in the <IMG> tag.// This script also smartly preloads only the photos it needs before displaying them.////////////////////// USER VARIABLES //////////////////////// Total number of photos availablevar total_photos = 8;// Path to the photos if not in same place as script (eg. "http://www.site.com/photos/")var path = "images/slideshow/";// Beginning of filename (eg. "photo" for "photo00.jpg");var filename = "photo";// The file extension (eg. ".jpg" for "photo00.jpg");var extension = ".jpg";// Delay in seconds before next photo appearsvar delay = 4;////////////////////// SLIDESHOW CODE //////////////////////var timeout;var next_photo;var prev_photo = 0;var cache = new Array();function cache_next_photo() {  var random_num = Math.round(Math.random() * (total_photos - 1));  if (random_num == prev_photo) {    cache_next_photo();  } else {    next_photo = random_num;    var temp_num;    if (cache[next_photo] == null) {      if (next_photo < 10) { temp_num = "0" + next_photo; } else { temp_num = next_photo; }      cache[next_photo] = new Image();      cache[next_photo].src = path + filename + temp_num + extension;    }    timeout = setTimeout('changePhoto()', (delay*1000));  }}function changePhoto() {  clearTimeout(timeout);  document.images.slideshow.src = cache[next_photo].src;  prev_photo = next_photo;  cache_next_photo();}function startSlideshow() {  cache_next_photo();}