$(document).ready(function(){
	$('.email').each(function(){
		var a = / at /;
		var d = / dot /g;
		var e = $(this).attr('title').replace(a,'@').replace(d,'.');
		var t = $(this).text().replace(a,'@').replace(d,'.');
		$(this)
			.after('<a href="mailto:' + e + '">' + t + '</a>')
			.remove();
	});
	$('#home #wrap').append('<div id="shadow"><p><span><img id="close-me" src="/img/x.png" alt="Close this." title="Close this." /><img id="fill-this" src="" alt="" /></span></p></div>');
	$('.figure img').hover(
		function(){$(this).css('cursor','pointer').attr('title','Click to view full-size.');},
		function(){$(this).css('cursor','default').attr('title','');}
	).click(function(){
		var imgPath = $(this).attr('src');
		$('#shadow #fill-this').attr('src', imgPath);
		$('#shadow').fadeIn(500).css('display','table');
		return false;
	});
	$('#shadow').click(function(){
		$(this).fadeOut(250);
		return false;
	});
	$('#close-me').hover(
		function(){$(this).css('cursor','pointer');},
		function(){$(this).css('cursor','default');}
	).click(function(){
		$('#shadow').fadeOut(250);
		return false;
	});
});