// Permet d'afficher la photo en grand dans zone contenu
function affiche_photo_grand(id_photo){
	Effect.Fade('contenu', {duration: 1});
	
	var par = window.parent.document;
	var mon_div_photo = par.getElementById('div_photo_grand');
	var mon_div_photo_2 = par.getElementById('photo_grand_2');
	mon_div_photo.removeChild(mon_div_photo_2);
		
	var mon_div_photo_2 = par.createElement('div');
	mon_div_photo_2.className = 'photo_grand_2';
	mon_div_photo_2.id = 'photo_grand_2';
	
	var new_img = par.createElement('img');
	new_img.id = 'image_grand';
	new_img.src = 'fichiers/lecture_photo_grand.php?id_img='+id_photo;

	mon_div_photo_2.appendChild(new_img);
	mon_div_photo.appendChild(mon_div_photo_2);
	
	document.getElementById('div_photo_grand').style.visibility = 'visible';
	Effect.Appear('div_photo_grand', {duration: 1});
}
 //------------------------------------------------------------------------------------------
 // Permet d'effacer la photo de la zone contenu
function efface_photo(){
	Effect.Fade('div_photo_grand', {duration: 1});
	Effect.Appear('contenu', {duration: 1});
	//document.getElementById('div_photo_grand').style.visibility = 'hidden';	
	//document.getElementById('contenu').style.visibility = 'visible';
	//document.getElementById('image_grand').src = '';
}

 //------------------------------------------------------------------------------------------
 // Appel du fichier ajax permettant de flouter une photo
function floute_photo(id_photo, valeur){
	if (valeur == true){
		document.getElementById(id_photo).className =  'photos_floue';
	}
	else {
		document.getElementById(id_photo).className =  'photos';
	}
	
	var xhr_object = null; 
	     
	if(window.XMLHttpRequest) // Firefox 
		xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) // Internet Explorer 
		xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else { // XMLHttpRequest non supporté par le navigateur 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		return; 
	} 
	 
	xhr_object.open("POST", "ajax/flouter_photo.php", true);
	xhr_object.onreadystatechange = function() { 
		if(xhr_object.readyState == 4) {
			// alert(xhr_object.responseText); // DEBUG MODE
			// --- ICI le retour (c'est à dire tout ce qui est écrit dans le fichier de traitement)
			// --- est interprété, donc il suffi d'écrire du code JS dans traitement.php pour
			// --- qu'il soit interprété au retour.
			eval(xhr_object.responseText);
		}
	}

	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	// --- ICI TU PASSE TES ARGUMENTS AU SCRIPT :
	var data = "id_photo="+id_photo+"&valeur="+valeur;
	xhr_object.send(data);	
}