  function getElementsByClassName(className) {
    var ret = [];
    var regex = new RegExp("\\b" + className + "\\b");
    var tags = this.getElementsByTagName("*");
    for (var i = 0; i < tags.length; i++) {
      var classes = tags[i].className;
      if (regex.test(classes)) ret.push(tags[i]);
    }
    return ret;
  }

  if (!document.getElementsByClassName) {
    document.getElementsByClassName = getElementsByClassName;
  }

  var downloads = document.getElementsByClassName("download");
  for (var i = 0; i < downloads.length; i++) {
    var download = downloads[i];

    if (!download.getElementsByClassName) {
      download.getElementsByClassName = getElementsByClassName;
    }

    var expando = download.getElementsByClassName("expando")[0];

    var a = document.createElement("a");
    a.setAttribute("href", "javascript:expand(" + i + ");");

    var img = document.createElement("img");
    img.setAttribute("src", "/res/plus.png");
    img.setAttribute("alt", "+");
    img.setAttribute("title", "Show Description");
    img.setAttribute("id", "expand" + i);

    a.appendChild(img);

    expando.appendChild(a);

    var projectname = download.getElementsByClassName("projectname")[0];

    a = document.createElement("a");
    a.setAttribute("href", "javascript:expand(" + i + ");");
    a.innerHTML = projectname.innerHTML;

    projectname.innerHTML = "";
    projectname.appendChild(a);

    var projectdesc = download.getElementsByClassName("projectdesc")[0];
    projectdesc.className = "collapsedprojectdesc";
    projectdesc.id = "details" + i ;
  }

  function expand(num) {
    var expander = document.getElementById("expand" + num);
    var codedesc = document.getElementById("details" + num);

    if (codedesc.className == "collapsedprojectdesc") {
      codedesc.className = "projectdesc";
      expander.setAttribute("src", "/res/minus.png");
      expander.setAttribute("alt", "-");
      expander.setAttribute("title", "Hide Description");
    } else {
      codedesc.className = "collapsedprojectdesc";
      expander.setAttribute("src", "/res/plus.png");
      expander.setAttribute("alt", "+");
      expander.setAttribute("title", "Show Description");
    }
  }
