function pageLoad(hash)
{
	hashImage = "";
	if(hash != "")
	{
		for(i=0; i< images.length; i++)
		{
			if(hash.toString() == images[i].permalink.toString())
			{
				hashImage = i;
				break;
			}
		}
	}
	else
	{
		hashImage = startImage;	
	}

	if(i != currentImage && hashImage != "")
	{
		currentImage = hashImage;
		swapImage();
	}

}

function swapImage()
{	
	if(currentImage == 0)
	{
		jQuery("a.prevLink").hide();
	}
	else
	{
		jQuery("a.prevLink").attr("href",images[currentImage-1].permalink)
		jQuery("a.prevLink").show();
	}	
	if(currentImage == (images.length-1))
	{
		jQuery("a.nextLink").hide();
	}
	else
	{
		jQuery("a.nextLink").attr("href",images[currentImage+1].permalink)
		jQuery("a.nextLink").show();
	}
	
	jQuery("#photo").fadeOut(250,
		function() {
			jQuery("#photo").attr("src",images[currentImage].src);
			jQuery(".imgHeight").height(images[currentImage].height + "px");
			jQuery(".imgWidth").width(images[currentImage].width + "px");
			jQuery("#photo").fadeIn(250);
			jQuery("div.numbers").text((currentImage + 1) + "/" + images.length);
			/*if(currentImage != startImage)*/ location.hash = images[currentImage].permalink; // + "&" + currentImage;
				//else location.hash = "";
			if(typeof(pageTracker)!="undefined") pageTracker._trackPageview(images[currentImage].permalink);
			_gaq.push(['_trackPageview',images[currentImage].permalink]);
		}
	);
	
}

function navigationScrollIn()
{
	navigationCounter++;
	els = jQuery(".hideout");
	jQuery(els[0]).removeClass("hideout");
	if(navigationCounter == navigationCount)
	{
		window.clearInterval(nav);
	}
}

