/*
 * base.js
 * k. walters
 * kennethwalters@lostghost.com
 */


// added by Greg Bray to allow for slideshow to be paused
var pauseSlideShow = 0;
function setPause() {
	pauseSlideShow=1;
}

function clearPause() {
	pauseSlideShow=0;
}
// end added part

// Browser Slide-Show script.
// With image cross fade effect for those browsers that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
var slideCache = new Array();
function RunSlideShow(pictureName,imageFiles,displaySecs,listLength)
{
  if (pauseSlideShow == 0){
      if (manualPictures[pictureName] == null) {
    	  imageFiles = imageFiles;
      } else {
    	  imageFiles = manualPictures[pictureName];
 	  }
	  var imageSeparator = imageFiles.indexOf(";");
	  var nextImage = imageFiles.substring(0,imageSeparator);
	  if (document.all)
	  {
	    document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
	    document.getElementById(pictureName).filters.blendTrans.Apply();
	  }
	  document.getElementById(pictureName).src = nextImage;
	  if (document.all)
	  {
	    document.getElementById(pictureName).filters.blendTrans.Play();
	  }
	  var futureImages= imageFiles.substring(imageSeparator+1,imageFiles.length)
	    + ';' + nextImage;
		
	  manualPictures[pictureName] =
	    imageFiles.substring(imageSeparator+1,imageFiles.length)
	    + ';' + nextImage;  // sets array for manual forward button to start in same order
	
	  // create a list of images in reverse order for use by previous button	
	  reversePictureList = "";
	  tempList = imageFiles + ';flag';
	  x = 1;
	  while (tempList.indexOf(";") != -1){
	  	imageSeparator = tempList.indexOf(";");
		if (x == 1) {
			reversePictureList = tempList.substring(0,imageSeparator);
		}else{
			reversePictureList = tempList.substring(0,imageSeparator) + ';' + reversePictureList;
		}
		tempList = tempList.substring(imageSeparator+1,tempList.length);
		x++;
	  }
	  reversePictures[pictureName] = reversePictureList;
	
	  setTimeout("RunSlideShow('"+pictureName+"','"+futureImages+"',"+displaySecs+")",
	   	displaySecs*1000);
		
	  // Cache the next image to improve performance.
	  imageSeparator = futureImages.indexOf(";");
	  nextImage = futureImages.substring(0,imageSeparator);
	  if (slideCache[nextImage] == null) {
	    slideCache[nextImage] = new Image;
	    slideCache[nextImage].src = nextImage;
	  }
 } // end if pauseslideshow  
}


// Manual Slide-Show script. With image cross fade effect for those browsers
// that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.
var manualPictures = new Array();
function NextImageSlide(pictureName,imageFiles)
{
  // Ensure picture list primed.
  if (manualPictures[pictureName] == null) {
    manualPictures[pictureName] = imageFiles;
  } else {
    imageFiles = manualPictures[pictureName];
  }
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);
  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = nextImage;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  manualPictures[pictureName] =
    imageFiles.substring(imageSeparator+1,imageFiles.length)
    + ';' + nextImage;
   
  // create a list of images in reverse order for use by previous button	
  reversePictureList = "";
  tempList = imageFiles + ';flag';
  x = 1;
  while (tempList.indexOf(";") != -1){
  	imageSeparator = tempList.indexOf(";");
	if (x == 1) {
		reversePictureList = tempList.substring(0,imageSeparator);
	}else{
		reversePictureList = tempList.substring(0,imageSeparator) + ';' + reversePictureList;
	}
	tempList = tempList.substring(imageSeparator+1,tempList.length);
	x++;
  }
  reversePictures[pictureName] = reversePictureList;
}

// Manual Slide-Show script. With image cross fade effect for those browsers
// that support it.
// Script copyright (C) 2004 www.cryer.co.uk.
// Script is free to use provided this copyright header is included.

// Adapted by Greg Bray to allow for back button instead of forward button
var reversePictures = new Array();
function PreviousImageSlide(pictureName,imageFiles,listLength)
{ 
  // Ensure picture list primed.
  if (reversePictures[pictureName] == null) {
    reversePictures[pictureName] = imageFiles;
  } else {
    imageFiles = reversePictures[pictureName];
	listLength = listLength - 1;
  }
  var imageSeparator = imageFiles.indexOf(";");
  var nextImage = imageFiles.substring(0,imageSeparator);
  if (document.all)
  {
    document.getElementById(pictureName).style.filter="blendTrans(duration=2)";
    document.getElementById(pictureName).filters.blendTrans.Apply();
  }
  document.getElementById(pictureName).src = nextImage;
  if (document.all)
  {
    document.getElementById(pictureName).filters.blendTrans.Play();
  }
  reversePictures[pictureName] =
    imageFiles.substring(imageSeparator+1,imageFiles.length)
    + ';' + nextImage;
  
  // create a list of images in original order for use by forward button	
  reversePictureList = "";
  tempList = imageFiles + ';flag';
  x = 1;
  while (tempList.indexOf(";") != -1){
  	imageSeparator = tempList.indexOf(";");
	if (x == 1) {
		reversePictureList = tempList.substring(0,imageSeparator);
	}else{
		reversePictureList = tempList.substring(0,imageSeparator) + ';' + reversePictureList;
	}
	tempList = tempList.substring(imageSeparator+1,tempList.length);
	x++;
  }
  manualPictures[pictureName] = reversePictureList;
}


 


//
