var Number = 3;
var Speed = 1;
var dx, xp, yp;
var am, stx, sty;
var BoundaryWidth, BoundaryHeight;

function Bubble() {
	if (!BIsIE) return;

	dx = Array();
	xp = Array();
	yp = Array();
	am = Array();
	stx = Array();
	sty = Array();
	BoundaryWidth = 766;
	BoundaryHeight = document.body.children[0].offsetHeight-80;

	for (i=0; i<Number; ++i) {
		dx[i] = 0;                    // set coordinate variables
		xp[i] = Math.random()*BoundaryWidth;  // set position variables
		yp[i] = Math.random()*BoundaryHeight;
		am[i] = Math.random()*40;         // set amplitude variables
		stx[i] = 0.02 + Math.random()/10; // set step variables
		sty[i] = 1.3 + Math.random();     // set step variables

		document.write("<div id=dot"+i+" style=position:absolute;z-index:"+i+";height:20;width:20;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/global/bubble.png,sizingMethod=scale)></div>");
	}

	Bubbler();
}

function Bubbler() {
	for (i=0; i<Number; ++i) {
		yp[i] -= sty[i];

		if (yp[i] < -50) {
			xp[i] = Math.random()*(BoundaryWidth-am[i]);
            yp[i] = BoundaryHeight;
            stx[i] = 0.02 + Math.random()/10;
            sty[i] = 0.7 + Math.random();
            BoundaryWidth = 766;
            BoundaryHeight = document.body.children[0].offsetHeight-80;
		}
        
		dx[i] += stx[i];
        document.all["dot"+i].style.pixelTop = yp[i];
        document.all["dot"+i].style.pixelLeft = xp[i]+am[i]*Math.sin(dx[i])+document.body.children[0].offsetLeft;
	}

	setTimeout("Bubbler()", Speed);
}

Bubble();