// Declare important variables...
var mouseX, mouseY, mouseOver, mouseOffsetX, mouseOffsetY;
var divID;

// Place the window X pixels below the cursor...
mouseOffsetX = "-20";
mouseOffsetY = "250";

// Figure out the browser we are working with...
var IE = document.all?true:false
if (!IE) document.captureEvents(Event.MOUSEMOVE);

// This gets the coordinates of the mouse.
document.onmousemove = setMouseXY;
if (!IE) document.captureEvents(Event.MOUSEMOVE);

// This moves the div to the mouse's position with the designated offsets
function moveWindow2Mouse() {
    divID.style.left = (mouseX - mouseOffsetX)+'px';
    divID.style.top = (mouseY - mouseOffsetY)+'px';
}

// This moves the div back to 0,0 so that the page isn't extended outwards far.
function moveWindow2Start() {
    divID.style.left = 0+'px';
    divID.style.top = 0+'px';
}

// When the mouse is moved, this sets the variables above.
function setMouseXY(e) {
    if(IE) {
        mouseX = event.clientX + document.body.scrollLeft;
        mouseY = event.clientY + document.body.scrollTop;
    } else {
        mouseX = e.pageX;
        mouseY = e.pageY;
    }

    if(mouseY < 0) mouseX = 0;
    if(mouseY < 0) mouseY = 0;

    // Move the div ONLY when it is over something defined on the page.
    if(mouseOver == 1) moveWindow2Mouse();

    return true;
}

// Sets the content inside the div
function EnterContent(id,title,content,width) {
    var div = get_by_id(id);
    div.innerHTML = '<table border="0" width="'+width+'" cellspacing="1" cellpadding="2" class="tooltiptable">'+
'<tr><td class="tooltip_head">'+ title +'</td></tr>'+
'<tr><td class="tooltip_body">'+ content +'</td></tr>'+
'</table>';
}

// Sets the div up and makes it visible
function Activate(id) {
    divID = get_by_id(id);
    mouseOver = 1;
    moveWindow2Mouse();
    show();
}

// Stops the div from following the mouse.
function deActivate(id) {
    divID = get_by_id(id);
    mouseOver = 0;
    hide();
}

// This actually causes the window to be shown
function show() {
    divID.style.display = 'block';
    divID.style.visibility = 'visible';
}

// This actually causes the window to be hidden
function hide() {
    divID.style.display = '';
    divID.style.visibility = 'hidden';
}


function EnterContentLite(id, content)
{
    var div = get_by_id(id);
    div.innerHTML = content;
}

