$(function(){
				var total   = $(".gallery > img").length;
				var current = 1;
				
				$("#gallery-counter").append(current+"/"+total);
				$(".gallery img:gt(0)").hide();
				
				$(".gallery img").each(function(index) {
				    $(this).attr("rel", (index+1));
				  });
				
				$(".gallery-nav a").click(function() {
					var img_index = $("img:visible").attr("rel");
					if($(this).attr("id") == "next") {
						if(img_index == total) {
							current = 1;
						} else {
							current++;
						}
						$(".gallery img:visible").fadeOut().siblings("[rel="+current+"]").fadeIn().end().appendTo('.gallery');
					} else if($(this).attr("id") == "prev") {
						if(img_index == 1) {
							current = total;
						} else {
							current--;
						}
						$(".gallery img:visible").fadeOut().siblings("[rel="+current+"]").fadeIn().end();
					}
					$("#gallery-counter").empty().append(current+"/"+total);
					return false;

				});
			});
				
