function returnFalse() { return false; };
$(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 prenom = false;
	var nom = false;
	var adresse = false;
	var codepostal = false;
	var ville = false;
	var telephone = false;
	var email = false;
	
	$('#txtprenom').blur(function(){
		if ($('#txtprenom').val() == '')
		{
			$('#alertprenom').append('<p class="red">* merci de pr&eacute;ciser votre pr&eacute;nom</p>');
			prenom = false;
		}
		else {
			$('#alertprenom').append('<p class="green">*  OK</p>');	
			prenom = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}		
	});	


	$('#txtnom').blur(function(){
		if ($('#txtnom').val() == '')
		{
			$('#alertnom').append('<p class="red">* merci de pr&eacute;ciser votre nom</p>');
			nom = false;
		}
		else {
			$('#alertnom').append('<p class="green">*  OK</p>');	
			nom = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}		
	});
	


	$('#txtadresse').blur(function(){
		if ($('#txtadresse').val() == '')
		{
			$('#alertadresse').append('<p class="red">* merci de pr&eacute;ciser votre adresse</p>');	
			adresse = false;
		}
		else {
			$('#alertadresse').append('<p class="green">* OK</p>');	
			adresse = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	$('#txtcodepostal').blur(function(){
		if ($('#txtcodepostal').val() == '')
		{
			$('#alertcodepostal').append('<p class="red">* merci de pr&eacute;ciser votre code postal</p>');	
			codepostal = false;
		}
		else {
			$('#alertcodepostal').append('<p class="green">* OK</p>');	
			codepostal = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	$('#txtville').blur(function(){
		if ($('#txtville').val() == '')
		{
			$('#alertville').append('<p class="red">* merci de pr&eacute;ciser votre ville</p>');	
			ville = false;
		}
		else {
			$('#alertville').append('<p class="green">* OK</p>');	
			ville = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});


	$('#txttelephone').blur(function(){
		if ($('#txttelephone').val() == '')
		{
			$('#alerttelephone').append('<p class="red">* merci de pr&eacute;ciser votre t&eacute;l&eacute;phone</p>');	
			telephone = false;
		}
		else {
			$('#alerttelephone').append('<p class="green">* OK</p>');	
			telephone = true;
		}		

		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});







	var filter=/^.+@.+\..{2,3}$/;
	$('#txtemail').blur(function(){
		if ($('#txtemail').val() == '')
		{
			$('#alertemail').append('<p class="red">* merci de pr&eacute;ciser votre e-mail</p>');	
			email = false;
		}
		else if (filter.test($('#txtemail').val())) {
			$('#alertemail').append('<p class="green">*  OK</p>');	
			email = true;
		}
		else {
			$('#alertemail').append('<p class="orange">* merci de saisir une adresse e-mail valide</p>');	
			email = false;
		}		
		
		if (prenom && nom && adresse && codepostal && ville && telephone && email)
		{
			$('#submit .button').unbind('click', returnFalse);
		
		}	
	});


	$('#txtprenom').focus(function(){
		$('#alertprenom').empty();	
	});		

	$('#txtnom').focus(function(){
		$('#alertnom').empty();	
	});	
	
	$('#txtadresse').focus(function(){
		$('#alertadresse').empty();	
	});		

	$('#txtcodepostal').focus(function(){
		$('#alertcodepostal').empty();	
	});		

	$('#txtville').focus(function(){
		$('#alertville').empty();	
	});		

	$('#txttelephone').focus(function(){
		$('#alerttelephone').empty();	
	});		

	$('#txtemail').focus(function(){
		$('#alertemail').empty();	
	});	

	$('#submit .button').click(function(){
		if (prenom && nom && adresse && codepostal && ville && telephone && email)
	  {
	 	$('#submit .button').unbind('click', returnFalse);
	  }
	 
	});	
				  

});


