// JavaScript Document

var timer =  5;

var photos = [
    ['judith-1', 'judith dubois1'],
				['judith-2', 'judith dubois2'],
				['judith-3', 'judith dubois3'],
				['judith-4', 'judith dubois4'],
				['judith-5', 'judith dubois5'],
				['judith-6', 'judith dubois6'],
				['judith-7', 'judith dubois7'],
				['judith-8', 'judith dubois8'],
				['judith-9', 'judith dubois9'],
				['judith-10', 'judith dubois10'],
				['judith-11', 'judith dubois11'],
				['judith-12', 'judith dubois12'],
				['judith-13', 'judith dubois13'],
				['judith-14', 'judith dubois14'],
				['judith-15', 'judith dubois15'],
				['judith-16', 'judith dubois16'],
				['judith-17', 'judith dubois17'],
					
];

var img, count = 1;

function startSlideshow()
{
  img = document.getElementById('photo');
  window.setTimeout('cueNextSlide()', timer * 1000);
};

function cueNextSlide()
{
  var next = new Image;

  next.onerror = function()
  {
    alert('Failed to load next image');
  };

  next.onload = function()
  {
    img.src = next.src;
    img.alt = photos[count][1];

    img.width = next.width;
    img.height = next.height;

    if (++count == photos.length) { count = 0; }

    window.setTimeout('cueNextSlide()', timer * 1000);
  };

  next.src = 'photos/' + photos[count][0] + '.jpg';
}

addLoadListener(startSlideshow);

function addLoadListener(fn)
{
  if (typeof window.addEventListener != 'undefined')
  {
    window.addEventListener('load', fn, false);
  }
  else if (typeof document.addEventListener != 'undefined')
  {
    document.addEventListener('load', fn, false);
  }
  else if (typeof window.attachEvent != 'undefined')
  {
    window.attachEvent('onload', fn);
  }
  else
  {
    var oldfn = window.onload;
    if (typeof window.onload != 'function')
    {
      window.onload = fn;
    }
    else
    {
      window.onload = function()
      {
        oldfn();
        fn();
      };
    }
  }
}
