function infobulle(w, h) {
	this.largeur = w;
	this.hauteur = h;
	this.body = document.getElementsByTagName('BODY')[0];
	this.infobulle = document.getElementById('fenetrePrincipale');
	this.barreTitre = document.getElementById('fenetreTitre');
	this.interieur = document.getElementById('fenetreInterieure');
	this.visible = false;
	// spécial IE
	this.correctX = 0;
	this.correctY = 0;
	
	// fonctions
	this.cree = creeInfobulle;
	this.titre = ajouteTitre;
	this.texte = ajouteTexte;
	this.montre = montreInfobulle;
	this.cache = cacheInfobulle;
	this.position = position;
}

function creeInfobulle() {
	this.infobulle.style.width = this.largeur+'px';
	this.infobulle.style.height = this.hauteur+'px';
	
	this.barreTitre.style.width = this.largeur+'px';
	this.barreTitre.style.height = "1.2em";
	
	if(navigator.appName == 'Microsoft Internet Explorer') { // apporte une correction sur le calcul des coordonnées pour IE
		element = this.infobulle;
		while(element = element.offsetParent) {
			this.correctX += element.offsetLeft;
			this.correctY += element.offsetTop;
		}
	}
}

function ajouteTitre(texte) {
	this.barreTitre.innerHTML = texte;
}

function ajouteTexte(texte) {
	this.interieur.innerHTML = "<br/>"+texte;
}

function montreInfobulle() {
	this.infobulle.style.visibility = 'visible';
	this.visible = true;
}

function cacheInfobulle() {
	this.infobulle.style.visibility = 'hidden';
	this.visible = false;
}

function position(x, y) {
	this.infobulle.style.left = (x-this.correctX) +'px';
	this.infobulle.style.top = (y-this.correctY) +'px';
}