//function to implement smart navigation bar

var document_title = document.title;
var document_domain = document.domain;
var document_url = document.URL;

var temp = document_url.lastIndexOf("/");
var document_path = document_url.slice(0, (temp + 1));
//document.writeln("document path: " + document_path + '<BR><BR>');
var document_file = document_url.slice((temp + 1), document.URL.length);
//document.writeln("document file: " + document_file + '<BR><BR>');

var navigation_string = '';
var section_string = '';
var file_index = new Array(1, 6, 10);

var navigation_path = new Array(
// SHAW.CA
  'http://chess.ca/Yanofsky/',
  'http://chess.ca/Yanofsky/yanofsky/',
  'http://chess.ca/Yanofsky/tournament/');
// LOCAL MACHINE
// 'http://68.145.121.153:8888/',
// 'http://68.145.121.153:8888/yanofsky/',
// 'http://68.145.121.153:8888/tournament/');

var navigation_section = new Array(
// INDEX
  'Home',
// YANOFSKY
  'Yanofsky',
// TOURNAMENT
  'Tournament');

var navigation_file = new Array(
// INDEX
  'index.html',
// YANOFSKY
  'biography.html',
  'rosner.html',
  'lipnowski.html',
  'spraggett.html',
  'games.html',
// TOURNAMENT
  'tournament.html',
  'details.html',
  'prizes.html',
  'accommodations.html');

var navigation_text = new Array(
// INDEX
  'Home',
// YANOFSKY
  'Biography',
  'Cecil Rosner',
  'Irwin Lipnowski',
  'Kevin Spraggett',
  'Games',
// TOURNAMENT
  'Tournament',
  'Details',
  'Prizes',
  'Accommodations');

function smart_navigation_bar()
  {
  for (var j = 0; j < navigation_path.length; j++)
    {
    if (document_path == navigation_path[j])
      {
      for (var i = file_index[j - 1]; i < file_index[j]; i++)
        {
        navigation_string += '<A HREF="' + navigation_path[j] + navigation_file[i] + '">' + navigation_text[i] + '</A><BR>';
        }
      document.writeln(navigation_string);
      navigation_string = '';
      }
    }
  }

function smart_section()
  {
  for (var j = 0; j < navigation_path.length; j++)
    {
    if (document_path == navigation_path[j])
      {
      section_string = navigation_section[j];
      document.writeln(section_string);
      }
    }
  }