
  var SlideshowDivId = "photodiv";
  var SlideshowImgId = "photoimg"; 
  
  // Begin Customisation section -----------------------------------
  
  // All photos must have the same dimensions
  
  var Img = new Array(
    "/_includes/images/slideshow/image4.jpg",
	"/_includes/images/slideshow/image2.jpg",
	"/_includes/images/slideshow/image3.jpg",
	"/_includes/images/slideshow/image1.jpg",
	"/_includes/images/slideshow/image5.jpg",
	"/_includes/images/slideshow/image6.jpg",
	"/_includes/images/slideshow/image7.jpg",
	"/_includes/images/slideshow/image8.jpg"
    );  // full path to the images to be used. ensure the first image in the array isn't the same as the image specified in the HTML
  
  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);
        if (theimg) StartImg = theimg.src; // save away to show as final image

	var slideDiv = document.getElementById(SlideshowDivId)
	if(slideDiv) slideDiv.style.backgroundImage='url(' + Img[OnDeck] + ')';
	setTimeout("SlideshowFade()",PauseSeconds*1000);
  }

  function SlideshowFade()
  {
  	var theimg = document.getElementById(SlideshowImgId);
	if (theimg) {
		// 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);
	if (theimg) {
		// 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;
  }




