/**
 * @author Vlad
 */

var minIndx = 1;
var maxIndx = imagelist.length-1; 
var numItems = th.length-1;
var album=' ';
function hidebuttons()
{
if(maxIndx <= 4) {document.getElementById("nextButton").style.visibility="hidden";
				document.getElementById("prevButton").style.visibility="hidden";
}
}
		
function previous()
{
var count = th[numItems];for (i = numItems; i >= 1; --i) {
if (count >= minIndx) {
--count;
th[i] = count;
vervangThumb('ThumbId' + i + '', thumbs[count].src,desc[count]);
} 
}
		
		if (th[1] <= minIndx) {
			document.getElementById("prevButton").style.visibility="hidden";
		}
		
		if (th[4] <= maxIndx) {
			document.getElementById("nextButton").style.visibility="visible";
		}
	}

function next() {
		var count = th[1];for (i = 1; i <= numItems; ++i) {
			if (count <= maxIndx) {
				++count;
				th[i] = count;
				vervangThumb('ThumbId' + i + '', thumbs[count].src,desc[count]);
			} 
		}
		
		
		if (th[1] > minIndx) {
			document.getElementById("prevButton").style.visibility="visible";
		}
		
		if (th[4] >= maxIndx) {
			document.getElementById("nextButton").style.visibility="hidden";
		}
	}

	function vervangFoto(id, bestand,descr) {
		var tmp = document.getElementById("f").src;
		document.getElementById("fotoId").innerHTML = '<img src="'+tmp+'" id="f" border="0" height="500" width="500" TITLE="header=['+album+'] body=['+descr+']">';
	
		if (document.all) {
			document.getElementById("f").style.filter = "blendTrans(duration=1)";
			document.getElementById("f").filters.blendTrans.Apply();
		}

		document.getElementById("f").src = bestand;
	
		if (document.all) {
			document.getElementById("f").filters.blendTrans.Play();
		}
		
		
	}
	
	function vervangThumb(id, bestand,descr) {
		document.getElementById(id).innerHTML = '<img src="'+bestand+'" border="0" height="119" width="119" TITLE="header=['+album+'] body=['+descr+']">';
	}
	
	function thumbClick(id) {
		if (id >= 1 && id <= numItems) {
			vervangFoto("fotoId", imagelist[th[id]].src,desc[th[id]]);
		}
	}

