var settimeout_headerbanniere_function_animation; 

jQuery(document).ready(function(){
	if(navigator.platform != "iPhone" && navigator.platform != "iPad") {
		//jquery_image_lazy_loading(".photo");
		headernav_onscroll_position();
		headerbanniere_hover_animation();
		minipost_hover_animation(".index");
		minipost_hover_animation(".single");
		jQuery('a[rel=external]').attr('target','_blank'); // rel="external" à la place de target="_blank"
	}
});

function jquery_image_lazy_loading(balise){
	jQuery(balise).find("img").lazyload({placeholder:jquery_plus_url+"illustrations/loading.gif",effect:"fadeIn"});
}

function headernav_onscroll_position(){
	window.onscroll = function() {
		yscroll = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;
		if(yscroll <= 250) jQuery("#header .header-nav").css({position:"fixed","top":(250-yscroll)+"px"});
		else jQuery("#header .header-nav").css({position:"fixed","top":"0px"});
	}
}

function headerbanniere_hover_animation(){
	largeur = jQuery("#header .header-banniere img").width();
	hauteur = jQuery("#header .header-banniere img").height();
	jQuery("#header").hover(
		function(){
			headerbanniere_function_animation();
		},
		function() {
			clearTimeout(settimeout_headerbanniere_function_animation);
		}
	);
}
function headerbanniere_function_animation(){
	jQuery("#header .header-banniere img")
	.animate({width:(largeur*1.025),height:(hauteur*1.025)},100).animate({width:largeur,height:hauteur},150)
	.animate({width:(largeur* 1.05),height:(hauteur* 1.05)},100).animate({width:largeur,height:hauteur},200)
	.delay(500);
	settimeout_headerbanniere_function_animation = setTimeout("headerbanniere_function_animation()",1100);
}

function minipost_hover_animation(balise){
	jQuery("#wraper " + balise + " .mini-post").hover(
		function(){
			//jQuery(".photo .lien",this).stop(false,true).css({visibility:"visible",opacity:"0"}).fadeTo(250,1).show();
			if(balise == ".index")       jQuery(".photo img",this).stop(false,true).addClass("hover").animate({top:"-50px",left:"-33px",width:"300px",height:"200px"},250); // position multiple de 4 et taille fixe
			else if(balise == ".single") jQuery(".photo img",this).stop(false,true).addClass("hover").animate({top:"-40px",left:"-26px",width:"240px",height:"158px"},250); // position multiple de 4 

		},
		function(){
			if(balise == ".index")       jQuery(".photo img",this).stop(false,true).removeClass("hover").animate({top:"0px",left:"0px",width:"200px",height:"133px"},250); // position et taille fixes
			else if(balise == ".single") jQuery(".photo img",this).stop(false,true).removeClass("hover").animate({top:"0px",left:"0px",width:"160px",height:"106px"},250); // position et taille fixes
			//jQuery(".photo .lien",this).stop(false,true).fadeTo(250,0);
		}
	);
}
