//verif form
var couleurAr = "#F7F4E0";
var couleurEr = "orange"
var nomInputEmail = '#email';
var nomform = "#formmail";
//mettre class="non" pour les inputs non obligatoires
var message = new Array("L'adresse mail n'est pas valide, merci de corriger", "Le champ Email est vide, merci de compléter.","Il manque certains renseignements, merci de compléter");
var err = false;


$(document).ready(function(){
/*Conditions générales
$("#sub1").attr("disabled", "disabled");
$("#check_condit").click(function(){
	if($("#check_condit").attr('checked') == true){
		$("#sub1").attr("disabled", false);
	}
	else{
		$("#sub1").attr("disabled", true);
	}
	
});*/




/*verif formulaire*/
	$(nomform).submit(function(){
	var err = false;
		$("input.ob").each(function(){//champs obligatoires
			if($(this).val() == ''){
				$(this).css({backgroundColor: couleurEr});
				err = true;
				}
			});	
		if(err == true){
		alert(message[2]);
			return false;
		}
	else { return true;}
	
	});
	
	$(nomform+" input[@type='text']").focus(function(){
		$(this).css({backgroundColor: couleurAr});
		});
	

	/*$("#modifier").click(function(){
		$("#verif").val('change');//pour eviter mise en bdd lors du retour
		$("#coordonnees2").attr("action","coordonnees.php");//retour vers formulaire de départ
				
	});
	*/
	$(nomInputEmail).blur(function(){// verif adresse email
		if (this.value != "")   { 
      		indexAroba = this.value.indexOf('@'); 
      		indexPoint = this.value.indexOf('.'); 
     			 if ((indexAroba < 0) || (indexPoint < 0)) { 
						this.style.backgroundColor = couleurEr; 
						alert (message[0]); 
      				} 
   			} 

		else   { //si champ vide
      		this.style.backgroundColor = couleurEr;
      		alert(message[1]); 
   		}
	});
//calcul 
/*
 $("#form_billets select").change(function(){
 	a = $("#vendredi").val()*19;
	b = $("#samedi").val()*22;
	c = $("#pass").val()*36;
 	$("#total_vendredi").html(a);
	$("#total_samedi").html(b);
	$("#total_pass").html(c);
	$("#total").html(a+b+c+1.2);//$("#total").html(parseInt ($("#total_vendredi"))+parseInt ($("#total_samedi"))+parseInt ($("#total_pass"))+parseFloat (1.20));
 });*/

	
	
});

