$(function()
{
	$("#niche-header ul.slide-pager a").click(function()
	{
		$slide = $("#niche-header .slide");
		$link = $(this);
		$slide.fadeOut(500, function()
		{
			$slide.html('<img src="' + $link.attr("href") + '" alt="' + $link.attr("title") + '" />').fadeIn(500);
		});
		return false;
	});
	$("a.modal").click(function()
	{
		link = $(this);
		$("#sitewrapper").append('<div id="modal-layer"></div><div id="modal"></div>');
		scrollTo(0, 0);
		$("#modal").load(link.attr("href"), function()
		{
			$("#modal").prepend('<h2><a class="close" href="#">close</a>' + link.attr("title") + '</h2>');
			$("#modal-layer, #modal").fadeIn(500, function()
			{
				$("#modal-layer").animate({ opacity: .8 }, 0)
			});
		});
		return false;
	});
	$("#modal-layer, #modal a.close").live("click", function()
	{
		$("#modal-layer, #modal").fadeOut(500, function() { $(this).remove(); });
		return false;
	});
});