$(function(){
	// open links in new window
	$('a[rel="external"]').click( function() {
		window.open( $(this).attr('href') );
		return false;
	});

	// show/hide guest book editor
	$('#postingeditor').css({ 'display':'none' });
	$('#postingeditorshow').attr('id','postingeditor');
	$('#writeposting').click( function() { $('#postingeditor').slideToggle(500); });

	// keyboard navigation for subpages
	var l1 = $('.next').attr('href'), l2 = $('.prev').attr('href'), l3 = $('.back').attr('href');
	if (l1 || l2 || l3) {
		$(document).bind('keydown.fb', function(e) {
			if (l3 && e.keyCode==27) { window.location = l3; }
			if (l2 && e.keyCode==37) { window.location = l2; }
			if (l1 && e.keyCode==39) { window.location = l1; }
		});
	}

});

