$(document).ready( function () {
	$('#diapo').cycle({ /* #diapo signifie "le bloc ayant diapo comme id" */
    		fx:    'fade', /* effet choisi (voir la liste deroulante ci-dessous) */
    		timeout: 3000 /* temps en millisecondes (ici 2 secondes) entre chaque photo */
    	});
});



function viewHeight() 
{
	if(window.innerHeight)
		return(window.innerHeight);
	if(document.documentElement && document.documentElement.clientHeight) 
		 return(document.documentElement.clientHeight);
	if(document.body) 
		return(document.body.clientHeight); 
	return 50;
}



function lightbox(id, width, height)
{
	document.getElementById('commun_fondopaque').style.display = 'block';
	document.getElementById(id).style.display = 'block';
	
	if(width==null)
	{
		width = document.getElementById(id).clientWidth;
	}
	if(height==null)
	{
		height = document.getElementById(id).clientHeight;
	}
	
	if(window.innerWidth)
		left = ((window.innerWidth-width-2)/2);
	else if(document.documentElement.clientWidth)
		left = ((document.documentElement.clientWidth-width-2)/2);
	else
		left = ((screen.width-width-2)/2);
	document.getElementById(id).style.marginLeft = ((left<20) ? 20 : left) + 'px';
	
	if(navigator.appName.substring(0, 3)=="Mic")
	{
		x = document.documentElement.scrollTop + document.body.scrollTop + (document.documentElement.clientHeight - height)/2;
		if(x<(document.documentElement.scrollTop + document.body.scrollTop))
		{
			document.getElementById(id).style.top = (document.documentElement.scrollTop + document.body.scrollTop + 20) + "px";
		}
		else
		{
			document.getElementById(id).style.top = x + "px";		
		}
	}
	//Autre
	else
	{
		top = (viewHeight() - height)/2;
		if(top<0)
		{
			document.getElementById(id).style.top = (document.documentElement.scrollTop+20)+'px';
			//document.getElementById(id).style.position = 'fixed';
		}
		else
		{
			document.getElementById(id).style.top = top + 'px';
			document.getElementById(id).style.position = 'fixed';
			//document.getElementById(id).style.position = 'fixed';
		}
	}
}



function lightbox_close(id)
{
	document.getElementById('commun_fondopaque').style.display = 'none';
	document.getElementById(id).style.display = 'none';
}



