/*
   High Top Mountain Cottages Website Navigation Bar 
   Version 4 ~ dynamic buttons and cookies
   Original JavaScript © June 2005 by 
   John Zachary Cannon
   High Top Mountain Cottages
   PO Box 216
   Dillsboro, NC  28725  USA
   (828) 586-3383
   http://www.mountaindog.net/
*/

var UseCookie = false;          // for the time being, leave unused.

/**************************************************************************************************/

/*  Cookie Functions -- "Night of the Living Cookie" Version (25-Jul-96)
    Written by:  Bill Dortch, hIdaho Design <bdortch@hidaho.com>
    The following functions are released to the public domain.
*/
  
function getCookieVal (offset) 
{
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}
  
function FixCookieDate (date) 
{
  var base = new Date(0);
  var skew = base.getTime();	// dawn of (Unix) time - should be 0
  if (skew > 0)			// except on the Mac - ahead of its time
    date.setTime (date.getTime() - skew);
}
  
function GetCookie (name) 
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return '';
}

function SetCookie (name,value,expires,path,domain,secure) 
{
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
}

var KeepCookie = false;
if ((location.href == 'http:') && (location.pathname.indexOf('mountaindog') >= 0)) KeepCookie = true;
var VISITED = 3,  PARTIALLY = 2,  UPDATED = 1,  UNVISITED = 0,  UNDETERMINED = -1;
var UNTRACKED = -2, NOTFOUND = -1;
var CookieValue = '';
var CookieName = 'pvi';        // page visit info

/**************************************************************************************************/

// Rollover functions.  These functions do nothing unless document.getElementById is defined.

var OVER = 1, IDLE = 0;

var mmap = new Object();
mmap[UNVISITED] = 'U';
mmap[UPDATED] 	= 'N';
mmap[PARTIALLY] = 'P';
mmap[VISITED] 	= 'V';

var alts = new Object();
alts['U'] = "You have not visited this link.";
alts['P'] = "You have not visited one or more pages in this group.";
alts['V'] = "You have visited this page (or pages).";
alts['N'] = "This page has been updated since your last visit.";

var enabled = false;
if (document.getElementById) enabled = true;

function rollo (p)
{
   // rollover routine for <a href=".."><img src="..">text</a> expecting class like
   // CNI, NNO, etc., and image name ending with those characters (with any extension).
   // This will also work for links with multiple or no images.

   if (!enabled) return;
   var ct, i, j, babe, currclass, newclass, s, alti, newsrc;
   currclass = p.className;
   if (currclass == '') currclass="NNI";	// default is non-current, not visited, idle
   newclass = currclass.substr(0,2);		// iscurrent and visitstate characters.
   (currclass.charAt(2) == 'I') ? newclass += 'O': newclass += 'I';  // add mousestate character.
   alti = currclass.charAt(1);			// the visitstate character
   ct = p.childNodes.length;
   for (j=0; j<ct; j++) {
       babe = p.childNodes[j];
       if (babe.tagName == "IMG") {
          babe = p.childNodes[j];
          i = babe.src.lastIndexOf (currclass);
          if (i != -1) {
             newsrc = babe.src.substring (0,i) + newclass + babe.src.substr (i+3);
             babe.src = newsrc;
             babe.className = newclass;
//           babe.alt = alts[alti];                 // this doesn't have any effect in Gecko.
          }
       }
   }
   p.className = newclass;
}

function rollp (p)
{
   // rollover routine for <img src=".."> expecting class of IDLE or OVER
   // and image name ending with OVER or IDLE (any extension).

   if (!enabled) return;
   var newclass, newsrc, a;
   currclass = p.className;
   if (currclass == '') currclass='IDLE';	// default is idle
   a = p.src.lastIndexOf (currclass);
   if (a == -1) return;
   (currclass == 'IDLE') ? newclass = 'OVER': newclass = 'IDLE';
   newsrc = p.src.substring (0,a) + newclass + p.src.substr (a+4);
   p.className = newclass;
   p.src = newsrc;
}

function rollq (p)
{
   /* Tries to toggle a tag's class between classIDLE and classOVER.  Tries to toggle an image src
      between fileIDLE.extn and fileOVER.extn */

   var tagn, nowclass, newclass, nowend, newend, l, i, babe;
   if (!enabled) return;

   /* If our object is not a tag, don't do anything.  If it is an image tag, change it's src 
      if possible and be done. */

   tagn = p.tagName;
   if ((!tagn) || (tagn == '')) {
      return;
   } else if (tagn == 'IMG') {
      rollp (p);
      return;
   }

   /* Get object's current class.  If it does not end with 'IDLE' or 'OVER' don't do anything
      with the class itself.  Otherwise the newclass will be the alternative:  abcIDLE becomes 
      abcOVER, etc. */

   if (! p.className) return;

   nowclass = p.className;
   l = nowclass.length;

   if (l < 4) return;
   nowend = nowclass.substr (l-4);	// last four characters of class name
   if (nowend == 'IDLE') newend = 'OVER';
   else if (nowend == 'OVER') newend = 'IDLE';
   else newend = '';

   if (newend != '') {
      newclass = nowclass.substr (0, l-4) + newend;
      p.className = newclass;
   }

   /* Now operate on the children (if any) of this object. */

   l = p.childNodes.length;
   for (i = 0; i < l; i++) {
       babe = p.childNodes[i];
       rollq (babe);
   }
}

/**************************************************************************************************/

// The following variables, in addition to the pages array (see below),
// may be set before calling hbar() or vbar().

var versiondate = '1999 - 2009';
var iconfold = 'pp/';
var buttonfold = 'butn/';
var pagefold = '';
var titlestart = "High Top Mountain Cottages - ";
var buttonadd = '.gif" border="0" width="20" height="12" alt="" class="';

var spacer, lipad, logo, backbutn, nextbutn, tabletd, tsl;

function navinit ()
{
   spacer = '<img src="' + iconfold + 'hspace.gif" border="0" width="160" height="1" alt="">';
   lipad = '<img src="' + iconfold + 'lipad.gif" border="0" width="20" height="12" alt="">';
   logo = '<img src="' + iconfold + 'logoIDLE.gif" border="0" width="140" height="90" class="IDLE" alt="">';
   backbutn = '<img src="' + iconfold + 'backIDLE.gif" border="0" width="70" height="36" class="IDLE" alt="click for previous page">';
   nextbutn = '<img src="' + iconfold + 'nextIDLE.gif" border="0" width="70" height="36" class="IDLE" alt="click for next page">';
   tabletd = '<td align="left" valign="top" width="160">' + spacer + '<BR>\n';
   tsl = titlestart.length;
}

var PageIndex = -1;
var HilitePage = -1;
var NextPage = 0;
var BackPage = 0;
var horizontal = false;
var useformed = true;
var funcloc = '';	// reset in bar constructor could also be 'parent.', etc. (notice dot)
var bartarget = '';	// reset in bar constructor could also be '" target="_top', etc.  (notice quotation marks)
var pages;		// this is set below

// The following are constants used to indicate the page type for entries in
// pages array.  See below.

var BREAK = 5,  MAIL = 4,  SIDEPAGE=3,   SUBPAGE = 2,  TOPPAGE = 1,  IGNORE = 0;

function mtndog ()
{
   var a, b, c, d, e, f, g, h, i, j;
   a = 'ndog@ve', b = 'n Cott', c = 'ect=Hig', d = 'mai', e = 'untai';
   f = 'lto:mt', g = 'h Top Mo',  h = 'et?subj', i = 'ages', j = 'rizon.n';
   return d + f + a + j + h + c + g + e + b + i;
}

function emimg (visi)
{
   var s = '<img src="' + visi + '" bo'
         + 'rder="0" alt="Cli'
         + 'ck here to send us an ema'
         + 'il!">';
   return s;
}

function elink (visi)
{
   var s = '<a class="IDLE" href="' + mtndog() + '" \n'
     + '   onMouseOver="rollq(this);status=\'Questions or comments?  '
     + '   Please ema'
     + 'il us, or call toll-free!\'; return true" \n'
     + '   onMouseOut="rollq(this);status=\'\'; return true">\n'
     + visi + '</a>';
   return s;
}

function lile ()
{
   var s = '<a class="IDLE" href="' + mtndog() + '" \n'
     + '   onMouseOver="rollq(this);status=\'Questions or comments?  '
     + '   Please ema'
     + 'il us, or call toll-free!\'; return true" \n'
     + '   onMouseOut="rollq(this);status=\'\'; return true"><img \n'
     + 'align="absbottom" src="pp/lilemailIDLE.gif" bo'
     + 'rder="0" alt="Cli'
     + 'ck here to send us an ema'
     + 'il!"></a>';
   document.write(s);
}
     

function intval (str)
{
   var n = parseInt (str)
   if (isNaN (n)) return 0;
   else return n;
}

function splits (str)
{
   var q = 0;
   var p = str.indexOf ('|', q);
   if (p == -1) p = str.length;
   var i = 0;
   while (q < str.length) {
      this[i] = str.substring (q, p);
      i ++;
      q = p+1;
      p = str.indexOf ('|', q);
      if (p == -1) p = str.length;
   }
   this.length = i;
   return this;
}

function FixBR (s)
{
   // Replace simple '<br>' with '<br><img src="lipad.gif"...>'

   var test, ans, ll, addon;
   ans = s;
   ll = lipad.length;
   test = ans.toLowerCase();
   p = test.indexOf ('<br>', 0);
   addon = 0;
   while (p >= 0) {
      ans = ans.substring (0, p+addon) + '<br>' + lipad + ans.substring (p+4+addon);
      addon += ll;
      p = test.indexOf ('<br>', p+1)
   }
   return ans;
}

function Entry ()
{
   // this is a member function for a Page object.

   var o = '', m = '';

   if (this.title) {
      if (useformed) m = FixBR (this.formed);
      else m = this.title;
   }

   if (this.level == MAIL) {
      o = '<p class=menu><a class="' + this.showclass + '" href="' + this.file
        + '" onMouseOver="' + funcloc + 'rollo(this);status=\'' + this.description
        + '\';return true;" onMouseOut="' + funcloc + 'rollo(this);status=\'\';return true;"><img \n'
        + '   src="' + buttonfold + this.showclass + buttonadd + this.showclass
        + '">' + m + '</a></p>\n';

   } else if (this.showclass) {
      o = '<p class=menu><a class="' + this.showclass + '" href="' + pagefold + this.file + bartarget
        + '" onMouseOver="' + funcloc + 'rollo(this);status=\'' + this.description;
      if (this.index == PageIndex) o += ' - This Page';
      o += '\';return true;" onMouseOut="' + funcloc + 'rollo(this);status=\'\';return true;"><img \n'
        + '   src="' + buttonfold + this.showclass + buttonadd + this.showclass
        + '">' + m + '</a></p>\n';

   } else if (this.level == BREAK) {
       if (horizontal) {
         o = '</td>' + tabletd;
       }
   }

   return o;
}


/* Additions June 17, 2005:

   These values are defined for TOPPAGE, SUBPAGE, SIDEPAGE.

   .seen	Receives a single character indicating the version of the page last seen.  If the
                page was never seen before, this defaults to a space.
   .abbrev	Receives a three-character unique page identifier.
   .version     Receives a single character indicating the latest, current page version for this page.
   .cookieplace Receives the character index of this page's information in the cookie.  This value
		is set to -1 if the page is not in the cookie and to UNTRACKED if the page entry
		is not actually a page, eg, BREAK, MAIL, IGNORE.  *** ALL pages have this property. ***
   .showclass   Receives the html class for a top-level page.  Undefined otherwise.
*/


function Page (pageinfo, pageindx)
{
   /* Each page has at least two properties:  index and level.  If level is BREAK
      or IGNORE then that is all the properties it has.  If level is TOPPAGE, SUBPAGE, or
      SIDEPAGE then file, title, and description properties are also present.
      All pages have the entry method, but it returns '' unless page is a TOPPAGE,
      MAIL, or BREAK entry.
   */

   var l, d, p, s;

   d = new splits (pageinfo);
   l = d.length;

   this.index = pageindx;
   this.entry = Entry;
   this.cookieplace = UNTRACKED;	// might be changed below.

   if (l == 0) {
      this.level = BREAK;
      return this;
   }

   this.level = intval(d[0]);
   if (this.level == BREAK) return this;
   if (this.level == IGNORE) return this;

   if (l < 4) {
      this.level = IGNORE;
      return this;
   }

   p = 0;
   this.seen = ' ';
   if (this.level != MAIL) {
      this.abbrev = d[1].substr (0,3);
      this.version = d[1].charAt (3);
      this.cookieplace = NOTFOUND;
      p = 1;
   }

   this.file = d[1+p];
   this.title = d[2+p];
   this.description = d[3+p];

   if (l >= 5+p) this.formed = d[4+p];
   else this.formed = this.title;

   if (this.level == TOPPAGE) this.showclass = 'NUI';
   else if (this.level == MAIL) this.showclass = 'NUI';

   return this;
}


function PageList ()
{
   // Make list of pages, discarding all entries which are invalid or designated
   // to be ignored.

   var i, all, good, test;
   all = PageList.arguments.length;
   good = 0;
   for (i = 0; i < all; i++) {
       test = new Page (PageList.arguments[i], good);
       if (test.level != IGNORE) {
          this[good] = test;
          good += 1;
       }
   }
   this.length = good;
   return this;
}


pages = new PageList (
   "1|INDA|index.html|Welcome|High Top Mountain Cottages Home Page",
   "1|SPEA|specs.html|Cottage Specifications|Cottage Specifications Page|Cottage<br>Specifications",
   "2|FEAA|features.html|Cottage Features Table|Cottage Features Comparison Table|Cottage Features<br>Table",
   "1|DW1A|dogwood.html|Dogwood Cottage|Dogwood Cottage Pictures and Description",
   "2|DW2A|dogwood2.html|Dogwood Pictures|More Pictures of Dogwood Cottage",
   "1|AZ1A|azalea.html|Azalea Cottage|Azalea Cottage Pictures and Description",
   "2|AZ2A|azalea2.html|Azalea Pictures|More Pictures of Azalea Cottage",
   "5",
   "1|LA1A|laurel.html|Laurel Cottage|Laurel Cottage Pictures and Description",
   "2|LA2A|laurel2.html|Laurel Pictures|More Pictures of Laurel Cottage",
   "1|POOA|pool.html|Swimming Pool|Pictures and Description of the Pool",
   "1|RA1A|rates.html|Rates and Reservations|2009 Rates and Reservations Information|Rates and<br>Reservations",
   "2|RA2A|detail.html|Rate Tables|Rates Tables by Cottage, Season, Number of Nights and Guests",
   "1|CALA|calendar.html|Availability Calendar|Check for Availability of Specific Dates",
   "5",
   "1|WE1A|weekend.html|Weekend Getaways|Weekend Getaways - Come Visit Us In The Off-season!",
   "2|WE2A|winter.html|Wintertime Pictures|Pictures from Winter",
   "2|WE3A|spring.html|Springtime Pictures|Pictures from Spring",
   "1|ANIA|animals.html|The Animals|Pictures of the Horse and Dogs",
   "1|REGA|region.html|Area Attractions|Western North Carolina Map and Links",
   "2|REPA|region2.html|Regional Pictures|A Few Pictures from Western North Carolina",
   "1|LOCA|local.html|How to Get Here|Local Map with Directions to High Top Mountain",
   "3|TOCA|toc.html|Table of Contents|Table of Contents - List of All Pages and Images",
   "4|" + mtndog() + "|Contact Us|Questions or comments?  Please email us, or call toll-free!"
);


/* We look for each page's 3-character abbreviation in the cookie.  If it is not found, then this page
   has never been visited before.  If it is found, the next character is the version indicator for the page.
   If this is the current version (as indicated in the pages info) then this page has been visited before;
   otherwise the page was updated since the last visit. */

function cookiecheck ()
{
   var lvl, cpl, abv, know, Q, mstr;

   // Retrieve our cookie and check  to see which pages have been visited.
   // Cookieplace is set to the string position within cookie if a page has been seen.

   if (!UseCookie) {
      for (i=pages.length-1; i>=0; i--) {
          lvl = pages[i].level;
          if (lvl == TOPPAGE) {
             if (i == HilitePage) {
                char1 = 'C'; 
                char2 = 'V';
             } else {
                char1 = 'N';
                char2 = 'U';
             }
             pages[i].showclass = char1+char2+'I';
          }
      }
      return;
   }

   CookieValue = GetCookie (CookieName);	
   if (CookieValue.length > 0) {
      for (i=0; i<pages.length; i++) {
          lvl = pages[i].level;
          cpl = pages[i].cookieplace;
          if (cpl != UNTRACKED) {
             abv = '.' + pages[i].abbrev;
             know = CookieValue.indexOf (abv);
             if (know >= 0) {
                pages[i].cookieplace = know;
                pages[i].seen = CookieValue.substr(know+4,1);
             }
          }
      }
   }

   // If we have a valid current page, set the cookie to show that we've been here.

   if (PageIndex > -1) {
      pages[PageIndex].seen = pages[PageIndex].version;
      cpl = pages[PageIndex].cookieplace;
      if (cpl > NOTFOUND) {
         cpl += 4;   // account for three characters of abbrev and . delimiter
         CookieValue = CookieValue.substring (0, cpl) + pages[PageIndex].version + CookieValue.substr (cpl+1);
      } else if (cpl == NOTFOUND ) {
         CookieValue += '.' + pages[PageIndex].abbrev + pages[PageIndex].version;
      }
      if (pages[PageIndex].cookieplace != UNTRACKED) {
         if (KeepCookie) {
            var expdate = new Date ();
            FixCookieDate (expdate);
            expdate.setTime (expdate.getTime() + (60 * 24 * 60 * 60 * 1000));    //60 days from now 
         } else expdate = null;
         SetCookie (CookieName, CookieValue, expdate);
      }
   }

   // Figure the showclass for each item visible in the menu depending on whether it and its subpages
   // have been visited.  Also account for which one is current.

   mstr = '';
   for (i=pages.length-1; i>=0; i--) {
       lvl = pages[i].level;
       cpl = pages[i].cookieplace;		// defined for all page items, even breaks
       if (cpl != UNTRACKED) {
          if (pages[i].seen == pages[i].version) mstr += 'A';   // visited
          else if (pages[i].seen == ' ') mstr += 'B';		// not visited
          else mstr += 'C';					// updated
       }
       if (lvl == TOPPAGE) {
          if (i == HilitePage) char1 = 'C'; else char1 = 'N';
          if ((mstr.indexOf('A') > -1) && (mstr.indexOf('B') == -1) && (mstr.indexOf('C') == -1)) char2 = 'V';
          else if ((mstr.indexOf('A') == -1) && (mstr.indexOf('B') > -1) && (mstr.indexOf('C') == -1)) char2 = 'U';
          else if ((mstr.indexOf('A') == -1) && (mstr.indexOf('B') == -1) && (mstr.indexOf('C') > -1)) char2 = 'N';
          else char2 = 'P';
          pages[i].showclass = char1+char2+'I';
          mstr = '';
       }
   }
}


function whichpage ()
{

   // If this page's title matches a menu item, set PageIndex to the
   // index of matching menu.  Also set HilitePage, NextPage, and BackPage.

   var i, title, testpiece, thispage, level, cookieplace;

   PageIndex = -1;
   HilitePage = -1;
   NextPage = 0;
   BackPage = 0;

   testpiece = document.title.substr (tsl);   // part of current title after titlestart

   for (i = 0; i < pages.length; i++) {
       if (pages[i].title) {
          title = pages[i].title;
          if (testpiece == title) {
             PageIndex = i;
             break;
          }
       }
   }
   if (PageIndex == -1) return;               // the title of this page was not in list

   thispage = pages[PageIndex];

   level = thispage.level;
   if ((level != TOPPAGE) && (level != MAIL)) {		// HilitePage is this page if it is a TOPPAGE
      for (i = PageIndex-1; i >= 0; i--) {		// or the first TOPPAGE before this page.
          if (pages[i].level == TOPPAGE) {
             HilitePage = i;
             break;
          }
      }
   } else {
      HilitePage = PageIndex;
   }

   BackPage = PageIndex;
   while (true) {
      BackPage -= 1;					// BackPage is first TOPPAGE or SUBPAGE
      if (BackPage <= 0) {				// before current page.
         BackPage = 0;
         break;
      }
      level = pages[BackPage].level;
      if ((level == TOPPAGE) || (level == SUBPAGE)) break;
   }

   NextPage = PageIndex;
   while (true) {
      NextPage += 1;
      if (NextPage >= pages.length) {			// NextPage is the next TOPPAGE or SUBPAGE
         NextPage = 0;					// following the current page.
         break;
      }
      level = pages[NextPage].level;
      if ((level == TOPPAGE) || (level == SUBPAGE)) break;
   }
}


function hbar() {

   // Standard horizontal bar used in most of our pages.

   navinit ();
   whichpage ();
   cookiecheck ();
   horizontal = true;
   useformed = false;
   bartarget = '';
   funcloc = '';

   var os = '<table width="650" border="0" cellspacing="0" cellpadding="0">\n'
   + '<tr><td align="left" width="170" rowspan="4">\n'

   + '<a class="IDLE" href="' + pagefold + pages[NextPage].file + bartarget
   + '" onMouseOver="' + funcloc + 'rollq(this);status=\''
   + 'Click logo for next page: ' + pages[NextPage].description
   + '\';return true;" onMouseOut="' + funcloc + 'rollq(this);status=\'\';return true;">'
   + logo + '<a></td>\n'
   + tabletd;

   for (i=0; i < pages.length-1; i++){
      os += pages[i].entry();
   }

   os += '</td></tr>\n'
   + '<tr><td align="left" colspan="2" valign="bottom">'
   + '<font class="tiny">'
   + '&nbsp;&copy; ' + versiondate + ' by High Top Mountain Cottages'
   + '</font></td>\n'
   + '<td align="left">'
   + pages[pages.length-1].entry()	// Last entry last...
   + '</td></tr></table>';

   this.bar = os;
   this.length = os.length;

}


function vbar()
{

   // A vertical bar for use in a generated frameset.

   navinit ();
   whichpage ();
   cookiecheck ();
   horizontal = false;
   useformed = true;
   bartarget = '" target="_top';
   funcloc = "parent.";

   var ts = '<p class="vtitle">'
   + '<a class="IDLE" href="' + pagefold + pages[NextPage].file + bartarget 
   + '" onMouseOver="' + funcloc + 'rollq(this);status=\''
   + 'Click logo for next page: ' + pages[NextPage].description
   + '\';return true;" onMouseOut="' + funcloc + 'rollq(this);status=\'\'; return true;">'
   + logo + '</a><br>\n'
   + pages[PageIndex].title + '</p>\n';

   var os = '';
   for (i=0; i < pages.length; i++){
       os += pages[i].entry();
   }
   os += '<p class=vcopy>'
   + '&copy; ' + versiondate + ' by High Top Mountain Cottages</p>\n';

   this.bar = os;
   this.topper = ts;
   this.length = os.length;
}

function cbar () {

   // A horizontal bar for use in a generated frameset.

   navinit ();
   whichpage ();
   cookiecheck ();
   horizontal = true;
   useformed = false;
   bartarget = '" target="_top';
   funcloc = "parent.";

   var os = '<table width="650" border="0" cellspacing="0" cellpadding="0">\n'
   + '<tr><td align="left" width="170" rowspan="4">\n'

   + '<a class="IDLE" href="' + pagefold + pages[NextPage].file + bartarget
   + '" onMouseOver="' + funcloc + 'rollq(this);status=\''
   + 'Click logo for next page: ' + pages[NextPage].description
   + '\';return true;" onMouseOut="' + funcloc + 'rollq(this);status=\'\';return true;">'
   + logo + '<a></td>\n'
   + tabletd;

   for (i=0; i < pages.length-1; i++){
      os += pages[i].entry();
   }

   os += '</td></tr>\n'
   + '<tr><td align="left" colspan="2" valign="bottom">'
   + '<font class="tiny">'
   + '&nbsp;&copy; ' + versiondate + ' by High Top Mountain Cottages'
   + '</font></td>\n'
   + '<td align="left">'
   + pages[pages.length-1].entry()	// Last entry last...
   + '</td></tr></table>';

   this.bar = os;
   this.length = os.length;

}

function nextbutton ()
{
   // Bartarget and funcloc are global variables.  They are set by calls to hbar, vbar,
   // and cbar.  Otherwise set them explicitly before calling this function.

   var s = '<a class="IDLE" href="' + pagefold + pages[NextPage].file + '" ';
   if (bartarget != '') s += 'target="' + bartarget + '" ';
   s += 'onMouseOver="' + funcloc + 'rollq(this);status=\''
   + 'Click Ghost for next page: ' + pages[NextPage].description
   + '\';return true;" onMouseOut="' + funcloc + 'rollq(this);status=\'\';return true;">'
   + nextbutn + '</a>\n';
   document.write (s);
}

function backbutton ()
{
   // Bartarget and funcloc are global variables.  They are set by calls to hbar, vbar,
   // and cbar.  Otherwise set them explicitly before calling this function.

   var s = '<a class="IDLE" href="' + pagefold + pages[BackPage].file + '" ';
   if (bartarget != '') s += 'target="' + bartarget + '" ';
   s += 'onMouseOver="' + funcloc + 'rollq(this);status=\''
   + 'Click Jack for previous page: ' + pages[BackPage].description
   + '\';return true;" onMouseOut="' + funcloc + 'rollq(this);status=\'\';return true;">'
   + backbutn + '</a>\n';
   document.write (s);
}
