jQuery(function($){
	initFontSize();
	initFontContrast();

	//Création des liens retours
	$('.retour a').click(function() {
		history.go(-1); return false;
	});

	//Initialisation du champ de recherche
	search_txt = $('.search input[type=text]').val();
	$('.search input[type=text]').focus(function() {
		this.value = '';
	});
	$('.search input[type=text]').blur(function() {
		if(this.value=='') this.value = search_txt;
	});

	//Initialisation du champ d'inscription à la newsletter
	$('#newsletter_txt input[type=text]').val('adresse email');
	$('#newsletter_txt input[type=text]').focus(function() {
		this.value = '';
	});
	$('#newsletter_txt input[type=text]').blur(function() {
		if(this.value=='') this.value = 'adresse email';
	});
	
	$(document).pngFix(); 
});

var fs = 100;
function initFontSize()
{
	var cookie = readCookie("font_size");
	fs = cookie ? cookie : fs;
	setFontSize();

	$('#print').click(function() {
		window.print(); return false;
	});
	$('#typocontrast').click(function() {
		setActiveStyleSheet('typo_contrast', 'switch'); return false;
	});
	$('#typomoins').click(function() {
		setFontSize(-1); return false;
	});
	$('#typoplus').click(function() {
		setFontSize(+1); return false;
	});
}
function setFontSize(val) {
	if(val != '') val = eval(fs + ' + ' + (val*20));
	if(val >= 100 && val <= 160)
	{
		fs = val;
		createCookie("font_size", fs, 365);	
	}
	$('#col_center').css('font-size', fs + '%');
}

var fc = 0;
function initFontContrast()
{
	var cookie = readCookie("contrast");
	fc = cookie ? cookie : fs;
	if(fc == 1) setFontContrast();	
}
