var no = 15; 							// number of snowflakes
var speed = 30; 						// the smaler, the faster move snowflakes
var snowflake = "http://images.in-ist-drin.de/grafik/snow2.gif";				// picture source
var ns4b = (document.layers) ? 1 : 0;	// Netscape4.x
var b4up = (document.all) ? 1 : 0;		// MSIE4, Opera5, Netccape5
var dx, xp, yp;							// coordinate and position variables
var am, stx, sty;						// amplitude and step variables
var snowobj;
var i, doc_width = 1000, doc_height = 650;

if (ns4b) 
	{
	doc_width  = self.innerWidth;
	doc_height = self.innerHeight;
	}
else if (b4up) 
	{
	doc_width  = document.body.clientWidth;
	doc_height = document.body.clientHeight;
	} 
else 
	{
	b4up = 1;								
	}

dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
snowobj = new Array();

for (i=0; i<no; ++i) 
	{  					
	dx[i] = 0;									
	xp[i] = Math.random()*(doc_width-50); 
	yp[i] = Math.random()*doc_height;
	am[i] = Math.random()*20;				
	stx[i] = 0.02 + Math.random()/10; 
	sty[i] = 0.7 + Math.random();			
	if (ns4b) 
		{
		document.write("<LAYER NAME=\"flake"+ i +"\" LEFT=\"15\" TOP=\"15\" VISIBILITY=\"show\"><IMG SRC=\""+ snowflake +"\" BORDER=0></LAYER>");
		} 
	else if (b4up) 
		{
		document.write("<DIV ID=\"flake"+ i +"\" STYLE=\"position:absolute; z-index:"+ i +"; visibility:visible; top:15px; left:15px;\"><IMG SRC=\""+ snowflake +"\" BORDER=0></DIV>");
		snowobj[i] = eval (document.getElementById("flake"+i).style);
		}
	}

function snowNS() 
	{  						
	for (i=0; i<no; ++i) 
		{  
		yp[i] += sty[i];
		if (yp[i] > doc_height-50) 
			{
			xp[i] = Math.random()*(doc_width-am[i]-30);
			yp[i] = 0;
			stx[i] = 0.02 + Math.random()/10;
			sty[i] = 0.7 + Math.random();
			}
		dx[i] += stx[i];
		document.layers["flake"+i].top = yp[i];
		document.layers["flake"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
		}
	setTimeout("snowNS()", speed);
	}

function snowDocument()
	{ 
	for (i=0; i<no; ++i) 
		{
		yp[i] += sty[i];
		if (yp[i] > doc_height-50) 
			{
			xp[i] = Math.random()*(doc_width-am[i]-30);
			yp[i] = 0;
			stx[i] = 0.02 + Math.random()/10;
			sty[i] = 0.7 + Math.random();
			}
		dx[i] += stx[i];
		snowobj[i].top  = yp[i];
		snowobj[i].left = xp[i] + am[i]*Math.sin(dx[i]);
		}
	setTimeout("snowDocument()", speed);
	}

if (ns4b) {	snowNS();} else if (b4up) {	snowDocument(); }
