function docImages(increment){
//This is called by the Previous/Next buttons in the pop-up
	imgClicked  = imgClicked  + increment;
	document.all.popuppic.src = document.images[imgClicked].src;
	showhidebuttons();
}

function showpicviewer(numero) {
// This is called when you click a thumb

	var h = document.body.scrollTop;
	if (h == 0) {h = document.documentElement.scrollTop;}
	
	var w = document.body.clientWidth;
	if (w == 0) {w = document.documentElement.clientWidth;}

	k = document.images.length;
	imgClicked = 0; //this will be the index of img that was clicked

	var j = 1;
	for (j=1;j<k;j++)
	{
		var strSrc = document.images[j].src;
		if (strSrc.indexOf(numero,1)>0) {
			imgClicked = j;
			j = k; //This exits the loop when the string hits.
			}
	}
	
	showhidebuttons();
		
	document.all.picviewer.style.top = h;		
	document.all.picviewer.style.left = (w - 600)/2;			
	document.all.picviewer.style.display="inline";
	document.all.popuppic.src = numero;
}

function showhidebuttons() {
	// Hide Next button, as needed
	if (imgClicked >= k-2) {
		document.all.nextimage.style.visibility="hidden";}
	else {
		document.all.nextimage.style.visibility="visible";}

	// Hide Previous button, as needed
	if (imgClicked == 1) {
		document.all.previmage.style.visibility="hidden";}
	else {
		document.all.previmage.style.visibility="visible";}	
	}

function hidepicviewer() {
	document.all.picviewer.style.display="none";
	}