	$.fn.fadeIn = function(speed, callback) { 
    return this.animate({opacity: 'show'}, speed, function() { 
        if ($.browser.msie)  
            this.style.removeAttribute('filter'); 
			
        if ($.isFunction(callback)) 
            callback();  
    }); 
}; 
 
$.fn.fadeOut = function(speed, callback) { 
    return this.animate({opacity: 'hide'}, speed, function() { 
        if ($.browser.msie)  
            this.style.removeAttribute('filter');  
        if ($.isFunction(callback)) 
            callback();  
    }); 
}; 
 
$.fn.fadeTo = function(speed,to,callback) { 
    return this.animate({opacity: to}, speed, function() { 
        if (to == 1 && $.browser.msie)  
            this.style.removeAttribute('filter');  
        if ($.isFunction(callback)) 
            callback();  
    }); 
};


$(document).ready(function() {
	var hash = window.location.hash.substr(1);
	var href = $('#nav li a').each(function(){
		var href = $(this).attr('href');
		if(hash==href.substr(0,href.length-5)){
			var toLoad = hash+'.html #content';
			$('#content').load(toLoad)
		}											
	});

	
	/*$('#nav li a').livequery('click', function() { 
       alert('clicked fixed'); 
       return false; 
   });*/

// loader function
/*	$('#nav li a').livequery('click',function(){
								  
		var toLoad = $(this).attr('href')+' #content';
		$('#content').fadeOut('fast',loadContent);
		$('#load').remove();
		$('#wrapper').append('<span id="load">LOADING...</span>');
		$('#load').fadeIn('normal');
		//window.location.hash = $(this).attr('href').substr(0,$(this).attr('href').length-5);
		
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').fadeIn('normal',hideLoader());
		}
		function hideLoader() {
			$('#load').fadeOut('normal');
		}
		return false;
		
	});*/
	// no loader function
/*		$('#nav li a').livequery('click',function(){
		var toLoad = $(this).attr('href')+' #content';
		$('#content').fadeOut('fast',loadContent);
		function loadContent() {
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').fadeIn('normal');
		}
		return false;
		
	});*/
	// no loader function try to prevent pops
		$('#nav li a').livequery('click',function(){
		var toLoad = $(this).attr('href')+' #content';
		$('#content').fadeOut('normal',loadContent);
			
		function loadContent() {
			/*$('#content').remove();
			$('#wrapper').append('<div id="content"></div>');*/
			$('#content').load(toLoad,'',showNewContent())
		}
		function showNewContent() {
			$('#content').fadeIn('normal');
		}
		return false;
		
	});
});