if (document.body)
{
	var larg = (document.body.clientWidth);
	var haut = (document.body.clientHeight);
} else {
	var larg = (window.innerWidth);
	var haut = (window.innerHeight);
}



$(document).ready(function() {	
	$('#header ul.menu_header li a').click(function(){
		$(this).addClass('actif');
	});
	
	$("a.lightbox").fancybox({
		overlayColor:'#000', 
		showNavArrows: false, 
		autoScale: false,
		autoDimensions: true,
		centerOnScroll:false,
		titleShow:false,
		padding:0,
		overlayOpacity:0.8,
/* 		height:haut, */
		width:false,
		onStart     :   function() {
	      	$('div.video').css('visibility','hidden');
	    },
	    onComplete: function(currentArray, currentIndex, currentOpts) {
			var topMarge = parseInt($('#fancybox-wrap').css('top'));
			var hauteur = parseInt($('#fancybox-wrap').height());
			var hauteurLightbox = hauteur+topMarge;
			var hauteurDef = (parseInt($('#fancybox-overlay').height())>hauteurLightbox)?false:hauteurLightbox;
			if(hauteurDef) {
				$('#fancybox-overlay').css('height',hauteurDef);
			}
			
			$('#lightbox div.liste ul a').hover(function() {
				$('span',this).fadeIn(300);
			},function() {
				$('span',this).fadeOut(100);
			});
			
/* 			$('#fancybox-wrap').css('width',470); */
			
			$("a.colorbox[rel=groupe]").colorbox({
				transition:"elastic", 
				maxHeight:haut+'px+', 
				initialHeight:'false', 
				contentCurrent:"{current} / {total}",
				onOpen: function() {
					$('.player_video').hide();
				},
				
				onClosed:function() {
					$('.player_video').show();
					fplayer.stop();
				}
			});
			
			$("a.colorbox").colorbox({
				transition:"elastic", 
				initialHeight:'false', 
				onOpen: function() {
					$('.player_video').hide();
				},
				
				onClosed:function() {
					$('.player_video').show();
				}
			});
	    },
	    onClosed    :   function() {
	       $('div.video').css('visibility','visible');
	       $('#header ul.menu_header li a').removeClass('actif');
	    }

	});
	
	$('#corps div.projets_bloc').each(function() {
		$('p.illu a').hover(function() {
			$('span',this).fadeIn(300);
		},function() {
			$('span',this).fadeOut(100);
		});
	});
	
	$('#corps div.bloc_accueil_prems p.illus a').hover(function() {
		$('span',this).fadeIn(300);
	},function() {
		$('span',this).fadeOut(100);
	});
	
	$('#colonne div.zone_projets ul li a').hover(function() {
		$('span',this).fadeIn(300);
	},function() {
		$('span',this).fadeOut(100);
	});
	
	
	
	$('#corps div.liste div.bloc p.illu a').hover(function() {
		$('span',this).fadeIn(300);
	},function() {
		$('span',this).fadeOut(100);
	});
});

