tooltip = null;
offset = 5;

document.onmousemove = update_tooltip;

function update_tooltip(e) {
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
	if (tooltip != null) {
		xmax = document.body.offsetWidth - parseInt(tooltip.style.width) - 24 - offset;  // 24 wg. potentiellen Scrollbar
		if (x > xmax)
			x = xmax;
		tooltip.style.left = (x + offset) + "px";
		tooltip.style.top  = (y + offset) + "px";
	}
}

function show_tooltip(id,text) {
	tooltip = document.getElementById(id);
	tooltip.innerHTML = text;
	tooltip.style.display = "block";
}

function hide_tooltip() {
	tooltip.style.display = "none";
}
