﻿ImgIndex=0;
var Images = new Array();

function diapo_addImg(src, name) {
	var lIndex = Images.length;
	Images[lIndex] = new Image();
	Images[lIndex].src = src;
	Images[lIndex].alt = name;
}


function diapo_show(pIndex) {

	if(pIndex < 0)pIndex=Images.length - 1;
	
	if(pIndex > Images.length - 1)pIndex=0;
	
	document.getElementById("diapoImg").src=Images[pIndex].src;
	document.images["diapoImg"].alt=Images[pIndex].alt;

	if(document.getElementById("footnote"))
	{
	   document.getElementById("footnote").innerHTML = Images[pIndex].alt;
	}
	document.getElementById("GalleryCounter").value = (pIndex+1) + "/" + Images.length;

	ImgIndex=pIndex;
}


function diapo_next() {
	if(ImgIndex < Images.length - 1){
		diapo_show(ImgIndex + 1);
	}
else {
	diapo_show(0);} 
}


function diapo_previous() {
	if(ImgIndex > 0 ){
		diapo_show(ImgIndex - 1);}
else {
	diapo_show(Images.length - 1);} 
}
