function CursorTrailer()
{
   var i = "/" + top.AppService +"/Immagini/";
   this.imgCursor = ["default",     "crosshair",         "crosshair",         "crosshair",             "default",              "crosshair",             "crosshair" ]; 
   this.imgFiles  = [""       ,     i + "curZoom.gif",   i + "curZoomIn.gif", i + "curZoomOut.gif",    i + "curInfo.gif",      i + "curHand.gif",       i + "curGrab.gif" ];
   this.imgModes  = ["none",        "zoom",              "zoomin",            "zoomout",               "info",                 "hand",                  "grab" ];
   this.mode = "none";
   this.divObj = null;
   this.imgObj = null;
   this.refObj = null;

   this.init = function (doc, ref)
   {
      doc.write ('<div id="trailimageid" style="position:absolute; visibility:hidden; z-index: 1000;">');
      doc.write ('<img id="cursorimg" src="" border="0" >');
      doc.write ('</div>');
      this.divObj = doc.getElementById("trailimageid");
      this.imgObj = doc.images["cursorimg"];
      this.refObj = ref;
      this.setMode (this.mode);
   };
   
   this.hide = function ()
   {
      this.imgObj.style.visibility="hidden";
      this.divObj.style.visibility="hidden";
   };
   
   this.hang = function ()
   {
      this.imgObj.style.visibility="hidden";
      this.divObj.style.visibility="hidden";
   };

   this.show = function (x, y)      // Coordinate assolute
   {
      if (this.isInside(x, y))
      {
         x += 10;
         y += 10;
         this.imgObj.style.visibility="visible";
         with (this.divObj.style)
         {
            visibility = "visible";
            left = x+"px";
            top  = y+"px";
         }
      }
      else
      {
         this.hide();
      }   
   };
   
   this.isInside = function (x, y)
   {
      var mbr = absCoords(this.refObj, this.refObj.parentWindow);

      var l = mbr[0];
      var t = mbr[1];
      var r = mbr[0] + mbr[2];
      var b = mbr[1] + mbr[3];
      
      return (x >= l && x <= r && y >= t && y <= b);
   };
   
   this.setMode = function (m)
   {
      for (var i = 0; i < this.imgModes.length; i++)
      {
         if (this.imgModes[i] == m)
         {
            this.mode = m;
            this.refObj.style.cursor = this.imgCursor[i];
            this.imgObj.style.cursor = this.imgCursor[i];
            this.imgObj.src = this.imgFiles[i];
            break;
         }
      }
   }
}