/* position of the tooltip relative to the mouse in pixel */
var offsetx = 12;
var offsety =  8;

function NewElement(newid)
{ 
	if(document.createElement)
	{ 
		var el = document.createElement('div'); 
		el.id = newid;     
		with(el.style)
		{ 
			display = 'none';
			position = 'absolute';
		} 
		el.innerHTML = '&nbsp;'; 
		document.body.appendChild(el); 
	} 
} 
function GetPosition(e) 
{
	var posx = 0;
	var posy = 0;

	// Set to window event if not set
	if (!e) 
	{
		var e = window.event;
	}

	if (e.pageX || e.pageY)   
	{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)  
	{
		posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	}

	var lixlpixel_tooltip = document.getElementById('tooltip');
	lixlpixel_tooltip.style.left = (posx+offsetx) + 'px';
	lixlpixel_tooltip.style.top = (posy+offsety) + 'px';
	/* posx and posy contain the mouse position relative to the document
	   Do something with this information */
}
function ToolTipImage(imagePath)
{
	if(!document.getElementById('tooltip'))
	{
		NewElement('tooltip');
	}

	var lixlpixel_tooltip = document.getElementById('tooltip');
	lixlpixel_tooltip.innerHTML = '&nbsp;';

	if(imagePath)
	{
		lixlpixel_tooltip.innerHTML = '<img src="'+imagePath+'" alt="" title="" />';
	}

	lixlpixel_tooltip.style.display = 'block';
	document.onmousemove = GetPosition;
}

function ToolTip(tip, imagePath)
{
	if(!document.getElementById('tooltip'))
	{
		NewElement('tooltip');
	}

	var lixlpixel_tooltip = document.getElementById('tooltip');
	lixlpixel_tooltip.innerHTML = tip;

	if(imagePath)
	{
		lixlpixel_tooltip.innerHTML = tip + '<br /><img src="'+imagePath+'" alt="" title="" />';
	}

	lixlpixel_tooltip.style.display = 'block';
	document.onmousemove = GetPosition;
}

function Exit()
{
	document.getElementById('tooltip').style.display = 'none';
}
