var pre = 'includes/include.';
function pageload(hash){
	if(hash){
		if($.browser.msie){
			hash = encodeURIComponent(hash);
		}
		$("#PageContent").load(pre + hash + ".php");
		if(hash=='home'){
		  window.location = window.location.href.replace( /#.*/, "");
		  $('#PageSideBar').fadeIn(1000);
		}else{
          if ($('#PageSideBar').css("opacity") != "0" && $('#PageSideBar').is(":not(animated)")) $('#PageSideBar').fadeOut(1000);
		}
	}else{
		$('#PageSideBar').fadeIn(1000);
		$("#PageContent").load(pre + "home.php");
	}
}
$(document).ready(function(){
//$(window).load(function(){
  $.historyInit(pageload, "index.php");
//  $('#PageNavigation li a').click(function(){
//  $("a[@rel='history']").click(function(){
  $('a[href^=#]').click(function(){
//	$('#load').remove();
	$('#PageWrapper').append('<span id="load">LOADING...</span>');
	$('#load').fadeIn('fast');
	$('#PageContent').stop(true, true).fadeOut(1000);
	var hash = this.href;
	hash = hash.replace(/^.*#/, '');
	$.historyLoad(hash);
	$('#PageContent').stop(true, true).fadeIn(1000);
	$('#load').fadeOut(1000);
	return false;
  });
});
$(function(){
    $('a[href^=http]').click(function(){
        window.open(this.href);
        return false;
    });
});