// JavaScript Document
function doheights(){
	oside=document.getElementById('side')
	omain=document.getElementById('main')
	
	hs=oside.offsetHeight
	hm=omain.offsetHeight
	//the side starts lower than the main so the main height needs to be bigger
	if (hs + 10 > hm ) omain.style.height=(hs - 10) + "px"
	if (hm > hs + 10 ) oside.style.height=(hm - 10 ) + "px"
}

wordarray=new Array()
buttonarray=new Array()
hue=new Array()
huespeed=new Array()
dimming=new Array()
dimmingspeed=new Array()

wmax=0
buttonmax=0
function getwords(){
	divside=document.getElementById("side1")
	divside.style.display="block"
	cn=divside.childNodes
	//alert(cn.length)
	j=0
	for (i=0; i<cn.length; i++){
		if(cn[i].className=="w"){
			wordarray[j]=cn[i]
			hue[j]=360/(i+1)
			huespeed[j]=Math.random()
			dimming[j]=0
			lightnesstime = 1 + 8*Math.random()
			dimmingspeed[j] = lightnesstime/1000
			wmax=j
			j++
		}
			//alert([wordarray[i].tagName + " " + wordarray[i].className] )
	}
	divside=document.getElementById("side2")
	divside.style.display="block"
	cn=divside.childNodes
	//alert(cn.length)
	for (i=0; i<cn.length; i++){
		if(cn[i].className=="w"){
			wordarray[j]=cn[i]
			hue[j]=360/(i+1)
			huespeed[j]=Math.random()
			dimming[j]=0
			lightnesstime = 1 + 8*Math.random()
			dimmingspeed[j] = lightnesstime/1000
			wmax=j
			j++
		}
			//alert([wordarray[i].tagName + " " + wordarray[i].className] )
	}
	j=0
	divbuttons=document.getElementById("topnav")
	cn=divbuttons.childNodes
	//alert(cn.length)
	for (i=0; i<cn.length; i++){
		if(cn[i].className=="w"){
			buttonarray[j]=cn[i]
			buttonmax=j
			j++
		}
			//alert([wordarray[i].tagName + " " + wordarray[i].className] )
	}


}
count=0
function dowords(){
	for (i=0; i<=wmax; i++){
			//debugger
			hue[i]=hue[i] + huespeed[i]
			dimming[i]=dimming[i]+dimmingspeed[i]
			rads=dimming[i]
			dimpart=0.4 * Math.cos(rads)  // +/- .15
			l=0.9+dimpart
			if(l>1) l=1
			s=1
		//debugger	
		c=getcolour(hue[i], s, l)
		wordarray[i].style.color=c
	}
	count++
	setTimeout("dowords()",40)
	//window.status=count
}





bgrads=0


function background(){
	bgrads=bgrads + .02
	bgl=0.9 + 0.1*((Math.cos(bgrads)+1)/2)
	
	bgs=0

	bgh=60
	
	c=getcolour(bgh, bgs, bgl)
	document.body.style.backgroundColor=c
	for(i=0; i<=buttonmax; i++){
		buttonarray[i].style.backgroundColor=c
	}
	
	setTimeout("background()",55)
	
}

