		function prev() {
			current -= 1;
			if (current < 0)
				current += images.length;
				
			imagechange();
			navvisible("none");
		}
		
		function next() {
			current += 1;
			if (current >= images.length)
				current -= images.length;		

			imagechange();
			navvisible("none");
		}
	
		function imageshow(index) {
			document.getElementById("photo-thumbs").style.overflow = "hidden";
			document.getElementById("photo").style.display = "block";
			document.getElementById("photo-overlay").style.display = "block";
			document.getElementById("photo-buttons").style.display = "block";
			
			current = index;
			imagechange();
			navvisible("none");
		}

		function imagehide() {
			document.getElementById("photo-thumbs").style.overflow = "auto";
			document.getElementById("photo").style.display = "none";
			document.getElementById("photo-overlay").style.display = "none";
			document.getElementById("photo-buttons").style.display = "none";
			navvisible("none");
		}
		
		function imagechange() {
			document.image.src = "watermark.php?file="+album+"/"+images[current];
			if (comment_status == "show")
				commentchange();
		}
		
		function commentchange() {
			var new_comment = "<a href=\"javascript:commenthide()\"><img src=\"images/-.gif\" style=\"border: 1px solid #000000\" align=\"right\"></a><a href=\"?album="+album+"&index="+current+"\">[permalink]</a><a href=\"/photography/"+album+"/"+images[current]+"\">[image link]</a>";
			document.getElementById("comments").innerHTML = new_comment;
		}
		
		function commentshow() {
			comment_status = "show";
			document.getElementById("comments").style.width = "";
			document.getElementById("comments").style.height = "";
			document.getElementById("comments").style.margin = "5px";
			document.getElementById("comments").style.padding = "5px";
			commentchange();
		}
		
		function commenthide() {
			comment_status = "hide";
			document.getElementById("comments").style.width = "12px";
			document.getElementById("comments").style.height = "12px";
			document.getElementById("comments").style.padding = "0px";
			var new_comment = "<a href=\"javascript:commentshow()\"><img src=\"images/+.gif\"  border=\"0\" align=\"left\"></a>";
			document.getElementById("comments").innerHTML = new_comment;
		}
				
		function navvisible(display) {
			if (display)
				document.getElementById("nav-albums").style.display = display;
			else {
				if (document.getElementById("nav-albums").style.display == "block")
					document.getElementById("nav-albums").style.display = "none";
				else
					document.getElementById("nav-albums").style.display = "block";
			}
		}

