var _topmenu = new Array(
	0,
	"Home","index.php",
	"Photographs","photos/index.htm",
	"Writings","writings/index.htm",
//	"Ideas","ideas/index.htm",
//	"WebLog","cgi-bin/nb/nb.cgi",
	"Work","work/index.htm"
);
var _photomenu = new Array(
	1,
	"General","photos1/index.htm",
	"Gallery 2","gallery2/index.htm",
	"Where pens go","pens/index.htm",
	"Peace marches","march/index.htm",
	"Architecture","architecture/index.htm",
	"Cars","cars/index.htm",
	"Bikes","race/index.htm",
//	"Hikes","hikes/index.htm",
	"Fiesta","fiesta/index.htm",
	"Farmers market","farmersmarket/index.htm",
	"Solstice","solstice/index.htm",
	"Wedding","weddingPM/index.htm",
	"Views","views/index.htm"
);

function Repeat(str, count) {
	while (count-- > 0)
		document.write(str);
}

function GetLevel() {
	var doclevel = 0; // directory level relative to the domain root
	var index = 0;    // character index within the path
	var path = location.pathname;
	// IE uses some (but not all) backslashes; replace them
	if (path.charAt(3) == '\\')
		path = path.replace(/\\/g, "/");
	// count the number of slashes in the path (excluding the first)
	while ((index = path.indexOf("/", index+1)) >= 0)
		doclevel++;
	// if it's a file:// then remove /D:/data/PM
//	if (doclevel >= 3)
//		doclevel -= 3;
  return doclevel;
}

function ShowMenu(menu, current) {
  var doclevel = GetLevel();
	var menulevel = menu[0]
	document.writeln("<div class=menu style=\"padding:0 0 0 ",String(menulevel*20),";\">");
	//Repeat("&nbsp;&nbsp;&nbsp;", menulevel);
	for (var i = 1; i < menu.length; i += 2)
	{
//		document.writeln("&nbsp;&nbsp;&nbsp;");
		if (menu[i] == current)
		{
			document.write(" <span class=no_nav>",menu[i],"</span>");
		}
		else
		{
			document.write(" <a class=nav href=");
			Repeat("../", doclevel - menulevel);
			document.write(
				menu[i+1],
				">",
				menu[i],
				"</a>");
		}
	}
	document.writeln("</div>");
}

// add the styles sheets - ensures all pages get the same set
function AddStyles() {
var s = "";
for (var i = GetLevel(); --i >= 0;)
  s += "../";
document.writeln("<link type=text/css rel=stylesheet href=\"",s,"site.css\">");
}

AddStyles();

