<!--

  var FM_LEFT       = 0x00000001;  
  var FM_BOTTOM     = 0x00000002;  
  var FM_RIGHT      = 0x00000004;  
  var FM_TOP        = 0x00000008;  
  var FM_TOPLEFT    = 0x00000010;  
  var FM_BOTTOMLEFT = 0x00000020;
  var FM_BOTTOMRIGHT= 0x00000040;
  var FM_RTL        = 0x00000080;
  var FM_NOSHADOW   = 0x00000100;
  var FM_EVAL       = 0x00000200;
  var FM_FIXEDPOS   = 0x00000400;

  // USE FM_BLOCKSTYLE to force a desired message style
  
  var FM_OFFSET   = 13
  var FM_MAXWIDTH = 350

  var nFMStyle = 0
  var nFMDefaultStyle = eval("FM_EVAL | FM_RTL | FM_BOTTOMLEFT")
  var bFM = false
  var bForceFM = false
  var bDisableFM = false
  var FM_nFixedPosX = 0;
  var FM_nFixedPosY = 0;
  var FM_bSticky = false;
  var FM_bDrag = false;
  var FM_nDragStartX;
  var FM_nDragStartY;

//---------------------------------

  document.onmousemove = OnMouseMove;

  var oLastObj = null
  //---------------------------------

  function FM_StartDrag (obj, event)
  //       ~~~~~~~~~~~~
  {
    obj.setCapture(true)
    FM_nDragStartX = event.screenX;
    FM_nDragStartY = event.screenY;
    FM_bDrag = true
  }
  //---------------------------------------------------------------

  function FM_ContinueDrag (event)
  //       ~~~~~~~~~~~~~~~
  {
    if (FM_bDrag)
    {
      divFM.style.left  = divFM.offsetLeft + event.screenX - FM_nDragStartX;
      divFM.style.top   = divFM.offsetTop + event.screenY - FM_nDragStartY;
      FM_nDragStartX = event.screenX;
      FM_nDragStartY = event.screenY;
      FM_AdjustShadow();
    }  
  }
  //---------------------------------------------------------------

  function FM_EndDrag (obj)
  //       ~~~~~~~~~~
  {
    obj.releaseCapture()
    FM_bDrag = false
  }
  //-----------------------------------------------------------------

  function OnMouseMove ()
  //       ~~~~~~~~~~~
  {
    if (bDisableFM || FM_bSticky)
      return;
    var oElement = event.srcElement
    
    try
    {
      if (!bForceFM)
      {
        while (oElement != null && typeof(oElement.FM) != "string" && (!bFM || (oElement != divFM && oElement != divShadow)))
          oElement = oElement.parentElement;

        if (!bFM || (oElement != divFM && oElement != divShadow))
        {
          if (oElement != null)
          {
            if (oElement != oLastObj)
            {
              var nStyle = nFMDefaultStyle
              FM_Hide()
              if (typeof(oElement.FMSTYLE) == "string")
                nStyle = eval(oElement.FMSTYLE)
              if (typeof(oElement.FMPOS) == "string")
              {
                nStyle |= FM_FIXEDPOS;
                var s = oElement.FMPOS
                FM_nFixedPosX = eval(s.substr(0,s.indexOf(",")))
                FM_nFixedPosY = eval(s.substr(s.indexOf(",")+1))
              }
              
              if ((nStyle & FM_EVAL) != 0)
              {
                try { FM(eval(oElement.FM) , nStyle) } catch(e) { }
              }  
              else  
                FM(oElement.FM, nStyle)
            }   
          }
          else
          if (bFM)
            FM_Hide()
          oLastObj = oElement
        }  
        if (!bFM)
          return;
      }    
      var nMouseX = event.x;
      var nMouseY = event.y; 
      var nNewPosX;
      var nNewPosY;
      var nHeight;
      var nWidth;

      if (document.body.currentStyle.direction == "rtl")
      {
        sOverflow = document.body.style.overflow

        if (sOverflow == "visible" || sOverflow == "hidden")
          bScrollBar = false
        else  
        if (sOverflow == "" || sOverflow == "scroll")
          bScrollBar = true
        else
        if (document.body.scrollHeight > document.body.clientHeight)
          bScrollBar = true
        else  
          bScrollBar = false
        if (bScrollBar)
          nMouseX -= 18;

        nMouseX += (document.body.scrollLeft - (document.body.scrollWidth - document.body.clientWidth))  
      }

      if ((nFMStyle & FM_RTL) == FM_RTL)
      {
        TheText.align = "right"
        TheText.dir = "rtl"
      }  
      else  
      {
        TheText.align = "left"
        TheText.dir = "ltr"
      }  

      nHeight = divFM.offsetHeight;
      nWidth  = divFM.offsetWidth;
      
      if (nFMStyle & FM_FIXEDPOS)
      {
        nNewPosX = FM_nFixedPosX;
        nNewPosY = FM_nFixedPosY;
      }
      else
      switch (nFMStyle & (FM_LEFT | FM_RIGHT | FM_TOP | FM_BOTTOM | FM_BOTTOMLEFT | FM_BOTTOMRIGHT | FM_TOPLEFT))
      {
        case FM_TOP :
          nNewPosX = nMouseX - nWidth/2;
          nNewPosY = nMouseY - FM_OFFSET - nHeight;
          break;
        case FM_RIGHT :
          nNewPosX = nMouseX + 3;
          nNewPosY = nMouseY - nHeight/2;
          break;
        case FM_BOTTOMRIGHT :
          nNewPosX = nMouseX + 3;
          nNewPosY = nMouseY + FM_OFFSET;
          break;
        case FM_LEFT :
          nNewPosX = nMouseX - 10 - nWidth;
          nNewPosY = nMouseY - nHeight/2;
          break;
        case FM_TOPLEFT :
          nNewPosX = nMouseX - 10 - nWidth;
          nNewPosY = nMouseY - FM_OFFSET - nHeight;
          break;
        case FM_BOTTOMLEFT :
          nNewPosX = nMouseX - 10 - nWidth;
          nNewPosY = nMouseY + FM_OFFSET;
          break;
        default :
          nNewPosX = nMouseX - nWidth/2;
          nNewPosY = nMouseY + FM_OFFSET;
          break;
      }

      // make sure the message is not running out of the BOTTOM of the screen
      if (nNewPosY + nHeight - 5> document.body.clientHeight)
        nNewPosY = document.body.clientHeight - nHeight + 5
      // make sure the message is not running out of the RIGHT of the screen
      if (nNewPosX + nWidth + 7 > document.body.clientWidth)
        nNewPosX = document.body.clientWidth - (nWidth + 7)
      // make sure the message is not running out of the LEFT of the screen
      if (document.body.currentStyle.direction == "rtl")
      {
        if (nNewPosX < (document.body.scrollLeft - (document.body.scrollWidth - document.body.clientWidth)))
          nNewPosX = (document.body.scrollLeft - (document.body.scrollWidth - document.body.clientWidth))
      }    
      else
      {
        if (nNewPosX < 0)
          nNewPosX = 0
      }
      // make sure the message is not running out of the TOP of the screen
      if (nNewPosY <-4)
        nNewPosY = -4
      // make sure the cursor is not in the message area
      if ((nNewPosY <= nMouseY &&   (nNewPosY + nHeight) >= nMouseY) && (nNewPosX <= nMouseX &&   (nNewPosX + nWidth) >= nMouseX))
        nNewPosY = nMouseY - nHeight - 20
        
      if (document.body.currentStyle.direction == "rtl")
        divFM.style.left  = nNewPosX 
      else  
        divFM.style.left  = nNewPosX  + document.body.scrollLeft;
      divFM.style.top        = nNewPosY + document.body.scrollTop;
      divFM.style.visibility = "visible";
      if ((nFMStyle & FM_NOSHADOW) == 0)
      {
        FM_AdjustShadow()
        
          divShadow.style.visibility = "visible";
        
      }
    }
    catch(e) {}
  }
  //---------------------------------

  function FM_AdjustShadow ()
  //       ~~~~~~~~~~~~~~~
  {
    divShadow.style.width  = divFM.offsetWidth-2
    divShadow.style.height = divFM.offsetHeight-2
    divShadow.style.left   = divFM.offsetLeft+2
    divShadow.style.top    = divFM.offsetTop+2
  }
  //---------------------------------

  function FM_MakeSticky (bSticky)
  //       ~~~~~~~~~~~~~
  {
    if (FM_bSticky == bSticky)
      return;
    FM_bSticky = bSticky  
    if (FM_bSticky)
      if (!bFM)
        FM_bSticky = false;
      else
      {
        FMSticky.style.display = ""
        FM_AdjustShadow();
      }  
    else    
    if (bFM)
      FMSticky.style.display = "none"
  }
  //---------------------------------

  function FM (sHtml, nStyle)
  //       ~~
  {
    if (bDisableFM)
      return;
    if (typeof(divFM) != "object")
    {
      var sCode = "<TABLE id=divFM style='position:absolute; z-index:100; visibility:hidden' cellpadding=2 cellspaing=0>" +
        '  <TR id="FMSticky" style="display:none">' +
        '    <TD>' +
        '      <TABLE dir=rtl border=0 cellspacing=0 cellpadding=0 UNSELECTABLE="on" style="cursor:default">' +
        '        <TR>' +
        '          <TD ID="FMHide" align="center" bgcolor="#1A448A" UNSELECTABLE="on">' +
        '             &nbsp;<FONT FACE="wingdings" ssize="+2" style="cursor:hand;color:#4A84aA;" onclick="FM_Hide()" onmouseover="this.style.color=\'#aAa4ff\'" onmouseout="this.style.color=\'#4A84aA\'">x</FONT>&nbsp;&nbsp;&nbsp;' +
        '          </TD>' +
        '          <TD width="100%" ID="LBTitle" align="right" bgcolor="#1A448A" style="color:white; font-weight:bold; cursor:default;" UNSELECTABLE="on"' +
        '             onlosecapture="LM_bDrag=false" onmousedown="FM_StartDrag(this, event)" onmouseup="FM_EndDrag(this)" onmousemove="FM_ContinueDrag(event)">' +
        '            &nbsp;' +
        '          </TD>' +
        '        </TR>' +
        '      </TABLE>' +
        '    </TD>' +
        '  </TR>' +
        "  <TR>" 
        
      if (typeof(FM_BLOCKSTYLE) != 'undefined') 
        sCode  += "    <TD id=TheText style=' " + FM_BLOCKSTYLE + "'></TD>" 
      else  
        sCode  += "    <TD id=TheText style=' cursor: default; font-size : 13;font-family :  Arial, Helvetica, sans-serif; color : Black; background-color:#fbfcdc; border:1px solid; border-color:#A08000;'></TD>" 
      sCode += 
        "  </TR>" +
        "</TABLE> " + 
        "<TABLE id=divShadow bgcolor=black cellpadding=0 cellspacing=0 style='position:absolute; z-index:99; visibility:hidden; filter:progid:DXImageTransform.Microsoft.Blur(PixelRadius=3,MakeShadow=true,ShadowOpacity=0.3);'>" +
        "  <TR>" +
        "    <TD>&nbsp</TD>" + 
        "  </TR>" +
        "</TABLE> "
                 
      var oTable = document.createElement("TABLE")
      oTable     = document.body.insertBefore(oTable)
      oTable.outerHTML = sCode
    }  
    divFM.style.width = ""
    divFM.style.height = ""
    TheText.innerHTML = sHtml;
    if (divFM.offsetWidth > FM_MAXWIDTH)
      divFM.style.width = FM_MAXWIDTH
    
    if ((nFMStyle & FM_RTL) == FM_RTL)
    {
      TheText.align = "right"
      TheText.dir = "rtl"
    }  
    else  
    {
      TheText.align = "left"
      TheText.dir = "ltr"
    }  

    nFMStyle     = nStyle
    bFM          = true
  }
  //---------------------------------
  
  function FM_Force (sHtml, nStyle)
  //       ~~~~~~~~
  {
    if (bDisableFM)
      return;
    FM (sHtml, nStyle)
    bForceFM = true
  }
  //---------------------------------

  function FM_Disable (bDisable)
  //       ~~~~~~~~~~
  {
    bDisableFM = bDisable
  }
  //---------------------------------

  function FM_Hide ()
  //       ~~~~~~~
  {
    if (!bFM)
      return;
    TheText.innerHTML = "out"  
    divShadow.style.visibility = "hidden";
    divFM.style.visibility = "hidden";
    
    FMSticky.style.display = "none"
    bFM = false
    bForceFM = false
    FM_bSticky = false
  }

//-->