
var rot_d = 1;
var t;

function timedCount() {
      var max = document.getElementById("rot_count").firstChild.nodeValue;
      swapClass(rot_d);
      rot_d=rot_d+1;
      if(rot_d>max) { rot_d=1;}
      t=setTimeout("timedCount()",7000);
}

function swapClass(view) {
  var max = document.getElementById("rot_count").firstChild.nodeValue;
  var i = 1;
  while (i <= max) {
    if (i != view) {
    document.getElementById("rot_div"+i).className = "rot_hide";
    }
    document.getElementById("rot_boxlink"+i).className = "rot_showlink"; 
    i++;
  }
  mydiv = "rot_div"+view;
  document.getElementById(mydiv).className = "rot_show";
  fade(mydiv, 10, 99, 2000);
  clearTimeout(t);
}

function setOpacity(eID, opacityLevel) {
          var eStyle = document.getElementById(eID).style;
          eStyle.opacity = opacityLevel / 100;
          eStyle.filter = 'alpha(opacity='+opacityLevel+')';
      }

function fade(eID, startOpacity, stopOpacity, duration) {
          var speed = Math.round(duration / 100);
          var timer = 0;
          if (startOpacity < stopOpacity){ // fade in
              for (var i=startOpacity; i<=stopOpacity; i++) {
                  setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
                  timer++;
              } return;
          }
          for (var i=startOpacity; i>=stopOpacity; i--) { // fade out
              setTimeout("setOpacity('"+eID+"',"+i+")", timer * speed);
              timer++;
          }
      }

