/*
  Easy Hint by marshen

  Put this src in your body tag
  
  <div class="invis" id="hint" style="position: absolute;" onClick="hidehint2('');" onMouseOver="clearhide();" onMouseOut="hidehint2('');">&nbsp;</div>
  
  
  
  Only for hint with overlay
  
  <div class="invis" id="overlay_hint" style="position: absolute;" onClick="hidehint2('ol');">&nbsp;</div>

*/

if (window.netscape) document.onmousemove = getpos;
var hide = '';


function getpos(event) {
  eventx = event.pageX;
  eventy = event.pageY;
}

function showhint(text,type) {
  clearhide();
  var div = getHintId();
  calchintpos(div,type);
  div.innerHTML = text;
  div.className = 'vis';
}

function shwhint(text) {
	showhint(text,'');
}
function shwoverlay(text) {
	getOverlayId().className = 'vis';
	showhint(text,'ol');
}

function hidehint() {
  clearhide();
	hide = window.setTimeout("getHintId().className = 'invis'; getOverlayId().className = 'invis';", 1000);
}

function hidehint2() {
	clearhide();
	hide = window.setTimeout("getHintId().className = 'invis'; getOverlayId().className = 'invis';", 10);
}

function clearhide() {
  window.clearTimeout(hide);
}

//calculates the hint position
function calchintpos(div,type) {
	myOffsetX = 20;
	myOffsetY = 0;
	if (type == 'ol') {
		myOffsetX = -20;
		myOffsetY = -20;
	}
	
	
  if (document.all) {
    div.style.left = window.event.clientX + document.body.scrollLeft + myOffsetX;
    div.style.top = window.event.clientY + document.body.scrollTop + myOffsetY;
  } else if (window.netscape) {
    div.style.left = eventx + myOffsetX + "px";
    div.style.top = eventy + myOffsetY + "px";
  }
}

//returns hint object
function getHintId() {
	return document.getElementById('hint');
}
function getOverlayId() {
	return document.getElementById('overlay_hint');
}