// JavaScript Document
$(document).ready(function(){
	// ENVOYER A UN AMI
	$("#envoiamiForm").show();
	$(".envoiamiBouton").click(function(){
			$("#envoiamiForm").toggle("slow");
	});
 	$("#envoiamiForm").corner("dog tr 20px");

	$("#envoiami_formulaire").submit(function(){
		if ($("#dest01").val()=='' && $("#dest02").val()=='' && $("#dest03").val()=='' && $("#dest04").val()=='') {
			$("#error_general").html("You have to fill at least one email address");
			return false;}
		
		if ($("#dest01").val() !='' && $("#dest01").val() !=$("#dest01").val().match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			$("#error_dest01").html("Invalid email address.");
			return false;}
		
		if ($("#dest02").val() !='' && $("#dest02").val() !=$("#dest02").val().match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			$("#error_dest02").html("Invalid email address.");
			return false;}
		
		if ($("#dest03").val() !='' && $("#dest03").val() !=$("#dest03").val().match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			$("#error_dest03").html("Invalid email address.");
			return false;}
		
		if ($("#dest04").val() !='' && $("#dest04").val() !=$("#dest04").val().match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			$("#error_dest04").html("Invalid email address.");
			return false;}

		if ($("#exped").val() =='') {
			$("#error_exped").html("This field is mandatory.");
			return false;}

		if ($("#exped").val() !='' && $("#exped").val() !=$("#exped").val().match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) {
			$("#error_exped").html("Invalid email address.");
			return false;}

		if ($("#exped_nom").val() =='') {
			$("#error_exped_nom").html("This field is mandatory.");
			return false;}

		
		if ($("#envoiamiCode").val() =='') {
			$("#code_error").html("You must fill CODE field");
			return false;}
		return true; 
	
	});

});



 

