		function prev() {
			current += 1;
			if (current >= drawings.length)
				current -= drawings.length;		

			imagechange();
		}
		
		function next() {
			current -= 1;
			if (current < 0)
				current += drawings.length;
				
			imagechange();
		}
	
		function imageshow(index) {
			document.getElementById("photo-thumbs").style.overflow = "hidden";
			document.getElementById("photo").style.display = "block";
			document.getElementById("photo-buttons").style.display = "block";
			document.getElementById("table-thumbs").style.opacity = "0.3";
			
			current = index;
			imagechange();
			commentshow();
		}

		function imagehide() {
			document.getElementById("photo-thumbs").style.overflow = "auto";
			document.getElementById("photo").style.display = "none";
			document.getElementById("photo-buttons").style.display = "none";
			document.getElementById("table-thumbs").style.opacity = "1.0";
		}
		
		function imagechange() {
			document.image.src = "images/"+drawings[current];
			if (comment_status == "show")
				commentchange();
		}
		
		function commentchange() {
			if (comments[current]) {
			
			} else
				comments[current] = "";
			var new_comment = "<a href=\"javascript:commenthide()\"><img src=\"images/-.gif\" style=\"border: 1px solid #000000; margin-bottom: 5px;\" align=\"right\"></a>\""+comments[current]+"\"<br><a href=\"?index="+current+"\">[permalink]</a> <a href=\"/draw/images/"+drawings[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";
			var new_comment = "<a href=\"javascript:commenthide()\"><img src=\"images/-.gif\" style=\"border: 1px solid #000000; margin-bottom: 5px;\" align=\"right\"></a>\""+comments[current]+"\"<br>";
			new_comment += "<div align=\"right\"><a href=\"?index="+current+"\">[permalink]</a> <a href=\"/draw/images/"+drawings[current]+"\">[image link]</a></div>";
			document.getElementById("comments").innerHTML = new_comment;
		}
		
		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;
		}
