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] = "/ezstatic/data/chimneyhill/i/image1.jpg";
  imageItems[1] = "/ezstatic/data/chimneyhill/i/image2.jpg";
  imageItems[2] = "/ezstatic/data/chimneyhill/i/image3.jpg";
  imageItems[3] = "/ezstatic/data/chimneyhill/i/image4.jpg";
  imageItems[4] = "/ezstatic/data/chimneyhill/i/image5.jpg";
  imageItems[5] = "/ezstatic/data/chimneyhill/i/image6.jpg";
  imageItems[6] = "/ezstatic/data/chimneyhill/i/image7.jpg";
  imageItems[8] = "/ezstatic/data/chimneyhill/i/image8.jpg";
  imageItems[7] = "/ezstatic/data/chimneyhill/i/image9.jpg";
  imageItems[9] = "/ezstatic/data/chimneyhill/i/image10.jpg";
  imageItems[10] = "/ezstatic/data/chimneyhill/i/image11.jpg";
  imageItems[11] = "/ezstatic/data/chimneyhill/i/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('headerslideshow'), imageItems[imageIndex], '2', wipe, '');
  
  timerID = setTimeout("wipeToNext()", 5000);
}

function fadeToNext()
{
  imageIndex++;
  if ( imageIndex >= imageCount )
    imageIndex = 0;
  
  crossfade(document.getElementById('headerslideshow'), imageItems[imageIndex], '1', '');

  timerID = setTimeout("fadeToNext()", 5000);
}

