
// Hack pour résolution 800x600

	// Ajout d'une classe "is800" sur l'élément HTML
	function testWindowWidth(){
		if (!jQuery.browser.opera) {
			var w = $(window).width(); // Opera 9.5 plante sur cette fonction
			if (w < 920) {
				$('html').removeClass('normal');
				$('html').addClass('is800');
			}
		}
	}
	testWindowWidth();

// Menu de navigation du haut

	// On utilise le plugin Superfish pour améliorer le menu déroulant
	// «pur CSS» (incompatible IE6, peu ergonomique, inutilisable au clavier).
	$(document).ready(function(){
		$('#topnav > ul.l1').superfish({
			hoverClass	: 'hover',
			delay		: 600,
			animation	: {opacity:'show', height: 'show'},
			speed		: 'normal',
			dropShadows	: false,
			autoArrows	: false
		});
	});

// Menu de navigation du bas

	// On utilise le plugin Superfish pour améliorer le menu déroulant
	// «pur CSS» (incompatible IE6, peu ergonomique, inutilisable au clavier).
	$(document).ready(function(){
		$('#bottomnav > ul').superfish({
			hoverClass	: 'hover',
			delay		: 600,
			animation	: {opacity:'show', height:'show'},
			speed		: 'normal',
			dropShadows	: false,
			autoArrows	: false
		});
	});


// Fonction pour remplir les champs de formulaire (INPUT de type text)

	// Fonction textInputDynamicValue
	function textInputDynamicValue (input_selector, text_to_use, def_class) {
		if (text_to_use == undefined) text_to_use = 'title';
		if (def_class == undefined) def_class = 'dvDefault';
		var dynamic_value = [];
		$(input_selector).each(function(j) {
			switch (text_to_use) {
				case 'title' :
					dynamic_value[j] = $(this).attr('title');
					break;
				case 'value' :
					dynamic_value[j] = $(this).attr('value');
					break;
				default :
					dynamic_value[j] = text_to_use;
			}
			$(this).attr('value', dynamic_value[j]).addClass(def_class)
			.focus(function() {
				if (this.value == dynamic_value[j]) {
					this.value = '';
					$(this).removeClass(def_class);
				}
			})
			.blur(function() {
				if (this.value == '') {
					this.value = dynamic_value[j];
					$(this).addClass(def_class);
				};
			});
		});
	};

	// Appel de la fonction
	$(document).ready(function(){
		//textInputDynamicValue('#recherche .text', 'Recherche\u2026', 'default');
		textInputDynamicValue('#inscription .text', 'Inscription newsletter', 'default');
	});


// Images d'illustration dans les blocs

	// On remplace les img.illustration par des span.illustration utilisant
	// l'image comme background
	$(document).ready(function(){
		$('.fluidbox img.illustration').each(function(){
			var image_src = $(this).attr('src');
			var cadre = document.createElement('span');
			cadre.className = 'illustration';
			cadre.style.backgroundImage = 'url(' + image_src + ')';
			$(this).wrap(cadre);
			$(this).removeClass('illustration');
		});
	});
