$(function(){

	var size = $.cookie('content-font-size');
	if (size != null)
		$('#content').css('font-size', 1*size);


	// sets the active menu item
	$('#header .menu a').removeClass('active').each(function(){
		if (window.location.href.indexOf($(this).attr('href').slice(0,-1)) > 0) //ignores / at the end
			$(this).addClass('active');
			
	});
	// if article, library is active
	if (window.location.pathname.indexOf('/article') == 0)
		$('#header .menu li:eq(6) a').addClass('active');

	// if no item is active, selects first (Home) item
	if ($('#header .menu a.active').size() == 0)
		$('#header .menu li:first-child a').addClass('active');


	//show font control panel
	$('.font-change').show();
	
	//hide go submit in jumpmenu
	if (document.jumpmenu)
		$(document.jumpmenu.go).hide();

	//bigger font
	$('#fontplus').click(function(e){
		e.preventDefault();
		var size = 1+parseInt($('#content').css('font-size'));
		$('#content').css('font-size', size);
		$.cookie('content-font-size', size, {path: '/'});
		return false;		
	});

	//smaller font
	$('#fontminus').click(function(e){
		e.preventDefault();
		var size = -1+parseInt($('#content').css('font-size'));
		$('#content').css('font-size', size);
		$.cookie('content-font-size', size, {path: '/'});
		return false;		
	});
	
});

