numero_photo = 1;

function AfficherEvenement(nouv_collection, nouv_nombre)
{
	document.getElementById("apercu").style.display = "block";
	document.getElementById("lecteur_video").style.display = "none";
	if (window.XMLHttpRequest)
	{	// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", "/mediatheque/arreter_video.php", false);
		xmlhttp.send(null);
	}
	else
	{	// code for IE6, IE5
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET", "/mediatheque/arreter_video.php", false);
		// Do not send null for ActiveX
		xmlhttp.send();
	}
	document.getElementById("lecteur_video").innerHTML = xmlhttp.responseText;
	
	
	collection = nouv_collection;
	nombre_photos = nouv_nombre;
	//description = "/mediatheque/" + collection + "/texte.txt";
	numero_photo = 0;
	PhotoSuivante();
	
	if (window.XMLHttpRequest)
	{	// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", "/mediatheque/" + collection + "/texte.txt", false);
		xmlhttp.send(null);
	}
	else
	{	// code for IE6, IE5
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET", "/mediatheque/" + collection + "/texte.txt", false);
		// Do not send null for ActiveX
		xmlhttp.send();
	}
	document.getElementById("description").innerHTML = xmlhttp.responseText;
	
	if (nouv_nombre == 1)
	{
		document.getElementById("suivant").style.visibility = "hidden";
	}
	else
	{
		document.getElementById("suivant").style.visibility = "visible";
	}
	document.getElementById("precedent").style.visibility = "hidden";
}

function AfficherVideo(sequence)
{
	document.getElementById('lecteur_video').style.display = 'block';
	document.getElementById('apercu').style.display = 'none';
	
	// vidéo
	if (navigator.appName == 'Microsoft Internet Explorer')
	{
		if (window.XMLHttpRequest)
		{	// code for IE7+, Firefox, Chrome, Opera, Safari
			xmlhttp = new XMLHttpRequest();
			xmlhttp.open("GET", "/mediatheque/videos_IE.php?v=" + sequence, false);
			xmlhttp.send(null);
		}
		else
		{	// code for IE6, IE5
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			xmlhttp.open("GET", "/mediatheque/videos_IE.php?v=" + sequence, false);
			// Do not send null for ActiveX
			xmlhttp.send();
		}
	}
	else
	{
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", "/mediatheque/videos.php?v=" + sequence, false);
		xmlhttp.send(null);
	}
		
	document.getElementById('lecteur_video').innerHTML = xmlhttp.responseText;
	
	// description
	if (window.XMLHttpRequest)
	{	// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET", "/mediatheque/videos/" + sequence + ".txt", false);
		xmlhttp.send(null);
	}
	else
	{	// code for IE6, IE5
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		xmlhttp.open("GET", "/mediatheque/" + sequence + ".txt", false);
		// Do not send null for ActiveX
		xmlhttp.send();
	}
	document.getElementById("description").innerHTML = xmlhttp.responseText;	
}

function PhotoSuivante()
{
	if (numero_photo < nombre_photos)
	{
		numero_photo = numero_photo+1;
		fichier = numero_photo+".jpg";
		document.getElementById("apercu").style.backgroundImage = "url(/mediatheque/"+collection+"/"+fichier+")";
	}
	if (numero_photo == nombre_photos)
	{
		document.getElementById("suivant").style.visibility = "hidden";
	}
	document.getElementById("precedent").style.visibility = "visible";
}

function PhotoPrecedente()
{
	if (numero_photo > 1)
	{
		numero_photo = numero_photo-1;
		fichier = numero_photo+".jpg";
		document.getElementById("apercu").style.backgroundImage = "url(/mediatheque/"+collection+"/"+fichier+")";
	}
	if (numero_photo == 1)
	{
		document.getElementById("precedent").style.visibility = "hidden";
	}
	document.getElementById("suivant").style.visibility = "visible";
}