// JavaScript Document

//Vérification du navigateur safari, google ou autre

function GalLoad(){
	var navInfo = navigator.userAgent +"";
	var widthGal = 0;
	var navSafari = new RegExp("safari", "gi")
	var navGoogle = new RegExp("chrome", "gi")
	if (navInfo.match(navSafari)|| navInfo.match(navGoogle)){
		widthGal = 10;
		}else{
			widthGal = 12;
		};
	return widthGal;
	};
	
//renvoi la valeur width selon le navigateur en cours safari, google ou autre  


function AffMyPic(MyPic){
	var AffAlt = $(MyPic).attr('alt');
	var AffTitle = $(MyPic).attr('title');
	$('#screener').html('<div id="DescImg"><img id="AffImage" src="'+AffAlt+'"/></div>').fadeIn('slow');
	$('img#AffImage').load(function(){
		AffImgWidth();
		$('#AffImage').css('visibility','visible');
		if (AffTitle){
			$('#DescImg').prepend('<span id="SpanImg">'+AffTitle+'</span>');
			};
		var AffImgX = eval($('#AffImage').width());
		$('#SpanImg').css({
			width: (AffImgX),
			marginLeft: (AffImgX/-2),
			top:"-100px"
			});
		
		  $("#AffImage").hover(
			  function(){
				$('#SpanImg').animate({top:'0px'}, 1000)
			  	},
			  function(){
				$('#SpanImg').animate({top:"-100px"}, 1000)
			  	}
			  );
		});
	HideAll();
};

	

function AffImgWidth(){		
	var x = document.getElementById('AffImage').naturalWidth;
	var y = document.getElementById('AffImage').naturalHeight;
	var WindowWidth = window.innerWidth;
	var WindowHeight = window.innerHeight;
	if (x > WindowWidth) { 
		$('#AffImage').addClass('ResizeW');
		}
	if (y > WindowHeight){
		$('#AffImage').addClass('ResizeH');
		}
};

function ScreenOut(){
	$('#AffImage').live("click", function(){
		$('#screener').fadeOut('fast');
		$('#AffImage').remove()
		$('#WrapSlider').animate({bottom:"0px"}, 'slow');
		ShowAll();
		});
};
function HideAll(){
		$('#FirstMenu').animate({"bottom": "-280px"}, 1000);
		$('#TitreSection').fadeOut("slow");
		$('h3').fadeOut("slow");
		$('#ContactMoi').fadeOut("slow");
};

function ShowAll(){
		$('#FirstMenu').animate({"bottom": "0px"}, 'slow');
		$('#TitreSection').fadeIn("slow");
		$('h3').fadeIn("slow");
		$('#ContactMoi').fadeIn("slow");
};

function SeeThumb(){
	$('#WrapSlider').hover(
		function(){
		$(this).animate({bottom:"-5px"}, 'slow');
		},
		function(){
		$(this).animate({bottom:"-100px"}, 'slow');
		});
};

function MaSouris(){
	$(document).mousemove(function(e){
		var MaSourisY = e.pageY;
		var WindowY = window.innerHeight;
		var MaLimit = MaSourisY >= WindowY-50;
		var MaSouris
		$(document).mouseleave(function(e){
			$('#WrapSlider').animate({bottom:"-5px"}, 400).stop();
			});
		$(document).mouseenter(function(e){
			$('#WrapSlider').animate();
			});
		});
};

