var snowbase = "http://www.archigraph.pl/new/archigraph/wzory/archigraph4/js/sniezki/";
var snowsrc=new Array();
snowsrc[0]=snowbase + "1.png";
snowsrc[1]=snowbase + "2.png";
snowsrc[2]=snowbase + "3.png";
var no = 80; var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0; var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, n1, doc_width = 750, doc_height = 200;
dx = new Array();xp = new Array();yp = new Array();am = new Array();stx = new Array();sty = new Array();
for (i = 0; i < no; ++ i) {
	dx[i] = 0;xp[i] = Math.random()*(doc_width-50);yp[i] = Math.random()*doc_height;
	n1 = Math.floor(Math.random()*3);
	am[i] = Math.random()*20;stx[i] = 0.02 + Math.random()/10;sty[i] = 0.7 + Math.random();
	document.write("<div id=\"dot"+ i +"\" style=\"position: absolute; z-index: "+ 1000 + i +"; visibility: visible; top: 15px; left: 15px;\"><img src='"+snowsrc[n1]+"' border=\"0\"></div><!-- "+n1+" -->");
}

function snowNS() { // Netscape main animation function
	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();
			//doc_width = self.innerWidth;
			//doc_height = self.innerHeight;
		}
		dx[i] += stx[i];
		document.getElementById("dot"+i).style.top = yp[i] + 'px';
		document.getElementById("dot"+i).style.left = xp[i] + am[i]*Math.sin(dx[i]) + 'px';
	}
}

function snowIE_NS6() { // IE and NS6 main animation function
	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();
			//doc_width = ns6up?window.innerWidth : document.body.clientWidth;
			//doc_height = ns6up?window.innerHeight : document.body.clientHeight;
		}
		dx[i] += stx[i];
		if (ie4up){
			document.all["dot"+i].style.pixelTop = yp[i];
			document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
		}else if (ns6up){
			document.getElementById("dot"+i).style.top=yp[i] + 'px';
			document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]) + 'px';
		}
	}
}

if (ns4up) {
	setInterval("snowNS()", 50);
} else if (ie4up||ns6up) {
	setInterval("snowIE_NS6()", 50);
}
