$(document).ready(function() {
 
	if (location.hash) {
		var navbutton = location.hash + '-nav';
		$('#navigation a').removeClass('selected');
		$(navbutton).addClass('selected');
		$('.page').hide();
		$(location.hash).fadeIn('slow')	
	}	
 
 
	$('#navigation a').click(function(e) {
		e.preventDefault();
		$('#navigation a').removeClass('selected');
		$(this).addClass('selected');
		$('.page').hide();
		$($(this).attr('href')).fadeIn('slow');
	});

	$('a.internal').click(function(e) {
		e.preventDefault();
		var clicked = $(this).attr('href');
		$('#navigation a').removeClass('selected');
		$(clicked + '-nav').addClass('selected');
		$('.page').hide();
		$($(clicked)).fadeIn('slow');
	});
 

	//stick the footer at the bottom of the page if we're on an iPad/iPhone due to viewport/page bugs in mobile webkit
	if(navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod') {
     		$("#footer").css("display", "none");
	};

 });
 

