//FUNCTION AJAX XHR enable
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;
}

// Maj THISNIV
function RetourListeCrocos(){
	window.location.replace('les-crocodiles.php');
}

function ChangeBackgroundExtras(img){
			document.getElementById("extras").style.background = 'url(images/'+img+') no-repeat left top';
	}
	
//Maj fiches crocodiles
function ShowCrocodile(niv0,niv1,niv2,map_php){
	//alert("croco_niv0="+niv0+"  croco_niv1="+niv1+"  croco_niv2="+niv2);
				var xhr = getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						document.getElementById("extras").style.background = 'url(images/'+map_php+') no-repeat left top';
						document.getElementById("corps").innerHTML = xhr.responseText;
						ShowCrocodileExtras(niv0,niv1,niv2);					
					}
				}
				xhr.open("POST","fiche-crocodile.php",true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xhr.send("croco_niv0="+niv0+"&croco_niv1="+niv1+"&croco_niv2="+niv2);
}

function ShowCrocodileExtras(niv0,niv1,niv2){
				var xhr = getXhr();
				xhr.onreadystatechange = function(){
					if(xhr.readyState == 4 && xhr.status == 200){
						document.getElementById("extras").innerHTML = xhr.responseText;
					}
				}
				xhr.open("POST","fiche-crocodile-extras.php",true);
				xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
				xhr.send("croco_niv0="+niv0+"&croco_niv1="+niv1+"&croco_niv2="+niv2);
}