$(function () {

	//@ add onclick handler to each navigation anchor
	$("div#nav ul li a").click(function(){
		//@ remove current class
		$('#nav ul li a.current').removeClass('current');
		//@ add current class to this
		$(this).addClass('current');
		//@ load the page which specify in its href attribute
		ajaxify($(this).attr('href'));
		//@ prevent default behaviour
		return false;
	});			
					
	//@ ajax function get page content
	function ajaxify(file){
		//@ loading message
		$('<div id="loading"></div>').html("").appendTo('body').fadeIn();
		//@ http GET request
		$.get(file,function(data) {	
			//@ add data to wrapper div, fade it slowly
			$("#wrapper").fadeOut('fast',function(){
				$(this).html(data).fadeIn('fast',function(){$('#loading').fadeOut('slow',function(){$(this).remove();});	
				});
			});
		});
	}
});
//@ ajax function get page content
	function displayarticle(url){
		//@ loading message
		$('<div id="loading"></div>').html("").appendTo('body').fadeIn();
		//@ http GET request
		$.get(url,function(data) {	
			//@ add data to wrapper div, fade it slowly
			$("#load-page-here2").fadeOut('fast',function(){
				$(this).html(data).fadeIn('fast',function(){$('#loading').fadeOut('slow',function(){$(this).remove();});	
				});
			});						
		});				
	}
//@ ajax function get page content
	function displayarticle2(url){
		//@ loading message
		$('<div id="loading"></div>').html("").appendTo('body').fadeIn();
		//@ http GET request
		$.get(url,function(data) {	
			//@ add data to wrapper div, fade it slowly
			$("#wrapper").fadeOut('fast',function(){
				$(this).html(data).fadeIn('fast',function(){$('#loading').fadeOut('slow',function(){$(this).remove();});	
				});
			});						
		});				
	}