function switchChapter(sTarget) {

	sActual = '#'+$('#contentBlockContainer div.current').attr('id');

	aFoo = sTarget.split("chapter=");
	sTargetChapter = "#chapter"+aFoo[1];

	if (sTargetChapter != sActual) {
		$('#contentBlockContainer div.current').fadeOut(function() {
			$(this).removeClass('current');
			$('#contentBlockContainer div'+sTargetChapter).addClass('current').fadeIn();
		});


		$('#blockNavigation a.current').removeClass('current');
		$('#blockNavigation a[href="'+sTarget+'"]').addClass('current');


	}

}

$(document).ready(function() {

	$('#blockNavigation').css('opacity', '0.01').show().hover(
		function() {
			$(this).addClass('blockNavigationActive');
			$(this).css('opacity', 0.8);
		}, 
		function() {
			$(this).removeClass('blockNavigationActive');
			$(this).css('opacity', 0.01);
		}
	);

	$('.next a').click(function() {
		switchChapter($(this).attr('href'));
		return false;
	});

	$('.previous a').click(function() {
		switchChapter($(this).attr('href'));
		return false;
	});

	$('#blockNavigation a').click(function() {
		switchChapter($(this).attr('href'));
		return false;
	});

	$("#blockNavigation a").tooltip({
	    showURL: false 
	});

	$('a').focus(function() {
		$(this).blur();
	});

});
