$(document).ready(function(){

	$('#slider') 
	.after('<div id="navSlider"></div>') 
	.cycle({ 
		fx:     'scrollHorz', 
		speed:  'fast', 
		timeout: 6000, 
		pager:  '#navSlider' 
	});
	
	$('.logo img').hover(function(){
		$(this).attr('src', 'images/logoHover.png');
		}, function() {
		$(this).attr('src', 'images/logo.png');
	});
	
	if ((document.width>=768)) {
	$('.produit').hover(function(){
		$(this).children('.prodHover').fadeIn();
		}, function() {
		$(this).children('.prodHover').fadeOut();
	});
	}
	
	$("#contact").submit( function() {							 
		$.ajax({
		   type: "post",
		   url: "mail.php",
		   data: "nom="+$("#nom").val()+"&prenom="+$("#prenom").val()+"&email="+$("#email").val()+"&telephone="+$("#telephone").val()+"&objet="+$("#objet").val()+"&message="+$("#message").val(),
		   success: function(msg){
				if(msg=='vide') // si la connexion en php a fonctionn?e
					{
						$(".erreur").html("Un des champs du formulaire est vide veuillez r&eacute;essayer.");
						$(document).scrollTop(0);
					}
				else if(msg=='mail')
					{
						$(".erreur").html("Votre email n\'est pas valide, merci de le corriger dans un format de ce type : nom@domaine.com");
						$(document).scrollTop(0);
					}
				else if(msg=='yes')
					{
						$(".erreur").html("Votre message nous &agrave; bien &eacute;t&eacute; envoy&eacute;, merci.");
						$("#contact input[type=\"submit\"]").hide();
						$(document).scrollTop(0);
					}
		   }
		});
		return false;
	});
	
});

