var curPageX = 0; var curPagey = 0; var tipBox = ""; window.document.onmousemove = trackMouse; function trackMouse(e) { var e = (e) ? e : ((event) ? event : null); // Functions do different things depending on whether or not a // doctype is present. Node type 10 is a doctype but IE reads // a doctype as Node type 8 - a comment. if (document.childNodes[0].nodeType == 10 || document.childNodes[0].nodeType == 8) { curPageX = e.clientX + document.documentElement.scrollLeft; curPageY = e.clientY + document.documentElement.scrollTop; scrollPageY = document.documentElement.scrollTop; viewPageX = e.clientX; viewPageY = e.clientY; viewScreenX = document.documentElement.clientWidth; viewScreenY = document.documentElement.clientHeight; totalScreenX = document.body.offsetWidth; totalScreenY = document.body.offsetHeight; } else { curPageX = e.clientX + document.body.scrollLeft; curPageY = e.clientY + document.body.scrollTop; scrollPageY = document.body.scrollTop; viewPageX = e.clientX; viewPageY = e.clientY; viewScreenX = document.body.clientWidth; viewScreenY = document.body.clientHeight; totalScreenX = document.documentElement.scrollWidth; totalScreenY = document.documentElement.scrollHeight; } if (tipBox != "" && tipBox.style.display == "block") { moveTip(); } } function clearTip() { while (tipBox.childNodes.length > 0) { tipBox.removeChild(tipBox.childNodes[0]); } tipBox.style.display = "none"; } function toolText(headerText, tipText) { if (tipBox == "") { tipBox = document.createElement("div"); tipBox.id = "toolTipDiv"; tipBox.style.position = "absolute"; tipBox.style.display = "none"; window.document.body.appendChild(tipBox); } else { clearTip(); } // make sure box settings are up to date tipBox.style.width = Drupal.settings.scripture.tipWidth; tipBox.style.border = Drupal.settings.scripture.tipBorderSize + " solid " + Drupal.settings.scripture.tipBorderColor; if (headerText != "") { // Build the tip header var tipHead = document.createElement("div"); tipHead.style.backgroundColor = Drupal.settings.scripture.tipHeaderBgColor; tipHead.style.fontFamily = Drupal.settings.scripture.tipHeaderFontFamily; tipHead.style.fontSize = Drupal.settings.scripture.tipHeaderFontSize; tipHead.style.color = Drupal.settings.scripture.tipHeaderFontColor; tipHead.style.padding = Drupal.settings.scripture.tipHeaderPadding; tipHead.style.textAlign = Drupal.settings.scripture.tipHeaderAlign; tipHead.style.width = Drupal.settings.scripture.tipWidthHeaderSub; tipHead.style.filter = "alpha(opacity=" + Drupal.settings.scripture.tipHeaderOpacity + ")"; tipHead.style.opacity = "." + Drupal.settings.scripture.tipHeaderOpacity; tipHead.style.mozOpacity = "." + Drupal.settings.scripture.tipHeaderOpacity; var tipHeadText = document.createTextNode(headerText); tipHead.appendChild(tipHeadText); tipBox.appendChild(tipHead); } var tipBody = document.createElement("div"); tipBody.style.backgroundColor = Drupal.settings.scripture.tipBodyBgColor; tipBody.style.fontFamily = Drupal.settings.scripture.tipBodyFontFamily; tipBody.style.fontSize = Drupal.settings.scripture.tipBodyFontSize; tipBody.style.color = Drupal.settings.scripture.tipBodyFontColor; tipBody.style.padding = Drupal.settings.scripture.tipBodyPadding; tipBody.style.textAlign = Drupal.settings.scripture.tipBodyAlign; tipBody.style.width = Drupal.settings.scripture.tipWidthBodySub; tipBody.style.filter = "alpha(opacity=" + Drupal.settings.scripture.tipBodyOpacity + ")"; tipBody.style.opacity = "." + Drupal.settings.scripture.tipBodyOpacity; tipBody.style.mozOpacity = "." + Drupal.settings.scripture.tipBodyOpacity; tipBody.innerHTML = tipText; tipBox.appendChild(tipBody); tipBox.style.visibility = "hidden"; tipBox.style.display = "block"; tipHeight = tipBox.offsetHeight; moveTip(); tipBox.style.visibility = "visible"; } function moveTip() { tipXloc = curPageX + 10; tipYloc = curPageY + 10; tipHeight = tipBox.offsetHeight; tipWidth = tipBox.offsetWidth; // If the tooltip extends off the side, pull it over if (viewPageX + 10 + tipWidth > viewScreenX) { tipXloc -= (tipWidth + 15); } // If the tooltip will extend off the bottom of the screen, pull it back up. if (viewPageY + 10 + tipHeight > viewScreenY) { pageDiff = (viewPageY + 10 + tipHeight - viewScreenY); tipYloc -= pageDiff; } // If the tooltip extends off the bottom and the top, line up the top of // the tooltip with the top of the page if (tipHeight > viewScreenY) { tipYloc = scrollPageY + 5; } tipBox.style.left = tipXloc + "px"; tipBox.style.top = tipYloc + "px"; }