var isNav, isIE; var coll = ""; var styleObj = ""; if (parseInt(navigator.appVersion) >= 4){ if (navigator.appName == "Netscape") { isNav = true; }else{ isIE = true; coll = "all."; styleObj = ".style"; } } function balloonHelp(message, evt){ var posX = 0; var posY = 0; var left = false; var top = false; if (isNav){ posX = evt.pageX + 15; posY = evt.pageY; if (posX == null){ posX = evt.screenX + 15; } if (posY == null){ posY = evt.screenY; } }else{ posX = window.event.clientX + 15; posY = window.event.clientY; } var balloon = document.getElementById("balloonhelp"); balloon.zIndex = 99; var window_width = 0; var window_height = 0; if (isNav){ window_width = window.innerHeight; window_height = window.innerWidth; }else{ // create the checkpoint element var cp = document.createElement("div"); cp.style.position = "absolute"; cp.style.width = "0px"; cp.style.height = "0px"; cp.style.right = "0px"; cp.style.bottom = "0px"; // we can only read it's position after we // insert it into the document document.body.appendChild(cp); // here we get the actual client size window_width = cp.offsetLeft; window_height = cp.offsetTop; } var divHeight = 150; var divWidth = 150; if (balloon.clientHeight != null){ divHeight = balloon.clientHeight; divWidth = balloon.clientWidth; } left = posX < (window_width - divWidth); top = posY < (window_height - divHeight); if (balloon.clientHeight != null){ if (!left){ if (balloon.clientWidth == 0){ posX -= 100; } posX -= (balloon.clientWidth + 30); } if (!top){ posY -= (balloon.clientHeight); } }else{ // lets at least make sure we move elements away a little when this // DOM property is not supported posX -= 150; posY -= 150; } // draw the balloon to the middle if we have "issues" // debug //status = "div " + divWidth + "w:" + divHeight + "h" + " window" + window_width + "w:" + window_height + "h"; if (divWidth > (window_width / 2)){ posX = window_width / 2 - divWidth / 2; } if (divHeight > window_height / 2){ posY = window_height / 2 - divWidth / 2; } balloon.innerHTML = '' + message + ''; balloon.style.display = "block"; if (isNav){ try{ balloon.moveTo(posX, posY); }catch(e){ // silly mozilla, DOM is for grown ups balloon.style.left = posX; balloon.style.top = posY; } }else{ var theShim = document.getElementById('DivShim'); balloon.style.left = posX; balloon.style.top = posY; theShim.style.width = balloon.offsetWidth; theShim.style.height = balloon.offsetHeight; theShim.style.top = balloon.style.top; theShim.style.left = balloon.style.left; theShim.style.zIndex = balloon.style.zIndex - 1; theShim.style.display = "block"; } } function hideBalloonHelp(){ var balloon = document.getElementById("balloonhelp"); balloon.style.display = "none"; if (!isNav){ var theShim = document.getElementById("DivShim"); theShim.style.display = "none"; } }