// Colored points of light swirl around the cursor
// LANGUAGE="JavaScript1.3"
//
// This seems most compatible when included at the end of the body of the HTML.
// just before the closing </BODY>.
// This insures that the window.document.body object exists, which we need to access.


{
  var isNetscape = navigator.appName=="Netscape";

  // get size of window
  var WinHeight, WinWidth;
  if (isNetscape)
  {
    WinHeight = window.innerHeight /* + document.scrollTop  */ ;
    WinWidth = window.innerWidth   /* + document.scrollLeft */ ;
  }
  else
  {	
    WinHeight = window.document.body.clientHeight + document.body.scrollTop;
    WinWidth = window.document.body.clientWidth + document.body.scrollLeft;
  }

  var yBase = WinHeight/2;
  var xBase = WinWidth/2;
  var delay = 15;
  var yAmpl = 10;
  var yMax = 40;
  var step = .2;
  var ystep = .5;
  var currStep = 0;
  var tAmpl=1;
  var Xpos = 50;
  var Ypos = 50;
  var j = 0;

  // just save mouse position for animation to use
  function MoveHandler(e)
  {
    Xpos = e.pageX;
    Ypos = e.pageY;	  
    return true;
  }

  // just save mouse position for animation to use
  function MoveHandlerIE()
  {
    Xpos = window.event.x + document.body.scrollLeft;
    Ypos = window.event.y + document.body.scrollTop;	  
  }

  if (isNetscape)
  {
    document.captureEvents(Event.MOUSEMOVE);
    document.onMouseMove = MoveHandler;
  }
  else
  {
    document.onmousemove = MoveHandlerIE;
  }

  // Return an object corresponding to the numbered dot.
  function Dot(i) 
  {
    if (isNetscape)
    {	
        return eval("document.dot" + i);
    }
    else
    {
        return eval("dot" + i + ".style");
    }
  } // Dot()

  function AnimateSwirl()
  {
    var CurDot;
    yBase = WinHeight/4 ;
    xBase = WinWidth/4;
    for ( j = 1 ; j < 7 ; j++ )
    {
      CurDot = Dot(j);
      CurDot.top  = Ypos + Math.cos((20*Math.sin(currStep/(20+j)))+j*70)*yBase*(Math.sin(10+currStep/10)+0.2)*Math.cos((currStep + j*25)/10);
      CurDot.left = Xpos + Math.sin((20*Math.sin(currStep/20))+j*70)*xBase*(Math.sin(10+currStep/(10+j))+0.2)*Math.cos((currStep + j*25)/10);
    }
    currStep += step;
    setTimeout("AnimateSwirl()", delay) ;
  } // AnimateSwirl()


  function StartCursorSwirl()
  {
    // Add the DIV tags for the individual swirling lights.
    SwirlInvocation = "";
    // Netscape 4.7 refuses to dynamically reposition the first DIV tag, so we provide a hidden sacrifical DIV tag.
    SwirlInvocation = SwirlInvocation + '<div id="junk_jcs" style="position: absolute; visibility: hidden; height: 1; width: 1;"></div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot1" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #ff0099;">_</div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot2" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #ff0033;">_</div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot3" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #006633;">_</div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot4" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #00cc33;">_</div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot5" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #00ccff;">_</div>';
    SwirlInvocation = SwirlInvocation + '<div id="dot6" style="position: absolute; height: 3; width: 3; overflow: hidden; background-color: #000066;">_</div>';
    document.write(SwirlInvocation);

    // Start it up...
    AnimateSwirl();
  } // StartCursorSwirl()
}

