var NS4 = (document.layers) ? 1 : 0;
var IE4 = (document.all) ? 1 : 0;

function clearEl() {}

var style = ((NS4 && document.test) || IE4) ? 1 : 0;

var timerID = null;

var padding = 3; // < 4 recommended
var bgcolor = "#e0e4ef";

var borWid = 1; // for no border, assign null
var borCol = "#0a4891";
var borSty = "solid";

var str = "<STYLE TYPE='text/css'>";
str += ".tooltip {";
str += "position: absolute;";
str += "visibility: hidden;";
str += "left: 0; top: 0;";
if (borWid > 0) { // if a border is specified
	str += "border-width: " + borWid + ";";
	str += "border-color: " + borCol + ";";
	str += "border-style: " + borSty + ";";
}
if (NS4) {
	if (borWid > 0 && padding <= 3) {
		str += "padding: 0;";
		str += "layer-background-color: " + bgcolor + ";";
	} 
	else if (borWid > 0 && padding > 3) {
		str += "padding: " + (padding - 3) + ";";
		str += "background-color: " + bgcolor + ";";
	} 
	else if (borWid == 0) {
		str += "padding: " + padding + ";";
		str += "layer-background-color: " + bgcolor + ";";
	}
} 

else {
	str += "padding: " + padding + ";";
	str += "background-color: " + bgcolor + ";";
}
str += "}";
str += "</STYLE>";

if (style) {
	document.write(str);
		if (NS4) window.onload = init;
}

function init() {
	setTimeout("window.onresize = redo", 1);
}

function redo() {
	window.location.reload();
}

function makeEl(id, width, code) {
	if (!style) return;
	var str = "<STYLE TYPE='text/css'>";
	str += "#" + id + " {";
	str += "width: " + width + ";";
	str += "}";
	str += "</STYLE>";
	str += "<DIV CLASS='tooltip' ID='" + id + "'>" + code + "</DIV>";
	document.write(str);
}

function displayEl(left, top) {
	if (NS4) document.releaseEvents(Event.MOUSEMOVE);
		document.onmousemove = null;
	var whichEl = (NS4) ? document[active] : document.all[active].style;
	whichEl.left = left;
	whichEl.top = top;
	whichEl.visibility = (NS4) ? "show" : "visible";
}

function clearEl() {
	if (!style) return;
	var whichEl = (NS4) ? document[active] : document.all[active].style;
	whichEl.visibility = (NS4) ? "hide" : "hidden";
	active = null;
	if (timerID) clearTimeout(timerID);
	if (NS4) document.releaseEvents(Event.MOUSEMOVE);
	document.onmousemove = null;
}

function activateEl(id, e) {
	if (!style) return;
	active = id;
	if (NS4) document.captureEvents(Event.MOUSEMOVE);
	document.onmousemove = checkEl;
	checkEl(e);
}

function checkEl(e) {
	if (timerID) clearTimeout(timerID);
	var left = (NS4) ? e.pageX-10 : event.clientX + document.body.scrollLeft-10;
	var top = (NS4) ? e.pageY + 15 : event.clientY + document.body.scrollTop + 15;
	timerID = setTimeout("displayEl(" + left + ", " + top + ")", 1);
}