
function showImg(img,gallery) {

	var imgPath = "/images/" + gallery + "/" + img;
	var smallImagePath = imgPath + "-s.jpg";
	var largeImagePath = imgPath + "-l.jpg";
//	var loadingImagePath = "/images/loading2.gif"
	var menuSelector = "#" + img;
	var imageTitle = $(menuSelector).html();

//	$("#active-picture > img").attr("src",loadingImagePath);

//	$("#active-picture > img").fadeOut("slow", function () {
//		$("#active-picture > img").hide();
//		$("#active-picture > img").attr("src",smallImagePath);
//		$("#active-picture > img").fadeIn("slow");
//	});


	$("#active-picture").hide();
	$("#loading").show();

	$("#active-picture > img").attr("src",smallImagePath);
	$("#active-picture").attr("href",largeImagePath);
	$("#active-picture").attr("title",imageTitle);

	$("#active-picture > img").load(function () {
		$("#loading").hide();
//		$("#active-picture").show();
//		$("#active-picture, #active-picture > img").fadeIn("slow");
		$("#active-picture, #active-picture > img").show();
	});


	$(".right-menu > a").attr("class","menu-item");
	$(menuSelector).removeClass("menu-item");
	$(menuSelector).addClass("currently-selected");

	return false;
}



function applyAnchor(gallery) {

	var my_anchor = window.location.hash;

	if (my_anchor.length > 0) {
		var current_image = my_anchor.slice(1);
	} else {
		var current_image = $(".picture-display:first").attr("id");
	}

	showImg(current_image,gallery);
}


