// Set the number of bubbles (more than 30 - 40 not recommended)
var numBubbles=30

// Set the colors for the bubble. Add as many colors as you like
var bubblecolor=new Array("#0099ff","#9bd7ff","#d1edfa")

// Set the fonts, that create the bubbles. Add as many fonts as you like
var bubbletype=new Array("Arial Black","Arial Narrow","Verdana","Trebuchet MS")

// Set the letter that creates your bubble
var bubbleletter="O"

// Set the speed of riseing (recommended values range from 0.3 to 2)
var risespeed=2

// Set the maximal-size of your bubbles
var bubblemaxsize=22

// Set the minimal-size of your bubbles
var bubbleminsize=8

var bubble=new Array()
var marginbottom
var marginright
var timer
var xMove=new Array();
var moveUp=new Array();
var leftRightMotion=new Array();
var browserinfos=navigator.userAgent 
var ie5=document.all&&document.getElementById&&!browserinfos.match(/Opera/)
var ns6=document.getElementById&&!document.all
var opera=browserinfos.match(/Opera/)  
var browserok=ie5||ns6||opera

function randomMaker(range) {		
	randomRange=Math.floor(range*Math.random())
    return randomRange
}

function initbubble() {
	if (ie5 || opera) {
		marginbottom = document.body.clientHeight
		marginright = document.body.clientWidth
	}
	else if (ns6) {
		marginbottom = window.innerHeight
		marginright = window.innerWidth
	}
	var bubblesizerange=bubblemaxsize-bubbleminsize
	for (i=0;i<=numBubbles;i++) {
		moveUp[i] = 0;                      
    	leftRightMotion[i] = Math.random()*15;         
    	xMove[i] =Math.random()/10;
		bubble[i]=document.getElementById("s"+i)
		bubble[i].style.fontFamily=bubbletype[randomMaker(bubbletype.length)]
		bubble[i].size=randomMaker(bubblesizerange)+bubbleminsize
		bubble[i].style.fontSize=bubble[i].size
		bubble[i].style.color=bubblecolor[randomMaker(bubblecolor.length)]
		bubble[i].rise=risespeed*bubble[i].size/5
		bubble[i].xPos=randomMaker(marginright/2-bubble[i].size)+marginright/4
		bubble[i].yPos=randomMaker(2*marginbottom-marginbottom-2*bubble[i].size)
		bubble[i].style.left=bubble[i].xPos
		bubble[i].style.top=bubble[i].yPos
	}
	movebubble()
}

function movebubble() {
	for (i=0;i<=numBubbles;i++) {
		moveUp[i] += xMove[i];
		bubble[i].yPos-=bubble[i].rise
		bubble[i].style.left=bubble[i].xPos+leftRightMotion[i]*Math.sin(moveUp[i]);
		bubble[i].style.top=bubble[i].yPos
		
		
	}
	var timer=setTimeout("movebubble()",50)
}

for (i=0;i<=numBubbles;i++) {
	document.write("<span id='s"+i+"' style='position:absolute;bottom:-"+bubblemaxsize+";z-index:2;'>"+bubbleletter+"</span>")
}
if (browserok) {
	window.onload=initbubble
}