/*--FONCTIONS pour le champs Recherche--*/
function selectS() {
	var valeur = document.searchform.s.value;
	if (valeur == 'Recherche') {
		document.searchform.s.focus();
		document.searchform.s.select();
	}
}
function restoreS() {
	var valeur = document.searchform.s.value;
	if (valeur == '') document.searchform.s.value = 'Recherche';
}


/*--LAVALAMP--*/
$(function() {
		$(".lavaLampBottomStyle").lavaLamp({
			fx: "backout",
			speed: 700,
			click: function() {return true;}
		});
});


/*--SLIDESHOW--*/
	// Fonction pour le slideshow en homepage
	var zindex = 20;

function slideShow() {
		// Masquage des images
		$('.slideshow a').css("display","none");

		// Affichage de la première image
		$('.slideshow a:first').css("display", "block" );

		// Intervalle de changement
		setInterval('gallery()',6500);

}

function gallery() {
		if(zindex>9990) {
			zindex = 20;
			$('.slideshow a').css("z-index",zindex);
		}
		zindex++;

		// Image courante
		var current = ($('.slideshow a.show')? $('.slideshow a.show') : $('.slideshow a:first'));

		//$('.slideshow a.show').click(function() { alert('boom'); gallery() });

		// Image suivante
		var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('.slideshow a:first') :current.next()) : $('.slideshow a:first'));

		// Effet de transition
		next.css("z-index",zindex);
		next.css({
			display: 'block',
			opacity: 0.0
		})
		.addClass('show')
		.animate({opacity: 1.0}, 1500, upd);

		// Disparition
		function upd() {
			current.css({display: 'none'}).removeClass('show');
		}
}
	
/*--AU CHARGEMENT DE LA PAGE--*/
$(document).ready(function(){
	slideShow();
}); 
