// JavaScript Document

$(document).ready(function(){
// AUTO HEIGHT
	$('#wrapper').css({'height': $(window).height()+'px' });
	//$('#principale').css({'min-height': ($(window).height() - 50)+'px' });
	
// EXTERNAL LINKS
	$('.extLink').click(function(){ window.open( $(this).attr('href') ); return false; });

// SHOW ITEMPS THAT NEEDS JAVASCRIPT
	$('.noScript').removeClass('noScript');

// GALERIES 
	if($('#galeries').length > 0 ){
		$('.ancre').appendTo('#ancres');
		
		$('.noJs').removeClass('noJs');
		
		$('.ancre').click(function(){
			var ancre = $(this);
			var selected = $($(this).attr('href'));
			if( ! selected.hasClass('active') ){
				$('.galerie.active').fadeOut(700, function(){ 
					$(this).removeClass('active'); 
					$('.ancre.active').removeClass('active'); 
					ancre.addClass('active'); 
					selected.fadeIn(700, function(){ $(this).addClass('active'); });
				}); 
			} 
			return false; 
		});	
		
		$('#prestations dl dd:first, #prestations dl dt:first ').show().addClass('active');
		$('#prestations dl dt').click(function(){
			if( ! $(this).hasClass('active')){
				$('#prestations dl dt.active').removeClass('active');
				$(this).addClass('active');
				
				o = $(this).next();
				$('#prestations dl dd.active')
					.removeClass('active')
					.slideUp( 500, function(){
						o.addClass('active').slideDown();											
					});
			}
		});
	}
	
//END READY
});


$(window).resize(function(){
// AUTO HEIGHT
	$('#wrapper').css({'height': $(window).height()+'px' });
	//$('#principale').css({'min-height': ($(window).height() - 50)+'px' });

//END RESIZE
});
