
  var SlideshowDivId = "photodiv";
  var SlideshowImgId = "photoimg"; 
  
  // Begin Customisation section -----------------------------------
  
  // All photos must have the same dimensions
  
  var PauseSeconds = 3.25;  // delay between fades
  var FadeSeconds = .85;  // duration of fade - DO NOT EDIT
  var Rotations = 6; // the number of cycles the images rotate thru

  // End Customisation section -------------------------------------
  
  
  
  
  
  
  // DO NOT EDIT BELOW ---------------------------------------------
  
  var DeckSize = Img.length;
  var Opacity = 100;
  var OnDeck = 0;
  var StartImg;
  var ImageRotations = DeckSize * (Rotations+1);

  window.onload = SlideshowLaunch;
  
  function SlideshowLaunch()
  {
  	var theimg = document.getElementById(SlideshowImgId);
        StartImg = theimg.src; // save away to show as final image

	document.getElementById(SlideshowDivId).style.backgroundImage='url(' + Img[OnDeck] + ')';
	setTimeout("SlideshowFade()",PauseSeconds*1000);
  }

  function SlideshowFade()
  {
  	var theimg = document.getElementById(SlideshowImgId);
	
  	// determine delta based on number of fade seconds
	// the slower the fade the more increments needed
        var fadeDelta = 100 / (30 * FadeSeconds);

	// fade top out to reveal bottom image
	if (Opacity < 2*fadeDelta ) 
	{
	  Opacity = 100;
	  // stop the rotation if we're done
	  if (ImageRotations < 1) return;
	  SlideshowShuffle();
	  // pause before next fade
          setTimeout("SlideshowFade()",PauseSeconds*1000);
	}
	else
	{
	  Opacity -= fadeDelta;
	  setOpacity(theimg,Opacity);
	  setTimeout("SlideshowFade()",30);  // 1/30th of a second
	}
  }

  function SlideshowShuffle()
  {
	var thediv = document.getElementById(SlideshowDivId);
	var theimg = document.getElementById(SlideshowImgId);
	
	// copy div background-image to img.src
	theimg.src = Img[OnDeck];
	// set img opacity to 100
	setOpacity(theimg,100);

        // shuffle the deck
	OnDeck = ++OnDeck % DeckSize;
	// decrement rotation counter
	if (--ImageRotations < 1)
	{
	  // insert start/final image if we're done
	  Img[OnDeck] = StartImg;
	}

	// slide next image underneath
	thediv.style.backgroundImage='url(' + Img[OnDeck] + ')';
  }

  function setOpacity(obj, opacity) {
    opacity = (opacity == 100)?99.999:opacity;
    
    // IE/Win
    obj.style.filter = "alpha(opacity:"+opacity+")";
    
    // Safari<1.2, Konqueror
    obj.style.KHTMLOpacity = opacity/100;

    // Older Mozilla and Firefox
    obj.style.MozOpacity = opacity/100;

    // Safari 1.2, newer Firefox and Mozilla, CSS3
    obj.style.opacity = opacity/100;
  }



