// Copyright 2000 SiteExperts.com, InsideDHTML.com, LLC. All rights reserved.
// You can reuse this script as long as the copyright notice is maintained.

// The list of images to display
var aImages = new Array("/bilder/home/IMG_1588.jpg","/bilder/home/IMG_1589.jpg","/bilder/home/IMG_1590.jpg","/bilder/home/IMG_1591.jpg","/bilder/home/IMG_1592.jpg","/bilder/home/IMG_1600.jpg")

// The width and height of the images. 
// All images should be the same size.
var aSize = new Array(375,250)

// The number of milliseconds to wait before switching images
var iDisplay = 12000

// SCRIPT
var oTimer = null 
var iCurrent = 0
var sSource = ""

function doDisplay() {
  // Try and display the image
  clearTimeout(oTimer)
  document.images.slideShow.src = sSource
}

function doReadyImage() {
  // Image is ready for display
  sSource = this.src
  // If time period expired just display
  if (oTimer==null) doDisplay()
}

function doErrorDisplay() {
  // If error, get next image
  // NOTE - Script not well written if all images fail
  clearTimeout(oTimer)
  doLoad()
}

function doLoad() {
  // Start getting the next image
  clearTimeout(oTimer)
  var img = new Image()
  img.onload = doReadyImage
  img.onerror = doErrorDisplay 
  sSource = ""
  iCurrent++
  if (iCurrent==aImages.length) iCurrent=0
  oTimer = setTimeout("oTimer=null;doDisplay()",iDisplay)
  img.src = aImages[iCurrent]
}

// Output the Image tab and next and previous buttons
document.write("<img name=slideShow src=\"" + aImages[iCurrent] + "\" onerror=\"doLoad()\" onload=\"doLoad()\" width=\"" + aSize[0] + "\"  height=\"" + aSize[1] + "\" />")

