var no = 9; // image number or falling rate
var speed = 60; // the lower the number the faster the image moves
var bubble = new Array();
bubble[0] = "/images/logo-bubble2.gif"
bubble[1] = "/images/logo-bubble-small.gif"
bubble[2] = "/images/logo-bubble-small.gif"

var ns4up = (document.layers) ? 1 : 0;  // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var ns6up = (document.getElementById&&!document.all) ? 1 : 0;
var dx, Xpos, Ypos;    // coordinate and position variables
var am, stx, sty;  // amplitude and step variables
var i, doc_width = 800, doc_height = 1800;

doc_width = document.getElementById("logo").offsetWidth;
doc_height = document.getElementById("logo").offsetHeight;

dx = new Array();
Xpos = new Array();
Ypos = new Array();
am = new Array();
stx = new Array();
sty = new Array();
j = 0;

for (i = 0; i < no; ++ i) {
        dx[i] = 0;                        // set coordinate variables
        Xpos[i] = Math.random()*(doc_width-50);  // set position variables
        Ypos[i] = Math.random()*doc_height;
        am[i] = Math.random()*10;         // set amplitude variables
        stx[i] = 0.02 + Math.random()/10; // set step variables
        sty[i] = 0.7 + Math.random();     // set step variables
		
		if (i == 0) {
			document.write("<div id=\"bubble"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + bubble[j] + "\" border=\"0\"></div>");
		} else {
			document.write("<div id=\"bubble"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + bubble[j] + "\" border=\"0\"></div>");
		}

        if (j == (bubble.length-1)) { j = 0; } else { j += 1; }
}

function bubbles() {  // IE main animation function
	for (i = 0; i < no; ++ i) {  // iterate for every dot
		Ypos[i] -= sty[i];
		if (Ypos[i] < 70) {
				Xpos[i] = Math.random()*(doc_width-am[i]-10);
				Ypos[i] = doc_height;
				stx[i] = 0.01 + Math.random()/7;
				sty[i] = 0.7 + Math.random();
				doc_width = document.getElementById("logo").offsetWidth;
				doc_height = document.getElementById("logo").offsetHeight + 50;
		}
		dx[i] += stx[i];
		if (ie4up){
		document.getElementById("bubble"+i).style.pixelTop = Ypos[i]+document.getElementById("logo").scrollTop;
		document.getElementById("bubble"+i).style.pixelLeft = Xpos[i] + am[i]*Math.sin(dx[i]);
		}
		else if (ns6up){
		document.getElementById("bubble"+i).style.top=Ypos[i]+pageYOffset + "px";
		document.getElementById("bubble"+i).style.left=Xpos[i] + am[i]*Math.sin(dx[i]) + "px";
		}
	}
	
	window.setTimeout("bubbles()", speed);
}
bubbles();
