//-----------------------------------------------------------------------------
// Diaporamas d'images avec liens, zooms et transitions (IE PC) M-tech Industries
//-----------------------------------------------------------------------------
// HJ : 18/10/01


// Preload images
var preloadedimages=new Array()
for (i=0;i<Slides.length;i++){
	preloadedimages[i]=new Image()
	preloadedimages[i].src=SlidesPath + Slides[i]
}


function DiaApplyEffect(){
if (document.all && Win==1) {
	document.CurrentSlide.filters.revealTrans.Transition=Math.floor(Math.random()*23)
	document.CurrentSlide.filters.revealTrans.stop()
	document.CurrentSlide.filters.revealTrans.apply()
}
}


function DiaPlayEffect(){
if (document.all && Win==1)
	document.CurrentSlide.filters.revealTrans.play()
}

function DiaCountStatus(){
	window.status="Image "+(currSlide+1)+" sur "+Slides.length //+ " : " + SlidesCaptions[currSlide]
}


function DiaPrevious(){
	if (currSlide>0){
		currSlide--
	} else {
		currSlide=Slides.length-1;
	}
	DiaApplyEffect()
	//document.images.CurrentSlide.src=SlidesPath + Slides[currSlide]
	ChangePict(SlidesPath + Slides[currSlide],SlidesWidth[currSlide],SlidesHeight[currSlide],"CurrentSlide","",1);
	DiaPlayEffect()
	DiaCountStatus()
	DiaUpdateCap("theCaption", SlidesCaptions[currSlide])
}


function DiaNext(){
	if (currSlide<Slides.length-1){
		currSlide++
	} else {
		currSlide=0;
	}
	DiaApplyEffect()
	//document.images.CurrentSlide.src=SlidesPath + Slides[currSlide]
	ChangePict(SlidesPath + Slides[currSlide],SlidesWidth[currSlide],SlidesHeight[currSlide],"CurrentSlide","",1);
	DiaPlayEffect() // Effet si IE PC
	DiaCountStatus()
	DiaUpdateCap("theCaption", SlidesCaptions[currSlide])
}

function DiaFirst(){
	currSlide=0;
	DiaApplyEffect()
	//document.images.CurrentSlide.src=SlidesPath + Slides[currSlide]
	ChangePict(SlidesPath + Slides[currSlide],SlidesWidth[currSlide],SlidesHeight[currSlide],"CurrentSlide","",1);
	DiaPlayEffect() // Effet si IE PC
	DiaCountStatus()
	DiaUpdateCap("theCaption", SlidesCaptions[currSlide])
}

function DiaLast(){
	currSlide=Slides.length-1;
	DiaApplyEffect()
	//document.images.CurrentSlide.src=SlidesPath + Slides[currSlide]
	ChangePict(SlidesPath + Slides[currSlide],SlidesWidth[currSlide],SlidesHeight[currSlide],"CurrentSlide","",1);
	DiaPlayEffect() // Effet si IE PC
	DiaCountStatus()
	DiaUpdateCap("theCaption", SlidesCaptions[currSlide])
}


function DiaGoNb(theIndex) {
	currSlide=parseInt(theIndex);
	DiaApplyEffect()
	//document.images.CurrentSlide.src=SlidesPath + Slides[currSlide]
	ChangePict(SlidesPath + Slides[currSlide],SlidesWidth[currSlide],SlidesHeight[currSlide],"CurrentSlide","",1);
	DiaPlayEffect() // Effet si IE PC
	DiaCountStatus()
	DiaUpdateCap("theCaption", SlidesCaptions[currSlide])
}


function DiaUpdateCap(theID, theCap) {
	if (NS4) {
		/*with (document[theID].document) {
			open();
			write(theCap);
			close();
		}*/
	} else if (NS6 || IE5) {
		document.getElementById(theID).innerHTML = theCap; // NS 6 et IE 5
	} else {
		document.all[theID].innerHTML = theCap;
	}
}


function DiaOpenLink(){
	// Ouvre lien
	if (OpenBlank) {
		window.open(SlidesLink[currSlide],'wLink','width=' + 600 + ',height=' + 400 + ',resizable=yes,scrollbars=auto,menubar=yes,toolbar=yes,directories=no,location=yes,status=yes');	
	} else {
		window.location=SlidesLink[currSlide]
	}
}


function DiaZoomPict(pictName) {
	theWidth=SlidesWidth[currSlide]+25;
	theHeight=SlidesHeight[currSlide]+60;
	
	theWindow=window.open(homePath+theWindowCont,'wPict','width=' + theWidth + ',height=' + theHeight + ',resizable=yes,scrollbars=yes,menubar=no,toolbar=no,directories=no,location=no,status=no');	
	document.DiaForm.thePictName.value=pictName;
	//document.DiaForm.thePictWidth.value=SlidesWidth[currSlide];
	theWindow.focus();
}


function DiaZoomPictMat(pictName) {
	theWidth=SlidesWidth[currSlide]+25;
	theHeight=SlidesHeight[currSlide]+60;
	
	theWindow=window.open(homePath+theWindowCont,'wPict','width=' + theWidth + ',height=' + theHeight + ',resizable=yes,scrollbars=yes,menubar=no,toolbar=no,directories=no,location=no,status=no');	
	document.DiaForm.thePictName.value=pictName;
	//document.DiaForm.thePictWidth.value=SlidesWidth[currSlide];
	theWindow.focus();
}
