// jquery plugin to simulate a link being followed
jQuery.fn.followLink = function() {
	this.attr('href', function(){ window.location = this.href; });
};

// navigate prev/next depending on left/right arrows pressed
$(function(){
	$(document).keydown(function(e){
		if (e.which == 37) {
			$('#prev').followLink();
		} else if (e.which == 39) {
			$('#next').followLink();
		}
	});
});



// navigate to next when clicking on main picture
$(function(){
	$('.photo IMG').click(function(){
		$('#next').followLink();
	});
});


// save width/height of browser into cookies upon page load & resize window
$(window).resize(function(){
	$.cookie('windowWidth', $(window).width(), {expires:365, path:'/'});
	$.cookie('windowHeight', $(window).height(), {expires:365, path:'/'});
});
