/*
Interactive Image slideshow with text description
By Christian Carlessi Salvadó (cocolinks@c.net.gt). Keep this notice intact.
Visit http://www.dynamicdrive.com for script
*/
g_fPlayMode = 0;
g_iimg = -1;
                             /*ci dessous, commenté car déja déclaré dans la page */
//g_imax = 0;
//g_ImageTable = new Array();

function ChangeImage(fFwd) {
	if (fFwd) {
		if (++g_iimg==g_imax) g_iimg=0;
	} else {
		if (g_iimg==0) g_iimg=g_imax;
		g_iimg--;
	}
	Update();
}

function getobject(obj){
	if (document.getElementById)
		return document.getElementById(obj)
	else if (document.all)
		return document.all[obj]
}

function Update(){
	getobject("background_image").src = g_ImageTable[g_iimg][0];
	getobject("Link").innerHTML = g_ImageTable[g_iimg][1];
	getobject("Link").href = g_ImageTable[g_iimg][2];
}

function Play() {
	Pause();
	
	if (g_fPlayMode) {
		ChangeImage(true);
		OnImgLoad();
	}
}

function Pause() {
	g_fPlayMode = !g_fPlayMode;
	getobject("RemoteContentPlay").src = path_DOSSIER_SQUELETTE+'/../blocs/images/common/remote_play.png';
}

function OnImgLoad() {
	if (g_fPlayMode) {
		window.setTimeout("Tick()", g_dwTimeOutSec*1000);
		getobject("RemoteContentPlay").src = path_DOSSIER_SQUELETTE+'/../blocs/images/common/remote_pause.png';
	}
}

function Tick() {
	if (g_fPlayMode) Next();
}

function Prev() { ChangeImage(false); }

function Next() {
	ChangeImage(true);
	OnImgLoad();
}

function goNext() { ChangeImage(true); }

function goPrev() { ChangeImage(false); }

//configure the below images, descriptions and links to your own.

//extend the above list as desired
g_dwTimeOutSec=10

g_ImageTable.sort(function() {return 0.5 - Math.random();} )
////End configuration/////////////////////////////

addLoadEvent(Play); // Images Background
