/*
 *
 *	@titre: newsletter.
 *	@description: javascript newsletter - Le Veau.
 *	@auteur: neov - http://www.neov.net.
 *	@creation: 20090511.
 *	@modification: -.
 *
*/

$(
  	function()
	{
		//$('#btn-proposer').click();
		//var testAffichage  = $('#btn-proposer').attr("name");

		// proposez recette.
		$('#btn-proposer').click(
			function()
			{
				$(this).css({visibility: 'hidden'});
				$('.proposer-recette form').slideDown();

				$('#news-ok').parents('form').find('.min').show();
				$('#news-ok').parents('form').find('.max').hide();

				$('.news-inscription .intro').show();
				$('.news-inscription .intro2').hide();
				
				return false;
			}
		);
		
		// inscription newsletter.
		$('#news-ok').click(
			function()
			{
				$(this).parents('form').find('.min').hide();
				$(this).parents('form').find('.max').slideDown();
				var mail = $('#news-mail').val();
				var mailSearch  = $('#news-info-mail').val();

				if (mailSearch == "" )
				{
					$('#news-info-mail').val(mail);
				}
				
				
				$('.proposer-recette form').hide();
				$('#btn-proposer').css({visibility: 'visible'});
				$('.news-inscription .intro').hide();
				$('.news-inscription .intro2').show();
				
				return false;
			}
		);

		// affiche automatiquement la fiche proposer recette
		var iAffiche = $('#btn-proposer').attr('name');
		if (iAffiche == 1)
		{
			$('#btn-proposer').click();
		}

		var iAffiche = $('#news-mail').attr('name');
		if (iAffiche == 1)
		{
			$('#news-ok').click();
		}
		
	}
);

