if(!Array.indexOf){
  Array.prototype.indexOf = function(obj){
    for(var i=0; i<this.length; i++){
      if(this[i]==obj){
        return i;
      }
    }
    return -1;
  }
}

function setCrumb() {
    var path = location.pathname;
    var infoArray = new Array("/about.html", "/faq.html", "/resources.html", "/staff.html");
    var actionArray = new Array("/petition.html", "/guestbook.html", "/join.html");
    if(infoArray.indexOf(path) != -1) {
        document.getElementById("info").id="crumb";
    }
    else if(actionArray.indexOf(path) != -1) {
        document.getElementById('action').id="crumb";
    }
    else if(path == "/contact.html") {
        document.getElementById("contact").id="crumb";
    }
}

function shownav(section) {
    if(document.getElementById('crumb')) {
        var currentPage = document.getElementById('crumb');
        var currentSubNav = currentPage.getElementsByTagName('div');
        if (currentSubNav.length > 0) {        
          var currentSubNav = currentSubNav[0];
        // hide persistant nav
          currentSubNav.style.display = 'none';
        }
    }
    // show this nav
    var sectionObj = document.getElementById(section);
    sectionObj.style.display = 'block';        
}

function hidenav(section) {
    // hide this nav
    var sectionObj = document.getElementById(section);
    sectionObj.style.display = 'none';        
    if(document.getElementById('crumb')) {
      // show persistant nav
      var currentPage = document.getElementById('crumb');
      var currentSubNav = currentPage.getElementsByTagName('div');
      if (currentSubNav.length > 0) {
        var currentSubNav = currentSubNav[0];
        currentSubNav.style.display = 'block';
      }
    }
}
