// start slide show
function runSlideShow() {
	currentImage = 0
	Picture[1] = makeImage(Picture[1])
	cached = 1
	showSlide()
}

// recursive function to show all slides
function showSlide() {
	nextImage = currentImage + 1
	if(nextImage == Picture.length) {
		currentImage = 0
		nextImage = 1
	}
	if (document.all && !window.opera) {
		// change the dissolve effect (transition) here
		document.images.PictureBox.style.filter = "progid:DXImageTransform.Microsoft.Fade(Overlap=1.00)"
		document.images.PictureBox.filters[0].apply()
	}
	document.images.PictureBox.src = Picture[nextImage].src
	if (document.all && !window.opera)
		document.images.PictureBox.filters[0].play()
	currentImage = nextImage++
	loadNextImage()
	setTimeout('showSlide()', SlideShowSpeed * 1000);
}

// load the next image
function loadNextImage() {
	// check if images is already cached
	if(typeof Picture[nextImage] == 'string') {
		cached = 0
		// make image object
		Picture[nextImage] = makeImage(Picture[nextImage])
		wait4Download()
	}
}

// check if image has fully loaded
function wait4Download() {
	if(Picture[nextImage].complete)
		cached = 1
	else	setTimeout("wait4Download()", 100) // check 10x per sec.
}

// turn a string into an image object
function makeImage(ImageSource) {
	var ImageObject = new Image()
	ImageObject.src = ImageSource
	return ImageObject
}

// basic slideshow script (c) 2002 by www.CodeLifter.com
function runSlideShow(){
	if (document.all && !window.opera) {
		nr = 999
		if(effect_nr == "all")
			nr = rand(effect.length)
		if(nr == 999) nr = effect_nr
		new_filter = "progid:DXImageTransform.Microsoft." + effect[nr]
		document.images.PictureBox.style.filter = new_filter
		// alert(document.images.PictureBox.style.filter)
		document.images.PictureBox.filters[0].apply()
	}
	document.images.PictureBox.src = preLoad[jss].src
	if (document.getElementById) {
		document.getElementById("CaptionBox").innerHTML = Caption[jss]
		if(show_ImageNumber > 0)
			document.getElementById("current_ImgNr").innerHTML = jss + " / " + pss
	}
	if (document.all && !window.opera)
		document.images.PictureBox.filters[0].play()
	jss++
	if (jss > (pss)) jss=1
	tss = setTimeout('runSlideShow()', SlideShowSpeed * 1000)
}

// The Central Randomizer 1.3 (C) 1997 by Paul Houle (houle@msc.cornell.edu)
// See:  http://www.msc.cornell.edu/~houle/javascript/randomizer.html
// NOTE: this example is set up to produce integers between 0-(limit-1)
rnd.today=new Date(); rnd.seed=rnd.today.getTime()
function rnd() {
    rnd.seed = (rnd.seed*9301+49297) % 233280
    return rnd.seed/(233280.0)
}
function rand(limit) {
    return Math.ceil(rnd()*limit)-1
}


