function highlightRows() {
  if(!document.getElementsByTagName) return false;
  var rows = document.getElementsByTagName("tr");
  for (var i=0; i<rows.length; i++) {
    rows[i].oldClassName = rows[i].className
    rows[i].onmouseover = function() {
      addClass(this,"highlightrow");
    }
    rows[i].onmouseout = function() {
      this.className = this.oldClassName
    }
  }
}

function showSection(id) {
    var divs = document.getElementsByTagName("div");
    for (var i=0; i<divs.length; i++ ) {
        if (divs[i].className.indexOf("section") == -1) continue;
        if (divs[i].getAttribute("id") != id) {
            divs[i].style.display = "none";
        } else {
            divs[i].style.display = "block";
        }
    }
}

function prepareMonthnav() {
    if (!document.getElementsByTagName) return false;
    if (!document.getElementById) return false;
    if (!document.getElementById("monthnav")) return false;
    var monthnav = document.getElementById("monthnav");
    var links = monthnav.getElementsByTagName("a");
    var first = true;
    
    for (var i=0; i<links.length; i++ ) {
        var sectionId = links[i].getAttribute("href").split("#")[1];
        if (!document.getElementById(sectionId)) continue;
        
        if (first) {
            first = false;
        } else {
            document.getElementById(sectionId).style.display = "none";
        }
        
        links[i].destination = sectionId;
        links[i].onclick = function() {
            showSection(this.destination);
            return false;
        }
    }
}

addLoadEvent(highlightRows);
addLoadEvent(prepareMonthnav);
