	 
$(document).ready(function(){
	 
      
      
     $("#menu-footer li:not(:last-child)").append("<span>|</span>");
     
       $(".en-comment-form #country").html("Country *");      
     
     /* SLIDER PRINCIPAL*/
 
//Set the opacity of all images to 0
	$('#slideshow img').css({opacity: 0.0});		
	//Get the first image and display it
	$('#slideshow img:first').fadeTo("slow", 1.0); 	
	//Set Start Interval
	sliderIntervalID = setInterval(slideshow,3000); 
	//Mouse events
	$('#slideshow li').hover(function() {
		clearInterval(sliderIntervalID);
		hovergal($(this).attr('rel'), $(this)); 
	}, function() {
		sliderIntervalID = setInterval(slideshow,3000);
	});
      
    /*SLISHOW SINGLE APPART*/
    
    //Set the opacity of all images to 0
	$('#slideshow2 #slides-container img').css({opacity: 0.0});		
	//Get the first image and display it
	$('#slideshow2 #slides-container img:first').fadeTo("slow", 1.0); 	
	//Set Start Interval
	sliderIntervalID2 = setInterval(slideshow2,3000); 
	//Mouse events
	$('#slideshow2 li').hover(function() {
         
		clearInterval(sliderIntervalID2); 
		hovergal2($(this).attr('rel'), $(this)); 
	});
    
    /* SLIDER SERVICES*/
    
	var totWidth=0;
	var position = new Array();
     var menuSliderWidth =0 ; 
     var nbItem = 0; 
	
	$('#slides .slide').each(function(i){

		position[i]= totWidth;
		totWidth += $(this).width();

		if(!$(this).width())
		{
			alert("Please, fill in width & height for all your images!");
			return false;
		}
		
	});
     
     $('#services-gallery #slider-menu ul li').each(function(){
           nbItem ++; 
		menuSliderWidth = menuSliderWidth + $(this).width();
          menuSliderWidth = menuSliderWidth + 2;
	});
     
     $('#services-gallery #slider-menu ul').width( menuSliderWidth);
     
     
	
	$('#slides').width(totWidth);

	$('#slider-menu ul li a').click(function(e){

			$('li.menuItem').removeClass('act').addClass('inact');
			$(this).parent().addClass('act');
			
			var pos2 = $(this).parent().prevAll('.menuItem').length;
			
			$('#slides').stop().animate({marginLeft:-position[pos2]+'px'},450);
		
			
			e.preventDefault();
			
	});
     

          var pos2 = 0;      
       setInterval(function(){
               if(pos2 <  (nbItem-1)){
                     
                  
                  pos2 = $("#home-services #slider-menu ul li.act").next(".inact").prevAll('#home-services .menuItem').length;
                  var current2 = $("#home-services #slider-menu ul li.act");
                  $(current2).removeClass('act').addClass('inact');
                  $(current2).next(".inact").addClass('act');
                   $('#home-services #slides').stop().animate({marginLeft:-position[pos2]+'px'},450);
                }
                else{
                      pos2 = 0;
                        var current2 = $("#home-services #slider-menu ul li.act");
                       $(current2).removeClass('act').addClass('inact');
                       $("#home-services #slider-menu li:first").addClass('act');
                        $('#home-services #slides').stop().animate({marginLeft:-position[pos2]+'px'},450);
                }
                
         }, 4000);   
     
     
	
	$(' #services-gallery #slider-menu ul li.menuItem:first').addClass('act').siblings().addClass('inact');
	
     /*END SLIDER SERVICES*/
     
     /*OPACITY EFFECT VIGNETTE*/
      $(".vignette, .appart-vignette").each(function(){
            $(this).addClass("op");
      });
      
     $(".vignette, .appart-vignette").hover(
       function(){
              $(this).removeClass("op");
             $(".op").stop().fadeTo( 500, 0.5);
       },  
       function(){
              $(this).addClass("op");
             $(".op").stop().fadeTo(500, 1);
       }    
     );
           
           /* PICTO BULLE */
     var text;   
     var pos;
     
     $("#bulle").hide();
     
     $("#appart-description ul li img").hover(
            function(){
                  text = $(this).attr("alt").replace(/-/g," ");
                  pos = $(this).offset();
                  width = $(this).width();
                  width = width/2;
                  $("#bulle-content p").html(text);
                  
                  bullWidth=  $("#bulle").width(); 
                  bullWidth= bullWidth / 2;
                  
                  $("#bulle").css( { "left": (pos.left + width - bullWidth) + "px", "top":pos.top + "px" } ); 
                   $("#bulle").show(); 
                 
                  
                 
            }, 
            function(){
                 $("#bulle").hide();
            }
      );
            
            
    /* TARIFS */   
    
    $(".personn2,.personn3, .personn4 ").hide();
    
     $("#tarifs-buttons div").click(
            
            function(){
                  
                var personn = $(this).attr('id');
             
                $(".personn").hide();
                 $("#tarifs-buttons div").removeClass("push");
                  
                if(personn == "personn2"){ $(".personn2").show(); }
                if(personn == "personn1"){ $(".personn1").show(); }
                if(personn == "personn3"){ $(".personn3").show(); }
                if(personn == "personn4"){ $(".personn4").show(); }
                
                 $(this).addClass("push");
                
                
            }
            
      );
    
	
});



function slideshow() {	
	//if no image have the show class go to the first
	var currentPic = ($('#slideshow img.active')?  $('#slideshow img.active') : $('#slideshow img:first'));
	var currentLink = ($('#slideshow li.active')?  $('#slideshow li.active') : $('#slideshow li:first'));		
	//Get next image or go back to the first
	var nextPic = ((currentPic.next().length) ? ((currentPic.next().hasClass('slideshow-items'))? $('#slideshow img:first') :currentPic.next()) : $('#slideshow img:first'));	
	var nextLink = ((currentLink.next().length) ? ((currentLink.next().hasClass('slideshow-items'))? $('#slideshow li:first') :currentLink.next()) : $('#slideshow li:first'));
	//Hide the current image
	currentPic.stop().animate({opacity: 0.0}, 800)
	.removeClass('active');		
	//Show the next image
	nextPic.stop().css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 800);		
	//Remove class to link
	currentLink.removeClass('active');		
	//Set class to link
	nextLink.addClass('active');
}
function hovergal(nextPic, nextLink) {  
	//if no image have the show class go to the first
		var currentPic = ($('#slideshow img.active')?  $('#slideshow img.active') : $('#slideshow img:first'));
	var currentLink = ($('#slideshow li.active')?  $('#slideshow li.active') : $('#slideshow li:first'));	
	//check if show
	if(currentLink.attr('class')==nextLink.attr('class')){
		return false;
	}else{	
	//Hide the current image

	currentPic.stop().animate({opacity: 0.0}, 400)
	.removeClass('active');				
	//Show the next image
	 $('#slideshow img.'+nextPic).stop().css({opacity: 0.0})
	.addClass('active')
	.animate({opacity: 1.0}, 400);			
	//Remove class to link
	currentLink.removeClass('active'); 		
	//Set class to link
	nextLink.addClass('active');
	}
}  

function slideshow2() {	
     
	//if no image have the show class go to the first
	var currentPic = ($('#slideshow2 #slides-container img.act')?  $('#slideshow2  #slides-container img.act') : $('#slideshow2 #slides-container img:first'));
	var currentLink = ($('#slideshow2 li.act')?  $('#slideshow2 li.act') : $('#slideshow2 li:first'));		
	//Get next image or go back to the first
	var nextPic = ((currentPic.next().length) ? ((currentPic.next().hasClass('slider-menu'))? $('#slideshow2 #slides-container img:first') :currentPic.next()) : $('#slideshow2 #slides-container img:first'));	
	var nextLink = ((currentLink.next().length) ? ((currentLink.next().hasClass('slider-menu'))? $('#slideshow2 li:first') :currentLink.next()) : $('#slideshow2 li:first'));
	//Hide the current image
	currentPic.stop().animate({opacity: 0.0}, 800)
	.removeClass('act');		
	//Show the next image
	nextPic.stop().css({opacity: 0.0})
	.addClass('act')
	.animate({opacity: 1.0}, 800);		
	//Remove class to link
	currentLink.removeClass('act');		
	//Set class to link
	nextLink.addClass('act');
}
function hovergal2(nextPic, nextLink) {  
	//if no image have the show class go to the first
		var currentPic = ($('#slideshow2  #slides-container img.act')?  $('#slideshow2 #slides-container img.act') : $('#slideshow2 #slides-container img:first'));
	var currentLink = ($('#slideshow2 li.act')?  $('#slideshow2 li.act') : $('#slideshow2 li:first'));	
	//check if show
	if(currentLink.attr('class')==nextLink.attr('class')){
		return false;
	}else{	
	//Hide the current image

	currentPic.stop().animate({opacity: 0.0}, 400)
	.removeClass('act');				
	//Show the next image
	 $('#slideshow2 #slides-container img.'+nextPic).stop().css({opacity: 0.0})
	.addClass('act')
	.animate({opacity: 1.0}, 400);			
	//Remove class to link
	currentLink.removeClass('act'); 		
	//Set class to link
	nextLink.addClass('act');
	}
}  
