// slideShowSpeed (milliseconds)
var slideShowSpeed = 4000;

// duration of crossfade (seconds)
var crossFadeDuration = 1;

// specify the image files
var Pic = new Array();
Pic.push( 'photo/intro_01.jpg' );
Pic.push( 'photo/intro_02.jpg' );
Pic.push( 'photo/intro_03.jpg' );
Pic.push( 'photo/intro_04.jpg' );
Pic.push( 'photo/intro_05.jpg' );
Pic.push( 'photo/intro_06.jpg' );
Pic.push( 'photo/intro_07.jpg' );
Pic.push( 'photo/intro_08.jpg' );
Pic.push( 'photo/intro_09.jpg' );
Pic.push( 'photo/intro_10.jpg' );
Pic.push( 'photo/intro_11.jpg' );
Pic.push( 'photo/intro_12.jpg' );

var displayed = new Array();

var preLoad = new Array();
for( var i = 0; i < Pic.length; i++ ){
   preLoad[i] = new Image();
   preLoad[i].src = Pic[i];
}

function runSlideShow()
{
	var idx = getNextImage();

   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=1)";
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";
      document.images.SlideShow.filters.blendTrans.Apply();
   }

   document.images.SlideShow.src = preLoad[idx].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }

   setTimeout( 'runSlideShow()', slideShowSpeed );
}


function getNextImage()
{
	// all have been displayed
	if( displayed.length == Pic.length ) {
		displayed = new Array();
	}

	// get random image, and check if it has been displayed
	var rand = Math.floor( Math.random() * Pic.length );
	for( var idx=0; idx < displayed.length; idx++ ) {
		if( displayed[idx] == rand ) {
			return getNextImage();
		}
	}

	displayed.push( rand );
	return rand;
}