/* Javascript to create a slide show on a web page.
  *
  * Call this script using the syntax
  *         javascript:lastSlide(<slide series number>, <Total number of slides in series>)
  *         javascript:nextSlide(<slide series number>, <Total number of slides in series>)
  *
  *        e.g. javascript:nextSlide(0,5)
  *
  *  This makes it possible to create up to nine slide shows on a page with up to nine pictures in each show.
  */

    var finalSlide;
    /* Using this array, up to 9 slideshows can be created on any one page. Each element in the array holds
	the ordinal value of the current slide for the array (i.e. the position of the slide in the deck in question)*/
	currentSlide = new Array(9);

    // Initialise the array. Each slide deck is set to display slide number 1.
    for (i=0; i < currentSlide.length; i++) {
        currentSlide[i] = 1;
    }

	/** Function to hide the current slide and
      *   display the next slide in the sequence
      */
    function nextSlide(setNum,totNum) {
        finalSlide = totNum;
		var objectID = "slide" + setNum + currentSlide[setNum];
		var object = document.getElementById(objectID);
		object.style.display = 'none';

		if (currentSlide[setNum] == finalSlide) {
			currentSlide[setNum] = 1;
		}else{
			currentSlide[setNum]++;
		}
		objectID = "slide" + setNum + currentSlide[setNum];
        object = document.getElementById(objectID);
        object.style.display = 'block';
	}

	/** Function to hide the current slide and
      *   display the previous slide in the sequence
      */
    function lastSlide(setNum,totNum) {
        finalSlide = totNum
		var objectID = "slide" + setNum + currentSlide[setNum];
		var object = document.getElementById(objectID);
		object.style.display = 'none';

		if (currentSlide[setNum] == 1) {
			currentSlide[setNum] = finalSlide;
		}else{
			currentSlide[setNum]--;
		}
		objectID = "slide" + setNum + currentSlide[setNum];
		object = document.getElementById(objectID);
		object.style.display = 'block';
	}

// </script>