/** Class for displaying and hiding simple tooltips. */
var Tip = {

	prefix: {content: 'Tooltip_', iFrame: 'TooltipIFrame_'},

	/**
	 * Display a tooltip over a particular element.
	 *
	 * @param elementId   Id of the tooltiped element.
	 * @param x           Left coordinate of the tooltip in pixels.
	 * @param y           Top coordinate of the tooltip in pixels.
	 */
	show: function(elementId, x, y) {
		var tt = document.getElementById(elementId);
		if (x == null) {
			x = 1;
		}
		if (y == null) {
			y = 1;
		}
		tt.style.left = x+'px';
		tt.style.top = y+'px';
		tt.style.visibility = 'visible';
		tt.style.display = 'block';
		// IFrame hack to eliminate drop-down list and applet z-index problems
		var iframe = document.getElementById(Tip.prefix.iFrame+elementId);
		if (iframe != null) {
			iframe.style.left = x+'px';
			iframe.style.top = y+'px';
			iframe.style.width = tt.offsetWidth+'px';
			iframe.style.height = tt.offsetHeight+'px';
			iframe.style.display = 'block';
			iframe.style.visibility = 'visible';
		}
	},

	/**
	 * Remove a tooltip of a particular element.
	 *
	 * @param elementId   Id of the tooltiped element.
	 */
	hide: function(elementId) {
		var ttStyle = document.getElementById(elementId).style;
		ttStyle.visibility = 'hidden';
		ttStyle.display = 'none';
		// IFrame hack to eliminate drop-down list and applet z-index problems
		var iframe = document.getElementById(Tip.prefix.iFrame+elementId);
		if (iframe != null) {
			iframe.style.visibility = 'hidden';
			iframe.style.display = 'none';
		}
	}
};
