jQuery(document).ready(function() {
	var carousel = $("#banniere").featureCarousel({
				"trackerSummation": false,
				"trackerIndividual": false,
				"largeFeatureHeight": 260,
				"largeFeatureWidth": 560,
				"smallFeatureHeight": 220,
				"containerWidth": 570,
				"containerHeight": 270,
				"autoPlay": 0,
				"smallFeatureOffset": 20,
				"sidePadding": 30
			});

	$("#caroussel-fleche-gauche, #caroussel-fleche-droite").hover(function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); });
	$("#caroussel-fleche-droite").click(function () {
          carousel.next();
        });
	$("#caroussel-fleche-gauche").click(function () {
          carousel.prev();
        });

	$('#newsletter input[name="newsletter_name"]')
		.focus(function() {
			$(this)
				.addClass('active')
				.removeClass('inactive')
				.val("");

		})
		.blur(function() {
			$(this)
				.addClass('inactive')
				.removeClass('active');
			if ($(this).val() == "")
			{
				$(this).val("votre e-mail");
			}
		});

	$('#newsletter button').click(function() {
		if (($('#newsletter input[name="newsletter_name"]').val() != "") && ($('#newsletter input[name="newsletter_name"]').val() != "votre e-mail"))
		{
			$.post(
				"ajax/newsletter.ajax.php",
				{
						action: "add_mail",
						mail: $('#newsletter input[name="newsletter_name"]').val()
				},
				function(data)
				{
					$('#newsletter_retour')
							.html(data)
							.fadeIn("slow", function() {
								delay(function() {
									$('#newsletter_retour').fadeOut("slow")
								}, 4000);
							});
				}
			);
		}
	});
});
