// JavaScript Document // Global variables // Global variables xMousePos = 0; // Horizontal position of the mouse on the screen yMousePos = 0; // Vertical position of the mouse on the screen xMousePosMax = 0; // Width of the page yMousePosMax = 0; // Height of the page function captureMousePosition(e) { if (document.layers) { // When the page scrolls in Netscape, the event's mouse position // reflects the absolute position on the screen. innerHight/Width // is the position from the top/left of the screen that the user is // looking at. pageX/YOffset is the amount that the user has // scrolled into the page. So the values will be in relation to // each other as the total offsets into the page, no matter if // the user has scrolled or not. xMousePos = e.pageX; yMousePos = e.pageY; xMousePosMax = window.innerWidth+window.pageXOffset; yMousePosMax = window.innerHeight+window.pageYOffset; } else if (document.all) { // When the page scrolls in IE, the event's mouse position // reflects the position from the top/left of the screen the // user is looking at. scrollLeft/Top is the amount the user // has scrolled into the page. clientWidth/Height is the height/ // width of the current page the user is looking at. So, to be // consistent with Netscape (above), add the scroll offsets to // both so we end up with an absolute value on the page, no // matter if the user has scrolled or not. xMousePos = (window.event.x+document.documentElement.scrollLeft); yMousePos = window.event.y+document.documentElement.scrollTop; xMousePosMax = document.body.clientWidth+document.documentElement.scrollLeft; yMousePosMax = document.body.clientHeight+document.documentElement.scrollTop; } else if (document.getElementById) { // Netscape 6 behaves the same as Netscape 4 in this regard xMousePos = e.pageX; yMousePos = e.pageY; xMousePosMax = window.innerWidth+window.pageXOffset; yMousePosMax = window.innerHeight+window.pageYOffset; } //fi } //function if (document.layers) { // Netscape document.captureEvents(Event.MOUSEMOVE); document.onmousemove = captureMousePosition; } else if (document.all) { // Internet Explorer document.onmousemove = captureMousePosition; } else if (document.getElementById) { // Netcsape 6 document.onmousemove = captureMousePosition; } //if /*/ * Outputs error message * to error bubble. /*/ function putErrorBubbleMsg(err){ var errorText =document.getElementById('error_text');// document.frames.error_bubble.document.getElementById('error_text'); errorText.innerHTML=err; } // function putErrorBubbleMsg(err) timerRunning = false; /*/ * showBubble shows the error bubble * targetObj is the id of the * element you are targeting. * * bubbleId is the id of the bubble * that will contain the message * * msg is a html message to put into * the pop up bubble. /*/ function showBubble(targetObj,bubbleId,msg,timer,userMousePosition,callFunctionOnOpen,callFunctionOnClose){ if(timerRunning){ clearTimeout(myTimer); }//if putErrorBubbleMsg(msg); target = document.getElementById(targetObj); document.getElementById(bubbleId).style.display = 'inline'; if(userMousePosition==true){ var yPos = (yMousePos- document.getElementById(bubbleId).clientHeight-2); var xPos = (xMousePos - (document.getElementById(bubbleId).clientWidth*.75)); }else{ var yPos = findPosY(target,bubbleId,document.getElementById(bubbleId).clientHeight-2); var xPos = findPosX(target,bubbleId,document.getElementById(bubbleId).clientWidth*.75); } document.getElementById(bubbleId).style.top = (yPos<0)?'0':yPos +"px"; document.getElementById(bubbleId).style.left = (xPos<0)?'0':xPos +"px"; /*/ * Can pass a function to call when teh bubble opens as a string /*/ if(callFunctionOnOpen){ eval(callFunctionOnOpen); } /*/ * Can pass a function to call when teh bubble closes as a string /*/ if(callFunctionOnClose){ document.getElementById(bubbleId).onclick = function(){ //document.getElementById(bubbleId).style.display='none'; eval(callFunctionOnClose); } }else{ document.getElementById(bubbleId).onclick = function(){ document.getElementById(bubbleId).style.display='none'; } } myTimer = setTimeout("hideBubble('"+bubbleId+"','"+callFunctionOnClose+"')",timer); timerRunning = true; } /*/ * Hides caps lock bubble /*/ function hideBubble(layer,callFunctionOnClose){ document.getElementById(layer).style.left = -1500+"px"; document.getElementById(layer).style.display = 'none'; if(callFunctionOnClose){ eval(callFunctionOnClose); } timerRunning = false; } /*/ * Get the x position of an * object on the current page * and align the object by the * offset of a layer. /*/ function findPosX(obj,layer,offSet){ var layerOffset = 0; var curleft = 0; if (obj.offsetParent){ while (obj.offsetParent){ curleft += obj.offsetLeft obj = obj.offsetParent; } }else if (obj.x){ curleft += obj.x; } return curleft-offSet; } /*/ * Get the y position of an * object on the current page * and align the object by the * offset of a layer. /*/ function findPosY(obj,layer,offset){ var curtop = 0; if (obj.offsetParent){ while (obj.offsetParent){ curtop += obj.offsetTop obj = obj.offsetParent; } }else if (obj.y){ curtop += obj.y; } return curtop-offset; }