
/*
Spiral in Cognizin logo dots for browsers that can handle DHTML
*/

var ie=document.all;
var dom=document.getElementById;

centerX = new Array(6);
centerX[1] = 259;
centerX[2] = 355;
centerX[3] = 470;
centerX[4] = 614;
centerX[5] = 725;

centerY = new Array(6);
centerY[1] = 18;
centerY[2] = -23;
centerY[3] = -19;
centerY[4] = 10;
centerY[5] = -15;

thisDot = new Array(6);
spin = new Array(6);
drop = new Array(6);
radius = new Array(6);
degree = new Array(6);
direction = new Array(6);
dotInt = new Array(6);

function spiraldots(){
   if (dom||ie){
      for (i=1;i<=5;i++){
         dotDiv = "dot" + i;
         thisDot[i] = (dom) ? document.getElementById(dotDiv).style : document.all(dotDiv);
         spin[i] = Math.floor(Math.random()*5)+10;
         drop[i] = Math.floor(Math.random()*5)+5;
         radius[i] = Math.floor(Math.random()*500)+300;
         degree[i] = Math.floor(Math.random()*360);
         direction[i] = Math.floor(Math.random()*2);
         dotInt[i] = setInterval("spiralin("+i+")",20);
      }
   }
}

function spiralin(whichDot) {
   thisDot[whichDot].left=(radius[whichDot]*Math.cos(degree[whichDot]*Math.PI/180))+centerX[whichDot] + "px";
   thisDot[whichDot].top=(radius[whichDot]*Math.sin(degree[whichDot]*Math.PI/180))+centerY[whichDot] + "px";
   if ( direction[whichDot] == 0 ){
      degree[whichDot]+=spin[whichDot];
   }
   else {
      degree[whichDot]-=spin[whichDot];
   }
   radius[whichDot]-=drop[whichDot];
   if ( radius[whichDot] <= 0 ){
      thisDot[whichDot].left=centerX[whichDot] + "px";
      thisDot[whichDot].top=centerY[whichDot] + "px";
      clearInterval(dotInt[whichDot]);
      dotInt[whichDot] = 0;
   }
}

window.onload=spiraldots;
