function LoadContent(url, push) {
	$('#content').fadeOut('fast', function() {
		$('#content').load(url + ' #content>*').fadeIn('fast', function() {
			$.get(url, function(data) {
				document.title = $(data).filter("title").text();
				if (push && history.pushState && history.replaceState) {
                	history.pushState( {url: url}, document.title, url);
	            }
			});
		});
	});
} 

$(document).ready(function(){
	$('ul.navBar a, #logo a').click(function(event) {
		event.preventDefault();
		LoadContent(this.toString(), true);
	});

	if (history.replaceState && history.pushState) {
		var urlStr = document.location.toString();
		history.replaceState( {url: urlStr}, urlStr, urlStr);
	}
});

$(window).bind("popstate", function(event) {
        if (event.state) {
            LoadContent(event.state.url.toString(), false);
        }
});


  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21207148-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();



