$(document).ready(function()
{
	$(function()
	{
		$("a[rel]").overlay(
		{
			expose: '#002448',
			start:
			{
				top: 0
			},
			finish:
			{
				top: 0,
				left: 'center'
			}
		});
	});


	$("a.loadLink").click(function()
	{
		var loadLoc;
		loadLoc = $(this).attr("href");

		$.ajax({
			 type: "GET",
			 url: loadLoc,
			 dataType: "xml",
			 timeout: 15000,
			 cache: false,
			 success: function(xml)
			 {
				doRes(xml);
			 },
			 error: function(XMLHttpRequest,textStatus,errorThrown)
			 {
				errorHandler(textStatus);
			 }
		 });
		return false;
	});

	function doRes(data)
	{
		$(data).find("photo").each(function()
		{
			var fn = $(this).find("fn").text();
			var height = $(this).find("height").text();
			var width = $(this).find("width").text();
			$("#popImg").attr("src","/repo/images/"+fn);
			$("#popImg").attr("height",height);
			$("#popImg").attr("width",width);
		});
	}

	function errorHandler(data)
	{
		$("div#container").html("<p>An error occured while processing the request.<br /><br />Please try again shortly.</p>");
		$("div#container").append("<p>The error was: "+data+"</p>");
	}

});