var divs = null;
var c = 1;

function mover(im)
{
	im.src = im.src.replace(/_d\.gif/i, "_h.gif");
}

function mout(im)
{
	im.src = im.src.replace(/_h\.gif/i, "_d.gif");
}

function init()
{
	divs = document.getElementsByTagName("div");
	for(var i = 0; i < divs.length; i++)
	{
		divs[i].setAttribute("offset", Math.round(Math.random() * 360));
		divs[i].setAttribute("radius", Math.round(Math.random() * 20) + 10);
		if(Math.random() < 0.5)
			var dir = 1;
		else
			var dir = -1;
		divs[i].setAttribute("dir", dir);
		divs[i].setAttribute("x", divs[i].offsetLeft);
		divs[i].setAttribute("y", divs[i].offsetTop);
	}
	render();
}

function render()
{
	c+= 0.1;
	if(c == 1)
		c = 0;
	for(var i = 0; i < divs.length; i++)
	{
		divs[i].style.left = (parseInt(divs[i].getAttribute("x")) + Math.sin(c * parseInt(divs[i].getAttribute("dir")) + parseInt(divs[i].getAttribute("offset"))) * parseInt(divs[i].getAttribute("radius"))) + "px";
		divs[i].style.top = (parseInt(divs[i].getAttribute("y")) + Math.cos(c * parseInt(divs[i].getAttribute("dir")) + parseInt(divs[i].getAttribute("offset"))) * parseInt(divs[i].getAttribute("radius"))) + "px";
		
	}
	window.setTimeout("render();", 20);
}