$(document).ready(function() {
						   
						   
	function loadContent(toLoad) {
		var url = 'content/'+toLoad+'/page.html';
		
		$('#siteContent').html("");
		$('#siteContent').hide('slow',getNewContent);
		//$('#siteContent').fadeOut('slow',getNewContent);
		//$('#siteContent').fadeIn('slow',getNewContent);
		//alert("Started");
		$('#loader').remove();
		$('#wrapper').append('<div id="loader"></div>');
		$('#loader').fadeIn('normal');
		
		function getNewContent() {
			$('#siteContent').ajaxComplete(hideLoader);
			$('#siteContent').load(url);
			
		}
		function showNewContent() {
		//	alert("Stopped1");
			$('#siteContent').show('normal');
	
			//$('#siteContent').fadeIn('normal');
			
		}
		//for loader
		function hideLoader() {
	//alert("Stopped2");
		
			$('#loader').fadeOut('normal',showNewContent);
			

		}
	}
	loadContent('home');
	
	
	$('#logout,#register,#start,#contact,#instructions,#home,#team').click(function(){
		$('#header li a').removeClass();
		$(this).addClass('on');
		var toLoad = $(this).attr('id');
		//alert(toLoad);
		//if(toload=='troika') return true;
		loadContent(toLoad);
			return false;
	});

});
