// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Temporary variables to hold mouse x-y pos.s
var mouseX = 0;
var mouseY = 0;


// help window width and height
var helpWidth = 300, helpHeight = 400;

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e) {
  mouseX = e ? e.pageX : window.event.clientX;
  mouseY = e ? e.pageY : window.event.clientY;
  
  //check screensize, minimum resolution 640x480
  var screenW = 640, screenH = 480;

  if (parseInt(navigator.appVersion)>3) {
     screenW = screen.availWidth;
     screenH = screen.availHeight;
  }
  else if (navigator.appName == "Netscape" 
	    && parseInt(navigator.appVersion)==3
	    && navigator.javaEnabled()
	   ) 
  {
    var jToolkit = java.awt.Toolkit.getDefaultToolkit();
    var jScreenSize = jToolkit.getScreenSize();
    screenW = jScreenSize.width;
    screenH = jScreenSize.height;
  }

  // catch possible negative or out of screen values
  if (mouseX+helpWidth > screenW) mouseX = screenW-helpWidth;
  if (mouseY+helpHeight > screenH) mouseY = screenH-helpHeight;  
  if (mouseX < 0) mouseX = 0;
  if (mouseY < 0) mouseY = 0;  
}

function openPopup (winurl, wintitle) {
  var pos = "width="+helpWidth+",height="+helpHeight+",top="+mouseY+",left="+mouseX+",status=no,toolbar=no,location=no,resizable=yes,scrollbars=yes";  
  var newWin = window.open (winurl, wintitle, pos);
  if (newWin) newWin.focus();
  return newWin?true:false;
}
