function sermons_nav() {
  var content=document.getElementById("bodyContent");
  var h3s=content.getElementsByTagName("H3");
  for (i=1; i<h3s.length; i++) {
    format_sermon(h3s[i]);
  }
}

function format_sermon(h3) {
  var div,parent,cur,nxt;
  div=document.createElement("DIV");
  div.className="sermon";
  div.over=false;
  div.onmouseover=function (e) {
    if (!this.over) { this.over=true; this.className += " over-sermon"; }
  }
  div.onmouseout=function (e) {
    if (this.over) { this.over=false; this.className = "sermon"; }
  }
  div.onclick=function (e) {
    if (this.href) { window.location.href=this.href; }
  }
  parent=h3.parentNode;
  cur=h3.nextSibling;
  nxt=cur.nextSibling;
  parent.replaceChild(div,h3);
  div.appendChild(h3);
  while (cur.nodeName=="P"||cur.nodeName=="#text") {
    parent.removeChild(cur);
    div.appendChild(cur);
    if (cur.nodeName=="P" && cur.innerHTML.indexOf("more...") != -1) {
      div.href = cur.getElementsByTagName("A")[0].href;
    }
    cur=nxt;
    nxt=cur.nextSibling;
  }
}

addOnloadHook(
  function() {
    if (window.location.href.indexOf("Sermons") != -1) {
      sermons_nav();
    }
  }
);
    

