//Cufon
Cufon.replace('ul.nav li a span',{textShadow: '1px 1px rgba(0, 0, 0, 0.2)'});

var VERSION_IMAGE = {};

VERSION_IMAGE.set_footer = function() {
	//Positionnement de l'adresse du footer
	var minTop = 427;
	var offset = $('div#footer p:first-child').offset();
	if(minTop < offset.top){
		var diffPos = offset.top - minTop;
		var opCalc = diffPos/85;
		var opLeft = Math.round(opCalc) * 25;
		var resLeft = 535 - opLeft;
		$('div#footer div#footerWrapper').css('margin-left',resLeft + 'px');
		var width = $(window).width();
		var height = $(window).height();
		$('div#fullScreen').css('width',(width - resLeft) + 'px');
		/*$('div#fullScreen').css('padding-left',resLeft + 'px');*/
	}
}


//jQuery
$(document).ready(function(){
	//Footer ajust
	VERSION_IMAGE.set_footer();
	$(window).resize(function(){
	  VERSION_IMAGE.set_footer();
	});
	
	
		
	//Menu dans realisations
	$('ul.navTop li a').not('.menuactive').parent('li').addClass('grey');
	$('ul.navTop li a').not('.menuactive').hover(function(){$(this).parent('li').removeClass('grey');}, function(){$(this).parent('li').addClass('grey');});
	$('ul.navTop li.Roulant a.menuactive').parents('ul').addClass('navTopGrey');
	$('ul.navTop li.Roulant a').not('.menuactive').hover(function(){$(this).parents('ul').addClass('navTopGrey');},function(){$(this).parents('ul').removeClass('navTopGrey');});

	//Slider dans realisations
	$('div#sliderWraperRealisations div#sliderRealisationsInt ul li img').click(function(){
		var imgCour = $(this);
		$('div#sliderWraperRealisations div#sliderRealisationsInt ul li img').each(function(){
			$(this).removeClass('selected');
		});
		imgCour.addClass('selected');
		$('div#loaderFullImg').fadeIn(500, function(){
			var img = imgCour.attr('src');
			$('img#imgBg').attr('src',img);
			var desc = imgCour.prev('div.desc').html();
			$('div#descReal div.desc').html(desc);
			$('div#loaderFullImg').fadeOut(500);
		});
	});

	//Cookie pour lien slider
	/*var cookieName = 'linkReal';
	var cookieOptions = {expires: 7, path: '/'};
	$("a#btnPlay").click(function(){
		//$.cookie(cookieName, null, cookieOptions);
		$.cookie(cookieName, $(this).attr("rel"), cookieOptions);
	});*/
	$("a#btnPlay").click(function(){
		var thisUrl = $(this).attr('href');
		$('div#loaderFullImg').fadeIn(500,function(){
			$('#fullScreen img').fadeOut(500).attr('src',thisUrl).fadeIn(500,function(){
				$('div#loaderFullImg').fadeOut(500);
			});
		});
		return false;
	});
	

});

$(window).load(function() {
	$('#fullScreen img').fadeIn(500,function(){
		$('div#loaderFullImg').fadeOut(500);
	});
});
