var typePub = 0;
function tb_add(form) {
var nom = $("input#nom").val();
var prenom = $("input#prenom").val();
var adresse = $("input#adr_send").val();
var nbr_present = $("input#adr_receive").val();

var dataString = 'nom='+ nom + '&prenom=' + prenom + '&adr_send=' + adresse+ '&adr_receive=' + nbr_present;

$('#message').html("Abonnement en cours").append("...<img src='img/mini-ajax-loader.gif'/>").hide().fadeIn(1000, function() {});

$.ajax({
   type: "GET",
   url: "send_ami.php",
   data: dataString,
   success: function(msg){
     if(msg == 1)
     {
		$('#message').html("<h2>La personne est inscrite</h2>")
		     .append("<p>Elle recevera un mail...</p>")
		     .hide()
		     .fadeIn(1500, function() {
		       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
		       //clearForm(form);

		     });
     }
     else if(msg == 2)
     {
		$('#message').html("<h2>Votre ami est déja inscrit</h2>")
		     .append("<p>Ne soyez pas triste...</p>")
		     .hide()
		     .fadeIn(1500, function() {
		       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
		       //clearForm(form);

		     });
     }
     else if(msg == 4)
     {
		$('#message').html("<br/><br/><p>Le formulaire doit etre bien renseigné<p>")
		     .append("...")
		     .hide()
		     .fadeIn(1500, function() {
		       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
		       //clearForm(form);

		     });
     }

     else if(msg == 5)
     {
		$('#message').html("<br/><br/><p>La personne que vous souhaitez inscrire ne souhaite pas recevoir la lettre Zaleo<p>")
		     .append("...Contactez nous pour plus d&rsquo;information.")
		     .hide()
		     .fadeIn(1500, function() {
		       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
		       //clearForm(form);

		     });
     }
     else if(msg == 6)
     {
		$('#message').html("<br/><br/><p>Envois de mail impossible<p>")
		     .append("....")
		     .hide()
		     .fadeIn(1500, function() {
		       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
		       //clearForm(form);

		     });
     }
	else
	     {
			$('#message').html("<h2>Un probleme est survenue</h2>")
			     .append("<p>vous pouvez recommencer...</p>")
			     .hide()
			     .fadeIn(1500, function() {
			       //$('#message').append(nom + " " + prenom + "<br>" + adresse + "<br>" + nbr_present);
			       //clearForm(form);

			     });
	     }
   }
 });
	return false;
}

function afficheMessage (Titre, txt){

}
      function clearForm(form) {

        // iterate over all of the inputs for the form

        // element that was passed in

        $(':input', form).each(function() {

          var type = this.type;

          var tag = this.tagName.toLowerCase(); // normalize case

          // it's ok to reset the value attr of text inputs,

          // password inputs, and textareas

          if (type == 'text' || type == 'password' || tag == 'textarea')

            this.value = "";

          // checkboxes and radios need to have their checked state cleared

          // but should *not* have their 'value' changed

          else if (type == 'checkbox' || type == 'radio')

            this.checked = false;

          // select elements need to have their 'selectedIndex' property set to -1

          // (this works for both single and multiple select elements)

          else if (tag == 'select')

            this.selectedIndex = -1;

        });

      };



