// Marco Faella - mfaella@soe.ucsc.edu
// menu.js - 1.0
// 
// A context-sensitive menu generator.
// Displays a simple navigation menu, 
// where the entry corresponding to the current page is always highlighted.
// Widely compatible.
//
// This code is released to the public domain.


// Number of menu entries
var n = 6

var target = new Array(n)
var name = new Array(n)
var base = "http://people.na.infn.it/mfaella/"

// Names of entries, as displayed on page
name[0] = "Home"
name[2] = "Short Bio"
name[1] = "Projects"
name[3] = "Publications"
name[4] = "Didattica"
name[5] = "Erasmus"
name[6] = "Store"

// Targets of menu entries
target[0] = base + "index.html"
target[2] = base + "bio.html"
target[1] = base + "projects.html"
target[3] = base + "papers.html"
target[4] = base + "didattica.html"
target[5] = base + "erasmus.html"
target[6] = "http://www.cafepress.com/paradoxa"


// Extracts the file name of the current location
slash = location.href.lastIndexOf("/") +1
page = location.href.substr(slash, location.href.length - slash)

// Uncomment to debug
// document.writeln("*" + page + "*")

if (page.length == 0) 
	page = "index.html"

// Prints the menu
for (i=0; i<n; i++)
{
  if (target[i] != page) {
      document.writeln("<p><a href=" + target[i] + ">" + name[i] + "</a></p>")
  } else {
      // The current entry
      document.writeln("<p><b>" + name[i] + "</b></p>") 
  }
}

