$(document).ready(function(){
	$(".navigation").load("navigation.php");
	
	//Page Loading
	//Make external links open in new window
	$('a.internal-link').address(function()
	{
		$.address.crawlable($(this));
		return $(this).attr('href').replace(/^#/, ''); 	
	});

	$.address.change(function(event)
	{
		if(event.value == "/"){
			event.value = "/pages/home.php";	
		}
		
		$("#navigation-box a").each(function(){
			if( $(this).attr("href") == event.value ){
				$(this).addClass("active");
			} else {
				$(this).removeClass("active");
			}
		});
		
		$("#content-loader").fadeOut("slow", function(){
			$.get(event.value, {}, function(data){
				$("#content-loader").html(data);
				$("#content-loader").fadeIn("slow");
			});
		});
	
	});

});
