/*
Drop Cognizin logo dots for browsers that can handle DHTML
*/

var ie=document.all;
var dom=document.getElementById;

endY = new Array(6);
endY[1] = 18;
endY[2] = -23;
endY[3] = -19;
endY[4] = 10;
endY[5] = -15;
thisDot = new Array(6);
speed = new Array(6);
down = new Array(6);
up = new Array(6);
dotInt = new Array(6);

function dropdots(){
   if (dom||ie){
   for (i=1;i<=5;i++){
      dotDiv = "dot" + i;
      thisDot[i] = (dom) ? document.getElementById(dotDiv).style : document.all(dotDiv);
      thisDot[i].top = (Math.floor(Math.random()*300)-500)+"px";
      speed[i] = 0;
      down[i] = true;
      up[i] = false;
      dotInt[i] = setInterval("bouncedots("+i+")",20);
   }
   }
}

function bouncedots(whichDot) {
   if ((parseInt(thisDot[whichDot].top)+speed[whichDot] < endY[whichDot]) && down[whichDot]) {
      thisDot[whichDot].top = parseInt(thisDot[whichDot].top) + speed[whichDot] + "px";
      speed[whichDot]++;
      return;
}
else {
   if ((parseInt(thisDot[whichDot].top)< endY[whichDot]) && down[whichDot]) {
      thisDot[whichDot].top = endY[whichDot] + 5 + "px";
      return;
   }
   down[whichDot] = false;
   up[whichDot] = true;
   if (speed[whichDot] < 0 && parseInt(thisDot[whichDot].top) > endY[whichDot]) {
   clearInterval(dotInt[whichDot]);
   dotInt[whichDot] = 0;
}
if (parseInt(thisDot[whichDot].top) > -300 && up[whichDot] && speed[whichDot] >= 0) {
   thisDot[whichDot].top = parseInt(thisDot[whichDot].top) - speed[whichDot] + "px";
   speed[whichDot]--;
   if (speed[whichDot]%3== 0) speed[whichDot]--;
   return;
}
down[whichDot] = true;
up[whichDot] = false;
}
}

window.onload=dropdots;
