function scramble(limit)
{//alert(document.width);
var k= Math.floor(Math.random()*limit);

return k;
}

function move_flakes(flakes,timer)
{

for (var i=0;i<flakes;i++)
{
document.getElementById("flake"+i).style.top = parseInt(document.getElementById("flake"+i).style.top)+scramble(50)+'px';
//tst.value=parseInt(document.getElementById("flake"+i).style.top+0)+"/"+document.height;
if(parseInt(document.getElementById("flake"+i).style.top+0)>parseInt(document.height)-50)document.getElementById("flake"+i).style.top='0px';
}
//alert(flakes);
setTimeout ( "move_flakes("+flakes+","+timer+")", timer );
}

function create_flakes(flakes)
{
for(var i=0;i<flakes;i++) {
var temp = document.createElement('div');
	temp.setAttribute('id','flake'+i);
        temp.setAttribute('name','flake'+i);
	temp.setAttribute('style','position:absolute;top:-'+scramble(document.height)+'px;left:'+scramble(document.width)+'px;');
	temp.innerHTML="<span style='font-size:36px;color:#E6E6FA;font-family:Arial;'><strong>*</strong></span>";
	document.body.appendChild(temp);
}
}
function start_snowing(flakes,timer)
{

create_flakes(flakes);
move_flakes(flakes,timer);

}
