var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var fallingFloaters=0;

var dx = new Array(), xp = new Array(), yp = new Array();    // coordinate and position variables
var am = new Array(), stx = new Array(), sty = new Array();  // amplitude and step variables
var i, doc_width = 800, doc_height = 600; 

function iecompattest() { return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body }

function fallingFloaterRepeater(fallingFloaters)
	{
	doc_width = ns6up?window.innerWidth-10 : iecompattest().clientWidth-10;
	doc_height=(ie4up && !window.opera)? iecompattest().scrollHeight : iecompattest().offsetHeight;
	for (i = 0; i < 10; ++ i)
		{
		yp[fallingFloaters][i] += sty[fallingFloaters][i];
		if (yp[fallingFloaters][i] > doc_height-50)
			{
			xp[fallingFloaters][i] = Math.random()*(doc_width-am[fallingFloaters][i]-30);
			yp[fallingFloaters][i] = 0;
			stx[fallingFloaters][i] = 0.02 + Math.random()/10;
			sty[fallingFloaters][i] = 0.7 + Math.random();
			}
		dx[fallingFloaters][i] += stx[fallingFloaters][i];
		document.getElementById("dot"+fallingFloaters+''+i).style.top=yp[fallingFloaters][i]+"px";
		document.getElementById("dot"+fallingFloaters+''+i).style.left=xp[fallingFloaters][i] + am[fallingFloaters][i]*Math.sin(dx[fallingFloaters][i])+"px";  
		}
	setTimeout("fallingFloaterRepeater("+fallingFloaters+")", 10);
	}

function fallingFloater(fallsrc)
	{
	if (ns6up) { doc_width = self.innerWidth;doc_height = self.innerHeight; }
	else
		if (ie4up) { doc_width = iecompattest().clientWidth;doc_height = iecompattest().clientHeight; }
		else return false;
	fallingFloaters++;
	dx[fallingFloaters] = new Array();xp[fallingFloaters] = new Array();yp[fallingFloaters] = new Array();
	am[fallingFloaters] = new Array();stx[fallingFloaters] = new Array();sty[fallingFloaters] = new Array();
	for (i = 0; i < 10; ++ i)
		{  
		dx[fallingFloaters][i] = 0;
		xp[fallingFloaters][i] = Math.random()*(doc_width-50);
		yp[fallingFloaters][i] = Math.random()*doc_height;
		am[fallingFloaters][i] = Math.random()*20;
		stx[fallingFloaters][i] = 0.02 + Math.random()/10;
		sty[fallingFloaters][i] = 0.7 + Math.random();
		if (ie4up||ns6up) document.write("<div id=\"dot"+ fallingFloaters + '' + i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src='"+fallsrc+"' border=\"0\"><\/div>");
		}
	fallingFloaterRepeater(fallingFloaters);
	return true;
	}
