var popUpWidth = 250;  //Change the popUpWidth to your requirements. 
var screenAvail = 1100;	//Change to your available screen width. You see in 
                        //this eBooks' middle frame, the frame width is
												//equal to 410 . So whether your using frames or
												//or a full 800 pixel screen, you must calculate 
												//your available screen width.  

var dropPopUp = document.getElementById("dfnPopUp");
document.write('<div id="dfnPopUp" style="visibility:hidden;z-index:4;width:'+popUpWidth+';position:absolute;"></div>');

var popUpWidth = 250;  //Change the popUpWidth to your requirements. 
var screenAvail = 1100;	//Change to your available screen width. You see in 
                        //this eBooks' middle frame, the frame width is
												//equal to 410 . So whether your using frames or
												//or a full 800 pixel screen, you must calculate 
												//your available screen width.  

var dropPopUp = document.getElementById("dfnPopUp");
document.write('<div id="dfnPopUp" style="visibility:hidden;z-index:4;width:'+popUpWidth+';position:absolute;"></div>');

function fnDef(obj,b){
 dropPopUp = document.getElementById("dfnPopUp");
 dropPopUp.innerHTML = b.innerHTML
 
 dropPopUp.style.left = getPos(obj,"Left");
 var screenNeed = getPos(obj,"Left") + popUpWidth;

if (screenNeed > screenAvail){

//The number 10 below is an extra offset x value applied when the 
//definitional popup box positions beyond your screen width. You 
//can change this number to fine tune your "beyond screenwidth" positioning. 
 var screenOffset = getPos(obj,"Left") +  popUpWidth - (screenAvail);
 dropPopUp.style.left = getPos(obj,"Left") - (screenOffset - 10);
 }
 dropPopUp.style.top = getPos(obj,"Top") + obj.offsetHeight;
 dropPopUp.style.visibility = 'visible';
}

function getPos(obj,sPos){
var iPos = 0;
while (obj != null) {
iPos += obj["offset" + sPos];
obj = obj.offsetParent;}
return iPos;
}

function hidePopUp(){
dropPopUp = document.getElementById("dfnPopUp");
dropPopUp.style.visibility = 'hidden';
}
