jQuery(function() {
	// Gestion de l'animation sur la page d'accueil.
	var animation = false;
	
	jQuery('.img_slide:last').width(380);
	
	jQuery('.img_slide').hover(
		function () {
			if(jQuery(this).width() == 10 && !animation)
			{
				animation = true;
			
				jQuery('.img_slide').animate({width: '10px'});
				jQuery(this).animate({width: '380px'}, 400, function() {
					animation = false;
				});
			}
		}, 
		function () {

		}
	);
	
	// Gestion du message d'informations.
	if (jQuery('#msg_slide').size() > 0)
	{
		jQuery('<div>', { html: jQuery('#msg_slide').detach().html() }).slide();
	}
	
	// Pop-up pour s'inscrire ŕ la newsletter.
	jQuery('#subscribe').live('click', function() {
		jQuery.ajax({
			type: 'GET',
			url: 'ajax/recup_form_newsletter.php',
			success: function(data) {
				jQuery('<div>', { html: data }).slide({
					skip_loader: true
				});
			},
			error: function(request) {
				alert(request.responseText);
			}
		});
	});
	
	// On change le code de vérification.
	jQuery('#change_code').live('click', function() {
		jQuery.ajax({
			type: 'GET',
			url: 'ajax/recup_code.php',
			success: function(data) {
				jQuery('#code').attr('src', 'authcode.php?auth=' + data);
				jQuery('#auth').attr('value', data);
			},
			error: function(request) {
				alert(request.responseText);
			}
		});
	});
});
