var imageIndex = 0;
var wipeIndex = 0;
var imageCount = 12;
var timerID;
var imageItems = new Array( 12 );

function initFader()
{
  /*****************************************************************************
   List the images that need to be cached
  *****************************************************************************/
  imageItems[0] = "image1.jpg";
  imageItems[1] = "image2.jpg";
  imageItems[2] = "image3.jpg";
  imageItems[3] = "image4.jpg";
  imageItems[4] = "image5.jpg";
  imageItems[5] = "image6.jpg";
  imageItems[6] = "image7.jpg";
  imageItems[8] = "image8.jpg";
  imageItems[7] = "image9.jpg";
  imageItems[9] = "image10.jpg";
  imageItems[10] = "image11.jpg";
  imageItems[11] = "image12.jpg";

  timerID = setTimeout("fadeToNext()", 2000);
}

function wipeToNext( )
{
  var wipes = [	'lr', 
                'rl',
                'tb', 
                'bt', 
                'tlbr',
                'trbl', 
                'bltr', 
                'brtl', 
                'cve',
                'che',
                'cc' ];
	
  var len = wipes.length;
  
  wipe = wipes[wipeIndex];
  wipeIndex++;
  if ( wipeIndex >= len )
    wipeIndex = 0;
  
  imageIndex++;
  if ( imageIndex >= imageCount )
    imageIndex = 0;
  	
  crosswipe(document.getElementById('slideshow'), imageItems[imageIndex], '2', wipe, '');
  
  timerID = setTimeout("wipeToNext()", 5000);
}

function fadeToNext()
{
  imageIndex++;
  if ( imageIndex >= imageCount )
    imageIndex = 0;
  
  crossfade(document.getElementById('slideshow'), imageItems[imageIndex], '1', '');

  timerID = setTimeout("fadeToNext()", 5000);
}
