//preload de l'image
function loadIt(theImage)
{
	if (document.images['imgtofadein'])
		verif(document.images['imgtofadein']);
}

//fade in
function fadeIn(opacity)
{
	if (opacity < 100)
	{
		//window.setTimeout("setOpacity("+opacity+")", 1);
		setOpacity(opacity);
		opacity += 20;
		//alert("opacite="+opacity);
		window.setTimeout("fadeIn("+opacity+")", 350);
	}
	else
	{
		window.setTimeout("setOpacity(100)", 1);
		document.images['imgtofadein'].style.visibility="visible";
	}
}

//maj opacité
function setOpacity(opa)
{
	//opa = (opa == 100)?99.999:opa;
	// IE/Win
	document.images['imgtofadein'].style.filter = "alpha(opacity="+opa+")";
	// Safari<1.2, Konqueror
	document.images['imgtofadein'].style.KHTMLOpacity = opa/100;
	// Older Mozilla and Firefox
	document.images['imgtofadein'].style.MozOpacity = opa/100;
	// Safari 1.2, newer Firefox and Mozilla, CSS3
	document.images['imgtofadein'].style.opacity = opa/100;
}

function verif(img)
{
	if (img.complete)
	{
		if (document.all)
		{
			objimg = document.all.galimgafficherentourephoto;
		}
		else
		{
			if (!document.all && document.getElementById)
			{
				objimg = document.getElementById("galimgafficherentourephoto");
			}
		}
		objimg.style.background = 'none';
		document.images['imgtofadein'].style.visibility="visible";
		//fadeIn(0);
	}
	else
	{
		setTimeout(function() {verif(img);}, 400);
	}
}
