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 description_aff(niveau,pg_code,pg_famille){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			leselect = xhr.responseText;
			document.getElementById('index_description').innerHTML = leselect;
		}
	}
	xhr.open("POST","ajax_description_aff.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');	
	xhr.send("niveau="+niveau+"&pg_code="+pg_code+"&pg_famille="+pg_famille);
	
}
function index_menu_aff(pg_code){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			leselect = xhr.responseText;
			document.getElementById('index_menu').innerHTML = leselect;
		}
	}
	xhr.open("POST","ajax_index_menu_aff.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	xhr.send("&pg_code="+pg_code);
	
}
function index_flash_aff(pg_code){
	var xhr = getXhr();
	xhr.onreadystatechange = function(){
		if(xhr.readyState == 4 && xhr.status == 200){
			leselect = xhr.responseText;
			document.getElementById('index_flash').innerHTML = leselect;
		}
	}
	xhr.open("POST","ajax_index_flash_aff.php",true);
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

	xhr.send("&pg_code="+pg_code);
	
}


function page_flash_aff(pg_code){
	var xhr = getXhr();
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				leselect = xhr.responseText;
				document.getElementById('page_flash').innerHTML = leselect;
			}
		}
		if(pg_code=="") pg_code=0;
		xhr.open("POST","ajax_page_flash_aff.php",true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send("pg_code="+pg_code);
}
function ssfamille_flash_aff(pg_code){
	var xhr = getXhr();
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				leselect = xhr.responseText;
				document.getElementById('page_flash').innerHTML = leselect;
			}
		}
		if(pg_code=="") pg_code=0;
		xhr.open("POST","ajax_ssfamille_flash_aff.php",true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send("pg_code="+pg_code);
}

function famille_flash_aff(pg_code){
	var xhr = getXhr();
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				leselect = xhr.responseText;
				document.getElementById('page_flash').innerHTML = leselect;
			}
		}
		if(pg_code=="") pg_code=0;
		xhr.open("POST","ajax_famille_flash_aff.php",true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send("pg_code="+pg_code);
}


function fournisseur_flash_aff(pg_code){
	var xhr = getXhr();
		xhr.onreadystatechange = function(){
			if(xhr.readyState == 4 && xhr.status == 200){
				leselect = xhr.responseText;
				document.getElementById('page_flash').innerHTML = leselect;
			}
		}
		if(pg_code=="") pg_code=0;
		xhr.open("POST","ajax_fournisseur_flash_aff.php",true);
		xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
		xhr.send("pg_code="+pg_code);
}

