//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Partie Configuration : Ne pas modifier
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Liste des urls à appeler
var tabUrl = new Array();
tabUrl[0] = "h01.htm";
tabUrl[1] = "h02.htm";
tabUrl[2] = "h03.htm";
tabUrl[3] = "h04.htm";
tabUrl[4] = "h05.htm";
tabUrl[5] = "h06.htm";
tabUrl[6] = "h07.htm";
tabUrl[7] = "h08.htm";
tabUrl[8] = "h09.htm";
tabUrl[9] = "h10.htm";
tabUrl[10] = "h11.htm";
tabUrl[11] = "h12.htm";
tabUrl[12] = "p01.htm";
tabUrl[13] = "p02.htm";
tabUrl[14] = "p03.htm";
tabUrl[15] = "p04.htm";
tabUrl[16] = "p05.htm";
tabUrl[17] = "p06.htm";
tabUrl[18] = "p07.htm";
tabUrl[19] = "p08.htm";
tabUrl[20] = "p09.htm";
tabUrl[21] = "p10.htm";
tabUrl[22] = "p11.htm";
tabUrl[23] = "p12.htm";

// Liste des div de la page
var tabDiv = new Array();
tabDiv[0] = "divphoto";

// HTML à afficher dans la DIV en attendant le chargement
var loadingHtml = "<table width=\"100%\" height=\"180\"><tr valign=\"middle\"><td align=\"center\" class=\"txtnoir\">loading</td></tr></table>";


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Partie AJAX : Ne pas modifier
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// Variables utilisées pour annuler le chargement d'une Url si une autre a été appelée
var xmlhttpdiv = false;

var loadingDiv = new Array();

// Fonction JS effectuant l'appel AJAX
function loadDiv(IdUrl, IdDiv)
{
	tempDiv = loadingDiv[IdDiv];
	//Supression de l'ancienne requête
	if( tempDiv && tempDiv.readyState >= 1 && tempDiv.readyState <= 3)
	{
		tempDiv.abort();
	}
	
	//Nouvelle requête
   	xmlhttpdiv = getHTTPObject(IdUrl, IdDiv);
	loadingDiv[IdDiv] = xmlhttpdiv;
	
  	xmlhttpdiv.open("GET", tabUrl[IdUrl], true);
   	document.getElementById(tabDiv[IdDiv]).innerHTML = loadingHtml;
   	xmlhttpdiv.send(null);
}

// Fonction AJAX
function getHTTPObject(IdUrl, IdDiv)
{
	var xmlhttp = false;

	/* Compilation conditionnelle d'IE */
	/*@cc_on
	@if (@_jscript_version >= 5)
		   try
		   {
				   xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		   }
		   catch (e)
		   {
				   try
				   {
				   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
				   }
				   catch (E)
				   {
				   xmlhttp = false;
				   }
		   }
	@else
		   xmlhttp = false;
	@end @*/

	/* on essaie de créer l'objet si ce n'est pas déjà fait */
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
	{
		   try
		   {
				   xmlhttp = new XMLHttpRequest();
		   }
		   catch (e)
		   {
				   xmlhttp = false;
		   }
	}

	if (xmlhttp)
	{
		   xmlhttp.onreadystatechange=function()
		   {
				   if (xmlhttp.readyState == 4) /* 4 : état "complete" */
				   {
				   			if (xmlhttp.status == 200) /* 200 : code HTTP pour OK */
								document.getElementById(tabDiv[IdDiv]).innerHTML = xmlhttp.responseText;
							else
							{
								 // VERSION 1
								 //  document.getElementById(tabDiv[IdDiv]).innerHTML = "Server Error";
								 
								 // VERSION 2
								 // On recharge la page car problème serveur ...
								 loadDiv(IdUrl, IdDiv);
							}
				   }
		   }
	}
	return xmlhttp;
}
