// JScript File

	var posx = 200;
	var posy = 200;
  
    var isOpera = (navigator.userAgent.indexOf('Opera') != -1);
    var isIE = (!isOpera && navigator.userAgent.indexOf('MSIE') != -1)
    var isFirefox = (!isOpera && navigator.userAgent.indexOf('Firefox') != -1)
    var isImageVisible = false;

	var last_image = "";
	var stored_image = "";
	

	  // we need to tell Mozilla to start listening:

//if (window.Event && document.captureEvents) {
//document.captureEvents(Event.MOUSEMOVE);
//}

    // we need to assign the mouse handler in Mozilla
    if (isFirefox) {
//        document.onmousemove = showPopup;
    }


 function showPopup(e, image) {
 
// alert(image);

     // N.B. Firefox never calls this function with both "e" and "image" set 
     //   - so we store "image" until "e" is set 
     
     // if we have a value for image store it for later 
     //and flag that the image is supposed to be seen
     if (image != null) stored_image = image;
     if (image != null) isImageVisible = true;
     
     // we don't have a value for image but we have one stored use the stored one
     if (image == null && stored_image != null) image = stored_image;

     // if the image hasn't changed we don't need to continue
     // otherwise store the image in the last image variable
     if (image != null && last_image != null) {
        if (image == last_image) {
          return; 
        } else {
       last_image = image;
        }
     }

	if (!e) var e = window.event;  // IE, Opera
	if (!e) var e = window.Event;  // Mozilla

    if (e != null) {
    	if (e.pageX || e.pageY) 	{
	    	posx = e.pageX;
		    posy = e.pageY;
    	}
	    else if (e.clientX || e.clientY) 	{
		    posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		    posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
	    }
	} else {
	    // browser may be Firefox
	}
	
	if (posy > document.body.scrollHeight - 200) {
	    posy = document.body.scrollHeight - 200;
	}
    
    // in Firefox if the image is not meant to be seen - just exit
    if (isFirefox) {
        if (! isImageVisible) exit;
     }

	// do what we need to do and flag that the image should be visible 
	document.getElementById("popup").style.left=(posx + 30) + "px";
	document.getElementById("popup").style.top=(posy - 30) + "px";
    document.getElementById("popup").innerHTML = "<table border=\"1\" bgcolor=\"white\" cellpadding=\"5\" cellspacing=\"0\" class=\"popup-table\" cellpadding=15>" +
        "<tr><td><img src=\"" + image + "\"></td></tr></table>";
        
    isImageVisible = true;
    
    return false;
}

function hidePopup() {
	var popup = document.getElementById("popup");
	popup.innerHTML="";
	stored_image = null;
	isImageVisible = false;
} 
