/******************************************************************************
 ******************************************************************************
 **
 **  File name:      pcc_nav.js
 **  Description:    The javascript to dynamicly generate a navigation bar for
 **                  different teams. It is assumed that the teams are held in
 **                  an array, with each element in the array being another
 **                  array (representing the team details). The first element of
 **                  the team details array is the name of the team, which is
 **                  used as both the anchor and the link.
 **
 **  Author:         Stuart Rudd
 **  Last Modified:
 **
 ******************************************************************************
 ******************************************************************************/


//
//  DATA PROCESSING FUNCTIONS
//

function add_page_heading(heading)
{
  write_page_heading(heading);
}


function add_nav_bar(items)
{
  start_nav();
  for (var i = 0; i < items.length; i++)
  {
    write_nav((items[i])[0], (i != 0));
  }
  end_nav();
}



//
//  OUTPUT FUNCTIONS
//

function write_page_heading(heading)
{
out("    <a name=\"top\" />");
out("    <h1>" + heading + "</h1>");
}

function write_nav(grade, useSeparator)
{
  var separator = useSeparator ? "|" : " ";
out("      " + separator +" <a href=\"#" + grade + "\">");
out("          <nobr>" + grade + "<nobr>");
out("        </a>");
}


function start_nav()
{
out("    <div class=\"grade_nav\">");
}

function end_nav()
{
out("    </div>");
}


