// _SlideShow.js
// NS4-6,IE4-6
// Fade effect only in IE; degrades gracefully

// global variables
var dac_SlideShow_slideDuration = 3500; // Time between start of one slide and start of next (milliseconds)
var dac_SlideShow_crossFadeDuration = 2; // Duration of crossfade (seconds)
var dac_SlideShow_currentPicIdx;
var dac_SlideShowFrameCount;
var dac_SlideShowFrames;

function dac_SlideShow_Init()
{
   dac_SlideShow_currentPicIdx = 0;

   //dac_SlideShowFrames[0].picimg = document.images[qwer[0]];
   //dac_SlideShowFrames[0].picimg.src = qwer[0];
   //for( i = 1; i < dac_SlideShowFrameCount; ++i )
   for( i = 0; i < dac_SlideShowFrameCount; ++i )
   {
      dac_SlideShowFrames[i].picimg = new Image();
      dac_SlideShowFrames[i].picimg.src = dac_SlideShowFrames[i].picname;
//alert( "index      = " + i + "\n" +
//       "picname    = " + dac_SlideShowFrames[i].picname + "\n" + 
//       "picimg.src = " + dac_SlideShowFrames[i].picimg.src + "\n" + 
//       "bg         = " + dac_SlideShowFrames[i].bg + "\n" + 
//       "fg         = " + dac_SlideShowFrames[i].fg + "\n" + 
//       "text       = " + dac_SlideShowFrames[i].text );
   }

   // leave current picture up, then begin switching slides
   setTimeout( 'dac_SlideShow_Swap()', dac_SlideShow_slideDuration );
}

function dac_SlideShow_Swap()
{
   ++dac_SlideShow_currentPicIdx;
   if( dac_SlideShow_currentPicIdx >= dac_SlideShowFrameCount )
   {
      dac_SlideShow_currentPicIdx = 0;
   }

//   if( document.all ) // i.e., if IE4+ then fade, otherwise gracefully degrade (meaning just switch to the next slide)
//   {
//      document.images.SlideShow.style.filter = "blendTrans( duration = 2 )";
//      document.images.SlideShow.style.filter = "blendTrans( duration = dac_SlideShow_crossFadeDuration )";
//      document.images.SlideShow.filters.blendTrans.Apply();
//   }
   document.getElementById( 'div-ss-cont' ).style.background = dac_SlideShowFrames[dac_SlideShow_currentPicIdx].bg;
   document.getElementById( 'td-ss' ).style.color = dac_SlideShowFrames[dac_SlideShow_currentPicIdx].fg;
   document.getElementById( 'td-ss' ).innerHTML = dac_SlideShowFrames[dac_SlideShow_currentPicIdx].text;
   document.getElementById( 'img-ss' ).src = dac_SlideShowFrames[dac_SlideShow_currentPicIdx].picimg.src;
//alert( "index      = " + i + "\n" +
//       "picname    = " + dac_SlideShowFrames[i].picname + "\n" + 
//       "picimg.src = " + dac_SlideShowFrames[i].picimg.src + "\n" + 
//       "bg         = " + dac_SlideShowFrames[i].bg + "\n" + 
//       "fg         = " + dac_SlideShowFrames[i].fg + "\n" + 
//       "text       = " + dac_SlideShowFrames[i].text );

//   if( document.all )
//   {
//      document.images.SlideShow.filters.blendTrans.Play();
//   }

   setTimeout( 'dac_SlideShow_Swap()', dac_SlideShow_slideDuration );
}
