//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Partie Configuration : Ne pas modifier
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Liste des urls à appeler
var tabUrl = new Array();
tabUrl[0] = "";
tabUrl[1] = "d_boutique_01.htm";
tabUrl[2] = "d_boutique_02.htm";
tabUrl[3] = "d_boutique_03.htm";
tabUrl[4] = "d_boutique_04.htm";
tabUrl[5] = "d_boutique_05.htm";
tabUrl[6] = "d_couture_01.htm";
tabUrl[7] = "d_couture_02.htm";
tabUrl[8] = "d_presse_01.htm";
tabUrl[9] = "d_presse_02.htm";
tabUrl[10] = "d_presse_eng01.htm";
tabUrl[11] = "d_presse_eng02.htm";
tabUrl[12] = "d_couture_01_pe_2008.htm";
tabUrl[13] = "d_couture_02_pe_2008.htm";
tabUrl[14] = "d_couture_03_pe_2008.htm";
tabUrl[15] = "d_pap_01_pe_2008.htm";
tabUrl[16] = "d_pap_02_pe_2008.htm";
tabUrl[17] = "d_pap_01_eng_pe_2008.htm";
tabUrl[18] = "d_pap_02_eng_pe_2008.htm";
tabUrl[19] = "d_couture_01_h_2008.htm";
tabUrl[20] = "d_couture_02_h_2008.htm";
tabUrl[21] = "d_couture_03_h_2008.htm";
tabUrl[22] = "d_pap_01_h_2008.htm";
tabUrl[23] = "d_pap_02_h_2008.htm";
tabUrl[24] = "d_pap_01_eng_h_2008.htm";
tabUrl[25] = "d_pap_02_eng_h_2008.htm";
tabUrl[26] = "d_presse_03.htm";
tabUrl[27] = "d_presse_04.htm";
tabUrl[28] = "d_presse_05.htm";
tabUrl[29] = "d_presse_eng03.htm";
tabUrl[30] = "d_presse_eng04.htm";
tabUrl[31] = "d_presse_eng05.htm";
tabUrl[32] = "d_couture_01_pe_2009.htm";
tabUrl[33] = "d_couture_02_pe_2009.htm";
tabUrl[34] = "d_couture_03_pe_2009.htm";
tabUrl[35] = "d_pap_01_pe_2009.htm";
tabUrl[36] = "d_pap_02_pe_2009.htm";
tabUrl[37] = "d_pap_03_pe_2009.htm";
tabUrl[38] = "d_pap_04_pe_2009.htm";
tabUrl[39] = "d_pap_01_eng_pe_2009.htm";
tabUrl[40] = "d_pap_02_eng_pe_2009.htm";
tabUrl[41] = "d_pap_03_eng_pe_2009.htm";
tabUrl[42] = "d_pap_04_eng_pe_2009.htm";
tabUrl[43] = "d_couture_01_h_2009.htm";
tabUrl[44] = "d_couture_02_h_2009.htm";
tabUrl[45] = "d_pap_01_h_2009.htm";
tabUrl[46] = "d_pap_02_h_2009.htm";
tabUrl[47] = "d_pap_03_h_2009.htm";
tabUrl[48] = "d_pap_01_eng_h_2009.htm";
tabUrl[49] = "d_pap_02_eng_h_2009.htm";
tabUrl[50] = "d_pap_03_eng_h_2009.htm";
tabUrl[51] = "d_presse_06.htm";
tabUrl[52] = "d_presse_07.htm";
tabUrl[53] = "d_presse_eng06.htm";
tabUrl[54] = "d_presse_eng07.htm";
tabUrl[55] = "d_pap_01_pe_2010.htm";
tabUrl[56] = "d_pap_02_pe_2010.htm";
tabUrl[57] = "d_pap_03_pe_2010.htm";
tabUrl[58] = "d_pap_04_pe_2010.htm";
tabUrl[59] = "d_pap_05_pe_2010.htm";
tabUrl[60] = "d_pap_01_eng_pe_2010.htm";
tabUrl[61] = "d_pap_02_eng_pe_2010.htm";
tabUrl[62] = "d_pap_03_eng_pe_2010.htm";
tabUrl[63] = "d_pap_04_eng_pe_2010.htm";
tabUrl[64] = "d_pap_05_eng_pe_2010.htm";
tabUrl[65] = "d_couture_01_pe_2010.htm";
tabUrl[66] = "d_couture_02_pe_2010.htm";
tabUrl[67] = "d_couture_03_pe_2010.htm";

// Liste des div de la page
var tabDiv = new Array();
tabDiv[0] = "div_boutique";
tabDiv[1] = "div_collection";
tabDiv[2] = "div_presse";
tabDiv[3] = "div_boutique_en";
tabDiv[4] = "div_collection_en";
tabDiv[5] = "div_presse_en";


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