


////// newsletter 

function newsletter_send() {

      var email=$("#input_news").val();
	  var test=true;
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  jAlert('Veuillez v&eacute;rifier votre adresse email. Merci.');
			  test=false;
	        }
	   }
	   else
	   {
		   if(email=='')
		   {
			  jAlert('Veuillez saisir votre adresse email. Merci.');
			  test=false;
		   }
	   }
	  if(test)
	  {
		  $.ajax({
						  type: "POST",
						  url: "Actionscript.php",
						  data: "input=news&"+"email="+email,
						  beforeSend : function(){
							
						  },
						  success: function(rep){
				 			jAlert('Votre demande de newsletter est enregistr&eacute;. Merci.');
							  $("#text_news").val("");
						  }
	
						});
	  }
}

///// login
function login() {


		  do_work('POST','Actionscript.php','#logmail|#logpws','.login','<div class=\'msg\'></div>');
	  }
///// loginen
function loginen() {


		  do_work('POST','Actionscript_en.php','#logmail|#logpws','.login','<div class=\'msg\'></div>');
	  
}

function login1() {

      var email=$("#logmail1").val();
	  var mp=$("#logpws1").val();
	  var test=true;
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  jAlert('Veuillez v&eacute;rifier votre adresse email, Merci.');
			  test=false;
	        }
	   }
	   else
	   {
		   if(email==''||mp=='')
		   {
			  jAlert('Veuillez saisir vos Coordonn&eacutees, Merci.');
			  test=false;
		   }
	   }
	  if(test)
	  {
		  do_work('POST','Actionscript1.php','#logmail1|#logpws1','.right_side','<div class=\'msg\'>Connexion en cours ....</div>');
	  }
}

function login1_en() {

      var email=$("#logmail1").val();
	  var mp=$("#logpws1").val();
	  var test=true;
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  jAlert('Please check your email, Thanks.');
			  test=false;
	        }
	   }
	   else
	   {
		   if(email==''||mp=='')
		   {
			  jAlert('Please enter your contact, thanks.');
			  test=false;
		   }
	   }
	  if(test)
	  {
		  do_work('POST','Actionscript1_en.php','#logmail1|#logpws1','.right_side','<div class=\'msg\'></div>');
	  }
}
//// logout
function logout(){
	
	get_Page('POST','Actionscript.php','doLogout=true','.login','<div class=\'msg\'>Traitement en cours ....</div>');
	Go_Home();
}
///// affiche information compte
function Mycompte(){
	   recharge('modif_compte.php','.Z_affiche');
}
////// creation compte
function newcompte(){
	$('.slider').hide("slow");
	$('.C_menu').hide("slow");
	   get_Page('POST','content.php','cat=inscription','.Z_affiche','<div class=\'msg\'>Traitement en cours ....</div>');
	   updateStyle()
}
////// inscription client
function inscription()
{
	 var test=true;
	 var msg ="";
	 var email=$("#Email").val();
	 
		if($("#nom").val()=='')
		{ 
			msg += "Veuillez saisir votre nom <br />";
			test=false;
		}
		
		if($("#prenom").val()=='')
		{ 
			msg += "Veuillez saisir votre pr&eacute;nom <br />";
			test=false;
		}
		
		
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  msg +='Veuillez v&eacute;rifier votre adresse email. Merci.\n';
			  test=false;
	        }
	   }
	   else
	   {
		   if(email=='')
		   {
			  msg +='Veuillez saisir votre adresse email. Merci.\n';
			  test=false;
		   }
	   }
	   
	   if($("#tel").val()=='')
		{ 
		msg += "Veuillez saisir votre N&deg; t&eacute;l&eacute;phone <br />";
		test=false;
		}
		
		var pass2=$("#pass").val();
		var pass=$("#pass2").val();
		
		if(pass2.value!=pass.value || pass.value=="" || pass2.value=="")
		{ 
			msg += "Veuillez v&eacute;rifier votre mot de passe  <br />";
			test=false;
		}
				
		if($("#cp").val()=='')
		{ 
			msg += "Veuillez saisir votre code postal <br />";
			test=false;
		}
				
		if($("#adresse").val()=='')
		{ 
			msg += "Veuillez saisir votre adresse <br />";
			test=false;
		}
		
		$.ajax({
          type: "POST",
          url: "verif_email.php",
          data: 'email='+Email.value,
          success: function(rep){
		
			  if(rep=="existe")
			   { 
			        msg+= "Cette adresse email existe d&eacute;ja !! <br />";
					test=false;
		
				}
 
          }

        });
	 if(test)
	 {
	 do_work('POST','Actionscript.php','#societe|#nom|#prenom|#cp|#adresse|#pays|#tel|#Email|#pass|#inscriptionform','.Z_affiche','<div class=\'msg\'>Traitement en cours ....</div>');
	 }else{ jAlert(msg);}
}

////// update compte client

function update_compte()
{
	 var test=true;
	 var msg ="";
	 var email=$("#Email").val();
	 var CEmail=$("#CEmail").val();
	 
		if($("#nom").val()=='')
		{ 
			msg += "Veuillez saisir votre nom <br />";
			test=false;
		}
		
		if($("#prenom").val()=='')
		{ 
			msg += "Veuillez saisir votre pr&eacute;nom <br />";
			test=false;
		}
		
		
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  msg +='Veuillez v&eacute;rifier votre adresse email. Merci.\n';
			  test=false;
	        }
	   }
	   else
	   {
		   if(email=='')
		   {
			  msg +='Veuillez saisir votre adresse email. Merci.\n';
			  test=false;
		   }
	   }
	   
	   if($("#tel").val()=='')
		{ 
		msg += "Veuillez saisir votre N&deg; t&eacute;l&eacute;phone <br />";
		test=false;
		}
		
		var pass2=$("#pass").val();
		var pass=$("#pass2").val();
		
		if(pass2.value!=pass.value || pass.value=="" || pass2.value=="")
		{ 
			msg += "Veuillez v&eacute;rifier votre mot de passe  <br />";
			test=false;
		}
				
		if($("#cp").val()=='')
		{ 
			msg += "Veuillez saisir votre code postal <br />";
			test=false;
		}
				
		if($("#adresse").val()=='')
		{ 
			msg += "Veuillez saisir votre adresse <br />";
			test=false;
		}
		
		$.ajax({
          type: "POST",
          url: "verif_email.php",
          data: 'email='+Email.value+"&action="+CEmail,
          success: function(rep){
		
			  if(rep=="existe")
			   { 
			        msg+= "Cette adresse email existe d&eacute;ja !! <br />";
					test=false;
		
				}
 
          }

        });
	 if(test)
	 {
	 do_work('POST','modif_compte.php','#societe|#nom|#prenom|#cp|#adresse|#pays|#tel|#Email|#pass|#MM_insert|#CEmail|#Cpass','.Z_affiche','<div class=\'msg\'>Traitement en cours ....</div>');
	 }else{ jAlert(msg);}
}

////// contact 

function save_contact()
{
	 var test=true;
	 var msg ="";
	 var email=$("#Email").val();
	 
		if($("#nom").val()=='')
		{ 
			msg += "Veuillez saisir votre nom <br />";
			test=false;
		}
		
		if($("#prenom").val()=='')
		{ 
			msg += "Veuillez saisir votre pr&eacute;nom <br />";
			test=false;
		}
		
		
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  msg +='Veuillez v&eacute;rifier votre adresse email. Merci.\n';
			  test=false;
	        }
	   }
	   else
	   {
		   if(email=='')
		   {
			  msg +='Veuillez saisir votre adresse email. Merci.\n';
			  test=false;
		   }
	   }
	   
			
		if($("#objet").val()=='')
		{ 
			msg += "Veuillez saisir le sujet du message  <br />";
			test=false;
		}
		
		if($("#demande").val()=='')
		{ 
			msg += "Veuillez saisir votre demande <br />";
			test=false;
		}
		
	 if(test)
	 {
	 do_work_page('POST','Actionscript.php','#nom|#prenom|#Email|#societe|#demande|#contact','.droit');
	 }else{ jAlert(msg);}
}

function testApp()
{
	 var test=true;
	 var msg ="";
	 var email=$("#Email").val();
	 
		if($("#nom").val()=='')
		{ 
			msg += "Veuillez saisir votre nom <br />";
			test=false;
		}
		
		if($("#prenom").val()=='')
		{ 
			msg += "Veuillez saisir votre pr&eacute;nom <br />";
			test=false;
		}
		
		
	  if(email!='')
	   {
		    indexAroba = email.indexOf('@');
		   indexPoint = email.indexOf('.');
		    if ((indexAroba < 0) || (indexPoint < 0)){
			  msg +='Veuillez v&eacute;rifier votre adresse email. Merci.\n';
			  test=false;
	        }
	   }
	   else
	   {
		   if(email=='')
		   {
			  msg +='Veuillez saisir votre adresse email. Merci.\n';
			  test=false;
		   }
	   }
	   
				
	 if(test)
	 {
	 do_work_page('POST','Actionscript.php','#nom|#prenom|#Email|#societe|#page|#tel|#pays','.Z_affiche','<div class=\'msg\'>Traitement en cours ....</div>');
	 }else{ jAlert(msg);}
}

function updateMeta(description,keyword,title){
	$("meta[name=description]").attr("content",description);
	$("meta[name=keywords]").attr("content",keyword);
	$("title").html(title);
}
function cat() {
	
     var email=$("#sous").val();
		 do_work('POST','Actionscript.php','#sous','.st1','<div class=\'msg\'>Traitement en cours ....</div>');
		
	   
}
