function MoveHandler(e)
{
    Xpos = e.pageX;
    Ypos = e.pageY;       
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = MoveHandler;


}
function MoveHandlerIE() {
    Xpos = window.event.x + document.body.scrollLeft;
    Ypos = window.event.y + document.body.scrollTop;      

}

function mausi() 
{
	dots = new Array();
	Xpos = 0;
	Ypos = 0;
	DELTAT = .01;
	SEGLEN = 20;
	SPRINGK = 10;
	MASS = 1;
	GRAVITY = 100;
	RESISTANCE = 20;
	STOPVEL = 0.1;
	STOPACC = 0.1;
	DOTSIZE = 15;
	BOUNCE = 0.75;	
	
	TanzPaar=new Image();
	TanzPaar.src="/images/mauslauf.gif";  
	amount=1;  
	Xpos=350;  
	Ypos=200;  
	step=0.3; 
	
    var i = 0;
    for (i = 0; i < amount; i++) {
        dots[i] = new dot(i);
    }

	
	var ns6=document.getElementById&&!document.all
	bats=new Array(3)
	if (document.layers)
	{
		for (i=0; i < amount; i++) 
		{document.write("<LAYER NAME=n"+i+" LEFT=0 TOP=-50><IMG SRC='"+TanzPaar.src+"' NAME='nsi' width=45 height=35 border=0></LAYER>")}
	}
	else if (document.all||ns6)
	{
		document.write('<div id="out" style="position:absolute;top:0;left:0"><div id="in" style="position:relative">');
		for (i=0; i < amount; i++)
		{	
		if (document.all)
		{
		document.write('<img src="'+TanzPaar.src+'" id="msieBats0" style="position:absolute;top:-50;left:0" border=0>');
		}
		else
		document.write('<img src="'+TanzPaar.src+'" id="ns6Bats0" width=45 height=35 style="position:absolute;top:-50;left:0" border=0>')
		}
		document.write('</div></div>');
	}


	if (document.layers)
	{
		for (i=0; i < amount; i++)
		document.layers['n'+i].document.images['nsi'].src=TanzPaar.src;
	}
	else if (document.all)
	{
		for (i=0; i < amount; i++)
		document.all.msieBats0.src=TanzPaar.src;
	}
	else if (ns6)
	{	
		for (i=0; i < amount; i++)
		document.getElementById("ns6Bats0").src=TanzPaar.src; 
	}
	
	
if (ns6 || document.layers) {
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = 	MoveHandler;

} else {
    document.onmousemove = MoveHandlerIE;
}
	
flycupid=setInterval('Animate()',29);
}

function Animate()
{
	var ns6=document.getElementById&&!document.all

    for (i = 0 ; i < amount; i++ ) {

        var spring = new vec(0, 0);
        // air resisitance/friction
        var resist = new vec(-dots[i].dx * RESISTANCE,
            -dots[i].dy * RESISTANCE);
        // compute new accel, including gravity
        var accel = new vec((spring.X + resist.X)/ MASS,
            (spring.Y + resist.Y)/ MASS + GRAVITY);
        // compute new velocity
        dots[i].dx += (DELTAT * accel.X);
        dots[i].dy += (DELTAT * accel.Y);
        // stop dead so it doesn't jitter when nearly still
        if (Math.abs(dots[i].dx) < STOPVEL &&
            Math.abs(dots[i].dy) < STOPVEL &&
            Math.abs(accel.X) < STOPACC &&
            Math.abs(accel.Y) < STOPACC) {
            dots[i].dx = 0;
            dots[i].dy = 0;
        }
        // move to new position
        dots[i].X += dots[i].dx;
        dots[i].Y += dots[i].dy;
        // get size of window
        var height, width;
        if (ns6 || document.layers) {
            height = window.innerHeight + document.scrollTop;
            width = window.innerWidth + document.scrollLeft;
        } else {        
            height = document.body.clientHeight + document.body.scrollTop;
            width = document.body.clientWidth + document.body.scrollLeft;
        }
        // bounce of 3 walls (leave ceiling open)
        if (dots[i].Y >=  height - DOTSIZE - 1) {
            if (dots[i].dy > 0) {
                dots[i].dy = BOUNCE * -dots[i].dy;
            }
            dots[i].Y = height - DOTSIZE - 1;
        }
        if (dots[i].X >= width - DOTSIZE) {
            if (dots[i].dx > 0) {
                dots[i].dx = BOUNCE * -dots[i].dx;
            }
            dots[i].X = width - DOTSIZE - 1;
        }
        if (dots[i].X < 0) {
            if (dots[i].dx < 0) {
                dots[i].dx = BOUNCE * -dots[i].dx;
            }
            dots[i].X = 0;
        }
        // move img to new position
    }


	    dots[0].X = Xpos+10;
        dots[0].Y = Ypos+10;       

        //dots[i].obj.style.left = dots[i].X;		             
        //dots[i].obj.style.top =  dots[i].Y;           


	if (document.layers)
	{
		for (i=0; i < amount; i++) 
		{
		  var NewL="n"+i
		  document.layers[NewL].top = dots[i].Y;
		  document.layers[NewL].left =dots[i].X;
	  	}
	}
	
	if (document.all)
	{
		for (i=0; i < amount; i++)
		{
	  	document.all.msieBats0.style.pixelTop =dots[i].Y;
	  	document.all.msieBats0.style.pixelLeft =dots[i].X;
	 	}
	}

	if (ns6)
	{
		for (i=0; i < amount; i++)
		{
	  	document.getElementById("ns6Bats0").style.top = dots[i].Y;
	  	document.getElementById("ns6Bats0").style.left =dots[i].X;
		}
	}

}
function vec(X, Y)
{
    this.X = X;
    this.Y = Y;
}
function dot(i) 
{

	var ns6=document.getElementById&&!document.all
    this.X = Xpos;
    this.Y = Ypos;
    this.dx = 0;
    this.dy = 0;

	if (document.layers)
	{
	  var NewL="n"+i
        this.obj = eval("document.layers["+NewL+"]");
	}

	if (document.all)
	{
	this.obj = eval("document.all.msieBats0");     
	
	}

	if (ns6)
	{
        this.obj = 	eval('document.getElementById("ns6Bats0")');
	}


}



