//  code by Alan Dix  copyright 2004-2006   http://www.meandeviation.com/
//  you are free to use, copy, or distribute this code so long as this notice
//  is included in full and any modifications clearly indicated


if ( typeof this_page == undefined ) {
	 var this_page = "";
}
if ( typeof open_submenu == undefined ) {
	 var open_submenu = "";
}

function MenuItem(name,url,label,submenu) {
	this.name = name;
	this.url = url;
	this.label = label;
	this.submenu = submenu;
}

function show_menu(menu) {
	for( var i=0; i<menu.length; i++ ) {
		var item = menu[i];
		show_menu_item(item.name,item.url,item.label);

		if ( item.submenu && item.name == open_submenu ) {
 			show_submenu_start(item.name);
			for( var j=0; j<item.submenu.length; j++ ) {
				var subitem = item.submenu[j];
				show_menu_item(subitem.name,subitem.url,subitem.label);
		    	document.write("  </li>\n" );
			}
			show_submenu_end(item.name);
		}
		document.write("  </li>\n" );
	}
}

function show_menu_item(name,url,label) {
    if ( name == this_page)  {
		linkstyle = "class=\"currentpage\"";
	} else if ( name == open_submenu)  {
		linkstyle = "class=\"opensubmenu\"";
	} else {
		linkstyle = "";
	}
 //   alert("  <li> <a href=\"" + url + "\" " + linkstyle + "> "+ label + "</a> </li>\n" );
    document.write("  <li " + linkstyle + "> <a href=\"" + url + "\"> "+ label + "</a>\n" );
    document.close();
}

function show_submenu_start(name) {
    document.write("  <ul class=\"submenu\">\n" );
    document.close();
}

function show_submenu_end(name) {
    document.write("  </ul>\n" );
    document.close();
}
