// 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", "books", "objectives", "grading", "portfolio", "honesty", "disabilities");
var linktexts = new Array("Home", "Books", "Course objectives", "Grading", "Portfolio", "Honesty policy", "Students with disabilities");

// 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 nlinkStart2php = '.php\">';           // end of A HREF tag
var nlinkEnd = '<\/a>';                   // closing /A tag


var extralink = liopen + nlinkStart1 + 'sked/index' + nlinkStart2php + 'Week-by-week schedule and assignments' + nlinkEnd + liclose;


// 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';
      }
   }
   navlist = navlist + extralink + '\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';
   }
   navlist = navlist + extralink + '\n';
   document.write(navlist);
}
// -------------------------------------------------------
// end of script page

