var pendingHide = null;
var tooltip = null;

function bcHeatmapHoverCell(state, id){
	if(state == "on"){
			document.getElementById(id).style.border = '1px solid #000000';
			document.getElementById(id).style.padding = '0px';
	}else if(state == 'off'){
			document.getElementById(id).style.border = '0px solid #000000';
			document.getElementById(id).style.padding = '1px';
	}
}

function hideTooltip() {
	if (tooltip) pendingHide = setTimeout("tooltip.style.display = 'none';", 200);
}

function showTooltip (e, label) {
	if (pendingHide) {
		clearTimeout(pendingHide);
		pendingHide = null;
	}
	e = e || window.event;
	if (!tooltip) {
		tooltip = document.createElement('div');
		tooltip.style.position = 'absolute';
		tooltip.id = 'tooltip';
		var tooltipText = document.createElement('div');
		tooltipText.className = 'tooltip';
		tooltip.appendChild(tooltipText);
		document.body.appendChild(tooltip);
	} else {
		tooltipText = tooltip.firstChild;
	}
	tooltipText.innerHTML = label;

	var left = e.pageX || (e.clientX +
		(document.documentElement.scrollLeft || document.body.scrollLeft));
	var top = e.pageY || (e.clientY +
		  (document.documentElement.scrollTop || document.body.scrollTop));

	tooltip.style.display = '';
	tooltip.style.top = (top-(tooltipText.offsetHeight+4))+'px';
	tooltip.style.left = (left+2)+'px';
}
