<!--

_bubble.instances = new Array()
//var t=0;

function _bubble(divName,decalX,decalY,relativeToDivName)
{
	this.id = _bubble.instances.length;
	_bubble.instances[this.id] = this;
	
	this.decalX = decalX;
	this.decalY = decalY;
	
	this.divName = divName;
	this.div = document.getElementById(divName);
	
	this.contentDivName = divName+'-content';
	this.contentDiv = document.getElementById(this.contentDivName);

	this.relativeToDivName = relativeToDivName;
	if(relativeToDivName.length > 0)
	{
		this.relativeToDiv = document.getElementById(this.relativeToDivName);
	}
	
	this.timer = null;
	this.autoUpdateTimer = null;
}

_bubble.prototype.stopAutoUpdatePosition = function()
{
	if(this.autoUpdateTimer!=null)
	{
		clearInterval(this.autoUpdateTimer);
		this.autoUpdateTimer = null;
	}
	else
	{
	}
}


_bubble.prototype.autoUpdatePosition = function()
{
	if(this.autoUpdateTimer!=null)
	{
		clearInterval(this.autoUpdateTimer);
		this.autoUpdateTimer = null;
	}
	else
	{
	}

	this.autoUpdateTimer = setInterval( "_bubble.instances["+this.id+"].moveToMousePosition()",20);
}

_bubble.prototype.autoDisappear = function(seconds)
{
	if(this.timer!=null)
	{
		clearInterval(this.timer);
		this.timer = null;
		//alert('timer en cours');
	}
	else
	{
		//alert('timer libre');
	}

	this.timer = setInterval( "_bubble.instances["+this.id+"].disappear()",seconds*1000);
}

_bubble.prototype.appearAtMousePosition = function()
{
	this.moveToMousePosition();
	this.appear();
}

_bubble.prototype.appearWithContent = function(content)
{
	this.setContent(content);
	this.moveToMousePosition();
	this.appear();
}

_bubble.prototype.setContent = function(content)
{
	this.contentDiv.innerHTML = content;
}

_bubble.prototype.appear = function()
{
	this.div.style.visibility = 'visible';
	this.div.style.opacity = 1.0;
}

_bubble.prototype.disappear = function()
{
	this.div.style.opacity = 0.0;
	this.div.style.visibility = 'hidden';
	
	if(this.timer!=null)
	{
		clearInterval(this.timer);
		this.timer = null;
	}
	
	this.stopAutoUpdatePosition();
}

_bubble.prototype.moveToMousePosition = function()
{
	//var posX = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
	var posX = get_mouse_x();
	posX+=this.decalX;
	
	//t++;
	//this.setContent('posX='+posX+'  t='+t);
	
	//alert('mouseX='+posX);
	
	//var posY = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.x+document.body.scrollTop;
	var posY = get_mouse_y();
	posY+=this.decalY;

	if(this.relativeToDiv!=null)
	{
		//alert(''+_div_getXPos(this.relativeToDiv));
		posX-=_div_getXPos(this.relativeToDiv);
		//alert('posX='+posX);
		//posY+=this.relativeToDiv.style.top;
	}
	
	this.div.style.left = posX+'px';
	this.div.style.top = posY+'px';
}


//-->
