$(document).ready(function() {
	champsRecherche.init();
	accessibilityButton.init();
});

var champsRecherche = function(){
	function _init(){
		handleInput($('#text-01'),  'Entrer votre recherche');
		handleInput($('#research'), 'Entrer votre recherche');
		handleInput($('#SearchText'), 'Rechercher');
	}

	function handleInput(e,s) {
		// e : objet jquery, typiquement $(this) ; s : string
		e.click(function(){
			if (e.val() == s) e.val('');
		}).blur(function(){
			if (e.val() == '') e.val(s);
		});
	}

	return {init:_init}
}();

var accessibilityButton = function(){
	var textSmaller, textBigger, printButton;
	function _init(){
		var aim = $('.center');

		// FIXME : recuperer la valeur dans un cookie s'il y en a un ? Ou le mettre dans le head ?
		var aimFontSize = parseInt(aim.css('font-size'));

		//console.log(aimFontSize);

		textSmaller = $('.text-lower');
		textBigger = $('.text-bigger');
		printButton = $('.print');

		textSmaller.click(function(){
			aimFontSize = aimFontSize*10/11;
			aim.css('font-size',aimFontSize+'px');
		});

		textBigger.click(function(){
			aimFontSize = aimFontSize*11/10;
			aim.css('font-size',aimFontSize+'px');
		});

		printButton.click(function(){
			window.print();
			return false;
		});
	}
	return {init:_init}
}();