// Rainbo Design Slideshow v2.2  December 8, 2010
// Copyright (C) 2009-2010 by Richard L. Trethewey rick@rainbo.net
// All rights reserved.  http://www.rainbodesign.com/pub/
// Permission for use is granted as long as this notice remains intact.

// Slideshow Globals

var RDShows = Array();		// Array of slideshow objects
var showCount = 0;		// Number of slideshows created
var curSlide = "slide1";	// Current visible slide id
var nextSlide = "1";		// Next visible slide index to gallery array
var slide1Opacity = 0;		// Slide #1 current opacity setting
var slide2Opacity = 0;		// Slide #2 current opacity setting
var opIncrement = 5;		// Opacity change increment %
var maxCycles = 0;		// Maximum number of slideshow cycles (0 = no limit)
var cycleCount = 0;		// Current cycle count
var showObject = null;		// Init slideshow DIV object variable
var s1BoxObject = null;		// Init slide1 DIV object
var s2BoxObject = null;		// Init slide2 DIV object
var s1Object = null;		// Init slide1 object
var s2Object = null;		// Init slide2 object
var t1BoxObject = null;		// Init title1 DIV object
var t2BoxObject = null;		// Init title2 DIV object
var t1Object = null;		// Init title1 object
var t2Object = null;		// Init title2 object
var switchFlag = 0;		// Switched slides flag
var timeoutID = null;		// ID for timeout handler
var timer = 0;			// Init transition delay timer
var pauseFlag = 0;		// Init pause start/stop flag
var showStats = 0;		// Show statistics flag (decpreciated)

var rdShowFont = 'Arial';		// Default font for titles and descriptions
var rdShowFontSize = 12;		// Default font size
var rdShowFontColor = '#fff';		// Default font color
var rdShowFontWeight = 'bold';	// Default font weight

// mover Globals
var s1TopInit = 0;		// slide #1 initial top position
var s1LeftInit = 0;		// slide #1 initial left position
var s2TopInit = 0;		// slide #2 initial top position
var s2LeftInit = 0;		// slide #2 initial left position
var t1BottomInit = 5;		// title #1 initial bottom position
var t1LeftInit = 5;		// title #1 initial left position
var t2BottomInit = 5;		// title #1 initial bottom position
var t2LeftInit = 5;		// title #1 initial left position
var s1Top = s1TopInit;		// slide #1 top position
var s1Left = s1TopInit;		// slide #1 left position
var s2Top = s2TopInit;		// slide #2 top position
var s2Left = s2LeftInit;	// slide #2 left position
var t1Bottom = t1BottomInit;	// title #1 bottom position
var t1Left = t1LeftInit;	// title #1 left position
var t2Bottom = t2BottomInit;	// title #2 bottom position
var t2Left = t2LeftInit;	// title #2 left position

var slideshowZBase = 20;	// Base z-index for slideshow showBox
var showBoxPaddingW = 0;	// Horizontal padding for showBox for 'caption' shows
var showBoxPaddingH = 0;	// Vertical padding for showBox for 'caption' shows
var captionHeight = 60;		// Height of caption box
var captionOverlap = 10;	// # of pixels that the caption overlaps the slide image

// Captions Slideshow Globals
var slideshowClass = 'rdSlideshow';
var slideshowListClass = 'slideshowList';
var slideClass = 'slide';
var slideImgClass = 'slideImg';
var slideDescClass = 'slideDesc';
var slideTitleClass = 'slideTitle';
var slideTileClass = 'rdSlideTile';

var mySheet = document.styleSheets[document.styleSheets.length -1];	// Get last stylesheet
//var numRules = mySheet.cssRules ? mySheet.cssRules.length : mySheet.rules.length;


// RDSlideshow(id of DIV tag to hold slideshow, slideshow type ('fader', 'mover', 'tiles', or 'captions'), slideshowWidth, slideshowHeight)
function RDSlideshow(showBoxID, showType, slideWidth, slideHeight) {
  this.showBoxID = showBoxID;
  this.showNum = ++showCount;
  RDShows[this.showNum] = this;
  this.showType = showType;
   this.switchFlag = 0;
   this.timeoutID = null;
   this.timer = 0;
   this.pauseFlag = 0;
   this.maxCycles = maxCycles;
   this.setMaxCycles = setMaxCycles;
   this.cycleCount = 0;
   this.showBox = document.getElementById(this.showBoxID);

// Initialize functions
  this.startShow = startShow;
  this.setBoxSize = setBoxSize;
  this.setBoxBorderWidth = setBoxBorderWidth;
  this.setBoxBorderColor = setBoxBorderColor;
  this.setBoxBackgroundColor = setBoxBackgroundColor;
  this.setSlideSize = setSlideSize;
  this.setTitleFont = setTitleFont;
  this.setTitleFontSize = setTitleFontSize;
  this.setTitleFontColor = setTitleFontColor;
  this.setTitleFontWeight = setTitleFontWeight;
  this.titleFont = rdShowFont;
  this.titleFontSize = rdShowFontSize;
  this.titleFontColor = rdShowFontColor;
  this.titleFontWeight = rdShowFontWeight;

// Continue, based on showType
 switch (this.showType) {
  case('fader'):
  case('mover'):
   this.curSlide = this.slide1ID;
   this.nextSlide = 1;
   this.slide1Opacity = 0;
   this.slide2Opacity = 0;
  this.gallery = new Array();
  this.titles = new Array();
  this.slide1ID = 'slide1_' + String(this.showNum);
  this.slide2ID = 'slide2_' + String(this.showNum);
  this.title1ID = 'title1_' + String(this.showNum);
  this.title2ID = 'title2_' + String(this.showNum);
   this.loadGallery = loadGallery;
   this.loadTitles = loadTitles;
   this.showBox.style.overflow = 'hidden';
   boxWidth = slideWidth;
   boxHeight = slideHeight;
   this.setBoxSize(boxWidth, boxHeight);
   this.boxBorderColor = '#f06060';
   this.boxBorderWidth = 2;
   this.slideWidth = slideWidth;
   this.slideHeight = slideHeight;
   this.imageBox1ID = 'imageBox1_' + String(this.showNum);
   this.imageBox2ID = 'imageBox2_' + String(this.showNum);
   this.titleBox1ID = 'titleBox1_' + String(this.showNum);
   this.titleBox2ID = 'titleBox2_' + String(this.showNum);
   break; // end fader, mover
  case('fadeHTML'):
   this.slideIDs = new Array();
   this.slideDescIDs = new Array();
   this.slideOpacity = new Array();
   this.numSlides = 0;
   for (i=0; i<this.showBox.childNodes.length; i++) {
    if (this.showBox.childNodes[i].className == slideshowListClass) {
     listNode = this.showBox.childNodes[i];
     for (j=0; j<listNode.childNodes.length; j++) {
       slideNode = listNode.childNodes[j];
      if (slideNode.className == slideClass) {
	this.slideIDs[this.numSlides] = slideNode.id;		// Save the slide ID
	newSlide = document.getElementById(slideNode.id);
	opacity = (this.numSlides == 0) ? 100 : 0;
	this.slideOpacity[this.numSlides] = opacity;		// Save initial opacity!
	lightup(newSlide, opacity);				// Change the slides actual opacity now
	newSlide.style.zIndex = slideshowZBase + 1 + (this.numSlides * 2);
	for (k=0; k<slideNode.childNodes.length; k++) {
         imgNode = slideNode.childNodes[k];
	 if (imgNode.tagName == 'IMG') {
	  this.slideDescIDs[this.numSlides] = "slide" + this.showNum + "Title" + String(this.numSlides);
          newSlide.innerHTML += "<p class=\"slideTitle\" id=\"slide" + this.showNum + "Title" + String(this.numSlides) + "\">" + imgNode.title + "</p>";
	  titleEl = document.getElementById(this.slideDescIDs[this.numSlides]);
	  titleEl.style.zIndex = slideshowZBase + 2 + (this.numSlides * 2);
	  titleEl.style.position = 'absolute';
	  titleEl.style.left = '6px';
	  titleEl.style.bottom = '1px';
          titleEl.style.fontFamily = this.titleFont;
	  titleEl.style.fontWeight = this.titleFontWeight;
	  titleEl.style.fontSize = this.titleFontSize + 'px';
	  titleEl.style.color = this.titleFontColor;
	 } // endif imgNode.tagName
	} // end for k
	this.numSlides++;					// Increment slide count
      } // endif className == slideClass
     } // end for j
    } // endif this.childNodes[i]
   } // end for i
   break; // end fadeHTML

  case('tiles'):
  this.swapFlag = 0;
  this.curTile = 1;
  this.curSlide = 0;
  this.nextSlide = 1;
  this.setBoxSize(slideWidth, slideHeight);
  this.tileWidth = Math.floor(slideWidth/2);
  this.tileHeight = Math.floor(slideHeight/2);
  this.t1LeftInit = 0;
  this.t2LeftInit = this.tileWidth;
  this.t3LeftInit = 0;
  this.t4LeftInit = this.tileWidth;
  this.gallery = new Array();
  this.titles = new Array();
  this.theTiles = new Array();
  this.theTileImages = new Array();
    for (i=1; i<=4; i++) {
     suffix = String(this.showNum) + '_' + String(i);
     tileID = 'rdTile' + suffix;
     tileImgID = 'rdTileImg' + suffix;
     theSlide = "<div class='" + slideTileClass + "' id='" + tileID + "'>";
     theSlide += "<img src='' width='" + slideWidth + "' height='" + slideHeight + "' id='" + tileImgID + "'>";
     theSlide += "</div>\n";
     this.showBox.innerHTML += theSlide;
     this.theTiles[i] = tileID;
     document.getElementById(tileID).style.zIndex = slideshowZBase + 1;
     this.theTileImages[i] = tileImgID;
     document.getElementById(tileImgID).style.position = 'absolute';
     document.getElementById(tileImgID).style.zIndex = slideshowZBase + 1;
    } // end for i
  this.showBox.innerHTML += "<div class=\"" + slideTitleClass + "\" id=\"titleBox" + this.showNum + "\"></div>\n";

  positionElementByID(this.theTiles[1], 0, 0);
  positionElementByID(this.theTiles[2], 0, this.tileWidth);
  positionElementByID(this.theTiles[3], this.tileHeight, 0);
  positionElementByID(this.theTiles[4], this.tileHeight, this.tileWidth);

  sizeElementByID(this.theTiles[1], this.tileWidth, this.tileHeight);
  sizeElementByID(this.theTiles[2], this.tileWidth, this.tileHeight);
  sizeElementByID(this.theTiles[3], this.tileWidth, this.tileHeight);
  sizeElementByID(this.theTiles[4], this.tileWidth, this.tileHeight);

  positionElementByID(this.theTileImages[1], 0, 0);
  positionElementByID(this.theTileImages[2], 0, (this.tileWidth * -1));
  positionElementByID(this.theTileImages[3], (this.tileHeight * -1), 0);
  positionElementByID(this.theTileImages[4], (this.tileHeight * -1), (this.tileWidth * -1));

  document.getElementById('titleBox' + this.showNum).style.position = 'absolute';
  document.getElementById('titleBox' + this.showNum).style.zIndex = slideshowZBase + 2;
  document.getElementById('titleBox' + this.showNum).style.left = '6px';
  document.getElementById('titleBox' + this.showNum).style.bottom = String(this.titleFontSize - 20) + 'px';

  this.loadGallery = loadGallery;
  this.loadTitles = loadTitles;
  break; // end tiles

  case('captions'):
   boxWidth = slideWidth;
   boxHeight = (slideHeight + captionHeight) - captionOverlap;
   this.setBoxSize(boxWidth, boxHeight);
   this.captionHeight = captionHeight;
   this.descHeight = captionHeight;
   this.setCaptionFont = setCaptionFont;
   this.setCaptionFontSize = setCaptionFontSize;
   this.setCaptionFontColor = setCaptionFontColor;
   this.setCaptionFontWeight = setCaptionFontWeight;
   this.setCaptionBackgroundColor = setCaptionBackgroundColor;
   this.setCaptionOpacity = setCaptionOpacity;
// Walk the showBox for slideshow elements
   this.slideIDs = new Array();
   this.slideDescIDs = new Array();
   for (i=0; i<this.showBox.childNodes.length; i++) {
    if (this.showBox.childNodes[i].className == slideshowListClass) {
     listNode = this.showBox.childNodes[i];
     for (j=0; j<listNode.childNodes.length; j++) {
       slideNode = listNode.childNodes[j];

      if (slideNode.className == slideClass) {
          this.slideIDs[this.slideIDs.length] = slideNode.id;
	  newSlide = document.getElementById(slideNode.id);
          newSlide.style.top = '0px';
          newSlide.style.left = String(this.boxWidth) + 'px';
      } // endif className == slideClass

      if (slideNode.className == slideDescClass) {
          this.slideDescIDs[this.slideDescIDs.length] = slideNode.id;
	  newDesc = document.getElementById(slideNode.id);
          newDesc.style.top = String(this.boxHeight) + 'px';
          newDesc.style.left = '0px';
       } // endif slideNode.childNodes[j] == slideDescClass

     } // end for j
    } // endif className == slideshowListClass
   } // end for i
   break;
  } // end switch(this.showType)
} // end RDSlideshow()

// startShow(# of seconds between slide transitions, slide transition cycle speed in milliseconds)
 function startShow(idleTime, delay) {
   this.idleTime = idleTime;
   this.delay = delay;
   this.cycleCount = 0;

  switch(this.showType) {
   case('fader'):
   case('mover'):
   this.showBox.innerHTML =  "<div id=\"" + this.imageBox1ID + "\"></div>\n";
   this.showBox.innerHTML += "<div id=\"" + this.titleBox1ID + "\"></div>\n";
   this.showBox.innerHTML += "<div id=\"" + this.imageBox2ID + "\"></div>\n";
   this.showBox.innerHTML += "<div id=\"" + this.titleBox2ID + "\"></div>\n";
   this.showBox.style.backgroundColor = 'white';
   this.showBox.style.border = 'solid ' + String(this.boxBorderWidth) + 'px ' + this.boxBorderColor;
   this.showBox.style.margin = '0px';
   this.showBox.style.position = 'relative';
   this.showBox.style.top = '0px';
   this.showBox.style.left = '0px';
   this.showBox.style.zIndex = slideshowZBase;
   this.s1BoxObject = document.getElementById(this.imageBox1ID);
   this.s2BoxObject = document.getElementById(this.imageBox2ID);
   this.s1BoxObject.style.position = 'absolute';
   this.s1BoxObject.style.top = '0px';
   this.s1BoxObject.style.left = String( (this.boxWidth - this.slideWidth) /2 ) + 'px';
   this.s2BoxObject.style.position = 'absolute';
   this.s2BoxObject.style.top = '0px';
   this.s2BoxObject.style.left = String((this.boxWidth - this.slideWidth)/2) + 'px';
   this.s1BoxObject.innerHTML = "<img src=\"" + this.gallery[0] + "\" width=\"" + this.slideWidth + "\" height=\"" + this.slideHeight + "\" id=\"" + this.slide1ID + "\">\n";
   this.s2BoxObject.innerHTML = "<img src=\"" + this.gallery[1] + "\" width=\"" + this.slideWidth + "\" height=\"" + this.slideHeight + "\" id=\"" + this.slide2ID + "\">\n";
   this.s1Object = document.getElementById(this.slide1ID);
   this.s2Object = document.getElementById(this.slide2ID);
   this.t1BoxObject = document.getElementById(this.titleBox1ID);
   this.t2BoxObject = document.getElementById(this.titleBox2ID);
   this.t1BoxObject.style.position = 'absolute';
   this.t1BoxObject.style.bottom = '0px';
   this.t1BoxObject.style.left = '0px';
   this.t1BoxObject.style.width = String(this.slideWidth-4) + 'px';
   this.t1BoxObject.style.height = String(this.titleFontSize + 6) + 'px';
   this.t1BoxObject.style.margin = '0px';
   this.t1BoxObject.style.padding = '0px 4px';
   this.t1BoxObject.style.backgroundColor = 'transparent';
   this.t1BoxObject.style.fontFamily = this.titleFont;
   this.t1BoxObject.style.fontSize = String(this.titleFontSize) + 'px';
   this.t1BoxObject.style.color = this.titleFontColor;
   this.t1BoxObject.style.fontWeight = this.titleFontWeight;
   this.t2BoxObject.style.position = 'absolute';
   this.t2BoxObject.style.bottom = '0px';
   this.t2BoxObject.style.left = '0px';
   this.t2BoxObject.style.width = String(this.slideWidth-4) + 'px';
   this.t2BoxObject.style.height = String((this.titleFontSize + 6)) + 'px';
   this.t2BoxObject.style.margin = '0px';
   this.t2BoxObject.style.padding = '0px 4px';
   this.t2BoxObject.style.backgroundColor = 'transparent';
   this.t2BoxObject.style.fontFamily = this.titleFont;
   this.t2BoxObject.style.fontSize = String(this.titleFontSize) + 'px';
   this.t2BoxObject.style.color = this.titleFontColor;
   this.t2BoxObject.style.fontWeight = this.titleFontWeight;
   this.t1BoxObject.innerHTML = "<div id=\"" + this.title1ID + "\"></div>\n";
   this.t2BoxObject.innerHTML = "<div id=\"" + this.title2ID + "\"></div>\n";
   this.t1Object = document.getElementById(this.titleBox1ID);
   this.t2Object = document.getElementById(this.titleBox2ID);
   this.s1BoxObject.style.width = String(this.slideWidth) + 'px';
   this.s1BoxObject.style.height = String(this.slideHeight) + 'px';
   this.s2BoxObject.style.width = String(this.slideWidth) + 'px';
   this.s2BoxObject.style.height = String(this.slideHeight) + 'px';
   this.s1Object.style.width = String(this.slideWidth) + 'px';
   this.s1Object.style.height = String(this.slideHeight) + 'px';
   this.s2Object.style.width = String(this.slideWidth) + 'px';
   this.s2Object.style.height = String(this.slideHeight) + 'px';
   this.slide1Opactity = 100;
   this.slide2Opactity = 0;
   this.s1Object.src = this.gallery[0];		// fetch image file for Slide 1
   if (this.titles.length > 0) { this.t1Object.innerHTML = this.titles[0]; }    // fetch title 1 text
   this.s2Object.src = this.gallery[1];		// fetch image file for Slide 2
   if (this.titles.length > 0) { this.t2Object.innerHTML = this.titles[1]; }     // fetch title 2 text
     if (this.showType == 'fader') {
   this.s1BoxObject.style.zIndex = slideshowZBase + 2;
   this.t1BoxObject.style.zIndex = slideshowZBase + 3;
   this.s2BoxObject.style.zIndex = slideshowZBase + 4;
   this.t2BoxObject.style.zIndex = slideshowZBase + 5;
   lightup(this.s2Object, this.slide2Opactity);  // initialize 2nd slide opacity first to make it "invisible"
   lightup(this.t2Object, this.slide2Opactity);  // initialize 2nd title opacity, too
   lightup(this.s1Object, this.slide1Opactity);  // then initialize 1st slide opacity
   lightup(this.t1Object, this.slide1Opactity);  // then initialize 1st title opacity
    } // endif this.showType == 'fader'
     if (this.showType == 'mover') {
   this.s1BoxObject.style.zIndex = slideshowZBase + 4;
   this.t1BoxObject.style.zIndex = slideshowZBase + 5;
   this.s2BoxObject.style.zIndex = slideshowZBase + 2;
   this.t2BoxObject.style.zIndex = slideshowZBase + 3;
    this.s1Top = s1TopInit;            // slide #1 top position
    this.s1Left = s1TopInit;           // slide #1 left position
    this.s2Top = s2TopInit;            // slide #2 top position
    this.s2Left = s2LeftInit;          // slide #2 left position
    this.t1Bottom = t1BottomInit;      // title #1 bottom position
    this.t1Left = t1LeftInit;          // title #1 left position
    this.t2Bottom = t2BottomInit;      // title #2 bottom position
    this.t2Left = t2LeftInit;          // title #2 left position
     } // endif this.showType == 'mover'
   this.timeoutID = setTimeout('doIdle(' + this.showNum + ')', this.idleTime * 1000);
   break; // end fader, mover

   case('tiles'):
   this.curSlide = 0;
   this.nextSlide = 1;
   this.switchFlag = 0;
   this.swapFlag = 0;
   this.curTile = 1;
    for (i=1; i<=4; i++) {
     document.getElementById(this.theTiles[i]).style.width = String(this.tileWidth) + 'px';
     tLeft = ((i/2) != Math.floor(i/2)) ? 0 : this.tileWidth;
     document.getElementById(this.theTiles[i]).style.left = String(tLeft) + 'px';
     document.getElementById(this.theTileImages[i]).src = this.gallery[this.curSlide];
    } // end for i
    if (this.titles.length > 0) {
     titleBox = document.getElementById('titleBox' + this.showNum);
     titleBox.innerHTML = '<p>' + this.titles[0] + '</p>';
     titleBox.style.fontFamily = this.titleFont;
     titleBox.style.fontColor = this.titleFontColor;
     titleBox.style.fontSize = this.titleFontSize + 'px';
     titleBox.style.fontWeight = this.titleFontWeight;
    }
   this.timeoutID = setTimeout('doIdle(' + this.showNum + ')', this.idleTime * 1000);
   break; // end tiles

   case('fadeHTML'):
   this.curSlide = 0;
   this.nextSlide = 1;
   this.switchFlag = 0;
   this.timeoutID = setTimeout('doIdle(' + this.showNum + ')', this.idleTime * 1000);
   break; // end fadeHTML

   case('captions'):
   this.curSlide = -1;
   this.nextSlide = 0;
   this.switchFlag = 0;
   captions(this.showNum);
   break; // end captions
  } // end switch(this.showType)
 } // end startShow()

function doIdle(showNum) {
  showObj = RDShows[showNum];
    if (showObj.pauseFlag == 0) {	// Are we paused?
     switch(showObj.showType) {		// No! Process idle tasks
      case('fader'):
      case('mover'):
      case('fadeHTML'):
      case('tiles'):
       showObj.timeoutID = setTimeout(showObj.showType + '(' + showObj.showNum + ')', showObj.delay);  // No! Begin fade/transition
       break;
      case('captions'):
       showObj.timeoutID = setTimeout('doNext(' + showObj.showNum + ')', showObj.delay);       // No! Begin transition
      break;
     } // end switch(showObj.showType)
      } else {
       showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.delay);    // Yes! Check here again (soon!)
    } // endif pauseFlag   
 } // end doIdle


  function pauseShow(showNum) {
     RDShows[showNum].pauseFlag = 1;
     return true;
   }

  function resumeShow(showNum) {
     RDShows[showNum].pauseFlag = 0;
     return true;
  }

  function restartShow(showNum) {
   showObj = RDShows[showNum];
   if (showObj.timeoutID != null) { clearTimeout(showObj.timeoutID); }
   showObj.cycleCount = 0;
   showObj.switchFlag = 0;
   showObj.timeoutID = null;
   showObj.timer = 0;
   showObj.pauseFlag = 0;
   showObj.curSlide = showObj.slide1ID;
   showObj.nextSlide = 1;
   showObj.slide1Opacity = 0;
   showObj.slide2Opacity = 0;

 if (showObj.showType == 'fadeHTML') {
  for (i=0; i<showObj.numSlides; i++) {
   if (i == 0) { showObj.slideOpacity[i] = 100; } else { showObj.slideOpacity[i] = 0; }
   lightup(document.getElementById(showObj.slideIDs[i]), showObj.slideOpacity[i]);   
  } // end for i
  showObj.curSlide = 0;
  showObj.nextSlide = 1;
 } // endif showType == 'fadeHTML'

  if (showObj.showType == 'captions') {
   showObj.curSlide = -1;
   showObj.nextSlide = 0;
// Need to re-position slide elements here!
    for (i=0; i<showObj.slideIDs.length; i++) {
     document.getElementById(showObj.slideIDs[i]).style.left = String(showObj.boxWidth) + 'px';
     document.getElementById(showObj.slideDescIDs[i]).style.top = String(showObj.boxHeight) + 'px';
    } // end for i
  } // endif showObj.showType == 'captions'

   showObj.startShow(showObj.idleTime, showObj.delay);
   return true;
 }

function fader(showNum) {
  showObj = RDShows[showNum];
   if (showObj.pauseFlag == 0) {			// Are we paused?
     showObj.switchFlag = 0;				// No! Continue processing transition.  Init switchFlag
     if (showObj.curSlide == showObj.slide1ID) {	// Is Slide 1 Current/Top?
     showObj.slide1Opactity -= opIncrement;		// Yes! Reduce its opacity by opIncrement
     showObj.slide2Opactity += opIncrement;		// Increase Slide 2 opacity by opIncrement
     if (showObj.slide1Opactity <= 0) {			// Is Slide 1 completely transparent?
        showObj.curSlide = showObj.slide2ID;		// Yes! Switch current slide
        showObj.slide1Opactity = 0;			// Insure legal min opacity 1
        showObj.slide2Opactity = 100;			// Insure legal max opacity 2
        showObj.nextSlide++;				// Bump next slide #
        if (showObj.nextSlide == showObj.gallery.length) { showObj.nextSlide = 0; showObj.cycleCount++; }  // Check for start of slide files list
        showObj.s1Object.src = showObj.gallery[showObj.nextSlide];	  // Change source file of Slide 1
	if (showObj.titles.length > 0) { showObj.t1Object.innerHTML = showObj.titles[showObj.nextSlide]; }
        showObj.switchFlag = 1;				// Show we switched slides
      } // endif slide1Opactity <= 0
     lightup(showObj.s1Object, showObj.slide1Opactity);	// Update Slide 1 opacity on screen
     lightup(showObj.t1Object, showObj.slide1Opactity);	// Update Title 1 opacity on screen
     lightup(showObj.s2Object, showObj.slide2Opactity);	// Update Slide 2 opacity on screen
     lightup(showObj.t2Object, showObj.slide2Opactity);	// Update Title 2 opacity on screen
       } else {			  // Slide 2 is current/top.  Do same for it.
     showObj.slide1Opactity += opIncrement;
     showObj.slide2Opactity -= opIncrement;
     if (showObj.slide2Opactity <= 0) {
        showObj.curSlide = showObj.slide1ID;  			  // Switch current slide
        showObj.slide1Opactity = 100;			  // Insure legal max opacity 1
        showObj.slide2Opactity = 0;			  // Insure legal min opacity 2
        showObj.nextSlide++;				  // Bump next slide #
        if (showObj.nextSlide == showObj.gallery.length) { showObj.nextSlide = 0; showObj.cycleCount++; }
        showObj.s2Object.src = showObj.gallery[showObj.nextSlide];
	if (showObj.titles.length > 0) { showObj.t2Object.innerHTML = showObj.titles[showObj.nextSlide]; }
        showObj.switchFlag = 1;
     } // endif slide2Opactity <= 0
     lightup(showObj.s1Object, showObj.slide1Opactity);
     lightup(showObj.t1Object, showObj.slide1Opactity);
     lightup(showObj.s2Object, showObj.slide2Opactity);
     lightup(showObj.t2Object, showObj.slide2Opactity);
   } // endif curSlide == "slide2"

   } // endif pauseFlag == 0

   if ((showObj.cycleCount < showObj.maxCycles) || (showObj.maxCycles == 0)) { // Have we completed slideshow cycles?
      if (showObj.timeoutID != null) { clearTimeout(showObj.timeoutID); showObj.timeoutID = null; }
      if (showObj.switchFlag == 0) {			       // No! Check switchFlag
        showObj.timeoutID = setTimeout('fader(' + showObj.showNum + ')', showObj.delay);      // No switch this time, so keep fading!
          } else {
        showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.idleTime * 1000);  // We switched! Use doIdle() for idleTime setting;
      } // endif switchFlag
    } // endif cycleCount

 } // end fader()

// Panes Support

function moveSlide(imageDiv, sTop, sLeft) {
   imageDiv.style.top = String(sTop) + 'px';
   imageDiv.style.left = String(sLeft) + 'px';
 } // end moveSlide

function moveTitle(titleDiv, tBottom, tLeft) {
   titleDiv.style.bottom = String(tBottom) + 'px';
   titleDiv.style.left = String(tLeft) + 'px';
 } // end moveSlide

function mover(showNum) {
  showObj = RDShows[showNum];
    if (showObj.pauseFlag == 0) {			  // Are we paused?
     showObj.switchFlag = 0;				  // No! Continue processing fade/transition sequence
    if (showObj.curSlide == showObj.slide1ID) {
     showObj.s1Left -= opIncrement;			  // Move Slide 1 to the left by opIncrement
     showObj.t1Left -= opIncrement;			  // Move Title 1 to the left by opIncrement
     if (showObj.s1Left <= -showObj.slideWidth) {
        showObj.curSlide = showObj.slide2ID;		  // switch current slide
        showObj.s2BoxObject.style.zIndex = slideshowZBase + 4;	  // swap z-indexes
	showObj.t2BoxObject.style.zIndex = slideshowZBase + 5;
        showObj.s1BoxObject.style.zIndex = slideshowZBase + 2;
	showObj.t1BoxObject.style.zIndex = slideshowZBase + 3;
        showObj.s1Top = 0;				  // slide #1 top position
        showObj.s1Left = 0;				  // slide #1 left position
	showObj.t1Bottom = t1BottomInit;
	showObj.t1Left = t1LeftInit;
        showObj.nextSlide++;				  // bump next slide #
        if (showObj.nextSlide == showObj.gallery.length) { showObj.nextSlide = 0; showObj.cycleCount++; }
        showObj.s1Object.src = showObj.gallery[showObj.nextSlide];
	if (showObj.titles.length > 0) { showObj.t1Object.innerHTML = showObj.titles[showObj.nextSlide]; }
        showObj.switchFlag = 1;				  // Show we switched slides
      } // endif op1 <= 0
     moveSlide(showObj.s1BoxObject, showObj.s1Top, showObj.s1Left);
     moveTitle(showObj.t1BoxObject, showObj.t1Bottom, showObj.t1Left);
   } else {
     showObj.s2Top -= opIncrement;
     showObj.t2Bottom += opIncrement;
     if (showObj.s2Top <= -showObj.slideHeight) {
        showObj.curSlide = showObj.slide1ID;		  // switch current slide
        showObj.s1BoxObject.style.zIndex = slideshowZBase + 4;	  // swap z-indexes
	showObj.t1BoxObject.style.zIndex = slideshowZBase + 5;
        showObj.s2BoxObject.style.zIndex = slideshowZBase + 2;
	showObj.t2BoxObject.style.zIndex = slideshowZBase + 3;
        showObj.s2Top = 0;				  // slide #2 top position
        showObj.s2Left = 0;				  // slide #2 left position
	showObj.t2Bottom = t2BottomInit;
	showObj.t2Left = t2LeftInit;
        showObj.nextSlide++;				  // bump next slide #
        if (showObj.nextSlide == showObj.gallery.length) { showObj.nextSlide = 0; showObj.cycleCount++; }
        showObj.s2Object.src = showObj.gallery[showObj.nextSlide];
	if (showObj.titles.length > 0) { showObj.t2Object.innerHTML = showObj.titles[showObj.nextSlide]; }
        showObj.switchFlag = 1;				  // Show we switched slides
     } // endif op2 <= 0
     moveSlide(showObj.s2BoxObject, showObj.s2Top, showObj.s2Left);
     moveTitle(showObj.t2BoxObject, showObj.t2Bottom, showObj.t2Left);
   } // endif showObj.curSlide == showObj.slide2ID

   } // endif pauseFlag

   if ((showObj.cycleCount < showObj.maxCycles) || (showObj.maxCycles == 0)) { // Have we completed slideshow cycles?
        if (showObj.timeoutID != null) { clearTimeout(showObj.timeoutID); showObj.timeoutID = null; }
      if (showObj.switchFlag == 0) {			       // No! Did we switch slides?
        showObj.timeoutID = setTimeout('mover(' + showObj.showNum + ')', showObj.delay);      // Not this time, so continue transition!
          } else {
        showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.idleTime * 1000);  // We switched! Use doIdle() for idleTime setting;
      } // endif switchFlag
    } // endif cycleCount

 } // end mover()

 function tiles(showNum) {
  showObj = RDShows[showNum];
  showObj.switchFlag = 0;		// init change completed flag

  theTile = document.getElementById(showObj.theTiles[showObj.curTile]);
  tWidth = parseInt(theTile.style.width);
  tLeft = parseInt(theTile.style.left);

  theTileImg = document.getElementById(showObj.theTileImages[showObj.curTile]);
  tIWidth = parseInt(theTileImg.style.width);
  tILeft = parseInt(theTileImg.style.left);

   if (showObj.swapFlag == 0) {
	tWidth -= opIncrement;
	if (tWidth < 0) { tWidth = 0; }
	theTile.style.width = String(tWidth) + 'px';
        theTile.style.left = String(tLeft + (Math.floor(opIncrement * .5))) + 'px';

	if (tWidth == 0) {
		showObj.swapFlag = 1;
		document.getElementById(showObj.theTileImages[showObj.curTile]).src = showObj.gallery[showObj.nextSlide];
	} // endif tWidth == 0

     } else {
	tWidth += opIncrement;
        if (tWidth > showObj.tileWidth) { tWidth = showObj.tileWidth; }
	theTile.style.width = String(tWidth) + 'px';
        theTile.style.left = String(tLeft - (Math.floor(opIncrement * .5))) + 'px';

	if (tWidth == showObj.tileWidth) {
		showObj.swapFlag = 0;		// Clear swapping flag
		showObj.curTile++;		// Move to next tile
	} // endif (tWidth == tileWidth)
   } // endif swapFlag

   if (showObj.curTile == 5) {
	showObj.curTile = 1;
	showObj.curSlide = showObj.nextSlide;
	showObj.nextSlide++;
	showObj.switchFlag = 1;		// Show switch completed!
    if (showObj.nextSlide == showObj.gallery.length) { showObj.nextSlide = 0; showObj.cycleCount++; }
       } // endif curTile

    if (showObj.switchFlag == 1) {
	for (i=1; i<=4; i++) {
	 document.getElementById(showObj.theTileImages[i]).src = showObj.gallery[showObj.curSlide];
	} // end for i
        showTitle(showObj.showNum);
    if ((showObj.cycleCount < showObj.maxCycles) || (showObj.maxCycles == 0)) { // Have we completed slideshow cycles?
	showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.idleTime * 1000);
    }
      } else {
        hideTitle(showObj.showNum);
	showObj.timeoutID = setTimeout('tiles(' + showObj.showNum + ')', (showObj.delay/5));
      }

 } // end tiles()

function captions(showNum) {		// was moverNext in deluxe
  showObj = RDShows[showNum];
  showObj.switchFlag = 0;		// init change completed flag

  if (showObj.curSlide >= 0) {		// special case first slide at showStart()
   s1 = document.getElementById(showObj.slideIDs[showObj.curSlide]);
   showObj.curLeft = parseInt(s1.style.left) - opIncrement;	// calculate new left for curSlide
  } // endif (showObj.curSlide > 0)

  s2 = document.getElementById(showObj.slideIDs[showObj.nextSlide]);
  showObj.nextLeft = parseInt(s2.style.left) - opIncrement;

  if (showObj.nextLeft >= 0) {
    if (showObj.curSlide >= 0) { moveSlide(s1, 0, showObj.curLeft); }
    moveSlide(s2, 0, showObj.nextLeft);
    showObj.timeoutID = setTimeout('captions(' + showNum + ')', showObj.delay);  // Not done - Come back after delay
   } else {
    showObj.switchFlag = 1;
     if (showObj.curSlide < 0) {
       showObj.curSlide = -1;
       showObj.nextSlide = 0; // special case 1st slide - fool cycle logic below
        } else {
// put 'invisible' curSlide back into stack
       document.getElementById(showObj.slideIDs[showObj.curSlide]).style.left = String(showObj.boxWidth) + 'px';
       document.getElementById(showObj.slideDescIDs[showObj.curSlide]).style.top = String(showObj.boxHeight) + 'px';
     } // endif showObj.curSlide < 0

    showObj.curSlide = showObj.nextSlide;
    showObj.nextSlide++;
    if (showObj.nextSlide == showObj.slideIDs.length) { showObj.nextSlide = 0; showObj.cycleCount++; }
  } // endif nextLeft >= 0

  if (showObj.switchFlag == 1) {
     if (showStats == 1) { statsCaptions(showNum); }
   showDesc(showObj.showNum);
    if ((showObj.cycleCount < showObj.maxCycles) || (showObj.maxCycles == 0)) { // Have we completed slideshow cycles?
     showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.idleTime * 1000);
    } // endif showObj.cycleCount
   } // endif showObj.switchFlag

 } // end captions()

 function statsCaptions(showNum) {
  showObj = RDShows[showNum];
  x = '<p>showObj.curSlide = ' + showObj.curSlide + '<br>';
  x += 'showObj.nextSlide = ' + showObj.nextSlide + '<br>';
  x += 'showObj.slideDescIDs[curSlide] = ' + showObj.slideDescIDs[showObj.curSlide] + "<br>\n";
  x += 'showObj.slideIDs[showObj.curSlide = ' + showObj.slideIDs[showObj.curSlide] + "<br>\n";
  x += 'showObj.nextSlide = ' + showObj.nextSlide + "<br>\n";
  x += 'showObj.slideIDs[showObj.nextSlide = ' + showObj.slideIDs[showObj.nextSlide] + "<br>\n";
  x += 'showObj.slideIDs.length = ' + showObj.slideIDs.length + "<br>\n";
  x += '</p>';
  document.getElementById('status').innerHTML = x;
 }

 function doNext(showNum) {
  showObj = RDShows[showNum];
   hideDesc(showNum);
   captions(showNum);
 } // end doNext()


function showDesc(showNum) {
  showObj = RDShows[showNum];
  theDesc = document.getElementById(showObj.slideDescIDs[showObj.curSlide]);
  curDTop = parseInt(theDesc.style.top) - opIncrement;
    if (curDTop >= (showObj.boxHeight - showObj.captionHeight)) {		// Is description fully visible yet?
     theDesc.style.top = String(curDTop) + 'px';
     showObj.timeoutID = setTimeout('showDesc(' + showNum + ')', delay);	// Not this time, so continue transition!
   } // endif curDTop
 } // end showDesc()

function hideDesc(showNum) {
  showObj = RDShows[showNum];
  theDesc = document.getElementById(showObj.slideDescIDs[showObj.curSlide]);
  curDTop = parseInt(theDesc.style.top) + opIncrement;
   if (curDTop <= showObj.boxHeight) {						// Is description fully hidden yet?
    theDesc.style.top = String(curDTop) + 'px';
    showObj.timeoutID = setTimeout('hideDesc(' + showNum + ')', delay);		// Not this time, so continue transition!
   } // endif curDTop 
} // end hideDesc()

function showTitle(showNum) {
  showObj = RDShows[showNum];
   if (showObj.titles.length > 0) {
  document.getElementById('titleBox' + showObj.showNum).innerHTML = '<p>' + showObj.titles[showObj.curSlide] + '</p>';
   }
 } // end showTitle

function hideTitle(showNum) {
  showObj = RDShows[showNum];
   if (showObj.titles.length > 0) {
  document.getElementById('titleBox' + showObj.showNum).innerHTML = '';
   }
 }


function fadeHTML(showNum) {
  showObj = RDShows[showNum];
   if (showObj.pauseFlag == 0) {			// Are we paused?
     showObj.switchFlag = 0;				// No! Continue processing transition.  Init switchFlag

     showObj.slideOpacity[showObj.curSlide] -= opIncrement;
     if (showObj.slideOpacity[showObj.curSlide] < 0) { showObj.slideOpacity[showObj.curSlide] = 0; }
     lightup(document.getElementById(showObj.slideIDs[showObj.curSlide]), showObj.slideOpacity[showObj.curSlide]);

     showObj.slideOpacity[showObj.nextSlide] += opIncrement;
     if (showObj.slideOpacity[showObj.nextSlide] > 100) { showObj.slideOpacity[showObj.nextSlide] = 100; }
     lightup(document.getElementById(showObj.slideIDs[showObj.nextSlide]), showObj.slideOpacity[showObj.nextSlide]);

	if (showObj.slideOpacity[showObj.curSlide] == 0) {
	showObj.switchFlag = 1;				// We've changed!
	showObj.curSlide = showObj.nextSlide;		// Update curSlide
	showObj.nextSlide++;				// Bump nextSlide
	if (showObj.nextSlide == showObj.numSlides) {	// Done all slides?
	  showObj.nextSlide = 0;			// Yes! Reset nextSlide
	  showObj.cycleCount++;				// Bump cycleCount
	} // endif showObj.nextSlide == showObj.numSlides
	} // endif showObj.slideOpacity

   } // endif pauseFlag == 0

// fadeHTMLstats(showNum);

   if ((showObj.cycleCount < showObj.maxCycles) || (showObj.maxCycles == 0)) { // Have we completed slideshow cycles?
      if (showObj.timeoutID != null) { clearTimeout(showObj.timeoutID); showObj.timeoutID = null; }
      if (showObj.switchFlag == 0) {			       // No! Check switchFlag
        showObj.timeoutID = setTimeout(showObj.showType + '(' + showObj.showNum + ')', showObj.delay);      // No switch this time, so keep fading!
          } else {
        showObj.timeoutID = setTimeout('doIdle(' + showObj.showNum + ')', showObj.idleTime * 1000);  // We switched! Use doIdle() for idleTime setting;
      } // endif switchFlag
    } // endif cycleCount

 } // end fadeHTML()

function fadeHTMLstats(showNum) {
 showObj = RDShows[showNum];
 x = '<p>';
  x += "slideOpacity = " + showObj.slideOpacity + "<br>\n";
  x += "slideOpacity = " + showObj.slideOpacity[0] + "<br>\n";
  x += "numSlides = " + showObj.numSlides + "<br>\n";
  x += "curSlide = " + showObj.curSlide + "<br>\n";
  x += "nextSlide = " + showObj.nextSlide + "<br>\n"
  x += "curSlide Opacity = " + showObj.slideOpacity[showObj.curSlide] + "<br>\n";
  x += "nextSlide Opacity = " + showObj.slideOpacity[showObj.nextSlide] + "<br>\n";
  x += "</p>\n";
 document.getElementById('status').innerHTML = x;
} // end fadeHTMLstats()

function moverPrevious(showNum) {
  showObj = RDShows[showNum];
    switchFlag = 0;				  // No! Continue processing fade/transition sequence
    if (showObj.curSlide == "slide1") {
     s1Left += opIncrement;			  // Move Slide 1 to the left by opIncrement
     if (s1Left >= slideWidth) {
        curSlide = "slide2";			  // switch current slide
        s2BoxObject.style.zIndex = slideshowZBase + 2;
        s1BoxObject.style.zIndex = slideshowZBase + 1;	  // swap z-idexes
        s1Top = 0;				  // slide #1 top position
        s1Left = 0;				  // slide #1 left position
        s1Object.src = gallery[nextSlide];
        switchFlag = 1;				  // Show we switched slides
      } // endif op1 >= slideWidth
     moveSlide(s1BoxObject, s1Top, s1Left);
   } else {
     s2Left += opIncrement;
     if (s2Left >= slideWidth) {
        curSlide = "slide1";			  // switch current slide
        s1BoxObject.style.zIndex = slideshowZBase + 2;
        s2BoxObject.style.zIndex = slideshowZBase + 1 ;	  // swap z-idexes
        s2Top = 0;				  // slide #2 top position
        s2Left = 0;				  // slide #2 left position
        s2Object.src = gallery[nextSlide];
        switchFlag = 1;				  // Show we switched slides
     } // endif op2 >= slideWidth
     moveSlide(s2BoxObject, s2Top, s2Left);
   } // endif curSlide == "slide2"
   if ((cycleCount < maxCycles) || (maxCycles == 0)) { // Have we completed slideshow cycles?
      if (switchFlag == 0) {			       // No! Did we switch slides?
        timeoutID = setTimeout('moverPrevious(' + showNum + ')', delay);      // Not this time, so continue transition!
          } else {
        if (nextSlide == gallery.length) { nextSlide = 0; cycleCount++; }
      } // endif switchFlag
    } // endif cycleCount
 } // end moverPrevious()


// Slideshow Object Style Functions

function lightup(imageobject, opacity) {
 if (document.all) { 
	imageobject.style.filter = 'alpha(opacity=' + opacity + ')';
	} else {
	imageobject.style.opacity = (opacity/100);
 } // endif IE
} // end lightup()

 function sizeElementByID(id, width, height) {
  document.getElementById(id).style.width = String(width) + 'px';
  document.getElementById(id).style.height = String(height) + 'px';
 } // end sizeElementByID()

 function positionElementByID(id, top, left) {
  document.getElementById(id).style.top = String(top) + 'px';
  document.getElementById(id).style.left = String(left) + 'px';
 } // end positionElementByID()

 function setBoxSize(width, height) {
  this.boxWidth = width;
  this.boxHeight = height;
  this.showBox.style.width = String(width) + 'px';
  this.showBox.style.height = String(height) + 'px';
 } // end setBoxSize()

 function setBoxBorderWidth(width) {
  this.boxBorderWidth = width;
  this.showBox.style.borderWidth = String(width) + 'px';
 } // end setBoxBorderWidth()

 function setBoxBorderColor(color) {
  this.boxBorderColor = color;
  this.showBox.style.borderColor = color;
 } // end setBoxBorderColor()

 function setBoxBackgroundColor(color) {
  this.boxBackgroundColor = color;
  this.showBox.style.backgroundColor = color;
 } // end setBoxBackgroundColor()

 function setMaxCycles(maxCycles) {
  this.maxCycles = maxCycles;
 } // end setMaxCycles()

 function setSlideSize(width, height) {
  this.slideWidth = width;
  this.slideHeight = height;
  this.showBox.style.width = String(width) + 'px';
  this.showBox.style.height = String(height) + 'px';
 } // end setSize()

 function loadGallery(galleryArray) {
  for (i=0; i<galleryArray.length; i++) {
   this.gallery[i] = galleryArray[i];
  } // end for i
 } // end loadGallery()

 function loadTitles(titlesArray) {
  for (i=0; i<titlesArray.length; i++) {
   this.titles[i] = titlesArray[i];
  } // end for i
 } // end loadSlides()

 function setTitleFont(font) {
  this.titleFont = font;
   if(this.t1BoxObject) {
  this.t1BoxObject.style.fontFamily = font;
  this.t2BoxObject.style.fontFamily = font;
   }
  if (this.showType == 'tiles') {
   document.getElementById('titleBox' + this.showNum).style.fontFamily = font;
  } // endif this.showType = 'tiles'
  if (this.showType == 'fadeHTML') {
   for (i=0;i<this.slideIDs.length; i++) {
    document.getElementById(this.slideDescIDs[i]).style.fontFamily = font;
   } // end for i
  } // endif showType == fadeHTML
 } // end setTitleFont()

 function setTitleFontSize(size) {
  this.titleFontSize = size;
   if(this.t1BoxObject) {
  this.t1BoxObject.style.fontSize = String(this.titleFontSize) + 'px';
  this.t2BoxObject.style.fontSize = String(this.titleFontSize) + 'px';
   }
  if (this.showType == 'tiles') {
   document.getElementById('titleBox' + this.showNum).style.fontSize = String(this.titleFontSize) + 'px';
   document.getElementById('titleBox' + this.showNum).style.bottom = String(this.titleFontSize - 20) + 'px';
  } // endif this.showType = 'tiles'
  if (this.showType == 'fadeHTML') {
   for (i=0;i<this.slideIDs.length; i++) {
    document.getElementById(this.slideDescIDs[i]).style.fontSize = size + 'px';
   } // end for i
  } // endif showType == fadeHTML
 } // end setTitleFontSize()

 function setTitleFontColor(color) {
  this.titleFontColor = color;
   if(this.t1BoxObject) {
  this.t1BoxObject.style.color = color;
  this.t2BoxObject.style.color = color;
   }
  if (this.showType == 'tiles') {
   document.getElementById('titleBox' + this.showNum).style.color = color;
  } // endif this.showType = 'tiles'
  if (this.showType == 'fadeHTML') {
   for (i=0;i<this.slideIDs.length; i++) {
    document.getElementById(this.slideDescIDs[i]).style.color = color;
   } // end for i
  } // endif showType == fadeHTML
 } // end setTitleFontColor()

 function setTitleFontWeight(weight) {
  this.titleFontWeight = weight;
   if(this.t1BoxObject) {
  this.t1BoxObject.style.fontWeight = weight;
  this.t2BoxObject.style.fontWeight = weight;
   }
  if (this.showType == 'tiles') {
   document.getElementById('titleBox' + this.showNum).style.fontWeight = weight;
  } // endif this.showType = 'tiles'
  if (this.showType == 'fadeHTML') {
   for (i=0;i<this.slideIDs.length; i++) {
    document.getElementById(this.slideDescIDs[i]).style.fontWeight = weight;
   } // end for i
  } // endif showType == fadeHTML
 } // end setTitleFontWeight()

 function setCaptionFont(font) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   theDesc.style.fontFamily = font;
  } // end for i
 } // end setCaptionFont()

 function setCaptionFontSize(size) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   theDesc.style.fontSize = size;
  } // end for i
 } // end setCaptionFontSize()

 function setCaptionFontColor(color) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   theDesc.style.color = color;
  } // end for i
 } // end setCaptionFontColor()

 function setCaptionFontWeight(weight) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   theDesc.style.fontWeight = weight;
  } // end for i
 } // end setCaptionFontWeight()

 function setCaptionBackgroundColor(color) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   theDesc.style.backgroundColor = color;
  } // end for i
 } // end setCaptionBackgroundColor()

 function setCaptionOpacity(opacity) {
  for (i=0; i<this.slideDescIDs.length; i++) {
   theDesc = document.getElementById(this.slideDescIDs[i]);
   if (document.all) { 
	theDesc.style.filter = 'alpha(opacity=' + opacity + ')';
	} else {
	theDesc.style.opacity = String(opacity/100);
   } // endif IE
  } // end for i
} // end setCaptionOpacity()

 function makeShowButtons(buttonsID, showNum) {
  buttonBox = document.getElementById(buttonsID);
  buttons = "<form action=\"\" id=\"showcontrol" + showNum + "\">\n";
  buttons += "<p class=\"showButtonBox\">\n";
//  buttons += '<button type="button" class="ssButton" value="" onclick="restartShow(' + showNum + ');">Restart<\/button>&nbsp;';
  buttons += '<button type="button" class="ssButton" value="" onclick="pauseShow(' + showNum + ');">Pause<\/button>&nbsp;';
  buttons += '<button type="button" class="ssButton" value="" onclick="resumeShow(' + showNum + ');">Resume<\/button><br />';
  buttons += "\n<\/p>\n";
  buttons += "<\/form>\n";
  buttonBox.innerHTML = buttons;
 } // end makeShowButtons() 

 function showCode(showObj) {
  alert(showObj.showBox.innerHTML);
 }

 function addCSSRule(theClassName, newRule) {
  selector = '.' + theClassName;
  if (mySheet.addRule) {
   mySheet.addRule(selector, newRule);		// For Internet Explorer
   } else {
   ruleIndex = mySheet.cssRules.length;
   mySheet.insertRule(selector + '{' + newRule + ';}', ruleIndex);	// For Firefox, Chrome, etc.
  } // endif mySheet.addRule
 } // end addCSSRule()

 function removeCSSRule(ruleIndex) {
  if (mySheet.removeRule) {
   mySheet.removeRule(ruleIndex);		// For Internet Explorer
   } else {
   mySheet.deleteRule(ruleIndex);		// For Firefox, Chrome, etc.
  } // endif mySheet.removeRule
 } // end removeCSSRule()

 function findCSSRule(theClassName) {
  selector = '.' + theClassName;
  ruleIndex = -1;				// Default to 'not found'
  theRules = mySheet.cssRules ? mySheet.cssRules : mySheet.rules;
   for (i=0; i<theRules.length; i++) {
    selectors = theRules[i].selectorText.split(' ');
    for (j=0; j<selectors.length; j++) {
     if (selectors[j] == selector) {
      ruleIndex = i;
      break;
     } // endif selectors[j]
    } // end for j
   } // end for i
  return ruleIndex;
 } // end findCSSRule()

 function slideshowRules() {
// showBox CSS rules
addCSSRule(slideshowClass, 'position:relative');
addCSSRule(slideshowClass, 'top:0px');
addCSSRule(slideshowClass, 'left:0px');
addCSSRule(slideshowClass, 'margin:0px');
addCSSRule(slideshowClass, 'padding:0px');
addCSSRule(slideshowClass, 'width:' + String(slideWidth + showBoxPaddingW) + 'px');
addCSSRule(slideshowClass, 'height:' + String(slideHeight + captionHeight - captionOverlap) + 'px');
addCSSRule(slideshowClass, 'overflow:hidden');
addCSSRule(slideshowClass, 'background-color:#800000');
addCSSRule(slideshowClass, 'border:solid 0px transparent');
addCSSRule(slideshowClass, 'z-index:' + slideshowZBase);

addCSSRule(slideshowListClass, 'display:block');
addCSSRule(slideshowListClass, 'position:absolute');
addCSSRule(slideshowListClass, 'top:0px');
addCSSRule(slideshowListClass, 'left:0px');
addCSSRule(slideshowListClass, 'margin:0px');
addCSSRule(slideshowListClass, 'padding:0px');
addCSSRule(slideshowListClass, 'width:100%');
addCSSRule(slideshowListClass, 'height:100%');
addCSSRule(slideshowListClass, 'background-color:transparent');
addCSSRule(slideshowListClass, 'z-index:' + String(slideshowZBase + 1));

addCSSRule(slideClass, 'display:block');
addCSSRule(slideClass, 'position:absolute');
addCSSRule(slideClass, 'top:0px');
addCSSRule(slideClass, 'left:0px');
addCSSRule(slideClass, 'width:100%');
addCSSRule(slideClass, 'height:' + String(slideHeight) + 'px');
addCSSRule(slideClass, 'list-style-type:none');
addCSSRule(slideClass, 'font-family:' + rdShowFont);
addCSSRule(slideClass, 'font-size:' + rdShowFontSize + 'px');
addCSSRule(slideClass, 'color:#ffffff'); // added FNGR?

addCSSRule(slideImgClass, 'margin:0px');
addCSSRule(slideImgClass, 'padding:0px');
addCSSRule(slideImgClass, 'width:100%');
addCSSRule(slideImgClass, 'text-align:center');

addCSSRule(slideDescClass, 'display:block');
addCSSRule(slideDescClass, 'position:absolute');
addCSSRule(slideDescClass, 'top:' + String(slideHeight + showBoxPaddingH) + 'px');
addCSSRule(slideDescClass, 'left:0px');
addCSSRule(slideDescClass, 'width:100%');
addCSSRule(slideDescClass, 'height:' + captionHeight + 'px');
addCSSRule(slideDescClass, 'margin:0px');
addCSSRule(slideDescClass, 'padding:0px');
addCSSRule(slideDescClass, 'background-color:#00a000');
addCSSRule(slideDescClass, 'font-family:' + rdShowFont);
addCSSRule(slideDescClass, 'font-size:' + rdShowFontSize + 'px');
addCSSRule(slideDescClass, 'color:' + rdShowFontColor);
addCSSRule(slideDescClass, 'border-top:solid 1px #ffffff');
addCSSRule(slideDescClass, 'z-index:' + String(slideshowZBase + 2));
addCSSRule(slideDescClass, 'opacity:1.0');
addCSSRule(slideDescClass + ' p', 'margin:4px 8px');

addCSSRule(slideTileClass, 'position:absolute');
addCSSRule(slideTileClass, 'width:' + Math.floor(slideWidth/2) + 'px');
addCSSRule(slideTileClass, 'height:' + Math.floor(slideHeight/2) + 'px');
addCSSRule(slideTileClass, 'overflow:hidden');
addCSSRule(slideTileClass, 'background-color:black');

// addCSSRule(slideTileClass + ' img', 'position:absolute');

 } // end slideshowRules()

slideshowRules();



