// Récupération d'une photo pour l'aperçu
var chemin = "http://www.locations-franqui.com/";

function recupererPhoto(ident){
	var xhr=null;
    if (window.XMLHttpRequest){ 
        xhr = new XMLHttpRequest();
    }else if (window.ActiveXObject){
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xhr.onreadystatechange = function() { afficherApercu(xhr);};
    xhr.open("GET", chemin+"recuperer-photo.php?id="+ident, true);
    xhr.send(null);
}

function afficherApercu(xhr){
    if (xhr.readyState == 4  && xhr.status == 200){
		var doc = xhr.responseXML;
		document.getElementById('photo_apercu').src = chemin + "photos-locations/" + doc.getElementsByTagName('galerie').item(0).firstChild.data + "/" +doc.getElementsByTagName('fichier').item(0).firstChild.data;
		if(doc.getElementsByTagName('alt').item(0).firstChild) document.getElementById('photo_apercu').alt = doc.getElementsByTagName('alt').item(0).firstChild.data;
		else document.getElementById('photo_apercu').alt = "";
		document.getElementById('titre_apercu').innerHTML = doc.getElementsByTagName('titre').item(0).firstChild.data;
	}
}