
//===========================================================================
// LOCALIZATION
//
var str_onlastpage 	= "You are on the last page.";
var str_onfirstpage 	= "You are on the first page.";

//===========================================================================
// GLOBAL VARIABLES
//
var curfile = "";

//===========================================================================
// doBrowse - enables back and next browsing
//
// This assumes that 'browselist' is defined elsewhere
//
// <direction> = the number of pages that are skipped, use 1 for next 
//               and -1 for back.
//
function doBrowse(direction) {
  curfile = document.all.curfile.value
  var ct = 0;
  for( var num in browselist ) {
    var file = browselist[num];
    if( curfile == file ) {
      var newfile = browselist[ct+direction];
    }
    ct++;
  }
  if( newfile ) { document.all.ifrm.src=newfile; }
  else {
    if( direction == 1 ) { alert(str_onlastpage); }
    else { alert(str_onfirstpage); }
  }
}

//===========================================================================
// setButton - sets the appropriate nav "button" for the lesson.
//
// This assumes that all button IMG object names are "imageN" starting with "image1"
//
// <imgnum>  = the number associated with the "image" object 
// <numbtns> = the number of buttons (lessons)

function setButton(imgnum,numbtns) {
  var i = 1;
  while( i <= numbtns ) {
    eval("parent.document.image"+i+".src='gray_sq.gif';");
    eval("parent.document.botimage"+i+".src='gray_sq.gif';");
    i++;
  }
  eval("parent.document.image"+imgnum+".src='blue_sq.gif';");
  eval("parent.document.botimage"+imgnum+".src='blue_sq.gif';");
  document.all.curfile.value = browselist[imgnum]
}

//===========================================================================
// setsize - adjusts the size of the iframe so the scrollbars align properly
//
// add to onload and onresize events

function setsize() {
  if( navigator.appName == "Microsoft Internet Explorer" ) {
    var ht = document.body.clientHeight - document.all.ifrm.offsetTop;
    if( ht > 32 ) {
      document.all.ifrm.style.height = ht-32;
    }
  }
}

//===========================================================================

function MakeArray(n) {
  this.length = n;
  for (var i = 1; i <= n; i++) { 
    this[i] = 0 
  }
  return this
}


