﻿var mouseOffset = [-350, 15]; // Div x,y offsets from cursor position in pixels.
//var currentHeight = 400;	// Maximum image height.

if (document.getElementById || document.all)
    document.write('<div id="rollover"></div>');

var prevObj = (document.all) ? document.all['rollover'] : document.getElementById("rollover");
var docBody = (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body;

function showtrail(title, body, xOffset, yOffset)
{
    newHTML = '<div class="prog-desc">';
    newHTML += '<span class="prog-desc-head">' + title + '</span><br /><br />';
    newHTML += body;
    newHTML += '</div>';

    if (xOffset != null)
        mouseOffset[0] = xOffset;
    if (yOffset != null)
        mouseOffset[1] = yOffset;

    prevObj.innerHTML = newHTML;

    document.onmousemove = followmouse;
}

function hidetrail()
{
    prevObj.style.display = "none";
    prevObj.innerHTML = "";
    document.onmousemove = "";
}

function followmouse(e)
{
    var xCoord = mouseOffset[0];
    var yCoord = mouseOffset[1];

    var docWidth = (document.all) ? docBody.scrollLeft + docBody.clientWidth : pageXOffset + window.innerWidth - 15;
    var docHeight = (document.all) ? Math.min(docBody.scrollHeight, docBody.clientHeight) : window.innerHeight;

    if (typeof e != "undefined")
    {
        xCoord += e.pageX;
        yCoord += e.pageY;
    }
    else if (typeof window.event != "undefined")
    {
        xCoord += docBody.scrollLeft + event.clientX;
        yCoord += docBody.scrollTop + event.clientY;
    }

    if (yCoord < 0)
        yCoord = yCoord * -1;

    prevObj.style.left = xCoord + "px";
    prevObj.style.top = yCoord + "px";
    prevObj.style.display = "inline";
}