var VISU_rafraichissement;
var VISU_play_pause = 0;
var VISU_timer = VISU_slideshow_seconde;
var VISU_actuel = 0;
var VISU_padding_px = 0;
var VISU_nbr_image = VISU_list_images.length - 1;
var VISU_preimage = new Array;
var VISU_IntervalNextImg = "";

for(i=1; i <= VISU_nbr_image; i++)
{
VISU_preimage[i] = new Image;
}

function VISU_aparaitre() {
	if(VISU_preimage[VISU_actuel].complete)
	{

		var VISU_w = VISU_h = VISU_t = VISU_l = 0;
		if (self.innerHeight) 
		{
		VISU_w = self.innerWidth;
		VISU_h = self.innerHeight;
		}
		else if (document.documentElement && document.documentElement.clientHeight)
		{
		VISU_w = document.documentElement.clientWidth;
		VISU_h = document.documentElement.clientHeight;
		}
		else if (document.body)
		{
		VISU_w = document.body.clientWidth;
		VISU_h = document.body.clientHeight;
		}
		
		if (self.pageYOffset)
		{
		VISU_l = self.pageXOffset;
		VISU_t = self.pageYOffset;
		}
		else if (document.documentElement && document.documentElement.scrollTop)
		{
		VISU_l = document.documentElement.scrollLeft;
		VISU_t = document.documentElement.scrollTop;
		}
		else if (document.body)
		{
		VISU_l = document.body.scrollLeft;
		VISU_t = document.body.scrollTop;
		}
		//document.getElementById("VISU_img").style.padding = VISU_padding_px + "px";
		//document.getElementById("VISU_img").style.height = VISU_preimage[VISU_actuel].height + 'px';
		document.getElementById("VISU_img").style.width = VISU_preimage[VISU_actuel].width + 'px';
		document.getElementById("VISU_img").style.marginTop = parseInt(((VISU_IMG_height - VISU_preimage[VISU_actuel].height) / 2), 10) + 'px';
		document.getElementById("VISU_img").style.marginBottom = parseInt(((VISU_IMG_height - VISU_preimage[VISU_actuel].height) / 2), 10) + 'px';
		document.getElementById("VISU_img").style.height = VISU_preimage[VISU_actuel].height + 'px';
		//document.getElementById("VISU_img").style.left = parseInt(((VISU_w - VISU_padding_px * 2 - VISU_preimage[VISU_actuel].width) / 2) + VISU_l, 10) + 'px';

		
		document.getElementById("VISU_image_grande").src = VISU_preimage[VISU_actuel].src;
		clearInterval(VISU_rafraichissement);
		fondu('VISU_img');
		document.getElementById("VISU_texte").innerHTML = VISU_list_texte[VISU_actuel];
	}
}

function VISU_images_select(VISU_selection) {
	VISU_actuel = VISU_selection;
	
	//document.getElementById('VISU_actuel').innerHTML = VISU_actuel + "/" + VISU_nbr_image;
	VISU_preimage[VISU_actuel].src = VISU_list_images[VISU_actuel];
	VISU_rafraichissement = setInterval("VISU_aparaitre()", 100);
}
function VISU_wait_fondu(VISU_prochain) {
	document.getElementById("VISU_texte").innerHTML = "";
	if(document.getElementById('VISU_img').style.display == "none")
	{
		VISU_images_select(VISU_prochain);
		clearInterval(VISU_IntervalNextImg);
		VISU_IntervalNextImg = "";
	}

}
function VISU_next(VISU_prochain) {
	if(!VISU_prochain) 
	{
		VISU_prochain = VISU_actuel + 1;
	}
	fondu('VISU_img');
	
	if(VISU_nbr_image < VISU_prochain)
	{ VISU_prochain = 1; }
	
	if(VISU_IntervalNextImg == "")
	VISU_IntervalNextImg = setInterval("VISU_wait_fondu(" + VISU_prochain + ")", 100);
	
}

function VISU_previous() {
	
	fondu('VISU_img');
	
	var VISU_prochain = VISU_actuel - 1;
	
	if(1 > VISU_prochain)
	{ VISU_prochain = VISU_nbr_image; }
	
	if(VISU_IntervalNextImg == "")
	VISU_IntervalNextImg = setInterval("VISU_wait_fondu(" + VISU_prochain + ")", 100);
}

function VISU_play() {
	document.getElementById('VISU_change_play').innerHTML = '<a href="javascript: VISU_pause();" class="VISU_pause"></a>';
	var time = VISU_slideshow_seconde * 1000;
	VISU_IntervalImage = setInterval("VISU_next()", time);
}

function VISU_pause() {
	document.getElementById('VISU_change_play').innerHTML = '<a href="javascript: VISU_play();" class="VISU_play"></a>';
	clearInterval(VISU_IntervalImage);
}
