$(document).ready(function () {  
  $.history.init(pageload);   
$('a[href=' + document.location.hash + ']').addClass('selected');  
$('a[rel=ajax]').click(function () {  
var hash = this.href;  
hash = hash.replace(/^.*#/, '');  
$.history.load(hash);     
$('a[rel=ajax]').removeClass('selected');  
$(this).addClass('selected');  
$('.content').fadeOut('fast');  
$('#loading').show();  
getPage();  
return false;  
});   
});  
function pageload(hash) {  
if (hash) getPage();      
}  
function getPage() {  
var data = 'page=' + document.location.hash.replace(/^.*#/, '');  
$.ajax({  
url: "content.php",    
type: "GET",          
data: data,       
cache: false,  
success: function (html) {    
$('#loading').hide();     
$('.content').html(html);  
$('.content').fadeIn('fast');         
}         
});  
}

