function returnFalse() { return false; };
nbNews = 3; // POUR LES ACTUALITES
$(document).ready(function(){	
	 
 	$(function() { $(".lavaLamp").lavaLamp({ fx: "easeOutExpo", speed: 700 })});

	// ***** PROMO BOX LEFT
	$('#promoLeft').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoLeft').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoLeft').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});
	
	// ***** PROMO BOX RIGHT
	$('#promoRight').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoRight').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoRight').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});
	
	// ***** PROMO BOX CENTER
	$('#promoCenter').children('.text').slideUp(2, 'easeInExpo');
	
	$('#promoCenter').mouseenter(function(){
		$(this).children('.text').slideDown('fast', 'easeOutExpo');							  
	});
	
	$('#promoCenter').mouseleave(function(){
		$(this).children('.text').slideUp('fast', 'easeInExpo');							  
	});	

	/* -++-+-+-+-+-+-+- CONTACT FORM +-+-+-++-+-+- */
	
	$('#submit .button').bind('click', returnFalse);
	var nom = false;
	var postal = false;
	var emailFrom = false;
	var phone = false;
	var city = false;
	var address = false;
	
	$('#txtName').blur(function(){
		if ($('#txtName').val() == '')
		{
			$('#alertName').append('<p class="red">* Veuillez indiquer vos nom et prénom </p>');
			nom = false;
		}
		else {
			$('#alertName').append('<p class="green">* Champ nom et prénom valide </p>');	
			nom = true;
		}		

		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	$('#txtAddress').blur(function(){
		if ($('#txtAddress').val() == '')
		{
			$('#alertAddress').append('<p class="red">* Veuillez indiquer votre adresse</p>');	
			address = false;
		}
		else {
			$('#alertAddress').append('<p class="green">* Champ adresse valide</p>');	
			address = true;
		}		

		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});
	
	$('#txtCity').blur(function(){
		if ($('#txtCity').val() == '')
		{
			$('#alertCity').append('<p class="red">* Veuillez indiquer le nom de votre ville</p>');	
			city = false;
		}
		else {
			$('#alertCity').append('<p class="green">* Champ ville valide</p>');	
			city = true;
		}		

		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	$('#txtPostal').blur(function(){
		if ($('#txtPostal').val() == '')
		{
			$('#alertPostal').append('<p class="red">* Veuillez indiquer le code postal</p>');	
			postal = false;
		}
		else {
			$('#alertPostal').append('<p class="green">* Champ code postal valide</p>');	
			postal = true;
		}		

		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	var filterTwo=/^\+?[0-9]{5,15}$/;
	$('#txtPhone').blur(function(){
		if ($('#txtPhone').val() == '')
		{
			$('#alertPhone').append('<p class="red">* Veuillez indiquer votre numéro</p>');	
			phone = false;
		}
		else if (filterTwo.test($('#txtPhone').val())) {
			$('#alertPhone').append('<p class="green">* Champ téléphone valide</p>');	
			phone = true;
		}		
	
		else {
			$('#alertPhone').append('<p class="orange">* ! uniquement des chiffres et sans espace</p>');	
			phone = false;
		}		

		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	var filter=/^.+@.+\..{2,3}$/;
	$('#txtEmailFrom').blur(function(){
		if ($('#txtEmailFrom').val() == '')
		{
			$('#alertEmailFrom').append('<p class="red">* Veuillez indiquer votre email</p>');	
			emailFrom = false;
		}
		else if (filter.test($('#txtEmailFrom').val())) {
			$('#alertEmailFrom').append('<p class="green">*  Champ email complet</p>');	
			emailFrom = true;
		}
		else {
			$('#alertEmailFrom').append('<p class="orange">* Rentrer une adresse email valide svp</p>');	
			emailFrom = false;
		}		
		
		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	$('#txtEmailFrom').focus(function(){
		$('#alertEmailFrom').empty();	
	});	
	
	$('#txtName').focus(function(){
		$('#alertName').empty();	
	});		

	$('#txtPhone').focus(function(){
		$('#alertPhone').empty();	
	});	

	$('#txtAddress').focus(function(){
		$('#alertAddress').empty();	
	});	

	$('#txtPostal').focus(function(){
		$('#alertPostal').empty();	
	});	

	$('#txtCity').focus(function(){
		$('#alertCity').empty();	
	});	
	

	$('#submit .button').click(function(){
		if (emailFrom && nom && address && city && postal && phone)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	 
	});	
	
	$('#ul-bandeau-accueil a').mouseover(function(){												  
		sonId = $(this).attr('id');
		$('#'+sonId+'-img').stop().fadeTo(400,0.7);							  
	});
	$('#ul-bandeau-accueil a').mouseout(function(){
		sonId = $(this).attr('id');										   
		$('#'+sonId+'-img').stop().fadeTo(400,1);							  
	});
	
	
	
	
	
	direction = 'next';	

	idee=1;	
	recto = true;
	var timerThree = setInterval (function () {		
		if (!recto)
		{
			idee--;	
			$('#ul-bandeau-accueil').stop().animate({marginLeft: '+=970px'},{queue:false, duration:1500, easing: 'easeInOutQuint'});
			if (idee == 1)
			{
				recto = true;	
			}			
		}
		else
		{	
			idee++;
			$('#ul-bandeau-accueil').stop().animate({marginLeft: '-=970px'},{queue:false, duration:1500, easing: 'easeInOutQuint'});
			if (idee == 4)
			{
				recto = false;	
			}
		}	

	}, 4000 );
	

	$('#menu p').slideUp(200);
	$('a.menuQuiSeDeroule').bind('click', returnFalse);
	
	$('a.menuQuiSeDeroule').click(function(){
		$('#menu p').slideUp(200);								   
		var nomMD = $(this).attr('id');
		$('p#laListe'+nomMD).slideDown(200); //slideToggle(200);
	
	});

	$('#menu').mouseleave(function(){
		var nomMD = $(this).attr('id');
		//alert (nomMD);
		$('#menu p').slideUp(200);
	
	});



});


