// navbar.js
//
// Copyright 1998, TC2 Solutions, All Rights Reserved.
//
// This product is protected under international copyright
// protection laws. It cannot be used for profit without
// first obtaining a license for the explicit use of this
// product.
//
// Basically, this means that this whole file has some use
// for some people. I worked my heart out on it, and I don't
// want to see someone else make money off of what I worked
// on without their kind donation to the author. If that
// person using this product is using it for a not for profit
// organization, then they are not required to pay a small
// licensing fee. However, if said person does use this product,
// makes a profit, and does not purchase a license, then the
// cost of this product will be amazingly larger than they
// would have paid beforehand.
//
// Come on. Be decent. Its only $5 per script, and $50 for the
// whole kit and caboodle. More details and scripts are located
// at http://www.bewley.net/~prsnyder/AdvJS/ Thanks again.

self.defaultStatus = "";

//  text, URL, img
function NavPoint()
{
  var argv = NavPoint.arguments;
  var argc = argv.length;

  this.text = "";
  this.URL = "";

  this.img = new Image();
  this.img.src = "";
  this.img2 = new Image();
  this.img2.src = "";
  this.images = 0;

  if (argc >= 3) {
    this.img.src = argv[2];
    this.images = 1;
  }
  if (argc > 3) {
    this.img2.src = argv[3];
    this.images = 2;
  }

  this.text = argv[0];
  this.URL = argv[1];

  function PrintPoint(pt)
  {
    if (pt.images == 2) {

      // We need to generate a uniwue name for this image,
      // so we'll use random numbers, naturally.
      var num = parseInt(Math.random() * 1000);
      var img_num = "nav_"+num;

      // But what if this random number already occurred by
      // some strange phenomenon?
      while (document.images[img_num]) {  // Check to see if it exists already
        num++;                            // As long as it does, add one to it
        img_num = "nav_"+num;             // That's our new image name then!
      }
      document.write("<a href=\""+pt.URL+"\" onMouseOver=\"document.images['nav_"+num+"'].src='"+pt.img2.src+"'; self.status='"+pt.text+"'; return true\" onMouseOut=\"document.images['nav_"+num+"'].src='"+pt.img.src+"'\"><img src=\""+pt.img.src+"\" border=0 name=\"nav_"+num+"\" alt=\""+pt.text+"\"></a>");
//      document.write("<a href=\""+pt.URL+"\" onMouseOver=\"document.images['nav_"+num+"'].src='"+pt.img2+"'; self.status='"+pt.text+"'; return true\" onMouseOut=\"document.images['nav_"+num+"'].src='"+pt.img+"'\"><img src=\""+pt.img+"\" border=0 name=\"nav_"+num+"\" alt=\""+pt.text+"\"></a>");

    } else {
      if (pt.images == 1)
        document.write("<a href=\""+pt.URL+"\" onMouseOver=\"self.status='"+pt.text+"'; return true\"><img src=\""+pt.img.src+"\" border=0 alt=\""+pt.text+"\"></a>");
//        document.write("<a href=\""+pt.URL+"\" onMouseOver=\"self.status='"+pt.text+"'; return true\"><img src=\""+pt.img+"\" border=0 alt=\""+pt.text+"\"></a>");
      else
        document.write(" <a href=\""+pt.URL+"\" onMouseOver=\"self.status='"+pt.text+"'; return true\">"+pt.text+"</a> ");
    }
  }

  this.Print = PrintPoint;
}

function NavBar(points)
{
  function PrintBar()
  {
    for (i=0; i<points.length; i++)
      points[i].Print(points[i]);
  }

  this.Print = PrintBar;
}

