// JavaScript Document
<!--
z=100
flash=1.00 // permanent flash.time light is off before next light is lit. higher flashrate leaves light on longer
timez=""
thisnum=0

function checknum(){ //prevent showing the same colour light in sequence. ie red after red
lastnum=thisnum
count=Math.round(Math.random()*5)
if(count==lastnum){
checknum()}
else{
thisnum=count
preview()
}
}

function preview(){
clearTimeout(timez)
red=100+Math.round(Math.random()*155)
green=100+Math.round(Math.random()*155)
blue=100+Math.round(Math.random()*155)

speed=50+Math.round(Math.random()*400) //100=minspeed, 100+400=maxspeed
//flash=0.1+Math.random()*0.9 // for random flash rate each run. higher flashrate leaves light on longer
flashrate=speed*flash // time light is off before next light is lit.

//count=Math.round(Math.random()*5) // transfered to function checknum

if(count==0){
document.all.disco.filters.Light(1).addcone(40,70,z,40,70,0,green,0,100,90);
setTimeout("clearme()",flashrate)
}
if(count==1){
document.all.disco.filters.Light(1).addcone(120,70,z,130,70,green,green,0,100,90); //yellow
setTimeout("clearme()",flashrate)
}
if(count==2){
document.all.disco.filters.Light(1).addcone(200,70,z,200,70,red,0,0,100,90);
setTimeout("clearme()",flashrate)
}
if(count==3){
document.all.disco.filters.Light(1).addcone(280,70,z,280,70,0,0,blue,100,90);
setTimeout("clearme()",flashrate)
}

if(count==4){
document.all.disco.filters.Light(1).addcone(360,70,z,360,70,red,0,blue,100,90);
setTimeout("clearme()",flashrate)
}
if(count==5){
document.all.disco.filters.Light(1).addcone(440,70,z,440,70,red,green,blue,100,90);
setTimeout("clearme()",flashrate)
}

timez=setTimeout("checknum()",speed)
}

function clearme(){
document.all.disco.filters.Light(1).clear();
document.all.disco.filters.Light(0).Addambient(0,0,0,0) // colour and intensity of background light
return
}

setTimeout("checknum()",1500)
// -->
