var InfoBulle = new TInfoBulle();

function TInfoBulle() {
//Attributs:
	this.InfoBulle 		= new Array;
	this.ATypeAnim  	= 0;
	this.AEcartX		= 10;
	this.AEcartY		= 10;
	this.AVitesseAnim	= 5;
	this.AIdJob			= 0;
	this.AEtat			= true;
	this.ALogOpen		= false;
	this.ALogClose		= false;
	this.ADisplayTime	= 1000;
	this.AStyle			= "position:absolute;top:100px;left:100px;padding: 2px;border: black 1px solid;font-size: 9pt;font-family: Arial, Verdana;background-color: #ffff99;color: black;z-index:999;";
//Methodes:
	this.Add 			= TAddInfoBulle;	
	this.GetLibelle		= TGetLibelle;
}

function TAddInfoBulle(id,libelle) {
	this.InfoBulle.push(new TInfo(id,libelle));
}

function TGetLibelle(id) {
	var i = 0,rep = "";
	var reste = true;
	while (this.InfoBulle[i] && reste) {
		if (this.InfoBulle[i].Id == id) {
			rep = this.InfoBulle[i].Libelle;
			reste = false;
		}	
		i++;
	}	
	return rep;
}

function TInfo(id,libelle) {
	this.Id = id;
	this.Libelle = libelle;
	add_event("id",id,null,"mousemove","affiche_info_bulle");
	add_event("id",id,null,"mouseout","efface_info_bulle");
	if (!getElem("id","info_bulle",null)) {
		document.write("<div id=\"info_bulle\"></div>");
		set_style_div("id","info_bulle",null,InfoBulle.AStyle);
		hide_div("id","info_bulle",null);
	}	
}

function affiche_info_bulle(e) {
	var direction = "";
	var x = get_mouse_x_abs(e);
	var y = get_mouse_y_abs(e);
	if (!InfoBulle.ALogOpen && InfoBulle.AEtat) {	
		set_xy_div("id","info_bulle",null,x+InfoBulle.AEcartX,y+InfoBulle.AEcartY);
		if (!is_visible_div("id","info_bulle",null) ) {
			setCont("id","info_bulle",null,InfoBulle.GetLibelle(this.id));
			if (InfoBulle.ATypeAnim > 0 && !OP) {
				switch (InfoBulle.ATypeAnim) {
					case 1:direction="right";break;
					case 2:direction="left";break;
					case 3:direction="top";break;
					case 4:direction="bottom";break;
					default:break;
				}
				InfoBulle.ALogOpen = true;
				move_clip_open("id","info_bulle",null,direction,InfoBulle.AVitesseAnim,3,0,"InfoBulle.ALogOpen = false;");
			}
			else show_div("id","info_bulle",null);
			InfoBulle.AIdJob = setTimeout("efface_info_bulle(0);",InfoBulle.ADisplayTime);
			InfoBulle.AEtat = true;
		}	
	}	
	return false;	
}

function bouge_info_bulle(e) {
	var x = get_mouse_x_abs(e);
	var y = get_mouse_y_abs(e);
	if (!InfoBulle.ALogOpen && 
		!InfoBulle.ALogClose && 
		InfoBulle.AEtat) {	
		set_xy_div("id","info_bulle",null,x+InfoBulle.AEcartX,y+InfoBulle.AEcartY);
	}	
	return false;	
}

function efface_info_bulle(e) {
	if (e == 0 && is_visible_div("id","info_bulle",null)) {
		InfoBulle.AIdJob = 0;
		InfoBulle.AEtat = false;
	}	
	else {
		if (InfoBulle.AIdJob > 0) {
			clearTimeout(InfoBulle.AIdJob);
			InfoBulle.AIdJob = 0;
		}	
		InfoBulle.AEtat = true;
	}	
	
	if (!InfoBulle.ALogClose) {	
		if (is_visible_div("id","info_bulle",null)) {
			if (InfoBulle.ATypeAnim > 0 && !OP) {
				switch (InfoBulle.ATypeAnim) {
					case 1:direction="left";break;
					case 2:direction="right";break;
					case 3:direction="bottom";break;
					case 4:direction="top";break;
					default:break;
				}
				InfoBulle.ALogClose = true;
				move_clip_close("id","info_bulle",null,direction,InfoBulle.AVitesseAnim,3,0,"InfoBulle.ALogClose = false;");
			}
			else hide_div("id","info_bulle",null);
		}	
	}		
	return false;	
}

function enleve_info_bulle(id) {
	remove_event("id",id,null,"mousemove","bouge_info_bulle");
	remove_event("id",id,null,"mouseout","efface_info_bulle");
}