// written by oliver knill, http://www.math.harvard.edu/~knill, June 2007
// this script is put in the public domain

var neu=-1; 
var xx=0; var yy=0; 
var xleft,xmiddle,xright; 
var vx=0; 
var x=0;
var o=100;
var control=1; 

function initialize(){
document.getElementById("curse1").style.top  = 0 + "px";
document.getElementById("curse1").style.left = -100 + "px";
document.getElementById("curse2").style.top  = 0 + "px";
document.getElementById("curse2").style.left = 1600+100 + "px";
document.getElementById("curse3").style.top  = 0 + "px";
document.getElementById("curse3").style.left = 0 + "px";
}


function pos(e){
  if (navigator.appName == 'Netscape'){ xx = e.pageX; yy = e.pageY;} else{
  xx = event.clientX; yy = event.clientY;}; 
  if (yy<100) { control=1; } else { control=0; }
}

function c(){
  if (neu==-1) { initialize(); neu=1; }
  if (control==1) {
    if (xx>500) { o-=2; } else { o+=2; } 
    if (o>=1600) {o=o-1600; } if (o<=-1600) {o=o+1600; }
    x=x-o; xx=xx-o; x=(9*x+xx)/10; x=x+o; xx=xx+o; 
    if (x>=1600) {x-=1600; } if (x<=-1600) {x+=1600; }
    xleft=x-1600-o; xright=x+1600-o; xmiddle=x-o; 
    if (xleft  >=   0) {xleft   -=1600; } if (xleft  <=-1600)  {xleft   +=1600; }
    if (xmiddle>=1600) {xmiddle -=1600; } if (xmiddle<=    0)  {xmiddle +=1600; }
    if (xright >=3200) {xright  -=1600; } if (xright<=- 1600)  {xright  +=1600; }
    document.getElementById("curse1").style.left = xleft   + "px";
    document.getElementById("curse2").style.left = xmiddle + "px";
    document.getElementById("curse3").style.left = xright  + "px";
  }
  start=setTimeout('c()',30);
}

start=setTimeout('c()',0);
document.onmousemove=pos;
