//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Partie Configuration : Ne pas modifier
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Liste des urls à appeler
var tabUrl = new Array();
tabUrl[1] = "press_ax_01.htm";
tabUrl[2] = "press_ax_02.htm";
tabUrl[3] = "press_ax_03.htm";
tabUrl[4] = "press_ax_04.htm";
tabUrl[6] = "video_ax_01.htm";
tabUrl[7] = "video_ax_02.htm";
tabUrl[8] = "video_ax_03.htm";
tabUrl[9] = "video_ax_04.htm";
tabUrl[10] = "video_ax_05.htm";
tabUrl[11] = "image_ax_00.htm";
tabUrl[12] = "image_ax_01.htm";
tabUrl[13] = "image_ax_02.htm";
tabUrl[14] = "image_ax_03.htm";
tabUrl[15] = "image_ax_04.htm";
tabUrl[16] = "image_ax_05.htm";
tabUrl[17] = "image_ax_06.htm";
tabUrl[18] = "image_ax_07.htm";
tabUrl[19] = "musique_ax_00.htm";
tabUrl[20] = "musique_ax_01.htm";
tabUrl[21] = "musique_ax_02.htm";
tabUrl[22] = "musique_ax_03.htm";
tabUrl[23] = "event_ax_00.htm";
tabUrl[24] = "event_ax_01.htm";
tabUrl[25] = "event_ax_02.htm";
tabUrl[26] = "event_ax_03.htm";
tabUrl[27] = "event_ax_04.htm";
tabUrl[28] = "event_ax_05.htm";
tabUrl[29] = "buzz_ax_00.htm";
tabUrl[30] = "buzz_ax_01.htm";
tabUrl[31] = "buzz_ax_02.htm";
tabUrl[32] = "buzz_ax_03.htm";
tabUrl[33] = "buzz_ax_04.htm";
tabUrl[34] = "image_ax_07.htm";
tabUrl[35] = "event_ax_06.htm";
tabUrl[36] = "image_ax_08.htm";


// Liste des div de la page
var tabDiv = new Array();
tabDiv[0] = "div_press";
tabDiv[1] = "div_image";
tabDiv[2] = "div_video";
tabDiv[3] = "div_music";
tabDiv[4] = "div_event";
tabDiv[5] = "div_buzz";


// HTML à afficher dans la DIV en attendant le chargement
var loadingHtml = "<table width=\"100%\" height=\"180\"><tr valign=\"middle\"><td align=\"center\" class=\"botblanc\">...</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;
}
