
	/*SLIDESHOW
	=================================*/

	jQuery( function()
	{

		$(".extlink").attr("target", "_blank");

		var p = 1;
		var max_p = $(".slide").length;
		var time = 4000;


		// Part avec l'animation automatique
		var playslideshow = true;
		showNextSlide();

		//Fonction qui passe à la prochaine slide automatiquement
		function showNextSlide ()
		{
			setTimeout
			(
				function ()
				{
					if(playslideshow == true)
					{
						p++;

						if(p > max_p)
						{
							p = 1;
						}

						//Animate the slide
						animateSlide();

						showNextSlide();
					}

				}, time
			);
		}

		//Fonction qui anime le slideshow et donne au bouton courant une classe current
		function animateSlide ()
		{
			$(".slide").fadeOut(750);
			$("#slide_" + p).fadeIn(750);
		}


		/*FORM VALIDATION
		=================================*/

		$('#cf_field_10').attr("checked", "checked");

		$("#cf_field_3").click
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_4").click
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_5").click
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);




		$("#cf_field_3").change
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_4").change
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_5").change
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);




		$("#cf_field_3").keyup
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_4").keyup
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);

		$("#cf_field_5").keyup
		(
			function ()
			{
				populate_hidden($(this).val());
			}
		);


		function populate_hidden(value)
		{
			$("#cf_field_9").val(value);
		}

		$(".success").html("Merci, votre demande est envoyée.");


	});
