$(
	function () {
		$('.menu_header > ul > li').hover(
			function ()	{
				$(this)
					.addClass("active");
				
			}, function () {	
				$(this).removeClass("active");
			}
		);
		//message de confirmation de suppression
		$("a[alt=supprimer]").click(function(){
		return (confirm($('#messageremov').val()));
		});

		// panier.
		$('.shop_cart')
			.mouseover(
				function () {
					$('.content_login').hide();
					$('.login').removeClass('login_active');
					$(this).parent().parent().addClass('shop_cart_active')
					$('.content_shop').show();

					$('.newsletter_content .close').click();
				}
			)
			/*.mouseout(
				function () {
					$(this).parent().parent().removeClass('shop_cart_active');
					$('.content_shop').hide();
				}
			);*/
		
		$('.content_shop .close').click(
			function()
			{
				$('.content_shop').hide();
				$('.header').removeClass('shop_cart_active');
				
				return false;
			}
		);
		
		// login
		$('.se_connecter')
			.click(
				function () {
					$('.login').addClass('login_active');
					$('.content_shop').hide();
					$('.header').removeClass('shop_cart_active');
					$('.content_login').show();

					$('.newsletter_content .close').click();
				}
			)
			/*.mouseout(
				function () {
					$(this).removeClass('login_active');
					$('.content_login').hide();
				}
			);*/
		$('.content_login .close').click(
			function()
			{
				$('.content_login').hide();
				$('.login').removeClass('login_active');
				return false;
			}
		);
		
		$('.content_login').find('#lien_signin').click(
			function()
			{
				$('.content_login').find('#part_signin').hide();
				$('.content_login').find('#part_forget').show();
                $('#echec_auth').css("display","none");
                $('#erreur_oubliForm1').css('display','none');
                $('#erreur_oubliForm2').css('display','none');
			}
		);
		$('.content_login').find('#lien_forget').click(
			function()
			{
				$('.content_login').find('#part_signin').show();
				$('.content_login').find('#part_forget').hide();
                $('#echec_auth').css("display","none");
                $('#erreur_oubliForm1').css('display','none');
                $('#erreur_oubliForm2').css('display','none');
			}
		);
		
		// newsletter
		$('.footer .newsletter')
			.mouseover(
				function () {
					$(this).parent().parent().parent().addClass('open_newsletter');
					$('.newsletter_content').show();

					$('.content_login .close').click();
					$('.content_shop .close').click();
				}
			)
			/*.mouseout(
				function () {
					$(this).parent().parent().parent().removeClass('open_newsletter');
					$('.newsletter_content').hide();
				}
			);*/
		$('.newsletter_content .close').click(
			function()
			{
				$('.newsletter_content').hide();
				$('.footer').removeClass('open_newsletter');
				
				return false;
			}
		);

		// authentification
		$('#lien_bag_forget').click(
			function()
			{
				$('#part_bag_singin').hide();
				$('#part_bag_forget').show();
				$('#echec_bag_auth').css("display","none");
			}
		);
		$('#lien_bag_singin').click(
			function()
			{
				$('#part_bag_singin').show();
				$('#part_bag_forget').hide();
                $('#erreur_bag_oubliForm1').css('display','none');
				$('#erreur_bag_oubliForm2').css('display','none');
			}
		);
		
		$('.bloc_modify').find('span.right').find('a.edit').click(
			function()
			{
				$(this).hide();
				$(this).next().show();
				$(this).parent('span').find('.pop_modify').show();
				
			}
		);
		
		$('.bloc_modify').find('.pop_modify').find('a.close').click(
			function()
			{
				$(this).parent('div.pop_modify').hide();
				$(this).parent('div.pop_modify').parent('span.right').removeClass('right_active');
				var parent_el = $(this).parent('div.pop_modify').parent('span.right');
				$(parent_el).find('a.edit_active').hide();
				$(parent_el).find('a.edit').show();
			}
		);

		
		/*bloc langue*/
		$('.bloc_langue').find('h2').find('a').click(
			function()
			{
				$(this).parent('h2').parent('.bloc_langue').removeClass("bloc_langue_close");
			}
		);
		$('.bloc_langue').find('.inner_langue').find('a.close').click(
			function()
			{
				$(this).parent('.inner_langue').parent('.bloc_langue').addClass("bloc_langue_close");
			
			}
		);
		
		/*close div error*/
		$('.error_form').find('a.close').click(
			function()
			{
				$('.error_form').hide();
			}
		);

			/*logo apres action lightbox*/
		$('.fiche_produit_left').find('p.galery').find('a').click(
			function()
			{
				$('.header').find('.logo_top').addClass('logo_hide');
			}
		);
			/*logo remise en Etat*/
		$('#big_produit').find('a.close_pop').click(
			function()
			{
				$('.header').find('.logo_top').removeClass('logo_hide');
			}
		);

		
	}
)
/*fonction call for error*/
function error_action(param)
	{
		//get effect type from 
		var selectedEffect = 'highlight';
		
		//most effect types need no options passed by default
		var options = {};
		
		//run the effect
		$('#'+param).effect(selectedEffect,options,500);
		
	}

function closeError(){
	$('.error_form').hide();
}
