function startAnimation()
{
	//alert(screen.height);
	writeSmileys();
 	rijdAuto();	
}



var i = 0;

function rijdAuto()
{
	
	//alert(arrCars[i]);
	try {		
		updateSmiley();
		setTimeout("rijdAuto()",100);
	}
	catch (e) {
		alert(e);
	}

}

function writeSmileys()
{
	var factorX = Math.floor(screen.width / 15);
	var factorY = Math.floor(screen.height/ 15);		

	for (i = 0; i < 100; i ++)
	{
		var x = Math.floor((Math.random()* factorX) * 15) + 'px';
		var y = Math.floor((Math.random()* factorY) * 15)+15 + 'px';
		var style = 'style="position:absolute; left:' + x + '; top:' + y + ';"';
		document.writeln('<img src="IMG/smiley.gif"' + style + ' id="img' + i + '">');
	}
}
function updateSmiley()
{
	
	
	for (i = 0; i < 100; i ++)
	{	
		var vorige;
		//oudX = document.getElementById('img' + i).style.left.replace('px', '') * 1 - 5;
		oudX = document.getElementById('img' + i).style.left.replace('px', '') * 1 - 5;
		oudY = document.getElementById('img' + i).style.top.replace('px', '') * 1;
		x = Math.floor(Math.sin(Math.random()-10)) + oudX +5;
		y = Math.floor(Math.sin(Math.random()+10)) + oudY +5;

		
		if (x > screen.width) 
		 x = 0;
		if (y > screen.height - 100)
			y = 0;
		document.getElementById('img' + i).style.left = x + 'px';		
		document.getElementById('img' + i).style.top = y + 'px';		
	}
}
