/* navbar.js */

var aNavBar = new Array();

aNavBar[0] = new navBarLink("2003 Indoor Home", "index.php", "2003 Indoor home page", "nbHome");
aNavBar[1] = new navBarLink("News", "news.php", "recent and upcoming news and events", "nbNews");
aNavBar[2] = new navBarLink("Schedule", "schedule.php", "match schedule for all competitions", "nbSchedule");
aNavBar[3] = new navBarLink("Standings", "standings.php", "league standings for all competitions", "nbStandings");
aNavBar[4] = new navBarLink("Fields", "fields.php", "playing field information", "nbFields");
aNavBar[5] = new navBarLink("Archives", "../archives.php", "results from other years", "nbArchives");
aNavBar[6] = new navBarLink("Contact", "contact.php", "GKSSA executive and team contact information", "nbContact");


/* -----------------------------------------------------------------------
*/
function navBarLink(sText, sHRef, sTitle, sId)
{
	/* base class and selected class hard-wired at least for now in this function:
		nav1bar and nbSelected
	*/
	this.sId = sId;
	this.sClass = "nav1bar";
	this.sSelected_class = "nbSelected";
	this.sHRef = sHRef;
	this.sTitle = sTitle;
	this.sText = sText;
}	// navBarLink()


/* -----------------------------------------------------------------------
*/
function writeNavBar(sDivId, sDivClass, sTableId, sPageId)
{
	document.writeln('<div align="left" id="' + sDivId + '" class="' + sDivClass + '">');
	document.writeln('<table id="' + sTableId + '" cellspacing="0" cellpadding="0" rules="cols" border="2">');
	document.writeln('<tr>');
	
	writeAllNavBarCells(sPageId);
	
	document.writeln('</tr>');
	document.writeln('</table>');
	document.writeln('</div>');
	document.writeln('<div id="nbSub" style="background-color: #bfb; text-align: right;"><a href="../index.php" title="today\'s GKSSA home page">GKSSA Home Page</a>&nbsp;&nbsp;&nbsp;</div>');
}	// writeNavBar()


/* -----------------------------------------------------------------------
*/
function writeAllNavBarCells(sPageId)
{
	/* for example:
	<td id="nbSchedule" class="nav1bar"><a href="schedule.php" 
				title="match schedule for all competitions">Schedule</a></td>
	*/
	
	var nIt;
	var nbLink;
	var	bIsLinkForPage;
		
	for (nIt = 0; nIt < aNavBar.length; nIt++)
	{
		nbLink = aNavBar[nIt];
		bIsLinkForPage = (nbLink.sId == sPageId);
		
		document.write('<td id="' + nbLink.sId + '" class="' + nbLink.sClass);
		if (bIsLinkForPage)
		{
			document.write(' ' + nbLink.sSelected_class);
		}
		document.write('">');
		
		if (!bIsLinkForPage)
		{
			document.write('<a href="' + nbLink.sHRef + '" title="' + nbLink.sTitle + '">');
		}

		document.write(nbLink.sText);

		if (!bIsLinkForPage)
		{
			document.write('</a>');
		}

		document.write('</td>');		
	}
}	// writeAllNavBarCells()
