
	$.preloadImages = function(id) {
		$("<img>").attr("src", id);
	}

	var activeGallery = "";
	$.setupGallery = function(length) {

		for (var i = 1; i <= length; i++) {
			$("<img>").attr("src", "images/gallery/gallery" + i + "_small.jpg");
			$("#gallery" + i).hover(
							  function() { $(this).attr("src", "images/gallery/" + this.id + "_small.jpg"); },
							  function() { if (this.id != activeGallery) { $(this).attr("src", "images/gallery/" + this.id + "_small_muted.jpg"); } } 
							);
			
			$("#linkgallery" + i).click(function(event) {
				event.preventDefault();
			});
			
			$("#gallery" + i).click(function() {				 
				$.changeGalleryImage(this.id);
			});
		}
	}
	
	$.changeGalleryImage = function(id) {
		activeGallery = id;
		
		$("#placeholderImage").attr("src", "images/gallery/" + id + ".jpg");
		$("img[id^='gallery']").each(function() {
			$(this).attr("src", "images/gallery/" + this.id + "_small_muted.jpg");
		});
		$("#" + id).attr("src", "images/gallery/" + id + "_small.jpg");	
	}
	
	
	
	
	var activeEdition = "";
	$.setupEdition = function(length) {

		for (var i = 1; i <= length; i++) {
			$("<img>").attr("src", "images/edition/edition" + i + "_small.jpg");
			$("#edition" + i).hover(
							  function() { $(this).attr("src", "images/edition/" + this.id + "_small.jpg"); },
							  function() { if (this.id != activeEdition) { $(this).attr("src", "images/edition/" + this.id + "_small_muted.jpg"); } } 
							);
			
			$("#linkedition" + i).click(function(event) {
				event.preventDefault();
			});
			
			$("#edition" + i).click(function() {				 
				$.changeEditionImage(this.id);
			});
		}
	}
	
	$.changeEditionImage = function(id) {
		activeEdition = id;
		
		$("#placeholderImage").attr("src", "images/edition/" + id + ".jpg");
		$("img[id^='edition']").each(function() {
			$(this).attr("src", "images/edition/" + this.id + "_small_muted.jpg");
		});
		$("#" + id).attr("src", "images/edition/" + id + "_small.jpg");	
	}

