// JavaScript Document

prepPDF = function() {
  var pageHasPDFs = false;
  var mainContent = document.getElementById("mainContent");
  var links = mainContent.getElementsByTagName("a");
  for (i=0; i<links.length; i++) {
    var currentLink = links[i];
    var images = currentLink.getElementsByTagName("img");
    /*Check if the link is an image (we don't want icons next to images) and that ".pdf" appears in the link href.*/
    if (images.length == 0 && currentLink.href.indexOf('.pdf') != -1) {
      var curClass = currentLink.getAttribute("class");
      if (curClass != null) { currentLink.className = curClass + " pdf"; }
      else { currentLink.className = "pdf"; }
      pageHasPDFs = true;
    }
  }
/*If any a's had classes of "pdf" applied, then add the text to let the user go to Adobe's site for Reader.*/
 /* if (pageHasPDFs==true) {
    var para = document.createElement("p");
    para.innerHTML = "This page has links to PDF files. In order to view these files, you will need to visit Adobe's     website download their free <a href=\"http://www.adobe.com\">PDF Reader.</a>";
    mainContent.appendChild(para);
  }*/
}
window.onload = function() {
prepPDF();
} 