
window.onload = function(){
	ndex = ""
	for (q=1; q<=nPics; q++)
		{	ndex += "<div class=\"thumb\" id=\"photo" + q +"\">";
			ndex += "<a href=\"javascript: gallery(" + q + ")\">";
			ndex += "<img src=\"" + thumbPath + photoz [q] +"\" alt=\"\" border=\"0\">";
			ndex += "</a></div>";
		}
	document.getElementById("index").innerHTML=ndex;
}
				

function gallery (picnum) {
		var prev = "photo" + CurPic;
		var cur = "photo" + picnum;
        photoURL=picPath+photoz [picnum];
		linkURL=linkPath+photoz [picnum];
        document.images.galpic.src=photoURL;
		document.getElementById("gallink").href=linkURL;
		if (CurPic > 0)
		{document.getElementById(prev).style.borderColor = "#990099";}
				
		document.getElementById(cur).style.borderColor="#FFFF00";

		
		if (captions==true)
			{ 
			capText = captionz [picnum];
			document.getElementById("galcaption").innerHTML="\<p\>"+capText+"\</p\>";
			}
		
        CurPic = picnum;
        }

function picbak (step) {
        nxtPic = CurPic - 1;
        if (nxtPic < 1 )
                { nxtPic = nPics }
        gallery (nxtPic); }

function picfwd (step) {
        nxtPic = CurPic + 1;
        if (nxtPic > nPics) {
                nxtPic = 1 }
        gallery (nxtPic);
        }
		
		
