// idl.js:

function initArray ()
  {
  // These are the page numbers where each successive html file begins:
	maxPage = 93
  pgArray = new Array(1, 9, 15, 22, 29, 37, 44, 48, 54, 62, 70, 74, 79, 87)
  // If I break up the book into different pages of html, just change this
  // array and all the links will still work!
  }

function step1 (pgno)
// Build a URL for one page of the book:
  {
  initArray()
  prefix = "idl_"

  for (ii=0; ii<pgArray.length; ii++)
    {
    if (pgno < pgArray[ii])
      {
// do nothing until we find the right html page:
      }
    else
      {
      where = pgArray[ii]
      }
    }
  if (where < 100)
    {
    prefix = prefix + "0"
    }
  if (where < 10)
    {
    prefix = prefix + "0"
    }
  }

function genAddr (pgno)
// Generate an "a href" tag for a page:
  {
  step1 (pgno)
  document.write("<a href='" + prefix + where + ".htm#pg" + pgno + "' title='see page " + pgno + "'>" )
  }

function goPage (pgno)
// Go to the URL for the desired page:
  {
  step1 (pgno)
  docAddr = prefix + where + ".htm#pg" + pgno
  window.location = docAddr
  }

function genBottom(p)
// Generate some links at the bottom of a page:
  {
  document.write("<h6><a href='index.htm' title='go to IDL home page'>IDL home<\/a>&nbsp;|&nbsp;")
  genAddr(p)
  document.write("Next page<\/a>&nbsp;|&nbsp;<a href='idl_a.htm' title='go to IDL index'>Index<\/a><\/h6>")
  }

function genMiddle(p)
// Generate some links in the middle of a page:
  {
  document.write("<h6><a href='index.htm' title='go to IDL home page'  name='pg" + p + "'>IDL home<\/a>&nbsp;|&nbsp;<a href='idl_a.htm' title='go to IDL index'>Index<\/a><\/h6>")
  }

function genTop(p)
// Generate some links at the top of a page:
  {
  document.write("<h6><a href='index.htm' title='go to IDL home page'>IDL home<\/a>&nbsp;|&nbsp;")
  genAddr(p)
  document.write("Preceding page<\/a>&nbsp;|&nbsp;<a href='idl_a.htm' title='go to IDL index'>Index<\/a><\/h6>")
  }

function choosePage()
// Process input from a FORM and then go to the selected page:
  {
  inParam = ""
  testURL = "" + self.location
	testChar = "="
  if (testURL.indexOf(testChar) != -1)
    {
    inParam = testURL.substring(testURL.indexOf(testChar)+1,testURL.length)
		if (inParam < 1) {inParam = 1}
		if (inParam > 93) {inParam = 93}
		goPage(inParam)
		}
	webTVkludge()
  }

function insertIndex(anchor)
  {
  // Generate an anchor name followed by links to all
  // the pages of Mrs. Morris' biographical index:
  document.write("<br clear=all>")
  document.write("<div class=idx>")
  // For some reason, Mozilla and MIE don't work right
  // if the anchor isn't within this div. Opera either
  // works right or just doesn't care...
  if (anchor.length != 0)
    {
  document.write("<center><a name='" + anchor + "'><\/a><\/center>")
    }
  document.write("<a href='idl_a.htm#a'>A<\/a>&nbsp;")
  document.write("<a href='idl_a.htm#b'>B<\/a>&nbsp;")
  document.write("<a href='idl_a.htm#c'>C<\/a>&nbsp;")
  document.write("<a href='idl_d.htm#d'>D<\/a>&nbsp;")
  document.write("<a href='idl_d.htm#e'>E<\/a>&nbsp;")
  document.write("<a href='idl_f.htm#f'>F<\/a>&nbsp;")
  document.write("<a href='idl_f.htm#g'>G<\/a>&nbsp;")
  document.write("<a href='idl_f.htm#h'>H<\/a>&nbsp;")
  document.write("<a href='idl_i.htm#i'>I<\/a>&nbsp;")
  document.write("<a href='idl_i.htm#j'>J<\/a>&nbsp;")
  document.write("<a href='idl_i.htm#k'>K<\/a>&nbsp;")
  document.write("<a href='idl_i.htm#l'>L<\/a>&nbsp;")
  document.write("<a href='idl_m.htm#m'>M<\/a>&nbsp;")
  document.write("<a href='idl_m.htm#mc'>Mc<\/a>&nbsp;")
  document.write("<a href='idl_m.htm#n'>N<\/a>&nbsp;")
  document.write("<a href='idl_m.htm#o'>O<\/a>&nbsp;")
  document.write("<a href='idl_m.htm#p'>P<\/a>&nbsp;")
  document.write("<a href='idl_r.htm#r'>R<\/a>&nbsp;")
  document.write("<a href='idl_r.htm#s'>S<\/a>&nbsp;")
  document.write("<a href='idl_t.htm#t'>T<\/a>&nbsp;")
  document.write("<a href='idl_t.htm#v'>V<\/a>&nbsp;")
  document.write("<a href='idl_t.htm#w'>W<\/a>&nbsp;")
  document.write("<a href='idl_t.htm#y'>Y<\/a>&nbsp;")
  document.write("<a href='index.htm'>Home<\/a>")
  document.write("<\/div>")
  }

function webTVkludge()
	// We have problems with certain browsers which require
	// us to bust out of the framed environment!
  {
  if (top.location != self.location)
    {
		// WebTV:		
		if (navigator.userAgent.indexOf('WebTV') != -1)
		  {
	  	top.location = self.location
		  }
		// Opera 3.62:
		if (navigator.userAgent.indexOf('Opera 3') != -1)
		  {
	  	top.location = self.location
		  }
		// Konqueror:
		if (navigator.userAgent.indexOf('Konqueror') != -1)
		  {
	  	top.location = self.location
		  }
		// I still have some problems with FireFox which I can't resolve.
    }
  }

// Last updated 21 Jun 2005.
