function createMenuItem(name, text, href) {
	var item = new Object();
	item["name"] = name;
	item["text"] = text;
	item["href"] = href;

	return item;
}

function getMenus() {
	var main = new Array();
	var gallery = new Array();
	var guestbook = new Array();

	main[0] = createMenuItem("home","Home","index.html");
	main[1] = createMenuItem("skills","Skills","skills.html");
	main[2] = createMenuItem("personal","Persönliches","personal.html");
	main[3] = createMenuItem("interests","Interessen","interests.html");
	main[4] = createMenuItem("photos","Fotos","gallery/gallery.html");
	main[5] = createMenuItem("guestbook","G&auml;stebuch","guestbook.html");
	main[6] = createMenuItem("links","Links","links.html");
	main[7] = createMenuItem("impressum","Impressum","impressum.html");

	return main;
}

function buildHorizontalMenu(activeMenu) {
	var menus = getMenus();
	var style = "style=\"font-size:10pt\"";

	document.writeln("<tr>");
	for (var i = 0; i < menus.length; i++) {
		if (menus[i]["name"] == activeMenu) {
			document.writeln("<td class=active " + style +">" + menus[i]["text"] + "<\/td>");
		} else {
			document.write("<td class=\"nav\">");
			document.write("<a class=nav href='" + menus[i]["href"] + "'>");
			document.write(menus[i]["text"] + "<\/a><\/td>");
		}
	}
	document.writeln("<\/tr>");
}

function buildMenu(activeMenu, subMenu) {
	var main = getMenus();
	var cellHeight = 20;
	var mainStyle = "style=\"font-size:12pt\"";
	var subStyle = "style=\"font-size:10pt\"";

	document.writeln("<table class=\"nav\" rules=\"rows\">");
	for (var i = 0; i < main.length; i++) {
		document.writeln("<tr><td height=\"" + cellHeight + "\" " + mainStyle + " ");
		if (main[i]["name"] != activeMenu) {
			document.writeln("class=\"nav\">")
			document.writeln("<a class=\"nav\" href=\"" + main[i]["href"] + "\">");
			document.writeln(main[i]["text"]);
			document.writeln("</a>");
		} else {
		 	if (main[i]["submenu"] != undefined)
		 		document.writeln("class=\"nav\">");
		 	else
					document.writeln("class=\"active\">");
			document.writeln(main[i]["text"]);
		}
		document.writeln("</td></tr>");

		if (main[i]["name"] == activeMenu && main[i]["submenu"] != undefined) {
			var menu = main[i]["submenu"];
			document.writeln("<tr><td>");
			document.writeln("<table class=\"nav\" rules=\"rows\" width=\"100%\">");
			for (var j = 0; j < menu.length; j++) {
				document.writeln("<tr>");
				document.writeln("<td height=\"20\" width=\"10\"></td>");
				document.write("<td height=\"" + cellHeight + "\" " + subStyle + " ");
				if (menu[j]["name"] != subMenu) {
					document.writeln("class=\"nav\">");
					document.writeln("<a class=\"nav\" href=\"" + menu[j]["href"] + "\">");
					document.writeln(menu[j]["text"]);
				} else {
					document.writeln("class=\"active\">");
					document.writeln(menu[j]["text"]);
				}
				document.writeln("</td></tr>");
			}
			document.writeln("</table>");
			document.writeln("</td></tr>");
		}
	}
	document.writeln("</table>");
}

