<!--------------------------------------------------------------------------------------------------->
<!------------------------ FICHE EQUIPE - Modification des environnements --------------------------->
<!--------------------------------------------------------------------------------------------------->
var boolEnvironnement = 0;

function modif_environnement(obj, id, statut, teamId){
	
	if ( boolEnvironnement == 0 )
	{
		boolEnvironnement = 1;
		
		if ( statut == 0 )
		{
			nveauStatut = 1;
			attributsLibelle = obj;
		}
		else
		{
			nveauStatut = 0;
			attributsLibelle = obj + ' inactif';
		}
					
		// Initialisation de l'objet xhr
		var xhr_obj = null;
		
		// Test du navigateur pour savoir quel objet choisir
		if(window.XMLHttpRequest){
			xhr_obj = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){
			xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// Choix du script 
		xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
		
		xhr_obj.onreadystatechange = function()
		{
			if (xhr_obj.readyState < 4)
			{
				document.getElementById('chargement').style.display = 'inline';
				document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
			}
			
			else if(xhr_obj.readyState == 4)
			{
				if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification de l\'environnement' )
				{
					alert(xhr_obj.responseText);
					
					boolEnvironnement = 0;
				}
				else
				{
					
					document.getElementById('chargement').style.display = 'none';
					
					document.images[obj].src = xhr_obj.responseText;
					document.images[obj].alt = attributsLibelle;
					document.images[obj].title = attributsLibelle;
					document.images[obj].setAttribute('onclick', 'modif_environnement(\'' + obj + '\', \'' + id + '\', \'' + nveauStatut + '\', \'' + teamId + '\');');
	
					boolEnvironnement = 0;
				}
			}
		}
		
		// En-tête 
		xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		// Paramètres à transmettre
		var param = "id=" + id + "&statut=" + nveauStatut + "&teamid=" + teamId + "&action=environnement";
		
		// Appel du serveur
		xhr_obj.send(param);
	}
}



<!--------------------------------------------------------------------------------------------------->
<!------------------------- FICHE EQUIPE - Modification des modes de jeu ---------------------------->
<!--------------------------------------------------------------------------------------------------->
var boolMode = 0;

function modif_mode(obj, id, statut, teamId){
	
	if ( boolMode == 0 )
	{
		boolMode = 1;
		
		if ( statut == 0 )
		{
			nveauStatut = 1;
			attributsLibelle = obj;
		}
		else
		{
			nveauStatut = 0;
			attributsLibelle = obj + ' inactif';
		}
					
		// Initialisation de l'objet xhr
		var xhr_obj = null;
		
		// Test du navigateur pour savoir quel objet choisir
		if(window.XMLHttpRequest){
			xhr_obj = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){
			xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// Choix du script 
		xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
		
		xhr_obj.onreadystatechange = function()
		{
			if (xhr_obj.readyState < 4)
			{
				document.getElementById('chargement').style.display = 'inline';
				document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
			}
			
			else if(xhr_obj.readyState == 4)
			{
				if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification du mode de jeu' )
				{
					alert(xhr_obj.responseText);
					
					boolMode = 0;
				}
				else
				{
					
					document.getElementById('chargement').style.display = 'none';
					
					document.images[obj].src = xhr_obj.responseText;
					document.images[obj].alt = attributsLibelle;
					document.images[obj].title = attributsLibelle;
					document.images[obj].setAttribute('onclick', 'modif_mode(\'' + obj + '\', \'' + id + '\', \'' + nveauStatut + '\', \'' + teamId + '\');');
	
					boolMode = 0;
				}
			}
		}
		
		// En-tête 
		xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		// Paramètres à transmettre
		var param = "id=" + id + "&statut=" + nveauStatut + "&teamid=" + teamId + "&action=mode";
		
		// Appel du serveur
		xhr_obj.send(param);
	}
}



<!--------------------------------------------------------------------------------------------------->
<!------------------------ FICHE EQUIPE - Modification des environnements --------------------------->
<!--------------------------------------------------------------------------------------------------->
var boolEnvironnement = 0;

function modif_environnement(obj, id, statut, teamId){
	
	if ( boolEnvironnement == 0 )
	{
		boolEnvironnement = 1;
		
		if ( statut == 0 )
		{
			nveauStatut = 1;
			attributsLibelle = obj;
		}
		else
		{
			nveauStatut = 0;
			attributsLibelle = obj + ' inactif';
		}
					
		// Initialisation de l'objet xhr
		var xhr_obj = null;
		
		// Test du navigateur pour savoir quel objet choisir
		if(window.XMLHttpRequest){
			xhr_obj = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){
			xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// Choix du script 
		xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
		
		xhr_obj.onreadystatechange = function()
		{
			if (xhr_obj.readyState < 4)
			{
				document.getElementById('chargement').style.display = 'inline';
				document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
			}
			
			else if(xhr_obj.readyState == 4)
			{
				if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification de l\'environnement' )
				{
					alert(xhr_obj.responseText);
					
					boolEnvironnement = 0;
				}
				else
				{
					
					document.getElementById('chargement').style.display = 'none';
					
					document.images[obj].src = xhr_obj.responseText;
					document.images[obj].alt = attributsLibelle;
					document.images[obj].title = attributsLibelle;
					document.images[obj].setAttribute('onclick', 'modif_environnement(\'' + obj + '\', \'' + id + '\', \'' + nveauStatut + '\', \'' + teamId + '\');');
	
					boolEnvironnement = 0;
				}
			}
		}
		
		// En-tête 
		xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		// Paramètres à transmettre
		var param = "id=" + id + "&statut=" + nveauStatut + "&teamid=" + teamId + "&action=environnement";
		
		// Appel du serveur
		xhr_obj.send(param);
	}
}



<!--------------------------------------------------------------------------------------------------->
<!-------------------------- FICHE EQUIPE - Modification du recrutement ----------------------------->
<!--------------------------------------------------------------------------------------------------->
var boolRecrutement = 0;

function modif_recrutement(obj, teamId, statut){
	
	if ( boolRecrutement == 0 )
	{
		boolRecrutement = 1;
		
		if ( statut == 0 )
		{
			nveauStatut = 1;
			attributsLibelle = obj;
		}
		else
		{
			nveauStatut = 0;
			attributsLibelle = obj + ' inactif';
		}
					
		// Initialisation de l'objet xhr
		var xhr_obj = null;
		
		// Test du navigateur pour savoir quel objet choisir
		if(window.XMLHttpRequest){
			xhr_obj = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){
			xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// Choix du script 
		xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
		
		xhr_obj.onreadystatechange = function()
		{
			if (xhr_obj.readyState < 4)
			{
				document.getElementById('chargement').style.display = 'inline';
				document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
			}
			
			else if(xhr_obj.readyState == 4)
			{
				if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification du recrutement' )
				{
					alert(xhr_obj.responseText);
					
					boolRecrutement = 0;
				}
				else
				{
					
					document.getElementById('chargement').style.display = 'none';
					
					document.images[obj].src = xhr_obj.responseText;
					document.images[obj].alt = attributsLibelle;
					document.images[obj].title = attributsLibelle;
					document.images[obj].setAttribute('onclick', 'modif_recrutement(\'' + obj + '\', \'' + teamId + '\', \'' + nveauStatut + '\');');
	
					boolRecrutement = 0;
				}
			}
		}
		
		// En-tête 
		xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		// Paramètres à transmettre
		var param = "&statut=" + nveauStatut + "&teamid=" + teamId + "&action=recrutement";
		
		// Appel du serveur
		xhr_obj.send(param);
	}
}



<!--------------------------------------------------------------------------------------------------->
<!--------------------- Fonction d'affichage des input sur clic de la souris ------------------------>
<!--------------------------------------------------------------------------------------------------->
var boolInput = 0;
var objId;

function ajout_input(obj, prefixe){
	
	if ( boolInput == 0 ) 
	{
		objId = obj.id;
		var objInner = obj.innerHTML;
		
		if ( objInner == 'n/a')
		{
			objInner = '';
		}
		
		if ( prefixe == 'textarea' )
		{
			obj.innerHTML = '<br /><br /><textarea rows="10" cols="70" id="input_'+ objId +'" name="' + objId.id + '" onblur="valider_input(this, \'' + prefixe + '\');" >' +  document.getElementById('hidden_description_team').value + '</textarea>';
			
			document.getElementById('input_'+objId).focus();
			boolInput = 1;
		}
		else if ( prefixe == 'nbre2' )
		{
			obj.innerHTML = '<input type="text" maxlength="2" style="width: 20px;" id="input_'+ objId +'" value="' + objInner + '" name="' + objId.id + '" onblur="valider_input(this, \'' + prefixe + '\');" />';
			
			document.getElementById('input_'+objId).focus();
			boolInput = 1;
		}
		else if ( prefixe == 'nbre4' )
		{
			obj.innerHTML = '<input type="text" maxlength="4" style="width: 40px;" id="input_'+ objId +'" value="' + objInner + '" name="' + objId.id + '" onblur="valider_input(this, \'' + prefixe + '\');" />';
			
			document.getElementById('input_'+objId).focus();
			boolInput = 1;
		}
		else 
		{
			obj.innerHTML = '<input type="text" id="input_'+ objId +'" value="' + objInner + '" name="' + objId.id + '" onblur="valider_input(this, \'' + prefixe + '\');" />';
			
			document.getElementById('input_'+objId).focus();
			boolInput = 1;
		}
	}
}



<!--------------------------------------------------------------------------------------------------->
<!------------------------ FICHE EQUIPE - Modification des zones de texte --------------------------->
<!--------------------------------------------------------------------------------------------------->
function valider_input(obj, prefixe){

	valeur = obj.value;
	
	if ( prefixe == 'nbre4' || prefixe == 'nbre2' )
	{
		if ( isNaN(valeur) )
		{
			if ( prefixe == 'nbre2' )
			{
				alert('Votre saisie doit être un nombre de 2 chiffres maximum, correspondant aux effectifs disponibles dans votre équipe');
			}
			else if ( prefixe == 'nbre4' )
			{
				alert('Votre saisie doit être un nombre de 4 chiffres correspondant à la date de fondation de l\'équipe');
			}
			
			document.getElementById('input_'+obj.id).focus();
		}
		else if ( prefixe == 'nbre2' && obj.id == 'input_effectif_min' && ( valeur > document.getElementById('effectif_max').innerHTML) )
		{
			alert('L\'effectif minimum doit avoir une valeur inférieure à celle de l\'effectif maximum');
		}
		else if ( prefixe == 'nbre2' && obj.id == 'input_effectif_max' && ( valeur < document.getElementById('effectif_min').innerHTML))
		{
			alert('L\'effectif minimum doit avoir une valeur inférieure à celle de l\'effectif maximum');
		}
		else
		{
			// Initialisation de l'objet xhr
			var xhr_obj = null;
			
			// Test du navigateur pour savoir quel objet choisir
			if(window.XMLHttpRequest){
				xhr_obj = new XMLHttpRequest();
			}
			else if(window.ActiveXObject){
				xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
			}
			
			// Choix du script 
			xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
			
			xhr_obj.onreadystatechange = function()
			{
				if (xhr_obj.readyState < 4)
				{
					document.getElementById('chargement').style.display = 'inline';
					document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
				}
				else if(xhr_obj.readyState == 4)
				{
					if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification des données' )
					{
						alert(xhr_obj.responseText);
						
						boolInput = 0;
					}
					else
					{
						document.getElementById('chargement').style.display = 'none';
						document.getElementById(objId).innerHTML = valeur;
						boolInput = 0;	
					}
				}
			}
			
			// En-tête 
			xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			
			teamId = document.getElementById('hidden_id_team').value;
			if ( valeur == '' )
			{
				valeur = 'n/a';	
			}
			
			// Paramètres à transmettre
			var param = "valeur=" + valeur + "&id=" + objId + "&teamid=" + teamId + "&prefixe=" + prefixe + "&action=inputs";
			
			// Appel du serveur
			xhr_obj.send(param);
		}
	}
	else
	{
	
		// Initialisation de l'objet xhr
		var xhr_obj = null;
		
		// Test du navigateur pour savoir quel objet choisir
		if(window.XMLHttpRequest){
			xhr_obj = new XMLHttpRequest();
		}
		else if(window.ActiveXObject){
			xhr_obj = new ActiveXObject("Microsoft.XMLHTTP");
		}
		
		// Choix du script 
		xhr_obj.open("POST", "includes/teams/fiche_equipe_modif.php", true);
		
		xhr_obj.onreadystatechange = function()
		{
			if (xhr_obj.readyState < 4)
			{
				document.getElementById('chargement').style.display = 'inline';
				document.getElementById('chargement').innerHTML = '<img src="img/loader.gif" width="32px" height="32px" alt="chargement" /> Enregistrement des modifications en cours... ';
			}
			else if(xhr_obj.readyState == 4)
			{
				if( xhr_obj.responseText == 'Une erreur s\'est produite lors de la modification des données' )
				{
					alert(xhr_obj.responseText);
					
					boolInput = 0;
				}
				else
				{
					document.getElementById('chargement').style.display = 'none';
					document.getElementById(objId).innerHTML = valeur;
					
					boolInput = 0;	
				}
			}
		}
		
		// En-tête 
		xhr_obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		
		teamId = document.getElementById('hidden_id_team').value;
		if ( valeur == '' )
		{
			valeur = 'n/a';	
		}
		
		// Paramètres à transmettre
		var param = "valeur=" + valeur + "&id=" + objId + "&teamid=" + teamId + "&prefixe=" + prefixe + "&action=inputs";
		
		// Appel du serveur
		xhr_obj.send(param);
	}
}