		function Diapo(image, texte, height, width)
		{
			this.image = image;
			this.texte = texte;
			
			if (height > diaporama_max_height)
			{
				this.height = diaporama_max_height;
				this.width = width / (height / diaporama_max_height);
			}
			else
			{
				this.height = height;
				this.width = width;
			}
		
			this.loadImage = function ()
			{
				document.getElementById("diaporama_image").style.left = Math.round((diaporama_max_width - this.width) / 2);
				document.getElementById("diaporama_image").style.top = Math.round((diaporama_max_height - this.height) / 2);
				document.getElementById("diaporama_image").innerHTML = "<img src='" + this.image + "' height='" + this.height + "' width='" + this.width + "' border='0'>";
				document.getElementById("diaporama_texte").innerHTML = this.texte;
			}
		}
		
		function loadMosaique()
		{
			var content = "";
			var size = 55;
			for (i = diaporama_start_index, k = 0; i < diapos.length && k < diaporama_per_row; ++i, ++k)
			{
				h = diapos[i].height;
				w = diapos[i].width;
				if (diapos[i].height < diapos[i].width)
				{
					if (diapos[i].height > size)
					{
						h = size;
						w = diapos[i].width / (diapos[i].height / size);
					}
				}
				else
				{
					if (diapos[i].width > size)
					{
						w = size;
						h = diapos[i].height / (diapos[i].width / size);
					}
				}
				content += "<a href='javascript:jumpToDiapo(" + i + ");' class='lien_diapo'><span id='diapo_" + i + "' class='mosaique_diapo' style='cursor: pointer;'><img border='0' src='" + diapos[i].image + "' height='" + h + "' width='" + w + "' onclick='javascript:jumpToDiapo(" + i + ");'></span></a>";
			}
			document.getElementById("mosaique").innerHTML = content;
		}
		
		function playDiaporama()
		{
			++diaporama_current;
			if (diaporama_current == diapos.length)
				diaporama_current = 0;
			selectDiapo(diaporama_current);
			diapos[diaporama_current].loadImage();
		}
		
		function startDiaporama()
		{
			playDiaporama();
			diaporama_timer = setInterval("playDiaporama();", diaporama_intervalle);
		}
		
		function selectDiapo(id)
		{
			if (id < diaporama_start_index || id >= diaporama_start_index + diaporama_per_row)
			{
				if (diaporama_start_index + diaporama_per_row >= diapos.length)
					diaporama_start_index = 0;
				else
					diaporama_start_index += diaporama_per_row;
				loadMosaique();
			}
			document.getElementById("diapo_" + id).style.border = "3px solid " + diapo_selected;
			for (i = diaporama_start_index, k = 0; i < diapos.length && k < diaporama_per_row; ++i, ++k)
				if (i != id)
					document.getElementById("diapo_" + i).style.border = "3px solid " + diapo_not_selected;
		}
		
		function jumpToDiapo(id)
		{
			diaporama_current = id - 1;
			clearInterval(diaporama_timer);
			diaporama_timer = null;
			playDiaporama();
			selectDiapo(id);
			document.getElementById("diaporama_action").src = media_path + "/icon_play.gif";
		}
		
		function controlDiaporama(action)
		{
			if (action == "next")
			{
				clearInterval(diaporama_timer);
				diaporama_timer = null;
				startDiaporama();
				document.getElementById("diaporama_action").src = media_path + "/icon_pause.gif";
			}
			else if (action == "prev")
			{
				clearInterval(diaporama_timer);
				diaporama_timer = null;
				diaporama_current -= 2;
				if (diaporama_current == -1)
					diaporama_current = diapos.length - 1;
				else if (diaporama_current == -2)
					diaporama_current = diapos.length - 2;
				startDiaporama();
				document.getElementById("diaporama_action").src = media_path + "/icon_pause.gif";
			}
			else
			{
				// Play, on met pause
				if (diaporama_timer != null)
				{
					clearInterval(diaporama_timer);
					diaporama_timer = null;
					document.getElementById("diaporama_action").src = media_path + "/icon_play.gif";
				}
				// Pause, on met play
				else
				{
					startDiaporama();
					document.getElementById("diaporama_action").src = media_path + "/icon_pause.gif";
				}
			}
		}
		
		function createDiaporama()
		{
			document.write('<div>');
			document.write('<div id="diaporama">');
			document.write('	<div id="diaporama_controle"><a href="javascript:void(0);"><img id="diaporama_action" border="0" src="' + media_path + '/icon_pause.gif" onclick="javascript:controlDiaporama(\'\');"><img border="0" src="' + media_path + '/icon_prev.gif" onclick="javascript:controlDiaporama(\'prev\');"><img border="0" src="' + media_path + '/icon_next.gif" onclick="javascript:controlDiaporama(\'next\');"></a></div>');
			document.write('	<div id="diaporama_image">Chargement...</div>');
			document.write('	<div id="diaporama_texte"></div>');
			document.write('</div>');
			document.write('<div id="mosaique"></div>');
			document.write('</div>');
		}
