function winWidth(){
   return (ns4||ns6) ? window.innerWidth : document.body.clientWidth;
}

n4=(document.layers); 
n6=(document.getElementById&&!document.all);
ie=(document.all);
o6=(navigator.appName.indexOf("Opera")!= -1)?true:false;
img0=new Image();
img0.src="images/bubble.gif";
bubspan=100
num=(ie)?(window.document.body.clientWidth/bubspan)+1:(window.innerHeight/bubspan)+1;
y=0;
x=0;
function doBubble(){
	if (n4||n6){
		y = window.innerHeight-20;
		x = Math.random()*window.innerWidth-80; }
	else {
		y = (ie)?window.document.body.clientHeight-20:window.innerHeight-20;
		x = Math.random()*document.body.clientWidth-80; }
}
yp=new Array();
xp=new Array(); 
sp=new Array();
rt=new Array();
gr=new Array();
s1=new Array();
s2=new Array(); 
nz=new Array();
wh=(ie)?window.document.body.clientHeight:window.innerHeight; 
for (i=0; i < num; i++){
	yp[i]=Math.random()*wh-y;
	xp[i]=x;
	sp[i]=12+Math.random()*6; 
	s1[i]=0;
	s2[i]=Math.random()*0.1+0.05;
	gr[i]=4;
	nz[i]=Math.random()*15+5;
	rt[i]=Math.random()*0.5+0.1; 
}

if (n4){
	for (i=0; i < num; i++){
		document.write("<LAYER NAME='bub"+i+"'LEFT=0 TOP=-50>" +"<img src='images/bubble.gif' width="+nz[i]+" height="+nz[i]+"></LAYER>");
	}
}
if (ie){
	document.write('<span style="position:absolute;top:0px;left:0px"><span style="position:relative">'); 
	for (i=0; i < num; i++){
		document.write('<img id="bub'+i+'" src="'+img0.src+'" style="position:absolute;top:-50px;left:0px">');
	}
	document.write('</span></span>'); 
}
if (n6||o6){
	for (i=0; i < num; i++){
		document.write("<span id='bub"+i+"'style='position:absolute;top:-50px;left:0px'>" +"<img src="+img0.src+" width="+nz[i]+" height="+nz[i]+"></span>");
	} 
}
function MouseBubbles(){
	doBubble();
	scy=(document.all)?document.body.scrollTop:window.pageYOffset; 
	scx=(document.all)?document.body.scrollLeft:window.pageXOffset;
	for (i=0; i < num; i++){
		sy = sp[i]*Math.sin(270*Math.PI/180);
		sx = sp[i]*Math.cos(s1[i]*5); 
		yp[i]+=sy;
		xp[i]+=sx;
		if (yp[i] < -40){
			yp[i]=y;
			xp[i]=x;
			sp[i]=6+Math.random()*3; 
			gr[i]=4;
			nz[i]=Math.random()*15+5;
		}
		if (n4){
			document.layers["bub"+i].left=xp[i]+scx; 
			document.layers["bub"+i].top=yp[i]+scy;
		} 
		if (ie){
			document.getElementById("bub"+i).style.left=xp[i]+scx; 
			document.getElementById("bub"+i).style.top=yp[i]+scy;
			document.getElementById("bub"+i).style.width=gr[i]; 
			document.getElementById("bub"+i).style.height=gr[i];
		}
		if (n6||o6){ 
			document.getElementById("bub"+i).style.left=xp[i]+scx;
			document.getElementById("bub"+i).style.top=yp[i]+scy; 
		}
		gr[i]+=rt[i];
		s1[i]+=s2[i];
		if (gr[i] > 14) gr[i]=15;
	}
	setTimeout('MouseBubbles()',15); 
}