pic1= new Image(100,25); 
pic1.src="/img-deco/ajax-loader.gif"; 

function masque(id_logo_texte, nbr_reac) {
	document.getElementById("liste_commentaires_logo_texte-"+id_logo_texte).style.display="block";
	document.getElementById("menu_commentaires-"+id_logo_texte).innerHTML="<img src=\"/img-deco/fleches-bas.gif\" width=\"9\" height=\"9\" />&nbsp;<a href='#' class=\"texte-normal\" onclick='affiche("+id_logo_texte+", "+nbr_reac+"); return false;'>Masquer les commentaires ("+nbr_reac+")</a>";
}

function affiche(id_logo_texte, nbr_reac) {
	document.getElementById("liste_commentaires_logo_texte-"+id_logo_texte).style.display="none";
	document.getElementById("menu_commentaires-"+id_logo_texte).innerHTML="<img src=\"/img-deco/fleches.gif\" width=\"9\" height=\"6\" />&nbsp;<a href='#' class=\"texte-normal\" onclick='masque("+id_logo_texte+", "+nbr_reac+"); return false;'>Afficher les commentaires ("+nbr_reac+") - Laisser un commentaire</a>";
}

function objConnexion(id_logo_texte, nbr_reac){
	//on definie la fonction de traitement de la réponse
	this.callBack = function() {
		if (this.obj.readyState==4){
			if (this.obj.status == 200){	  	
			  var result = this.obj.responseText;
			  document.getElementById("menu_commentaires-"+id_logo_texte).innerHTML="<img src=\"/img-deco/fleches-bas.gif\" width=\"9\" height=\"9\" />&nbsp;<a href='#' class=\"texte-normal\" onclick='affiche("+id_logo_texte+", "+nbr_reac+"); return false;'>Masquer les commentaires ("+nbr_reac+")</a>";
			  document.getElementById("liste_commentaires_logo_texte-"+id_logo_texte).innerHTML=result;
			}else{
			  alert('Problème de connexion ');
		  }
	  }
	}
	
	//
	try{
		this.obj = new ActiveXObject("Msxml2.XMLHTTP")
	}
	catch(e){
		try{
			this.obj = new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch(oc){
			this.obj = null
		}		
	}
	if(!this.obj&&typeof XMLHttpRequest!="undefined")
		this.obj = new XMLHttpRequest()
		
	return this
}



// fonction qui interroger l'url
function get_commentaires_logo_texte(id_logo_texte, nbr_reac, url_post) {
	document.getElementById("liste_commentaires_logo_texte-"+id_logo_texte).style.display="block";
	document.getElementById("liste_commentaires_logo_texte-"+id_logo_texte).innerHTML = '<center><img src="/img-deco/ajax-loader.gif" alt="" width="16" height="16" /></center>';
	var url = '/franche-comte/template/commentaires_logo_texte_httprequest.php?id_logo_texte='+id_logo_texte+'&url_post='+url_post;
	//connexion asynchrone au serveur pour recuperer les données des biens trouvés
	//alert(url);
	connexion_asc(url, id_logo_texte, nbr_reac);
}

// fonction qui interroge l'URL
function connexion_asc(url, id_logo_texte, nbr_reac) {
	var methode = "GET";
	var asynchrone = true;
	var httpRequest = new objConnexion(id_logo_texte, nbr_reac);
	
	if (httpRequest) {
    try{
	    var _this = httpRequest;
			//Appel de la fonction de callback quand l'objet XMLHTTPRequest change de status
			httpRequest.obj.onreadystatechange = function() {
				//alert(_this);
				_this.callBack();
			}
	  	httpRequest.obj.open(methode, url, asynchrone);
    	httpRequest.obj.send(null);
			
    }catch(oe){
    }
	}
}
