picSum = picList.length;

queryString = document.location.search.substr(1);
selfURL = document.location.pathname;

if (queryString.length < 1) {
	currentPic = 1;
}//endif;
else {
	currentPic = parseInt(queryString);
}//endelse;

if (currentPic < 1) {
	currentPic = picSum;
}//endif;
if (currentPic > picSum) {
	currentPic = 1;
}//endif;

function fotoNav() {
	document.write("<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\" align=\"center\"><tr>");
	document.write("<td><p class=\"nav\">");
	document.write("<a href=\"" + selfURL + "?" + (currentPic - 1) + "\">&lt;</a>");
	document.write("</p></td>");
	
	document.write("<td><p class=\"nav\">");
	for (i = 0; i < picSum; i++) {
		document.write(" ");
		if (currentPic != (i + 1)) {
			document.write("<a href=\"" + selfURL + "?" + (i + 1) + "\">");
		}//endif;
		document.write("[" + (i + 1) + "]");
		if (currentPic != (i + 1)) {
			document.write("</a>");
		}//endif;
		document.write(" ");
	}//endfor;
	document.write("</p></td>");
	
	document.write("<td><p class=\"nav\">");
	document.write("<a href=\"" + selfURL + "?" + (currentPic + 1) + "\">&gt;</a>");
	document.write("</p></td>");
	
	document.write("</tr></table>");
}//endfunction fotoNav;

fotoNav();
//document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"550\"><tr><td align=\"center\"><img src=\"" + fotoDirectory + "/" + picList[currentPic - 1] + "\" border=\"0\" alt=\"\"></td></tr><tr><td><p class=\"center\">" + subtextList[currentPic - 1] + "</p></td></tr></table>");
document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"550\"><tr><td align=\"center\"><img src=\"" + fotoDirectory + "/" + picList[currentPic - 1] + "\" border=\"0\" alt=\"\"></td></tr></table>");
fotoNav();
