$(document).ready(function(){

		
		/* ----------------- LINKS OUTLINE NONE IE ----------------- */
		$("a").focus(function() {
  			$(this).blur();
		});
		
		/*
		$('a[rel=external]').click(function(){
			window.open(this.href); 
			return false;
  		});
  		*/
  		
		$("a[href=#]").attr("href", "javascript:void(0);");
		
		$("a[href^='http:']:not([href*='" + window.location.host + "'])").each(function() {               
        	$(this).attr("target", "_blank");
    	});
		
		
		
		
		/*------------------ oter borderbottom sur last ---------------*/
		$(".borderbottom:last").css({background:"none"});


		
		
		
		/* ----------------- SLIDESHOW ----------------- */
	
		$('#body_maison .slideshow').cycle({
			fx:     'scrollLeft',  
			speed:   1600, 
			timeout: 4000
			//pause:   1
		}).cycle('pause');
		
		$('#body_maison .slideshow:first').cycle('resume');
		$('#body_maison .slideshow').click(function() {
			$('#body_maison .slideshow').cycle("pause");
    		$(this).cycle('resume');
		});
		/* ----------------- SLIDESHOW BY NEXT ----------------- */
		$('#body_catalogue #slideshow').cycle({ 
			fx:     'scrollLeft',
			speed:   1600, 
			timeout: 6000,
			next:   '#next', 
			timeout: 0 
		}).cycle('resume');
		/*$("#slideshow img:first").hide();
	
	
          $('#slideshow img:first').onImagesLoaded(function(_this){
			$(_this).fadeIn(1000);
		  });
			*/			

			$("#slideshow,.slideshow").preloader();

        /* ----------------- FORM SEARCH ------------------*/
        if(!$('input#search_terms').val()){
			$('input#search_terms').removeClass("full").addClass('empty');
		}else{
			$('input#search_terms').removeClass("empty").addClass('full');
		}
		$('input#search_terms').focus(function() {
			$(this).removeClass("empty").addClass("full");
			if (this.value == this.defaultValue){ 
				this.value = '';
			}
			if(this.value != this.defaultValue){
				this.select();
			}
		});
		$('input#search_terms').blur(function() {
			if(!$(this).val()){
				$(this).removeClass("full").addClass('empty');
			}
		});
		
		
		/* ----------------- CONTENT TOP MARGIN ------------------*/
		
		var titleheight = ($(".title").height()+5);
		var contentmtop = 40-(titleheight);
		if(titleheight){
			$(".titlefirst").css({marginTop:"-"+titleheight+"px"});
		}

		
		
		/* ----------------- NAV ACCORDION + achat ------------------*/
		
		$('#achat ul').hide();
		$('#achat li a').click(function(){
			$(this).next().slideToggle('on');
		});
		
		$('#nav').accordion({ 
			active: 'a.current',
			header: '.head', 
			navigation: true, 
			event: 'click', 
			//fillSpace: true, 
			animated: 'easeslide',
			collapsible: true,
			autoHeight: false
		});
		
		
		  
		var mytitle =  $(location).attr('href').match(/[^/]*$/i);
		//alert(mytitle);
            
		  $("#nav ul ul li").each(function () {
            var li = $(this);
            var a = li[0].firstChild;
            if (mytitle == $(a).attr("title")) {
                $(a).addClass("current");
            }
        });

            
            
		if($('.each_extraits p,.each_critiques p').length > 1){
			$(".each_extraits,.each_critiques").each(function() {
				$('.each_extraits p:last-child,.each_critiques p:last-child').css({marginTop:"1px"});
			});
		}

		$(".extraits p:contains('***')").css("margin-top", "4px");

		


});		  
