var no=30, speed=20, dx, xp, yp, am, stx, sty, i, doc_width=700, doc_height, Lroot, StopSnow=false, th;
if (doc_width < 10) doc_width = 700;
function GetHeight(){
return((document.layers)?self.innerHeight:document.body.clientHeight);
}
function SnowFlake(){
return('<img src="http://gavrylyuk.com/snow/'+Math.floor(Math.random()*5)+'.gif" border=0>');
}
function PutDot(i){
if(document.layers) document.write('<layer name="dot'+i+'" left=15 top=15 visibility="show">'+SnowFlake()+'</layer>');
else document.write('<div id="dot'+i+'" style="POSITION: absolute; Z-INDEX: '+ i +'; VISIBILITY: visible; TOP: 15px; LEFT: 15px;">'+SnowFlake()+'</div>');
}
function setNS6Property( id, property, value ) {
var styleObject = document.getElementById( id );
if (styleObject != null) {
styleObject = styleObject.style;
styleObject[ property ] = value;
}
}
function MoveDot(i,x,y) {
if (document.layers) NSMoveDot(i,x,y);
else if(document.all) IEMoveDot(i,x,y);
else MZMoveDot(i,x,y);
}
function NSMoveDot(i,x,y) {
Lroot['dot'+i].top=y;
Lroot['dot'+i].left=x;
}
function IEMoveDot(i,x,y) {
Lroot['dot'+i].style.pixelTop=y;
Lroot['dot'+i].style.pixelLeft=x;
}
function MZMoveDot(i,x,y) {
setNS6Property( 'dot'+i, 'left', x+200); setNS6Property( 'dot'+i, 'top', y);
}
function Snow() {
if (document.layers) setTimeout('NSSnow()',speed);
else if(document.all) setTimeout('IESnow()',speed);
else setTimeout('MZSnow()',speed);
}
function Estim() {
yp[i]+=sty[i];
if (yp[i]>doc_height-50) {
xp[i] = Math.random()*(doc_width-am[i]-25);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 1+Math.random();
}
dx[i]+=stx[i];
}
function IESnow() {
for(i=0;i<no;++i) { Estim(); IEMoveDot(i,xp[i]+am[i]*Math.sin(dx[i]),yp[i]); }
if(!StopSnow) th = setTimeout('IESnow()',speed);
}
function NSSnow() {
for(i=0;i<no;++i) { Estim(); NSMoveDot(i,xp[i]+am[i]*Math.sin(dx[i]),yp[i]); }
if(!StopSnow) th = setTimeout('NSSnow()',speed);
}
function MZSnow() {
for(i=0;i<no;++i) { Estim(); MZMoveDot(i,xp[i]+am[i]*Math.sin(dx[i]),yp[i]); }
if(!StopSnow) th = setTimeout('MZSnow()',speed);
}

function StopIt() {
StopSnow=true; clearTimeout(th);
for(i=0;i<no;++i) MoveDot(i,-50,0);
}

// Main
//unremarked for run snow!!!

dx=new Array(); xp=new Array();
yp=new Array(); am=new Array();
stx=new Array(); sty=new Array();
Lroot=(document.all?document.all:document.layers);
doc_height = 200; doc_height=doc_height?doc_height:100;
for(i=0;i<no;++i) {
dx[i] = 0; xp[i] = Math.random()*(doc_width-25);
yp[i] = Math.random()*doc_height; am[i] = Math.random()*20;
stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random();
PutDot(i);
}
Snow();
setTimeout('StopIt()',180000);
