
// =====================================
// Do not edit anything below this line!
// =====================================
var iss;
var pss = Picture.length-1;
var maxPics = Picture.length-1;
var objAltArray;
var AltTag;
var do_not_dispay_1_of_XX = false;
//var GBL_img;
var preLoad = new Array();
for (iss = 1; iss < pss+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = Picture[iss];}
current = 1;

	if(isArray(AltTag)){
		objAltArray = AltTag;
	}else{
		objAltArray = Caption;
	}

function next() {
	if (current < maxPics) {
		document.images.PictureBox.src = preLoad[current+1].src;
		if(isArray(AltTag)){
			document.images.PictureBox.alt = AltTag[current+1];
		}else{
			document.images.PictureBox.alt = Caption[current+1];
		}
		//GBL_img = preLoad[current+1].src;
		
	if (do_not_dispay_1_of_XX == true){
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML = objAltArray[current+1];
	}else{
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML= (current+1) + " of " + (Picture.length-1) + "<br>" + Caption[current+1];
	}
	
		document.images.PictureBox.alt = objAltArray[current+1];
		current = current+1;
   	}
	else first();
}

function previous() {
	if (current > 1) {
		document.images.PictureBox.src = preLoad[current-1].src;
		document.images.PictureBox.alt = objAltArray[current-1];
		//alert(current-1);
		
	if (do_not_dispay_1_of_XX == true){
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML = Caption[current-1];
	}else{
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML= (current-1) + " of " + (Picture.length-1) + "<br>" + Caption[current-1];
	}
	
		document.images.PictureBox.alt = objAltArray[current-1];
		current = current-1;
		//alert(current);
   	}
	else last();
}
function first() {
	current = 1;
	document.images.PictureBox.src = preLoad[1].src;
	if (do_not_dispay_1_of_XX == true){
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML = Caption[1];
	}else{
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML= "1" + " of " + (Picture.length-1) + "<br>" + Caption[1];
	}
	
}
	
function last() {
	current = maxPics;
	document.images.PictureBox.src = preLoad[current].src;
	if (document.getElementById) {
		if (do_not_dispay_1_of_XX == true){
				document.getElementById("CaptionBox").innerHTML= Caption[maxPics];
		}else{
			document.getElementById("CaptionBox").innerHTML= (Picture.length-1) + " of " + (Picture.length-1) + "<br>" + Caption[maxPics];
		}
		document.images.PictureBox.alt = objAltArray[maxPics];
	}
}

function ap(text) {
	document.slideform.slidebutton.value = (text == "Stop") ? "Play Slideshow" : "Stop";
	rotate();
}

function rotate() {
//alert(do_not_dispay_1_of_XX);
	if (document.slideform.slidebutton.value == "Stop") {
		current = (current == maxPics) ? 1 : current+1;
		document.images.PictureBox.src = preLoad[current].src;
	if (do_not_dispay_1_of_XX == true){
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML = Caption[current];
		//alert("hi");
	}else{
		if (document.getElementById) document.getElementById("CaptionBox").innerHTML= current + " of " + (Picture.length-1) + "<br>" + Caption[current];
		//if (document.getElementById) Caption[current];
	}
	
		window.setTimeout("rotate()", rotate_delay);
		document.images.PictureBox.alt = objAltArray[current];
   }
}

function isArray(testObject) {       
	return testObject && !(testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number';
}
