// Set the name attribute of the image tag to be the same as baseName
// In <body>, use onLoad="loadImages(baseName,howMany)"
// Put images in the images/ directory as baseName_#.jpg where # is 0 indexed


var x = 0; //number of switching images on page (where to start switching)
var y = 3500; //delay in ms
var z = .5; //transition duration


function loadImages(bn,howMany) {
	baseName = bn;
	plpix = new Array(); // global
	for (i=0; i < howMany; i++) {
		plpix[i] = 'images/' + baseName + '_' + i + '.jpg';
	}

	pl = new Array(); //preloader, global
	for (i = 0; i < plpix.length; i++){
	   pl[i] = new Image();
	   pl[i].src = plpix[i];
	}
	slide();
}

function slide() {
	var hx = eval('document.images.' + baseName); //find img name attributes from page using img names from plpix array
	if (document.all){
		hx.style.filter="blendTrans(duration=" + z + ")";
		hx.filters.blendTrans.Apply();
	}
	hx.src = pl[x].src;
	if (document.all){
		hx.filters.blendTrans.Play();
	}
	x += 1;
	if (x > (plpix.length-1)) {x=0;}
	setTimeout('slide()', y);
}