
//Preloaded slideshow script- By Jason Moon
//For this script and more
//Visit http://www.dynamicdrive.com

// ...
var enlargedPhotosArr=["Fgallery1-1.gif","Fgallery1-2.gif","Fgallery1-3.gif","Fgallery1-4.gif","Fgallery1-5.gif","Fgallery1-6.gif"];

// PUT THE URL'S OF YOUR IMAGES INTO THIS ARRAY...
var Slides = new Array(
'gallery1-1.jpg',
'gallery1-2.jpg',
'gallery1-3.jpg',
'gallery1-4.jpg',
'gallery1-5.jpg',
'gallery1-6.jpg');

// DO NOT EDIT BELOW THIS LINE!
function CacheImage(ImageSource) { // TURNS THE STRING INTO AN IMAGE OBJECT
var ImageObject = new Image();
ImageObject.src = ImageSource;
return ImageObject;
}

function ShowSlide(Direction) {
if (SlideReady) {
NextSlide = CurrentSlide + Direction;
// THIS WILL DISABLE THE BUTTONS (IE-ONLY)
document.getElementById("Previous").disabled = (NextSlide == 0);
document.getElementById("Next").disabled = (NextSlide == (Slides.length-1)); 
if ((NextSlide >= 0) && (NextSlide < Slides.length)) {
document.images['Screen'].src = Slides[NextSlide].src;
CurrentSlide = NextSlide++;
Message = 'Picture ' + (CurrentSlide+1) + ' of ' + 
Slides.length;
/*
if (document.all||document.getElementById)
document.getElementById? document.getElementById("stat").innerHTML=Message:document.all["stat"].innerHTML=Message
*/
if (document.layers)
self.defaultStatus = Message;
if (Direction == 1) CacheNextSlide();
}
return true;
}
}

function Download() {
if (Slides[NextSlide].complete) {
SlideReady = true;
/*
if (document.all||document.getElementById)
document.getElementById? document.getElementById("stat").innerHTML=Message:document.all["stat"].innerHTML=Message
*/
if (document.layers)
self.defaultStatus = Message;
}
else setTimeout("Download()", 100); // CHECKS DOWNLOAD STATUS EVERY 100 MS
return true;
}

function CacheNextSlide() {
	if 
		((NextSlide < Slides.length) && (typeof Slides[NextSlide] == 'string'))
			{ // ONLY CACHES THE IMAGES ONCE
				Message2 = 'Downloading next picture...';
				SlideReady = false;
					/*
					if (document.all||document.getElementById)
					document.getElementById? document.getElementById("stat").innerHTML=Message2:document.all["stat"].innerHTML=Message2
					*/
						if (document.layers)
						self.defaultStatus = 'Downloading next picture...';
						Slides[NextSlide] = CacheImage(Slides[NextSlide]);
						Download();
			}
				return true;
		}

function StartSlideShow() {
CurrentSlide = -1;
Slides[0] = CacheImage(Slides[0]);
SlideReady = true;
ShowSlide(1);
}

function enlargeGallPhoto(){
	var gallWin=window.open("","","width=500,height=251");
	gallWin.document.write("<body leftmargin=0 rightmargin=0 marginwidth=0 marginheight=0><img src='"+enlargedPhotosArr[CurrentSlide]+"'/></body>");
}
