<!--

// Called when a document is loaded in the main frame
function onLoadMainFrame()
{
	syncNavigationBar();
}

// Synchronize the navigation bar with the current document
function syncNavigationBar()
{
	// Get the name of the current page loaded
	var mainPageName = getNameMainPageLoaded()

	// Strip the .html
	mainPageName = mainPageName.substr(0, mainPageName.indexOf(".")); 

	// Find the button on the navigation frame with the same name, and "push it"
	var button = parent.frames["navigationframe"].document.images[mainPageName];

	// Reset all buttons
	resetAllButtons();

	// Push the button
	pushButton(button);
}

// Get the name of the current loaded document in the main frame
function getNameMainPageLoaded()
{
	// Full name of the loaded document on the main frame
	var mainPageName = parent.frames["mainframe"].location.toString();

	// Strip the directory
  var indexer = mainPageName.lastIndexOf("/");
  if (indexer != -1) {
  	 mainPageName = mainPageName.substr(indexer+1);
  }
	return mainPageName;
}

// Push the button
function pushButton(button)
{
	if (button) {
		button.src = "./pictures/" + button.name + "_in.swf";
	}
}

// Reset the button
function resetButton(button)
{
	if (button) {
		button.src = "./pictures/" + button.name + ".swf";
	} 
}

// Reset all buttons
function resetAllButtons() 
{
	var navigationDocument = parent.frames["navigationframe"].document;

  // Reset all pushed buttons (should be only one)
  for (var i=0; i<navigationDocument.images.length; i++) {
		resetButton(navigationDocument.images[i]);
  }
}

// This has to be changed to something with a cookie/database
var loggedIn = false;
function isLoggedIn()
{
	return loggedIn;
}

// -->
