var imageIndex = 0;
var wipeIndex = 0;
var imageCount = 5;
var timerID;
var imageItems = new Array( 5 );

function initFader()
{
  /*****************************************************************************
   List the images that need to be cached
  *****************************************************************************/
  imageItems[0] = "/ezstatic/data/mountainassociates/i/header.jpg";
  imageItems[1] = "/ezstatic/data/mountainassociates/i/header1.jpg";
  imageItems[2] = "/ezstatic/data/mountainassociates/i/header2.jpg";
  imageItems[3] = "/ezstatic/data/mountainassociates/i/header3.jpg";
  imageItems[4] = "/ezstatic/data/mountainassociates/i/header4.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('test'), imageItems[imageIndex], '2', wipe, 'Alt text - Image9');
  
  timerID = setTimeout("wipeToNext()", 5000);
}

function fadeToNext()
{
  imageIndex++;
  if ( imageIndex >= imageCount )
    imageIndex = 0;
  
  crossfade(document.getElementById('test'), imageItems[imageIndex], '1', 'Alt text - Image9');

  timerID = setTimeout("fadeToNext()", 5000);
}