function modifier(id, id2,suffixe) {
	if(document.getElementById('href_ouvert'+id2).firstChild.style.display =='block'){
		document.getElementById('href_cache'+id2).firstChild.style.display='block';
		document.getElementById('href_ouvert'+id2).firstChild.style.display='none';
		document.getElementById(id).style.display='block';
	} else {
		document.getElementById(id).style.display='none';
		document.getElementById('href_cache'+id2).firstChild.style.display='none';
		document.getElementById('href_ouvert'+id2).firstChild.style.display='block';
	}

}

function ajouter(id, fichier, opt, site,prix) {
	if(document.getElementById('img_'+id).src == 'http://netskiss.fr/agenceweb/devis/img/bouton_ajouter_off.gif'
		|| document.getElementById('img_'+id).src == 'http://www.netskiss.fr/agenceweb/devis/img/bouton_ajouter_off.gif' ) {
		document.getElementById('img_'+id).src='/agenceweb/devis/img/bouton_ajouter_on.gif';
		ajouterSelection(fichier, opt, site,prix);
	} else {
		document.getElementById('img_'+id).src='/agenceweb/devis/img/bouton_ajouter_off.gif';
		deselectionner(opt, site,prix);
	}
}

function getXhr(){
	var xhr = null; 
	if(window.XMLHttpRequest) // Firefox et autres
		xhr = new XMLHttpRequest(); 
	
	else if(window.ActiveXObject){ // Internet Explorer 
		try {
			xhr = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			xhr = new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	
	else { // XMLHttpRequest non supporté par le navigateur 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		xhr = false; 
	} 
	
	return xhr;
}

function deselectionner(id, site){
	var xhr = getXhr();
	// On défini ce qu'on va faire quand on aura la réponse
	xhr.onreadystatechange = function(){
	// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4){
			//alert(xhr.responseText);
			var leselect = xhr.responseText;
				document.getElementById('prix').innerHTML = leselect;
			}
	}
	// Ici on va voir comment faire du post
	xhr.open("POST","/agenceweb/devis/deselectionner.php",true);
	
	// ne pas oublier ça pour le post
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	// ne pas oublier de poster les arguments
	// ici, l'id du groupe
	xhr.send("id="+id+"&site="+site);
	
}

function ajouterSelection(fichier,id, site, prix){
	var xhr = getXhr();
	// On défini ce qu'on va faire quand on aura la réponse
	xhr.onreadystatechange = function(){
	// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4){
			//alert(xhr.responseText);
			var leselect = xhr.responseText;
				document.getElementById('prix').innerHTML = leselect;
			}
	}
	// Ici on va voir comment faire du post
	xhr.open("POST",fichier,true);
	
	// ne pas oublier ça pour le post
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	// ne pas oublier de poster les arguments
	// ici, l'id du groupe
	xhr.send("id="+id+"&site="+site+"&prix="+prix);
	
}

function ajouterSelect(fichier,id){
	var xhr = getXhr();
	// On défini ce qu'on va faire quand on aura la réponse
	xhr.onreadystatechange = function(){
	// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
		if(xhr.readyState == 4){
			//alert(xhr.responseText);
			var leselect = xhr.responseText;
				document.getElementById('famille').innerHTML = leselect;
			}
	}
	// Ici on va voir comment faire du post
	xhr.open("POST",fichier,true);
	
	// ne pas oublier ça pour le post
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	
	// ne pas oublier de poster les arguments
	// ici, l'id du groupe
	xhr.send("id="+id);
	
}


