<!--

function so_clearInnerHTML(obj) 
{
	// so long as obj has children, remove them
	while(obj.firstChild) obj.removeChild(obj.firstChild);
}


function ChangePhoto(ind)
{

 document.getElementById('coeurimg').src=document.getElementsByTagName('img')[ind].src;
 
 for (i =2;i< document.getElementsByTagName('img').length;i++)
	document.getElementsByTagName('img')[i].style.border="0px solid";
 //alert( document.getElementsByTagName('img')[ind].width);
	
 document.getElementsByTagName('img')[ind].style.border="2px solid red";
}
function getImage(pExistingImageID, pImageURL)
{
    var img = document.createElement('img');
    img.onload = function (evt) {
        document.getElementById(pExistingImageID).src=this.src;
		//var hauteur=this.height;
		//alert(this.height);
		//alert(this.width);
		var largeur=200*this.height/this.width;
		//alert(largeur);
			
		//this.height=15;
		//this.width=	20;	
        //document.getElementById(pExistingImageID).width=2*this.width;
        //document.getElementById(pExistingImageID).height=2*this.height;
		//document.getElementById(pExistingImageID).style.height=this.height+"px";
		//document.getElementById(pExistingImageID).style.width=this.width+"px";
		//alert(document.getElementById(pExistingImageID).style.width);
    }
	img.src = pImageURL;
    return false;
	}
	function getMinia( pImageURL,ind){
		
    var img = document.createElement('img');
    img.onload = function (evt) {
		//alert(document.getElementsByTagName('img')[ind]);
        document.getElementsByTagName('img')[ind].src=this.src;
		document.getElementsByTagName('img')[ind].style.display = "block";
		if(ind==3)
			document.getElementsByTagName('img')[ind].style.border="2px solid red";
		else
			document.getElementsByTagName('img')[ind].style.border="0px solid red";
	    }
    img.src = pImageURL;
    return false;
}


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 GetBien(xhr)
{
// On ne fait quelque chose que si on a tout reçu et que le serveur est ok
if(xhr.readyState == 4 && xhr.status == 200){ 
	var docXML=xhr.responseXML;

	var items=docXML.getElementsByTagName("commune");
		
	longueurCible=document.getElementById("valcom").firstChild.length;
	
	document.getElementById("valcom").firstChild.replaceData(0, longueurCible,items.item(0).firstChild.data);
	
	items=docXML.getElementsByTagName("ref");
				
	longueurCible=document.getElementById("valref").firstChild.length;
	document.getElementById("valref").firstChild.replaceData(0, longueurCible,items.item(0).firstChild.data);
			
	items=docXML.getElementsByTagName("detail");
	longueurCible=document.getElementById("legende").firstChild.length;
	document.getElementById("legende").firstChild.replaceData(0, longueurCible,items.item(0).firstChild.data);
	items=docXML.getElementsByTagName("prix");
	longueurCible=document.getElementById("valprix").firstChild.length;
	if(items.item(0).firstChild.data!="0")
		document.getElementById("valprix").firstChild.replaceData(0, longueurCible,items.item(0).firstChild.data+" €");
	else
		{
		var strPrix="nous consulter";
		
		document.getElementById("valprix").firstChild.replaceData(0, longueurCible,strPrix);
		}
	items=docXML.getElementsByTagName("photo");
	//alert(items.item(0).firstChild.data);
	getImage('coeurimg',"photos/" + items.item(0).firstChild.data);
	//alert(items.length);
	for(i=0;i<6;i++)
		document.getElementsByTagName('img')[i+3].style.display = "none";
	//getMinia("photos/" + items.item(0).firstChild.data,i+2);
	for(i=0;i<items.length;i++)
		{
		//alert("photos/" + items.item(i).firstChild.data);
		getMinia("photos/" + items.item(i).firstChild.data,i+3);
		}
	
	}
}
			
function go()
{
var xhr = getXhr();
xhr.onreadystatechange = function(){GetBien(xhr);};
xhr.open("GET","getBienxml.php",true);
xhr.send(null);
setTimeout("go()",10000);
}


			//setTimeout("go()",10000);
 
 //-->


