// Sidebars with links should use this file.

// First, make the background color "sticky"
var whereami = window.parent.location.toString();
for (var i=0;i<document.links.length;i++) {
  if((whereami.indexOf(document.links[i].href) > -1) && (document.links[i].parentNode.className == 'subitem')) {
    document.links[i].style.backgroundColor = "#d76e32";
    document.links[i].style.backgroundImage = "url(/images/yellow-orange-triangle.gif)";
  }
}

// Also, resize the parent iframe to accommodate a perhaps fluctuating
// number of links (means I don't have to touch the files using the
// sidebar by hand if the height changes).

var A = window.parent.document.getElementsByTagName("iframe");
var B = Math.max(document.body.offsetHeight,document.body.scrollHeight);

var C = document.getElementById("elastic");
B = Math.max(C.offsetHeight+C.offsetTop,B);

for (var i=0;i<A.length;i++) {
  if (/sidebar.html/.test(A[i].src.toString())) {
    A[i].style.height = B+"px";
  }
}
