$(document).ready(function(){
	$('a[href^=#]').click(function(){
		cible = $(this).attr('href');
		if($(cible).length>=1){
			horizontal=$(cible).offset().top;
			vertical=$(cible).offset().left;
		}
		else
		{
			horizontal=$("a[name="+cible.substr(1,cible.length-1)+"]").offset().top;
			vertical=$("a[name="+cible.substr(1,cible.length-1)+"]").offset().left;
		}
		$('html,body').animate({scrollTop: horizontal, scrollLeft: vertical}, 2000);
		return false;
	});

	$(document).mousemove(function(e){
		var ecran_w=$(window).width();
		var ecran_h=$(window).height();
		var x=Math.round((50/ecran_w)*e.pageX)-50;
		var y=Math.round((50/ecran_h)*e.pageY)-50;
		if(x>=0)
			x=0;
		if(y>=0)
			y=0;
		$('#page_centre_diapo_image').css({backgroundPosition: x+'px '+y+'px'});
		var x=Math.round((15/ecran_w)*e.pageX);
		var y=Math.round((15/ecran_h)*e.pageY);
		if(x>=15)
			x=15;
		if(y>=15)
			y=15;
		$('#page_centre_diapo_image_avant').css({backgroundPosition: x+'px '+y+'px'});
   });
});

