/* =================================================================================================
 * DisplayImage
 * August, 2007
 *
 * Copyright 2007-2007, Philippe Plamondon (www.asystechnologies.com)
 * =================================================================================================
 * "Can I use this?"
 *
 * Use of this library is governed by the Creative Commons Attribution 2.0 License. You can check it
 * out at: http://creativecommons.org/licenses/by/2.0/
 *
 * Basically: You may copy, distribute, and eat this code as you wish. But you must give me credit
 * for writing it. You may not misrepresent yourself as the author of this code.
 * =================================================================================================
 * updates:
 * dd.mm.yyyy Fixed cascade problem with menus nested greater than two levels.
 * ============================================================================================== */
var i;
var mouseX = 0;
var mouseY = 0;

function Is_IE(){
   return document.all?true:false;
}

function getMouseXY(e){

  if (Is_IE()) { // grab the x-y pos.s if browser is IE
     mouseX = event.clientX + document.body.scrollLeft;
     mouseY = event.clientY + document.body.scrollTop;
     if (document.body.scrollTop == 0) mouseY = event.clientY + document.documentElement.scrollTop;

  } else {  // grab the x-y pos.s if browser is NS
     mouseX = e.pageX;
     mouseY = e.pageY;
  }
  // catch possible negative values in NS4
  if (mouseX < 0){mouseX = 0;}
  if (mouseY < 0){mouseY = 0;}
}

function displayLayer(id, display) {
   var d = document.getElementById(id);

   if (d) {
      if (display == 'O') {
         if (!Is_IE()){
            d.style.display  = 'table';
            d.style.top = mouseY + "px";
            
         }else{
            d.style.display  = 'block';
            d.style.top = mouseY + "px";
            d.style.left= mouseX + "px";
         }
      }else{
         d.style.display='none';
      }
   }
}

function loadImage(id, url) {
   //var i = document.getElementById(id);
   i = document.getElementById(id);
   if (i) {
      i.src = url;
      displayLayer("Viewer", 'O');
   }
}

