var SlideShowSpeed = 8000; 
var myimages1 = new Array();

myimages1[1]  = 'images/estate_planning1.jpg';
myimages1[2]  = 'images/estate_planning2.jpg';
myimages1[3]  = 'images/estate_planning3.jpg';
myimages1[4]  = 'images/estate_planning4.jpg';
myimages1[5]  = 'images/estate_planning5.jpg';
myimages1[6]  = 'images/estate_planning6.jpg';
myimages1[7]  = 'images/estate_planning7.jpg';
myimages1[8]  = 'images/estate_planning8.pg';
myimages1[9]  = 'images/estate_planning9.jpg';
myimages1[10]  = 'images/estate_planning10.jpg';


var itrigger = 0;
var iss;
var jss = 1;
var pss = myimages1.length-1; // computes how many images there are 
var randomstart = Math.round(Math.abs(Math.random())*(endpoint-1)) + 1; // where in the list we should start
var nss; // used in runSlideShow, holds the current image selection number
var preLoad1 = new Array();

var imglogger = new Array(); // array of possible image selection numbers
var imgselect; // used to point to slot in the "imglogger" array, randomly chosen
var endpoint = pss; // decrementing counter.  Any image between imglogger[endpoint] and imglogger[pss] has already been shown this cycle
for (iss = 1; iss < pss+1; iss++){ // this loop loads all the images into the "preLoad" array sequentially
imglogger[iss] = iss;

preLoad1[iss] = new Image();
}

var rand_no = Math.ceil(pss*Math.random())


// This gets first image randomly
imgselect = rand_no;  // randomly select from 1 to endpoint
nss = imglogger[imgselect]; // grab the number stored in that slot, put it in nss
preLoad1[nss].src = myimages1[nss];

function runSlideShow(){
	imglogger[imgselect] = imglogger[endpoint]; // Next two lines switch the chosen number...
	imglogger[endpoint] = nss; // ...with the one at the endpoint.
	endpoint--; // now endpoint is decremented, so that image isn't shown again.
	if (endpoint < 1) endpoint = pss; // if we're out of images, then recycle 

	if (document.all){
	  if (itrigger == 0) {
	  	document.images.PictureBox1.style.filter="blendTrans(duration=0)";
        SlideShowSpeed = 1500;
	  }
	  if (itrigger == 1) {
		document.images.PictureBox1.style.filter="blendTrans(duration=2)";
        SlideShowSpeed = 4000;
	  }
	  itrigger=1;
	  document.images.PictureBox1.filters.blendTrans.Apply();
	}
	document.images.PictureBox1.src = preLoad1[nss].src;
	
	if (document.all) {	
		document.images.PictureBox1.filters.blendTrans.Play();
	}
	imgselect = Math.round(Math.abs(Math.random())*(endpoint-1)) + 1;  // randomly select from 1 to endpoint
	nss = imglogger[imgselect]; // grab the number stored in that slot, put it in nss
	preLoad1[nss].src = myimages1[nss];
	
	setTimeout('runSlideShow()', SlideShowSpeed);
}


