var pageload = function(hash) {
		if(hash) {
			GoToPage(hash);
			if ($.mizu && typeof(MizuConf)!='undefined') {
				MizuConf.id = hash;
			}
		} else {
		}
};
var GoToPage = function(id) {
	$('.nav li a').removeClass('on');
	$('.nav li a[rel="'+id+'"]').addClass('on');
	var left = $('.page[rel="'+id+'"]').offset().left-$('.cont').offset().left;
	$('.cont').animate({
			marginLeft :'-'+left+'px'
			},1000,'easeOutBack');
	
};

$(document).ready(function() {
	if(AllContent) {
		$('.content .cont').html(decodeURIComponent(AllContent));
		if($.mizu && $.mizu.setEditEvents) {
			$.mizu.setEditEvents();
		}
		
	}
	$('.content .cont').each(function() {
		$(this).find(".fancy").fancybox();	
	});
	
	$.historyInit(pageload);
	if(CurrentPage) {
		if(window.location.href.indexOf('#')<0) {
			$.historyLoad(CurrentPage);
		}
	}
	$('.nav a, .pagelink').click(function() {
		$.historyLoad($(this).attr('rel'));
		return false;
	});
});
