ï»¿
//Créons une fonction de création d'objet XMLHttRequest
function get_Xhr()
 {
  if(window.XMLHttpRequest)
   {
    xhr = new XMLHttpRequest();
   }
  else if(window.ActiveXOject)
   {
    try
     {
      xhr = new ActiveXObject("Msxml2.XMLHTTP");
     }
    catch(e)
     {
      try
       {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
       }
      catch(el)
       {
        xhr = null;
       }
     }
   }
  else
   {
    alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest\nVeuillez le mettre à jour");
   }
  return xhr;
 }

function loadContent(element,url) {
	var Element = document.getElementById(element);
	if (Element.style.display != 'block'){
		Element.style.display = 'block';
	}

	// Creation de l'objet XMLHttpRequest
	get_Xhr();
	xhr.onreadystatechange = function() {
		if(xhr.readyState == 4 && xhr.status == 200){
			//alert (xhr.responseText);
			if (xhr.responseText == "") {
				//window.location.reload();
				//window.location = window.location+'index.php';
				document.connexion.submit();
			}
			document.getElementById(element).innerHTML = xhr.responseText;
				
		}
	}
	xhr.open("GET",url,true);
	//alert (url);
	xhr.setRequestHeader('Content-Type','x-www-form-urlencoded');
	xhr.send(null);
}

function toggleDI(div_id) {
	var Element = document.getElementById(div_id);
	if (Element.style.display != 'block'){
		Element.style.display = 'block';
	}
}

function toggleNoneDI(div_id) {
	var Element = document.getElementById(div_id);
	if (Element.style.display != 'none'){
		Element.style.display = 'none';
	}
}

/*******************************************************************************
 * Affichage des différents contenu d'index
 ******************************************************************************/

// Affichage de la partie connexion
function DisplayConnexion() {
	loadContent('ContentMenu','index.php?action=connexion');
}

//Affichage de la partie menu
function DisplayMenu() {
	loadContent('ContentMenu','index.php?action=menu');
}

//Affichage de la partie suscribe
function DisplaySuscribe() {
	loadContent('ContentIndex','index.php?action=suscribe');
}
//Affichage de la partie suscribe
function DisplayMdpLost() {
	loadContent('ContentIndex','index.php?action=mdplost');
}

//Affichage de la partie overview
function DisplayOverview() {
	loadContent('ContentIndex','index.php?action=overview');
}

//Affichage de la partie Recruitment
function DisplayRecruitment() {
	loadContent('ContentIndex','index.php?action=recruitment');
}
//Affichage de la partie Recruitment
function DisplayLanguage(action,langue) {
	loadContent('content','index.php?lang='+langue);
	//loadContent('ContentIndex','index.php?lang'+langue);
}
//Affichage de la partie Recruitment
function ActionSuscribe() {
	var login = document.getElementById('login').value;
	var email = document.getElementById('email').value;
	var password = document.getElementById('password').value;
	var password2 = document.getElementById('password2').value;
	var langue = document.getElementById('langue').value;
	loadContent('content','index.php?action=initsuscribe&login='+login+'&email='+email+'&password='+password+'&password2='+password2+'&langue='+langue);
}

function ActionConnexion() {
	var login = document.getElementById('login').value;
	var password = document.getElementById('password').value;
	loadContent('ContentMenu','index.php?action=initconnexion&login='+login+'&password='+password);
}

//Affichage de la partie Recruitment
function ActionMdpLost() {
	//alert (document.getElementById('emailmdp').value);
	var email = document.getElementById('emailmdp').value;
	loadContent('ContentIndex','index.php?action=initmdplost&email='+email);
}

