var currentPopup = ""; var cX = 0; var cY = 0; function truebody() { return (!window.opera && document.compatMode && document.compatMode != "BackCompat") ? document.documentElement : document.body; } // Hide all three popups function hidePopups() { var y = document.getElementById("popup1"); y.style.visibility = "hidden"; y.style.display = "none"; y = document.getElementById("popup2"); y.style.visibility = "hidden"; y.style.display = "none"; y = document.getElementById("popup3"); y.style.visibility = "hidden"; y.style.display = "none"; y = document.getElementById("popup4"); y.style.visibility = "hidden"; y.style.display = "none"; currentPopup = ""; } function showPopup(x,w,h) { // Get popup div var y = document.getElementById(x).style; // Set position y.left = Math.max((cX-w/2),0) + "px"; y.top = Math.max((cY-h-10),0) + "px"; // Display it y.visibility = "visible"; y.display = "block"; // Set variable so we know which popup is open currentPopup = x; } function movePopup() { var y = document.getElementById(currentPopup); var w = y.offsetWidth; var h = y.offsetHeight; // Set position y.style.left = Math.max((cX-w/2),0) + "px"; y.style.top = Math.max((cY-h-10),0) + "px"; } function mouseMove(e) { if (!e) { e = window.event; } cX = truebody().scrollLeft + e.clientX; cY = truebody().scrollTop + e.clientY; if (currentPopup !== "") { movePopup(currentPopup); } } document.onmousemove = mouseMove;