var isie = document.all?true:false
function getObj(id)
{
	return document.getElementById(id);
}

var mposX, mposY = 100;
function logXY(e)
{
	if (isie) {
		mposX = window.event.clientX + document.body.scrollLeft;
    	mposY = window.event.clientY + document.body.scrollTop;
    } else {
		mposX = e.pageX;
		mposY = e.pageY;
	}
}
document.onmousemove = logXY;
function bubble()
{
	this.b = document.createElement('span');;
	this.b.className = 'bubble';
	this.b.style.display = 'none';
	//this.b.onmouseout = function(){b.offbubble=true;b.doHide();}
	this.b.onclick = function(){b.offbubble=true;b.offelement=true;b.doHide();}

	this.offbubble;
	this.offelement;

	this.isOffBubble = function()
	{
		return ((parseInt(this.b.style.left) <= mposX && mposX <= (parseInt(this.b.style.left)+this.b.offsetWidth)) && (parseInt(this.b.style.top) <= mposY && mposY <= (parseInt(this.b.style.left)+this.b.offsetHeight))) ? true : true;
	}

	this.show = function(s)
	{
		this.b.innerHTML = getObj('b_'+s).innerHTML;
		getObj('b_container').appendChild(this.b);
		this.b.style.display = '';
		this.b.style.left = mposX - this.b.offsetWidth - 10 +'px';
		this.b.style.top = mposY+10 +'px';
		this.b.style.bottom = this.b.style.right = 'auto';
		this.offbubble = this.isOffBubble();
		this.offelement = false;
		//alert(this.isOffBubble());
	}

	this.hide = function()
	{
		if(!this.b)return true;
		this.offelement = true;
		this.doHide();
	}

	this.doHide = function()
	{
		if(!this.b)return true;
		if(!this.isOffBubble() || !this.offelement) return;
		this.b.style.display = 'none';
	}
}
