/**
 * PORTAIL E-BOURGOGNE
 * General js functions 
 */


// Printing
function toPrint(){
	if (document.getElementById("print")) {
		$("#print").click (function(){
			window.print();	
		});
	}
}

// Contextual fieldset help
function fsHelp() {
	$("div.fieldset-help").toggleClass("active");
	$("div.fieldset-help div.content").hide();
	$("div.fieldset-help p.trigger").hover(
		function(){
			$(this).parent("div.fieldset-help").toggleClass("active");
			$(this).next("div.content").slideDown("fast");
			return false;
        },
		function(){
			$(this).parent("div.fieldset-help").toggleClass("active");
			$(this).next("div.content").slideUp("fast");
			return false;
        });
	$("div.fieldset-help p.trigger a").focus(
		function(){
			$(this).parent("p.trigger").parent("div.fieldset-help").toggleClass("active");
			$(this).parent("p.trigger").siblings("div.content").slideDown("fast");
			return false;
       	});
}

$(function(){
	$('#zoomOut a').click(function(){
		var ourText = $('#main-content');
		if(ourText) {
			var currFontSize = ourText.css('fontSize');
			var finalNum = parseFloat(currFontSize, 10);
			var stringEnding = currFontSize.slice(-2);
			finalNum *= 1.2;
			ourText.animate({fontSize: finalNum + stringEnding},600);
		}
		return false;
	});
	
	$('#zoomIn a').click(function(){
		var ourText = $('#main-content');
		if(ourText) {
			var currFontSize = ourText.css('fontSize');
			var finalNum = parseFloat(currFontSize, 10);
			var stringEnding = currFontSize.slice(-2);
			finalNum /=1.2;
			ourText.animate({fontSize: finalNum + stringEnding},600);
		}
		return false;
	});	
});
