var timer = 5;

var cover = [
    ['couple1', ''],
    ['couple2', ''],
    ['couple5', ''],
    ['couple3', ''],
    ['couple4', ''],
    ['band1', ''],    
 	['couple6', ''],
	['couple7', ''],
	['couple9', ''],
	['couple10', ''],
	['2010c', ''],
	['rooma', ''],
	['roomb', '']
	
	
];

var img, count = 1;

function startSlideshow()
{
  img = document.getElementById('cover');
  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 = cover[count][1];

    img.width = next.width;
    img.height = next.height;

    if (++count == cover.length) { count = 0; }

    window.setTimeout('cueNextSlide()', timer * 1000);
  };

  next.src = 'cover/' + cover[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();
      };
    }
  }
}
