var oDv=document.createElement("div");
var dvHdr=document.createElement("div");
var dvBdy=document.createElement("div");
var windowlock,boxMove,fixposx,fixposy,lockX,lockY,fixx,fixy,ox,oy,boxLeft,boxRight,boxTop,boxBottom,evt,mouseX,mouseY,boxOpen,totalScrollTop,totalScrollLeft;
boxOpen=false;
ox=10;
oy=10;
lockX=0;
lockY=0;

function initBoxOver() {
	
	dvHdr=document.createElement("div");
	dvBdy=document.createElement("div");

	dvHdr.className = "boxOverHdr";
	dvBdy.className = "boxOverBdy";
	
	oDv.appendChild(dvHdr);
	oDv.appendChild(dvBdy);
	oDv.style.position="absolute";
	oDv.style.display="none";
	oDv.style.visibility="hidden";
	oDv.style.width="250px";
	oDv.style.zIndex="900";
	document.body.appendChild(oDv);	
	
	
	if (document.layers) { // Netscape
    	document.captureEvents(Event.MOUSEMOVE);
		document.onmousemove = updateDivPos;
	} else if (document.all) { // Internet Explorer
		document.onmousemove = updateDivPos;
	} else if (document.getElementById) { // Netcsape 6
		document.onmousemove = updateDivPos;
	}
	
}

function showBoxOver(headerTxt, bodyTxt){

	dvHdr.innerHTML = headerTxt;
	dvBdy.innerHTML = bodyTxt;
	oDv.style.visibility="visible";
	oDv.style.display="block";

}

function moveMouseFunc(e){
	
  if (!e) e = window.event; // works on IE, but not NS (we rely on NS passing us the event)
 
  if (e)
  { 
    if (e.pageX || e.pageY)
    { // this doesn't work on IE6!! (works on FF,Moz,Opera7)
      mouseX = e.pageX;
      mouseY = e.pageY;
    }
    else if (e.clientX || e.clientY)
    { // works on IE6,FF,Moz,Opera7
      // Note: I am adding together both the "body" and "documentElement" scroll positions
      //       this lets me cover for the quirks that happen based on the "doctype" of the html page.
      //         (example: IE6 in compatibility mode or strict)
      //       Based on the different ways that IE,FF,Moz,Opera use these ScrollValues for body and documentElement
      //       it looks like they will fill EITHER ONE SCROLL VALUE OR THE OTHER, NOT BOTH 
      //         (from info at http://www.quirksmode.org/js/doctypes.php)
      mouseX = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
      mouseY = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
    }
  }	
	
  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winWidth = window.innerWidth;
    winHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    winWidth = document.documentElement.clientWidth;
    winHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    winWidth = document.body.clientWidth;
    winHeight = document.body.clientHeight;
  }
	
}


function updateDivPos(e) {
	
	moveMouseFunc(e);
	
	oDvWidth = oDv.clientWidth;
	oDvHeight = oDv.clientHeight;

	if((mouseX+oDvWidth) > winWidth) oDv.style.left= mouseX-oDvWidth + 14 + 'px';
	else oDv.style.left=mouseX+14 + 'px';
	
	if((mouseY+oDvHeight) > winHeight) oDv.style.top= mouseY-oDvHeight + 14 + 'px';
	else oDv.style.top=mouseY+21 + 'px';

}

function hideBoxOver(){
	oDv.style.visibility="hidden";
	oDv.style.display="none";
}

