/********************************************************************************
 * Unit:        navbar.js							*
 * Description: functions to synchronize contents (body-frame) with the navbar	*
 ********************************************************************************
 * Author:      Martin Seelhofer			      			*
 * Date:        July 2000							*
 ********************************************************************************
 * Copyright © 2000 Martin Seelhofer						*
 *******************************************************************************/

// synchronize the current body-document with the navbar
function syncNavbar()
{
	var doc;
	var i=1;

	//alert("No" + i); i++;

	if (top)
	{
		//alert("No" + i); i++;
		if (top.body)
		if (top.body.document)
		if (top.navbar)
		if (top.navbar.document)
		if (top.navbar.set)
		{
			top.navbar.set(findSection());
			return;
		}
	}
	else
	{
		// document was opened alone (not in the original framset)
		return;
	}

	top.setTimeout("syncNavbar();",200);
}


// find out which number the current doc has (inside the navbar)
function findSection()
{
	var layer;

	layer	= top.navbar.document;

	for (var i=0;i<layer.links.length;i++)
	{
		if (docName(layer.links[i])==docName(top.body.document.URL))
			return i;
	}
	return 0;
}

// get the document's name (without path information)
function docName(href)
{
	var pos1, pos2;
	var nam = new String(href);

	pos1	= nam.lastIndexOf("/");
	pos2	= nam.lastIndexOf("\\");

	if (pos2>pos1)
		pos1	= pos2;

	return nam.slice(pos1+1);
}

// Now synchronize with navbar...
// syncNavbar();
// Netscape is not able to do that right when loading all the frames
// but as the first menu-item is displayed as active anyway, this won't
// be a problem...
