// JavaScript Document
function cacherVoir(leDiv,idImage){
	leStyle = document.getElementById(leDiv).style;
	if(leStyle.display == "block"){
		leStyle.display = "none";
		document.getElementById(idImage).src = "images/bt_AHGM_Off.gif";
	}
	else{ 
		leStyle.display = "block";
		document.getElementById(idImage).src = "images/bt_AHGM_Off.gif";
	}
}

function popupcentree(page,largeur,hauteur,options)
{
var top=(screen.height-hauteur)/2;
var left=(screen.width-largeur)/2;
window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}


doclay = (document.layers)? true : false
docall = (document.all)? true : false
docget = (document.getElementById)? true : false

// Set the slideshow speed (in milliseconds)
var SlideShowSpeed = 5000;

// Set the duration of crossfade (in seconds)
var CrossFadeDuration = 3;

var currentImg;
var total;

thisImg = 0
imgCt = 4
baseCt = 0

//add captions, put initial caption in div at bottom of this page

imageLocation = new Array()

imageLocation[0] = "images/image1.jpg"
imageLocation[1] = "images/image2.jpg"
imageLocation[2] = "images/image3.jpg"
imageLocation[3] = "images/image4.jpg"
imageLocation[4] = "images/image5.jpg"

imageNavigation = new Array()
imageNavigation[0] = "<span class=\"slideshow-on\">1<\/span> . <a href=\"javascript:StartorStop(0);(thisImg=1);layerWrite(\'imageDiv\')\">2<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=2);layerWrite(\'imageDiv\')\">3<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=3);layerWrite(\'imageDiv\')\">4<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=4);layerWrite(\'imageDiv\')\">5<\/a>"
imageNavigation[1] = "<a href=\"javascript:StartorStop(0);(thisImg=0);layerWrite(\'imageDiv\')\">1<\/a> . <span class=\"slideshow-on\">2<\/span> . <a href=\"javascript:StartorStop(0);(thisImg=2);layerWrite(\'imageDiv\')\">3<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=3);layerWrite(\'imageDiv\')\">4<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=4);layerWrite(\'imageDiv\')\">5<\/a>"
imageNavigation[2] = "<a href=\"javascript:StartorStop(0);(thisImg=0);layerWrite(\'imageDiv\')\">1<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=1);layerWrite(\'imageDiv\')\">2<\/a> . <span class=\"slideshow-on\">3<\/span> . <a href=\"javascript:StartorStop(0);(thisImg=3);layerWrite(\'imageDiv\')\">4<\/a> . <a href=\"javascript:StartorStop(0);(thisImg=4);layerWrite(\'imageDiv\')\">5<\/a>"

var tss;
var iss;
var thisImg = 0;
var start = 1;

//variable is set to 1 initially so that slideshow starts when page is loaded
//vairable is set to 0 if PREVIOUS or NEXT is clicked which stops the slideshow
function StartorStop(x) {
start = x;
}

//preloads images into an array
var preLoad = new Array();
for (iss = 0; iss < imgCt+1; iss++){
preLoad[iss] = new Image();
preLoad[iss].src = imageLocation[iss];}

//this function is run first so that there is a delay on the first image
//otherwise the slideshow jumps to the second image immediately
//timer is faster for this than the loop
function runSlideShowParent(){
tss = setTimeout('runSlideShow()', 2000);
}

//this is the automatic slideshow
function runSlideShow(){

	if ( start == 1 ){

		//counter is at beginning so that if user interrupts the slideshow with the PREVIOUS NEXT
		//then the slideshow won't jump ahead two images instead of just one

	navigation = imageNavigation[thisImg]

		if (thisImg >= imgCt){
		thisImg=0;
		navigation = imageNavigation[thisImg]
		} else {
		thisImg = thisImg + 1;
		navigation = imageNavigation[thisImg]
		}

		if (docall){
		document.images.slider.style.filter="blendTrans(duration=2)";
		document.images.slider.style.filter="blendTrans(duration=CrossFadeDuration)";
		document.images.slider.filters.blendTrans.Apply();}
	
	document.images.slider.src = preLoad[thisImg].src; 
	
		

		if (docall) document.images.slider.filters.blendTrans.Play();
		
	tss = setTimeout('runSlideShow()', SlideShowSpeed);
	}
}

//this is the user controlled slideshow
function layerWrite(id,text) {

image = imageLocation[thisImg]
navigation = imageNavigation[thisImg]

	if (thisImg > imgCt) {
	thisImg = 0
	navigation = imageNavigation[thisImg]
	}
	
	if (thisImg < baseCt) {
	thisImg = 3
	navigation = imageNavigation[thisImg]
	}

currentImg = thisImg + 1
total = imgCt + 1

	

}
