// scripts for navigation links

// two arrays hold (1) filesnames and (2) link text
// the two must be parallel in construction, and the order matters
// cannot go down into subdirectories: links will break
var linkfiles = new Array("index", "attend", "books", "objectives", "grading", "honesty", "sked", "disabilities", "after_week6");
var linktexts = new Array("Home", "Attendance", "Books", "Course objectives", "Grading", "Honesty policy", "Schedule", "Students with disabilities", "After Week 6");

// generic tags defined here
var liopen = '<li>';                     // open LI tag
var liclose =  '<\/li>';                 // generic close LI
var nlinkStart1 = '<a href=\"';           // beginning of A HREF tag
var nlinkStart1a = '<a href=\"..\/';      // beginning of A HREF tag
var nlinkStart2 = '.htm\">';              // end of A HREF tag
var nlinkEnd = '<\/a>';                   // closing /A tag


// footer text

var identcr = "Syllabus contents, design &amp; graphics copyright &copy; 2003 Melinda J. McAdams ";
identcr += "[" + nlinkStart1 + "http:\/\/mindymcadams.com\/" + '\">' + "Home" + nlinkEnd + "]" + "\n\n";
// -------------------------------------------------------
// here's the stuff that generates the code for the navigation links
// call the function on the page at the spot where the list of links should appear
var navlist = "";
// the function called on the page is writeNav
function writeNav(docFilename)  {
   if (docFilename == "lev3") {
      nlinkStart1 = nlinkStart1a;
   }
   for (i = 0; i < linkfiles.length; i++) {  // linkfiles is the array, at top
      if (linkfiles[i] == docFilename) {
         navlist = navlist + liopen + linktexts[i] + liclose + '\n';
      } else {
         navlist = navlist + liopen + nlinkStart1 + linkfiles[i] + nlinkStart2 + linktexts[i] + nlinkEnd + liclose + '\n';
      }
   }
   document.write(navlist);
}
// -------------------------------------------------------
// the function called on the page is writeHomenav
function writeHomenav()  {
   for (i = 1; i < linkfiles.length; i++) {  // linkfiles is the array, at top
         navlist = navlist + liopen + nlinkStart1 + linkfiles[i] + nlinkStart2 + linktexts[i] + nlinkEnd + liclose + '\n';
   }
   document.write(navlist);
}
// -------------------------------------------------------
// end of script page
