function majDiv(cible, params, php) {
	var xhr_object = null;
	if(window.XMLHttpRequest) xhr_object = new XMLHttpRequest(); 
	else if(window.ActiveXObject) xhr_object = new ActiveXObject("Microsoft.XMLHTTP"); 
	else {
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); 
		return;
	}
	xhr_object.open("POST", php, true);
	xhr_object.onreadystatechange = function() {
		if (xhr_object.readyState == 4) {
			cible.innerHTML = xhr_object.responseText;
		}
	}
	xhr_object.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
	xhr_object.send(params);
}

var timerBulle = null;

function tailleEcran() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  var tab = new Array;
  tab[0] = myWidth;
  tab[1] = myHeight;
  return tab;
}

function posBulle (div) {
	document.getElementById(div).style.top=Number(posY-100) + 'px';
	var ecran = tailleEcran();
	var decalGauche = 0;
	var larg = document.getElementById(div).offsetWidth + 50;
	if (posX > (ecran[0] - larg)) decalGauche = larg;
	document.getElementById(div).style.left=Number(30 + posX - decalGauche) + 'px';
}

function bulle(id, afficher) {
	if (document.getElementById("bulle")) {
		if (afficher) {
			timerBulle = setInterval("posBulle('bulle')", 25);
			document.getElementById("bulle").className="visible";
			majDiv(document.getElementById("bulle"), "id="+id, "visite_bulle.php");
		} else {
			if (timerBulle) {
				clearInterval(timerBulle);
				timerBulle = null;
			}
			document.getElementById("bulle").className="invisible";
			document.getElementById("bulle").innerHTML = "";
		}
	}
}

function infosPartenaire(id) {
	posBulle("bulle2");
	document.getElementById("bulle2").className="visible";
	majDiv(document.getElementById("bulle2"), "id="+id, "infosPartenaire.php");
	return false;
}
function fermeInfosPartenaire() {
	document.getElementById("bulle2").className="invisible";
	document.getElementById("bulle2").innerHTML = "";
	return false;
}

function zoomImage(image, imageW, imageH) {
	var div = document.getElementById("zoomImage");
	var ecran = tailleEcran();
	var left = (ecran[0]-imageW)/2;
	if (imageH < ecran[1]) var top = (ecran[1]-imageH)/2;
	else var top = 0;
	div.style.left = left+"px";
	div.style.top = top+"px";
	var masque = document.getElementById("masqueTransparent");
	masque.style.height = document.body.clientHeight+"px";
	if (document.all) masque.style.width = ecran[0]+"px";
	div.className="visible";
	masque.className="visible";
	majDiv(div, "img="+image, "zoomImage.php");
	return false;
}
function zoomImage_Fermer() {
	var div = document.getElementById("zoomImage");
	div.className="invisible";
	document.getElementById("masqueTransparent").className="invisible";
	div.innerHTML = "";
}