/***********************************************************/
function Controlnumber(evt) {
var keyCode = evt.which ? evt.which : evt.keyCode;	
//alert("keycoe = " + keyCode);
	var interdit = '0123456789';
	if(keyCode==39 || keyCode==37 || keyCode==9 || keyCode==8 || keyCode==46){
		return true;
	}
	if ((interdit.indexOf(String.fromCharCode(keyCode)) <= -1))
	{
	 return false;
	}
}

//************************* Champ remplir ******************//
function validate_field(field,alerttxt){
if(field.value == ""){
alert(alerttxt); 
   return false; 
	 }
else { return true;}
}

//****************** validation email ***********************//
function validate_email(field,alerttxt)
{
	with (field)
	{
	  var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	  if(reg.test(value) == false) {
		alert(alerttxt);
		return false;
	 }
	 else {return true;}
	}
}

//**************************************************//
function validate_cnt(thisform){	
with(thisform) {	 
if (validate_field(nom,"Veuillez saisir votre nom")==false)
  {nom.focus();return false;}
if (validate_field(prenom,"Veuillez saisir votre prenom ")==false)
  {prenom.focus();return false;}
if (validate_field(pays,"Veuillez saisir votre pays ")==false)
  {pays.focus();return false;}
if (validate_field(tel,"Veuillez saisir votre telephone")==false)
  {tel.focus();return false;}
if (validate_field(email,"Veuillez verifier saisir votre email !")==false)
  {email.focus();return false;} 
if (validate_email(email,"Veuillez verifier la saisie de votre email !")==false)
  {email.focus();return false;} 
if (validate_field(message,"Veuillez verifier la saisie de votre demande !")==false)
  {message.focus();return false;} 
}
}
//**************************************************//
function validate_cnt2(thisform){	
with(thisform) {	 
if (validate_field(nom,"Please enter your name")==false)
  {nom.focus();return false;}
if (validate_field(prenom,"Please enter your first name ")==false)
  {prenom.focus();return false;}
if (validate_field(pays,"Please enter your country ")==false)
  {pays.focus();return false;}
if (validate_field(tel,"Please enter your phone")==false)
  {tel.focus();return false;}
if (validate_field(email,"Please enter your email check")==false)
  {email.focus();return false;} 
if (validate_email(email,"Please check your email entry ")==false)
  {email.focus();return false;} 
if (validate_field(message,"Please check your entry message !")==false)
  {message.focus();return false;} 
}
}
//**************************************************//
function validate_cnt3(thisform){	
with(thisform) {	 
if (validate_field(nom,"Por favor ingrese su nombre")==false)
  {nom.focus();return false;}
if (validate_field(prenom,"Por favor ingrese su nombre de pila ")==false)
  {prenom.focus();return false;}
if (validate_field(pays,"Por favor, introduzca su país ")==false)
  {pays.focus();return false;}
if (validate_field(tel,"Por favor, introduzca su teléfono")==false)
  {tel.focus();return false;}
if (validate_field(email,"Por favor, introduzca su cheque por correo electrónico")==false)
  {email.focus();return false;} 
if (validate_email(email,"Por favor, inténtelo de nuevo correo electrónico")==false)
  {email.focus();return false;} 
if (validate_field(message,"Por favor, consulte para escribir el mensaje !")==false)
  {message.focus();return false;} 
}
}

//**************************************************//
function validate_reservation(thisform){	
with(thisform) {	 
if (validate_field(nom,"Veuillez saisir votre nom")==false)
  {nom.focus();return false;}
if (validate_field(age,"Veuillez saisir votre age")==false)
  {age.focus();return false;}
if (validate_field(email,"Por favor, introduzca su cheque por correo electrónico")==false)
  {email.focus();return false;} 
if (validate_email(email,"Por favor, inténtelo de nuevo correo electrónico")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Veuillez saisir votre telephone")==false)
  {tel.focus();return false;}  
}
}
//**************************************************//
function validate_reservation2(thisform){	
with(thisform) {	 
if (validate_field(nom,"Veuillez saisir votre nom")==false)
  {nom.focus();return false;}
if (validate_field(age,"Veuillez saisir votre age")==false)
  {age.focus();return false;}
if (validate_field(email,"Veuillez verifier saisir votre email !")==false)
  {email.focus();return false;} 
if (validate_email(email,"Veuillez verifier la saisie de votre email !")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Veuillez saisir votre telephone")==false)
  {tel.focus();return false;}  
if (validate_field(chercher,"Veuillez choisir une vehicule")==false)
  {chercher.focus();return false;}  
if (validate_field(datedepart,"Veuillez saisir la date de livraison")==false)
  {datedepart.focus();return false;}  
if (validate_field(ville1,"Veuillez saisir la ville de livraison")==false)
  {ville1.focus();return false;}  
if (validate_field(dateretour,"Veuillez saisir la date de recuperation")==false)
  {dateretour.focus();return false;}  
if (validate_field(ville2,"Veuillez saisir la ville de recuperation")==false)
  {ville2.focus();return false;}  
}
}
//**************************************************//
function validate_reservation3(thisform){	
with(thisform) {	 
if (validate_field(nom,"Por favor ingrese su nombre")==false)
  {nom.focus();return false;}
if (validate_field(age,"Por favor, introduzca su edad")==false)
  {age.focus();return false;}
if (validate_field(email,"Por favor, introduzca su cheque por correo electrónico")==false)
  {email.focus();return false;} 
if (validate_email(email,"Por favor, inténtelo de nuevo correo electrónico")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Por favor, introduzca su teléfono ")==false)
  {tel.focus();return false;}  
if (validate_field(datedepart,"Veuillez saisir la date de livraison")==false)
  {datedepart.focus();return false;}  
if (validate_field(ville1,"Veuillez saisir la ville de livraison")==false)
  {ville1.focus();return false;}  
if (validate_field(dateretour,"Veuillez saisir la date de recuperation")==false)
  {dateretour.focus();return false;}  
if (validate_field(ville2,"Veuillez saisir la ville de recuperation")==false)
  {ville2.focus();return false;}  
}
}
//**************************************************//
function validate_reservation_3(thisform){	
with(thisform) {	 
if (validate_field(nom,"Por favor ingrese su nombre")==false)
  {nom.focus();return false;}
if (validate_field(age,"Por favor, introduzca su edad")==false)
  {age.focus();return false;}
if (validate_field(email,"Por favor, introduzca su cheque por correo electrónico")==false)
  {email.focus();return false;} 
if (validate_email(email,"Por favor, inténtelo de nuevo correo electrónico")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Por favor, introduzca su teléfono ")==false)
  {tel.focus();return false;}  
}
}
//**************************************************//
function validate_reservation_1(thisform){	
with(thisform) {	 
if (validate_field(nom,"Please enter your name")==false)
  {nom.focus();return false;}
if (validate_field(age,"Please enter your age")==false)
  {age.focus();return false;}
if (validate_field(email,"Please enter your email check")==false)
  {email.focus();return false;} 
if (validate_email(email,"Please check your email entry ")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Please enter your phone")==false)
  {tel.focus();return false;}  
}
}
//**************************************************//
function validate_reservation_2(thisform){	
with(thisform) {	 
if (validate_field(nom,"Please enter your name")==false)
  {nom.focus();return false;}
if (validate_field(age,"Please enter your age")==false)
  {age.focus();return false;}
if (validate_field(email,"Please enter your email check")==false)
  {email.focus();return false;} 
if (validate_email(email,"Please check your email entry ")==false)
  {email.focus();return false;} 
if (validate_field(tel,"Please enter your phone")==false)
  {tel.focus();return false;}  
}
}
/*************************************************************************
                          Vider news
**************************************************************************/			
function vidernews() {
	$("#email").val('');
}
/*************************************************************************
                           Ajouter newsletters
**************************************************************************/			
function addnews() {
       var email=$("#email");
		$.ajax({
			type: "POST",
			data: "email_user="+encodeURIComponent($("#email").attr("value")),
			url: "ajouter-news.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Merci pour votre inscription');
				}
				if(data==2) {
				  alert('Merci Vous etes deja inscrit');	
				}
			}
		});
  }
/*************************************************************************
                           Ajouter newsletters 2
**************************************************************************/			
function addnews2() {
	  var email=$("#email"), pass=$("#pass_acces");
		$.ajax({
			type: "POST",
			data: "email_user="+encodeURIComponent($("#email").attr("value")),
			url: "ajouter-news.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Thank you for your registration');
				}
				if(data==2) {
				  alert('Thank you you are already registered');	
				}
			}
		});
  }
/*************************************************************************
                           Ajouter newsletters 3
**************************************************************************/			
function addnews3() {
	  var email=$("#email"), pass=$("#pass_acces");
		$.ajax({
			type: "POST",
			data: "email_user="+encodeURIComponent($("#email").attr("value")),
			url: "ajouter-news.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Gracias por su registro');
				}
				if(data==2) {
				  alert('Gracias ya está registrado');	
				}
			}
		});
  }
/*************************************************************************
                          Vider tel
**************************************************************************/			
function vidertel() {
	$("#tel_user").val('');
}
/*************************************************************************
                           Ajouter Tel
**************************************************************************/			
function addtel() {	
		$.ajax({
			type: "POST",
			data: "tel="+encodeURIComponent($("#tel_user").attr("value")),
			url: "envoi-num.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Merci pour votre inscription');
				}
			}
		});
  }
/*************************************************************************
                           Ajouter Tel
**************************************************************************/			
function addtel2() {	
		$.ajax({
			type: "POST",
			data: "tel="+encodeURIComponent($("#tel_user").attr("value")),
			url: "envoi-num.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Thank you for your registration');
				}
			}
		});
  }
/*************************************************************************
                           Ajouter Tel
**************************************************************************/			
function addtel3() {	
		$.ajax({
			type: "POST",
			data: "tel="+encodeURIComponent($("#tel_user").attr("value")),
			url: "envoi-num.php",
			beforeSend: function(){
				//document.getElementById('btnaddservice').src='../images/ajax-loader.gif';
			},
			success: function(data){
				if(data==1) {
				  alert('Gracias por su registro');
				}
			}
		});
  }

