/*
Image qui suit et regarde la souris
*/

/*
var x = 0;
var y = 0;

if (document.getElementById)
   {
   if(navigator.appName.substring(0,3) == "Net")
      	document.captureEvents(Event.MOUSEMOVE);
   		document.onmousemove = Pos_Souris;
   		window.onload = Bouge_Image;
   }

function Pos_Souris(e)
   {
   x = (navigator.appName.substring(0,3) == "Net") ? e.pageX : event.x+document.body.scrollLeft;
   y = (navigator.appName.substring(0,3) == "Net") ? e.pageY : event.y+document.body.scrollTop;
   }

posX = 0;
posY = 0;
anim = true;
oldpos = "";

function Bouge_Image()
   {
   if (document.getElementById && anim)
      {
      posX = posX+(((x-posX)+20)/15);
      posY = posY+(((y-posY)+20)/15);
      if(posX<x)
         newpos='';
      else
         newpos='';
	  if(newpos!=oldpos)
	  	{
		document.tete.src=newpos;
		oldpos=newpos;
		}
      document.getElementById("teteronde").style.top = posY+"px";
      document.getElementById("teteronde").style.left = posX+"px";
      tempo = setTimeout("Bouge_Image()", 15)
      }
   }

if(document.getElementById)
   {
   document.write('<div id="teteronde" style="position: absolute; z-index:1000000">');
   document.write('<a href="#" onClick="anim=false;document.getElementById(\'teteronde\').style.visibility = \'hidden\';return(false)">');
   document.write('<img src="images/bouteilles/bouteille.png" style="border:0px" name="tete" alt="Cliquez ici pour faire disparaître" />');
   document.write('</a>');
   document.write('</div>');
   }
   

window.onload = Bouge_Image; 

*/

/*
Elastic Bullets
*/


/*
var nDots = 7;
var Xpos = 0;
var Ypos = 0;
var DELTAT = .01;
var SEGLEN = 10;
var SPRINGK = 10;
var MASS = 0.8;
var GRAVITY = 50;
var RESISTANCE = 10;
var STOPVEL = 0.1;
var STOPACC = 0.1;
var DOTSIZE = 10;
var BOUNCE = 0.75;
var isNetscape = navigator.appName=="Netscape";
var followmouse = true;
var dots = new Array();

function init() {
	var i = 0;
	for (i = 0; i < nDots; i++) {
		dots[i] = new dot(i);
	}
	if (!isNetscape) {
	}

	for (i = 0; i < nDots; i++) {
		if(isNetscape){
			dots[i].obj.style.left = dots[i].X;
			dots[i].obj.style.top = dots[i].Y;
		}
		else{	
			dots[i].obj.left = dots[i].X;
			dots[i].obj.top = dots[i].Y;
		}
	}

	if (isNetscape) {
		startanimate();
	} else {
		setTimeout("startanimate()", 3000);
	}
}

function dot(i) {
	this.X = Xpos;
	this.Y = Ypos;
	this.dx = 0;
	this.dy = 0;
	if (isNetscape) this.obj = eval(document.getElementById("dot" + i));
	else this.obj = eval("dot" + i + ".style");
}

function startanimate() {
	setInterval("animate()", 20);
}

function setInitPositions(dots) {
	var startloc = document.all.tags("LI");
	var i = 0;
	for (i = 0; i < startloc.length && i < (nDots - 1); i++) {
	dots[i+1].X = startloc[i].offsetLeft
	startloc[i].offsetParent.offsetLeft - DOTSIZE;
	dots[i+1].Y = startloc[i].offsetTop +
	startloc[i].offsetParent.offsetTop + 2*DOTSIZE;
	}
	dots[0].X = dots[1].X;
	dots[0].Y = dots[1].Y - SEGLEN;
	}
	function MoveHandler(e) {
		Xpos = e.pageX;
		Ypos = e.pageY;
		return true;
	}
	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;
}

function vec(X, Y)
{
	this.X = X;
	this.Y = Y;
}

function springForce(i, j, spring)
{
	var dx = (dots[i].X - dots[j].X);
	var dy = (dots[i].Y - dots[j].Y);
	var len = Math.sqrt(dx*dx + dy*dy);
	if (len > SEGLEN) {
		var springF = SPRINGK * (len - SEGLEN);
		spring.X += (dx / len) * springF;
		spring.Y += (dy / len) * springF;
	}
}
function animate() {
	var start = 0;
	if (followmouse) {
	dots[0].X = Xpos;
	dots[0].Y = Ypos;
	start = 1;
	}
	for (i = start ; i < nDots; i++ ) {
		var spring = new vec(0, 0);
		if (i > 0) {
		springForce(i-1, i, spring);
		}
		if (i < (nDots - 1)) {
		springForce(i+1, i, spring);
		}
		var resist = new vec(-dots[i].dx * RESISTANCE, -dots[i].dy * RESISTANCE);
		var accel = new vec((spring.X + resist.X)/ MASS, (spring.Y + resist.Y)/ MASS + GRAVITY);
		dots[i].dx += (DELTAT * accel.X);
		dots[i].dy += (DELTAT * accel.Y);
		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;
		}
		dots[i].X += dots[i].dx;
		dots[i].Y += dots[i].dy;
		var height, width;
		if (isNetscape)
		{
			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;
		}
		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;
		}
		
		if (isNetscape){
			dots[i].obj.style.left = dots[i].X;
			dots[i].obj.style.top =  dots[i].Y;
		}
		else{
			dots[i].obj.left = dots[i].X;
			dots[i].obj.top =  dots[i].Y;
		}
	}
}

window.onload = init;
*/

/*
Image0 = new Image();
Image0.src = "images/bulle.gif";
Amount = 30; 
Ymouse = -50;
Xmouse = -50;
Ypos = new Array();
Xpos = new Array();
Speed = new Array();
rate = new Array();
grow = new Array();
Step = new Array();
Cstep = new Array();
nsSize = new Array();

ns = (document.getElementById)?1:0;

//(document.getElementById)?window.captureEvents(Event.MOUSEMOVE):0;

function Mouse(evnt){
	Ymouse=(document.getElementById)?evnt.pageY-20:event.y-20;
	Xmouse=(document.getElementById)?evnt.pageX:event.x;
}

document.onmousemove=Mouse;

for (i = 0; i < Amount; i++) {
	Ypos[i] = Ymouse;
	Xpos[i] = Xmouse;
	Speed[i] = Math.random()*4+1;
	Cstep[i] = 0;
	Step[i] = Math.random()*0.1+0.05;
	grow[i] = 8;
	nsSize[i] = Math.random()*15+5;
	rate[i] = Math.random()*0.5+0.1;
}

document.write('<div style="position:absolute;top:0px;left:0px;z-index:100000000"><div style="position:relative">');
for (i = 0; i < Amount; i++) {
	document.write('<img id="si'+i+'" src="'+Image0.src+'" style="z-index:100000000;position:absolute;top:0px;left:0px;filter:alpha(opacity=90)">');
}
document.write('</div></div>');

function MouseBubbles() {
	var hscrll = (document.getElementById)?window.pageYOffset:document.body.scrollTop;
	var wscrll = (document.getElementById)?window.pageXOffset:document.body.scrollLeft;

	for (i = 0; i < Amount; i++){
		sy = Speed[i] * Math.sin(270 * Math.PI / 180);
		sx = Speed[i] * Math.cos(Cstep[i] * 4);
		Ypos[i] += sy;
		Xpos[i] += sx;
		if (Ypos[i] < -40) {
			Ypos[i] = Ymouse;
			Xpos[i] = Xmouse;
			Speed[i] = Math.random() * 6 + 4;
			grow[i] = 8;
			nsSize[i] = Math.random() * 15 + 5;
		}
		
		if (ns) {
			document.getElementById('si'+i).style.left = Xpos[i] + wscrll;
			document.getElementById('si'+i).style.top = Ypos[i] + hscrll;
		}
		else {
			si[i].style.left = Xpos[i] + wscrll;
			si[i].style.top = Ypos[i] + hscrll;
			si[i].style.width = grow[i];
			si[i].style.height = grow[i];
		}
		
		console.info(Xpos[i] + wscrll);
		
		grow[i] += rate[i]; 
		Cstep[i] += Step[i];
		if (grow[i] > 10) grow[i] = 11;
	}
	setTimeout('MouseBubbles()', 50);
}

MouseBubbles();
//  End -->

*/

