// ** Popup box hover thingy (c)2005 by Ralph Capper
// ** Free for you to use - but please credit me - www.ralpharama.co.uk
// Start trapping mouse


var ent; // Our floating div
var posx=0; // Our mouseX
var posy=0; // Our mouseY
var offsetX= -30; // Offset X away from mouse
var offsetY=20; // Offset Y
var popUp = false; // Is it showing right now??!

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

// Main function to retrieve mouse x-y pos.s


// Run upon load
function init() {
// Set up div we will use to hover our text
ent = document.createElement("div");
// Change these to customise your popup
ent.style.color = "#ffffff";
ent.style.font = "normal 9pt verdana";
ent.style.fontWeight = "bold";
ent.style.padding = "4px 4px 4px 4px";
ent.style.background = "#00553a";
ent.style.border = "1px solid black";
ent.style.width = "150px";
// Don't, however, change these
ent.style.left = -100;
ent.style.top = -100;
ent.style.position = 'absolute';
ent.innerHTML = '';
ent.style.zIndex = 50;
document.getElementById("thepage").appendChild(ent);
}

function doText(t, e) {
popUp = true;
ent.innerHTML = t;
}
// Change back to nothing

function getMouseXY(e) 
{
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  }  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
	
	tempX = tempX + offsetX;
	tempY = tempY + offsetY;
		
	if (popUp) {
		ent.style.left = tempX + "px";
		ent.style.top = tempY + "px";
	}
}

function doClear() {
popUp = false;
ent.style.left = -100 + "px";
ent.style.top = -100 + "px";
ent.innerHTML = "";
}

