			function GalleryImage(thumb, image) {
				this.thumb = thumb;
				this.image = image;
			}
		
			var currentPage = 0;
			var currentGallery;
			//595x619
			$(document).ready(function(){
				
				var shown = $("#image-show");
				var hidden = $("#image-hide");
				
				$("#back").click(function()
				{
					$(this).hide();
					$("#page-navigation").hide();
					$(".one").fadeIn('fast');
					
					animate(0);
				});
				
				$(".one img").hover(
					function()
					{
						$("#gallery-name").html($(this).parent().attr("id"));
						$("#gallery-name").show();
					},
					function()
					{
						$("#gallery-name").hide();
					}
				);
				
				function swapImages(event)
				{	
					$(event.target).unbind();
					
					$(event.target).parent().fadeIn('slow');
				}
				
				$(".two img").click(function()
				{
					hidden.hide();
					
					var temp = shown;
					shown = hidden;
					hidden = temp;
					
					var id = $(this).attr("id"); 
					var copyright = id.substring(0, id.indexOf("/"));
					id = id.replace("" + copyright + "/", "");
					var img = id.replace("show", "");
					
					shown.children().first().attr("src", img);
					var maxHeight = $(window).height() - 120;
					shown.css("max-height", maxHeight + "px");
					
					hidden.fadeOut('slow');
					
					shown.children().first().bind("load", swapImages);
					
					shown.children(".copyright").text($("#cr" + copyright).html());
				});
		
				$(".one img").click(function()
				{
					var id = $(this).attr("id");
					var gallery = id.replace("show", "");
					
					var numImages = gallery.substring(gallery.indexOf("-") + 1);
					var numPages = Math.ceil(numImages / 12);
					
					if(numPages == 1)
					{
						$("#page-1").hide();
						$("#page-2").hide();
						$("#page-3").hide();
					}
					else if(numPages == 2)
					{
						$("#page-1").show();
						$("#page-2").show();
						$("#page-3").hide();
					}
					else if(numPages == 3)
					{
						$("#page-1").show();
						$("#page-2").show();
						$("#page-3").show();
					}	
					
					gallery = gallery.replace("-" + numImages, "");
					
					currentGallery = $("#gallery-pages" + gallery);
					
					$(".one").fadeOut('slow');
					$("#gallery-name").hide();
					animate(1);
				});
				
				animate = function(page)
				{
					if(page == currentPage)
						return;
					
					var sign;
					var pageOffset = 0;
					
					if(currentPage < page)
					{
						pageOffset = page - currentPage;
						sign = '-=';
					}
					else
					{
						pageOffset = currentPage - page;
						sign = '+='
					}
					
					currentPage = page;
					var offset = pageOffset * 200;
					
					var combined = sign + offset;
					
					if(page == 0)
						offset = 200;

					currentGallery.animate(
					{
						left: combined
					}, 
					offset, 
					function() 
					{
						if(page > 0)
						{
							$("#back").fadeIn('fast');
							$("#page-navigation").fadeIn('fast');
						}
						else
						{
							$("#back").fadeOut('fast');
							$("#page-navigation").fadeOut('fast');
						}
					});
				};
								
				$(".page").click(function()
				{
					animate($(this).text());
				});
				

			});
