/* créateur du site : Netalapage (c)2006 www.netalapage.com, sites personnalisés */
/* nom de la page   : intro-start.js                                             */
/* protégé par SARL : Netalapage - création des sites Internet uniques, pas cher */

var fadeIndexPhotoTotal = 10;						/* number of DIVs containing photos to fade */
var fadeIndexPhotoCurrent = 2;						/* current photo DIV being faded */
var fadeIndexPhotoPrevious = fadeIndexPhotoTotal;	/* previous photo DIV being faded */
var fadeIndexPhotoSpeed = 50;						/* speed to fade photo in and out */
var fadeIndexPhotoAmount = 5;						/* amount of opacity of photo to change */
var fadeIndexPhotoWait = 2000;						/* pause to show photo */
var currentIndexPhotoOpacity = 0;					/* opacity value of current photo */

setTimeout("nextIndexPhoto()", fadeIndexPhotoWait);

function fadeIndexPhoto() {
	if (document.getElementById) {
		obj = document.getElementById('index-pic'+fadeIndexPhotoCurrent);
		setOpacity(obj, currentIndexPhotoOpacity);
		currentIndexPhotoOpacity += fadeIndexPhotoAmount;
		/* if fading a landscape photo, divide by 2 as these are displayed twice for the fading process */
		if (currentIndexPhotoOpacity >100) 
			window.setTimeout("nextIndexPhoto()", fadeIndexPhotoWait);
		else
			window.setTimeout("fadeIndexPhoto()", fadeIndexPhotoSpeed);
	}
}

function nextIndexPhoto () {
	fadeIndexPhotoCurrent++; if (fadeIndexPhotoCurrent>fadeIndexPhotoTotal) fadeIndexPhotoCurrent=1;	/* get photo to fade - if faded all, set to first */
	image = document.getElementById('index-pic'+fadeIndexPhotoCurrent);				/* get reference to object */
	image.style.visibility = 'visible';
	setOpacity(image, 0);	image.style.zIndex = 1;									/* 0 for fade in 1 for z-index to ensure on top */
	
	image = document.getElementById('index-pic'+fadeIndexPhotoPrevious);				/* get reference to previous photo object */
	setOpacity(image, 0);	image.style.zIndex = 0;									/* 0 as finished, z-index to 1 to ensure on bottom */

	fadeIndexPhotoPrevious++; if (fadeIndexPhotoPrevious>fadeIndexPhotoTotal) fadeIndexPhotoPrevious=1;	/* get photo just faded - if faded all, set to first */
	image = document.getElementById('index-pic'+fadeIndexPhotoPrevious);				/* get reference to object */
	image.style.zIndex = 0;															/* z-index to 1 to ensure on bottom */
	currentIndexPhotoOpacity=0; 
	window.setTimeout("fadeIndexPhoto()", 1);
}

function setOpacity(obj, opacity) {
	opacity = (opacity == 100)?99:opacity;
	obj.style.filter = "alpha(opacity:"+opacity+")";			/* IE/WIN */
	obj.style.KHTMLOpacity = opacity/100;						/* Safari<1.2, Konqueror */
	obj.style.MozOpacity = opacity/100;							/* Older Mozilla and Firefox */
	obj.style.opacity = opacity/100;							/* Safari 1.2, newer Firefox and Mozilla, CSS3 */
}