// VERIFICATION POUR LE HTTP REQUEST
function verif_xhr()
{
	if(window.XMLHttpRequest) // Firefox et autres
		xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer
	{  
		try 
		{
			xhr_object = new ActiveXObject("Msxml2.XMLHTTP"); 
		}
		catch (e) 
		{
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	else // XMLHttpRequest non supporté par le navigateur
	{  
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr_object = false; 
	} 	
}

// CREATION OU DESTRUCTION D'UNE SESSION
function projet(p_projet)
{
	verif_xhr();
	
	xhr_object.open("POST", 'themes/main/scripts/resultats.php',true);
		
	xhr_object.onreadystatechange = function()
	{
		if (xhr_object.readyState == 4 && xhr_object.status == 200) 
		{
			if(xhr_object.responseText)
			{
				document.getElementById('zone').innerHTML = xhr_object.responseText
				return true;
			}
		}
	}
	
	xhr_object.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr_object.send("projet="+p_projet);
}

// AFFICHAGE
function affiche(p_id) 
{  		
	if (document.getElementById(p_id).style.display == 'none')
		document.getElementById(p_id).style.display = '';					
}

// MASQUAGE
function masque(p_id) 
{  		
	if (document.getElementById(p_id).style.display == '' || document.getElementById(p_id).style.display == 'block')		
		document.getElementById(p_id).style.display = 'none';			
}

// AFFICHAGE ET MASQUAGE
function affiche_masque(p_select) 
{ 		
	for(cpt = 1; cpt != p_select.options.length; cpt ++)
		document.getElementById("zone"+cpt).className = "";
		
	document.getElementById("zone"+p_select.value).className = "affiche";
}

// AFFICHAGE ET MASQUAGE
function affiche_masque3(p_select) 
{ 		
	for(cpt = 1; cpt != p_select.options.length; cpt ++)
		document.getElementById("pens"+cpt).className = "";
		
	document.getElementById("pens"+p_select.value).className = "affiche";
}


// AFFICHAGE ET MASQUAGE
function affiche_masque2(p_select) 
{ 		
	for(cpt = 1; cpt != p_select.options.length; cpt ++)
	{
		if(document.getElementById("credit"+cpt).className == "affiche")
			document.getElementById("credit"+cpt).className = "";
	}
		
	for(cpt = 1; cpt <= p_select.value; cpt ++)
		document.getElementById("credit"+cpt).className = "affiche";
}
