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 firstName = false;
	var lastName = false;
	var emailFrom = false;
	
	$('#txtName').blur(function(){
		if ($('#txtName').val() == '')
		{
			$('#alertName').append('<p class="red">* Champ soci&eacute;t&eacute; requis / <i>Company requested</i></p>');
			firstName = false;
		}
		else {
			$('#alertName').append('<p class="green">*  Champ soci&eacute;t&eacute; Incomplet / <i>Company completed</i></p>');	
			firstName = true;
		}		

		if (emailFrom && lastName && firstName)
		{
			$('#submit .button').unbind('click', returnFalse);
		}		
	});

	$('#txtCompany').blur(function(){
		if ($('#txtCompany').val() == '')
		{
			$('#alertCompany').append('<p class="red">* Champ nom requis / <i>Name requested</i></p>');	
			lastName = false;
		}
		else {
			$('#alertCompany').append('<p class="green">* Champ nom complet / <i>Name completed</i></p>');	
			lastName = true;
		}		

		if (emailFrom && lastName && firstName)
		{
			$('#submit .button').unbind('click', returnFalse);
		}	
	});

	var filter=/^.+@.+\..{2,3}$/;
	$('#txtEmailFrom').blur(function(){
		if ($('#txtEmailFrom').val() == '')
		{
			$('#alertEmailFrom').append('<p class="red">* Champ email requis / <i>Email requested</i></p>');	
			emailFrom = false;
		}
		else if (filter.test($('#txtEmailFrom').val())) {
			$('#alertEmailFrom').append('<p class="green">*  Champ email incomplet/ <i>Email completed</i></p>');	
			emailFrom = true;
		}
		else {
			$('#alertEmailFrom').append('<p class="orange">* Rentrer une adresse email valide svp / <i>Please enter a valid email address</i></p>');	
			emailFrom = false;
		}		
		
		if (emailFrom && lastName && firstName)
		{
			$('#submit .button').unbind('click', returnFalse);
		
		}	
	});


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

	$('#txtCompany').focus(function(){
		$('#alertCompany').empty();	
	});	
	
	$('#submit .button').click(function(){
	  if (emailFrom && lastName && firstName)
	  {
	 	$('#submit .button').unbind('click', returnFalse);
	  }
	 
	});	
				  

});

