/**
 * Modifie la valeur d'une propriété du style de l'infobulle
 */
function _I_setStyle(p_propriete, p_valeur) {
    eval('this.paragraphe.style.' + p_propriete + ' = "' + p_valeur + '"');
}
 

/**
 * Affiche l'infobulle en mettant sa prorpiété de style DISPLAY à BLOCK
 */
function I_afficher() {
    this._setStyle('display', 'block');
}

/**
 * Masque l'infobulle en mettant sa prorpiété de style DISPLAY à None
 */
function I_masquer() {
    this._setStyle('display', 'none');
}

/**
 * Affiche l'infobulle avec pour contenu le TITLE de l'option
 * sélectionnée de la sélection passée en paramètre
 */
function I_afficherTitle(p_element) {
	var title = rechercherTitle(p_element.getAttribute('id'));
	this.setContenu(title);
    if (this.comportementNonGecko) {
        this.afficher();
    }
}

/**
 * Masque l'infobulle
 */
function I_masquerTitle() {	
    if (this.comportementNonGecko) {
        this.masquer();
    }
}

/**
 * Initialise l'infobulle
 */
function _I_initialiser(p_contenu) {
    // Crée un noeud paragraphe
    this.paragraphe = document.createElement("p");
    this.paragraphe.setAttribute('id', this.id);
    this.paragraphe.setAttribute('class', this.classe);        
    
    // Ajoute ce noeud au corps de la page
    document.body.appendChild(this.paragraphe);    
    this.setContenu(p_contenu);
    
    // Définit le mode de positionnement du paragraphe créé
    // et masque l'élément
    this._setStyle('position', 'absolute');
    this.masquer();
    
    // Détermine si le navigateur n'est pas compatible Gecko
    this.comportementNonGecko = !(new Navigateur().estGecko());
}

/**
 *
 */
function I_setDistanceHaut(p_distance) {
    this._setStyle('top', p_distance);
}

/**
 *
 */
function I_setDistanceGauche(p_distance) {
    this._setStyle('left', p_distance);
}

/**
 *
 */
function I_setContenu(p_contenu) {
    this.paragraphe.innerHTML = p_contenu;
}

/**
 *
 */
function Infobulle(p_id, p_classe, p_contenu) {
    // Déclare ses attributs
    this.id = p_id;
    this.classe = p_classe;
    this.paragraphe = null;
    this.comportementNonGecko = false;
  
    // Déclare ses méthodes
    this._setStyle = _I_setStyle;
    this._initialiser = _I_initialiser;
    this.afficher = I_afficher;
    this.masquer = I_masquer;
    this.afficherTitle = I_afficherTitle;
    this.masquerTitle = I_masquerTitle;
    this.setDistanceHaut = I_setDistanceHaut;
    this.setDistanceGauche = I_setDistanceGauche;
    this.setContenu = I_setContenu;
    
    // S'initialise
    this._initialiser(p_contenu);  
}
