
      slideshowInterval = 5000;
      slideshowtimer = null;

      function Photo(src, name, description, price) {
        if (!price) price = '&nbsp;';
        if (!description) description = '&nbsp;';

        photo = new Object();
        photo.src = src;
        photo.name = name;
        photo.description = description;
        photo.next = photo;
        photo.previous = photo;
        photo.price = price;
        return photo;
      }

      function addPhoto(photo, newPhoto) {
        newPhoto.next = photo;
        newPhoto.previous = photo.previous;
        photo.previous.next = newPhoto;
        photo.previous = newPhoto;
      }


      function cancelSlideshow() {
        clearTimeout(slideshowtimer);
        slideshowtimer = null;
      }

      function next() {
        cancelSlideshow();
        clearTimeout(slideshowtimer);
        current = current.next;
        updatePicture();
      }

      function previous() {
        cancelSlideshow();
        current = current.previous;
        updatePicture();
      }

      function updatePicture() {
        document.getElementById('seriesimage').src = current.src;
        document.getElementById('seriesitemname').innerHTML = current.name;
        document.getElementById('seriesitemdesc').innerHTML = current.description;

        priceElement = document.getElementById('seriesitemprice');
        if (priceElement) {
          priceElement.innerHTML = current.price;
        }

        //preload the next image
        preloadImg = document.getElementById('preloadimg');
        if (preloadImg) {
          preloadImg.src = current.next.src;
        }
      }

      function startslideshow() {
        slideshow_event();
      }

      function slideshow_event() {
          next();
          schedule_slideshow();
      }

      function schedule_slideshow() {
          slideshowtimer = self.setTimeout("slideshow_event()", slideshowInterval);
      }

  

