var chValid=true;
function validChange(obj){
var ErrorMsg=""; var Msg="";
if(isEmpty($("#Nature"))){ Notif();ErrorMsg+="La nature du paiement est obligatoire\n";};
if(isEmpty($("#Montant"))){ Notif();ErrorMsg+="Le montant est obligatoire\n";};
if(isEmpty($("#Montant"))){ Notif();ErrorMsg+="Le montant est obligatoire\n";};
	if(!vAmount($("#Montant")) || (!isZero($("#Montant")))){ Notif();ErrorMsg+="Le montant doit être une valeur supérieure à zéro au format 0.00\n"; } ;
	if(isEmpty( $("#Ref"))){Notif();ErrorMsg+="La référence est obligatoire\n";} ;
	if(isEmpty($("#Nom"))) {Notif();ErrorMsg+="Le nom est obligatoire\n";}	;
	if(isEmpty($("#Prenom"))) {Notif();ErrorMsg+="Le prénom est obligatoire\n"};
	if(isEmpty($("#Ville"))) {Notif();ErrorMsg+="La ville est obligatoire\n";}	;
	if(isEmpty($("#Email"))) {Notif();ErrorMsg+="L'email est obligatoire\n"};
	if(!vEmail($("#Email"))){Notif();ErrorMsg+="L'email doit être valide\n";}
	if(isEmpty($("#conf_Email"))) {Notif();Msg="L'email de confirmation doit correspondre à l'email\n"; ErrorMsg+=Msg;}	;
	if(!vEmail($("#conf_Email"))){Notif();if(Msg=="")ErrorMsg+="L'email de confirmation doit être valide\n";}
	if( $("#Email").val() != $("#conf_Email").val() ) {Notif();ErrorMsg+="L'email de confirmation doit correspondre à l'email\n";}
	if(chValid){
		obj.method="post";
		obj.action="formulaire-effectuer-paiement-online-step2.php";
		//obj.submit();
	}
	if(ErrorMsg!="") alert(ErrorMsg);
	return chValid;
}

function isEmpty(obj){
	var myval = $.trim(obj.val());
		if((myval.length==0) || (myval==null)){
			return true;
		}else{
			return false;
		}
	
}

function vAmount(obj){
	var bSigned = false;
	var re = new RegExp("^"+((bSigned)?"[\\-\\+]?":"")+"\\d+(.\\d{2})?$");
	return re.test(obj.val());
}

function vEmail(obj){
  return ((/^[a-zA-ZüöäßÄÖÜ]+([\.-]?[a-zA-ZüöäßÄÖÜ]+)*@[a-zA-ZüöäßÄÖÜ]+([\.-]?[a-zA-ZüöäßÄÖÜ]+)*(\.\w{2,5})+$/).test(obj.val()));
}
function isZero(obj){
	return (obj.val() > 0);
}
function DeNotif(obj){
	chValid=true;
//	$(obj).removeClass('required');
}
function Notif(obj){
	try{
	//console.log(obj);
	chValid=false;
//	$(obj).removeClass('required');
//	$(obj).addClass('required');
	
	}catch(e){ alert(e); }
}
