var ss1;
window.onload = function()
{
  // Create slideshow object
  ss1 = new xSlideShow(4000, 'slideshow1', 'gallery/Well-Project-Renovations/',
['01.jpg', '02.jpg', '03.jpg', '04.jpg', '05.jpg', '06.jpg', '07.jpg', '08.jpg', '09.jpg', '10.jpg', '11.jpg', '12.jpg', '13.jpg', '14.jpg', '15.jpg', '16.jpg', '17.jpg', '18.jpg', '19.jpg', '20.jpg', '21.jpg', '22.jpg', '23.jpg', '24.jpg', '25.jpg', '26.jpg', '27.jpg', '28.jpg', '29.jpg', '30.jpg', '31.jpg', '32.jpg', '33.jpg', '34.jpg', '35.jpg', '36.jpg', '37.jpg', '38.jpg', '39.jpg', '40.jpg', '41.jpg', '42.jpg', '43.jpg', '44.jpg', '45.jpg', '46.jpg', '47.jpg', '48.jpg'],
['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''],
["&nbsp;1", "&nbsp;2", "&nbsp;3 ", "&nbsp;4", "&nbsp;5", "&nbsp;6", "&nbsp;7", "&nbsp;8", "&nbsp;9", "&nbsp;10", "&nbsp;11", "&nbsp;12", "&nbsp;13", "&nbsp;14", "&nbsp;15", "&nbsp;16", "&nbsp;17", "&nbsp;18", "&nbsp;19", "&nbsp;20", "&nbsp;21", "&nbsp;22", "&nbsp;23 ", "&nbsp;24", "&nbsp;25", "&nbsp;26", "&nbsp;27", "&nbsp;28", "&nbsp;29", "&nbsp;30", "&nbsp;31", "&nbsp;32", "&nbsp;33", "&nbsp;34", "&nbsp;35", "&nbsp;36", "&nbsp;37", "&nbsp;38", "&nbsp;39", "&nbsp;40", "&nbsp;41", "&nbsp;42", "&nbsp;43 ", "&nbsp;44", "&nbsp;45", "&nbsp;46", "&nbsp;47", "&nbsp;48"])
  // Initialize buttons
  if (ss1) {
    var b = document.getElementById('btnPrev');
    b.onclick = function() { ss1.prev(); };
    b = document.getElementById('btnAuto');
    b.onclick = function() { ss1.start(); };
    b = document.getElementById('btnNext');
    b.onclick = function() { ss1.next(); };
  }
}
/*
  xSlideShow - A simple slideshow object.

  uInterval  - The time in milliseconds for auto-slide.
  sImgEleId  - The IMG element in the HTML.
  sImagePath - The path to be prepended to each image file name.
               It must have a trailing backslash.
  aFiles     - An array of image file names.
  aLinks     - An optional array of URLs for when the image is clicked.
  aTitles    - An optional array of titles for each image.

  If provided, aLinks and aTitles must have the same length as aFiles.
*/

function xSlideShow(uInterval, sImgEleId, sImagePath, aFiles, aLinks, aTitles)
{
  // Private Properties

  var ths = this;
  var tmr = null;
  var idx = -1;
  var imgs = []; // zero-based

  // Private Methods

  function run()
  {
    tmr = setTimeout(run, uInterval);
    ths.next(true);
  }

  function onClick()
  {
    // note: In this function, 'this' points to the IMG object
    var t = aTitles ? aTitles[idx] + ': ' : '';
 //   if (confirm('Do you want to visit the following page?\n' + t + aLinks[idx])) {
 //     window.location = aLinks[idx];
 //   }
  }

  // Public Methods

  this.start = function()
  {
    if (tmr == null) {
      run();
    }
    else {
      this.stop(); // implements a 'toggle'
    }
  };

  this.stop = function()
  {
    if (tmr != null) {
      clearTimeout(tmr);
      tmr = null;
    }  
  };

  this.next = function(bRunning)
  {
    var i = document.getElementById(sImgEleId);
    if (i) {
      if (!bRunning) {
        // stop auto-slide unless next() is called from run()
        this.stop();
      }
      if (++idx >= imgs.length) {
        idx = 0;
      }
      i.src = imgs[idx].src;
      if (aTitles) {
//        i.title = aTitles[idx];
        bottom(aTitles[idx]);
      }
    }
  };

  this.prev = function()
  {
    var i = document.getElementById(sImgEleId);
    if (i) {
      this.stop(); // stop auto-slide
      if (--idx <= 0) {
        idx = imgs.length - 1;
      }
      i.src = imgs[idx].src;
      if (aTitles) {
//        i.title = aTitles[idx];
        bottom(aTitles[idx]);
      }
    }
  };

  this.onunload = function()
  {
    var i = document.getElementById(sImgEleId);
    if (i) {
      i.onclick = null;
    }
    ths = null;
  };

  // Constructor Code

  var i;
  i = document.getElementById(sImgEleId);
  if (i) {
    if (aLinks) {
      i.onclick = onClick;
    }
    for (i = 0; i < aFiles.length; ++i) {
      imgs[i] = new Image();
      imgs[i].src = sImagePath + aFiles[i];
    }
    this.next(true); // show first image
  }
  else return null; // error
}
function bottom(s)
	{
		document.getElementById("SlideTitle").innerHTML=s;
	}
