/**
  SlideShow.js
  Copyright Gallaware 2002

  This library provides the ability to walk through a list of HTML files.
  It relies on a separate setup .js file which includes the function 'ssSetup()'.
  This function needs to populate the global array and the base file name for the
  HTML files.
  For example:

	function ssInit()
 	{
		slideshowBasename = "slide"
		slideshowArray = new Array(1, 3, 4, 5, 6, 10, 12)
	}

  The filenames are built using the slideshowBasename and adding the number, prepending '0'
  where the numbers are < 10 and adding '.html'.  So, slide 1 would be named:

		slides01.html

  slide 12 would be named:

		slides12.html

  When calling the previous(), next(), first(), last(), be sure to provide the current
  file name such has  "slides12.html".  These functions will determine the slide number
  and the next slide to present.

  In your HTML code you need to include both this file and the .js with the "ssSetup()",
  and you will need to call the function ssSetup() before using any of the other functions
  in this library.
*/

/* USER CHANGABLE ITEMS */
var slideshowBasename  = "aspenslide"
var slideshowArray = new Array(1,2,3,63,64,8,46,48,9,41,66,65,70,71,49,61,62,56,57,20,68,69,23,72,10,12,15,52)

/*------------------------------------------------*/
/* BEGIN LIBRARY SECTION - DO NOT EDIT BELOW THIS */
/* gets the current slide number from the current slide name */
function getslidenum(currslide)
{
  var idx = currslide.indexOf(".")

  return parseInt(currslide.substring(idx-2, idx), 10)
}

/* sets the document to the first slide */
function firstslide(MO)
{
  gotoSlide(0)
}

/* sets the document to the last slide */
function lastslide(MO)
{
  gotoSlide(slideshowArray.length - 1)
}

/* sets the document to the next slide */
function nextslide(MO)
{
  var idx = getSlideIndex(getslidenum(MO))

  if (idx < slideshowArray.length - 1)
    gotoSlide(++idx)
}

/* sets the document to the previous slide */
function prevslide(MO)
{
  var idx = getSlideIndex(getslidenum(MO))

  if (idx > 0)
    gotoSlide(--idx)
}

/* sets the document to the slide identified by the index into the slide array */
function gotoSlide(idx)
{
  var intval = parseInt(slideshowArray[idx], 10)
  var filenum = (intval < 10 ? "0" : "") + intval

  document.location = slideshowBasename + filenum + ".html"
}

/* returns the current slide number in the series of slides; eg. 3 or 7 */
function getSlideSeriesNum(MO)
{
  return getSlideIndex(getslidenum(MO)) + 1
}

/* returns the index into the slide array that the slide number represents */
function getSlideIndex(slidenum)
{
  var idx

  for (idx = 0; idx < slideshowArray.length; idx++)
  {
    if (slideshowArray[idx] == slidenum)
      return idx
  }
  return -1
}

/* returns the number of slide in the array */
function getSlideCount()
{
  return slideshowArray.length
}

function stopshow()
{
  $PL == false 
}

/* opens the slide show help window */
function sshelp()
{
  window.open("sshelp.html","sshelp","width=300,height=400")
}

