$(document).ready(function() {

// Page du popup : mise en forme
$('.infosbox').hide();



function mypopup(popuid){

	var thepopup = $(popuid);
	
	thepopup.addClass('infosbox_popup');
	$('#modalwindow').addClass('modal-overlay');
	thepopup.show().centerScreen();
	   
    var btnclose="<p class='infosbox_close'><a href='#'><span>&nbsp;</span></a></p>";
	var winW = $(window).width();

	thepopup.append(btnclose);
	
	// OVERLAY :
	var maskHeight = $(document).height();
	var maskWidth = $(window).width();
	
	// Effets de transition :		
	$('#mask').fadeIn(500, function () { $(this).animate (  { opacity: "0.8" } , 500)});

	// Overlay : mask
	$('#mask').css({'width':maskWidth,'height':maskHeight});

	// Fermeture du popup
	$('.infosbox_close a').click(function (){
		$('.infosbox').fadeOut();	
		$('#mask').fadeOut();		
		});

} 

$('#popup1').click(function (){ mypopup('#1'); return false; });
$('#popup2').click(function (){ mypopup('#2'); return false;});
$('#popup3').click(function (){ mypopup('#3'); return false;});
$('#popup4').click(function (){ mypopup('#4'); return false;});
$('#popup5').click(function (){ mypopup('#5'); return false;});
$('#popup6').click(function (){ mypopup('#6');return false; });


 

$(".outerblocks_2").click(function(){					 
  var gotourl = $('#outerlink2').attr('href');
  window.open(gotourl,'_blank');
  return false;
		 
});
	

/* **************************  Fonction smoothscrool FOOTER   ****************************   */
function smoothFootScroll(){
	$('.backtotop a[href*=#]').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
		&& location.hostname == this.hostname) {
			var $target = $(this.hash);
			$target = $target.length && $target
			|| $('[name=' + this.hash.slice(1) +']');
			if ($target.length) {
				var targetOffset = $target.offset().top;
				$('html,body')
				.animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		}
	});

 
}

smoothFootScroll()

}); 