////////////////////////////////////////////
// This document contains all the code for controlling the mission menu system,
// including the menus on the top and on the left side of the site

var path=""
var pageurl = window.location.pathname.substring(top.location.pathname.lastIndexOf("/")+1)
if (pageurl == "manual.html")
{
	path="manual/"
}

function menu_start() {
	menu_top()
	if (pageurl != "manual.html")
	{
		menu_left()
	}
	menu_frame()
}

function url(location, name) {
	if (location == pageurl) {
		document.write("<a class=menu href=" + location + "><font size=-3>&bull; </font>" + name + "</a><br>")
	}
	else {
		document.write("<a class=menu href=" + location + ">" + name + "</a><br>")
	}
}

// Display the appropriate menu on the top of the page, based on whether
// the user is logged in or not
function menu_top() {
	document.write(
	"<center>"+
	"<img src="+path+"images/page_top_loggedin.jpg width=760 height=120>"+
	"<table border=0 cellpadding=0 cellspacing=0><tr>");
}

// Display the manual menu
function menu_left() {
	var action=window.location.pathname.substring(top.location.pathname.lastIndexOf("/")).substring(1,4)
	document.write(
	"		<td valign=top width=176>"+
	"<img src="+path+"images/page_left_head.gif width=176 height=12><div class=leetmenu><div class=leetmenu2>"+
	"<div class=menutitle>Manual</div>"+
	"<div class=submenu>")

	url("introduction.html", "Introduction")
	url("character.html", "Your Character")
	if (action == "cha") { 
		document.write("<div class=submenu2>")
		url("cha_create.html", "Creation")
		url("cha_progression.html", "Progression")
		url("cha_equipment.html", "Equipment")
		document.write("</div>")
	}

	url("gameplay.html", "Gameplay")
	if (action == "gam") { 
		document.write("<div class=submenu2>")
		url("gam_flight.html", "Flight System")
		url("gam_combat.html", "Combat")
		url("gam_trading.html", "Trading")
		url("gam_navigation.html", "Navigation")
		url("gam_missions.html", "Missions")
		url("gam_mining.html", "Mining")
		document.write("</div>")
	}

	url("station.html", "Station Interface")
	if (action == "sta") { 
		document.write("<div class=submenu2>")
		url("sta_buy.html", "Cargo")
		url("sta_maintenance.html", "Maintenance")
		url("sta_missions.html", "Missions")
		document.write("</div>")
	}

	url("hud.html", "Heads Up Display")
	if (action == "hud") { 
		document.write("<div class=submenu2>")
		url("hud_tactical.html", "Tactical Display")
		url("hud_radar.html", "Radar")
		url("hud_message.html", "Chat Window")
		url("hud_equipment.html", "Equipment")
		url("hud_navigation.html", "Navigation")
		document.write("</div>")
	}

	url("multiplayer.html", "Multiplayer")
	if (action == "mul") { 
		document.write("<div class=submenu2>")
		url("mul_chat.html", "Chatting")
		url("mul_group.html", "Grouping")
		url("mul_duel.html", "Dueling")
		url("mul_guilds.html", "Guilds")
		url("mul_buddy.html", "Buddy System")
		document.write("</div>")
	}

	url("config.html", "Configuration")
	url("appendix.html", "Appendix")
	if (action == "app") { 
		document.write("<div class=submenu2>")
		url("app_faq.html", "Gameplay FAQ")
		url("app_commands.html", "Commands")
		url("app_gts.html", "GTS")
		document.write("</div>")
	}


	// Fin
	document.write("</div>"+
	"	</div>"+
	"	<img src="+path+"images/page_left_foot.gif width=176 height=15></div></td>"+
	"");
}

function menu_frame() {
	document.write(
	"<td valign=top>"+
	"	<div class=mainbody><div class=mainbody2> "+
	"	<table cellspacing=0 cellpadding=0 border=0 width=100%><tr>"+
	"		<td><img src="+path+"images/page_main_01.gif width=15 height=12></td>"+
	"		<td background="+path+"images/page_main_02.jpg width=100%><img src="+path+"images/spacer.gif width=1 height=1></td>"+
	"		<td><img src="+path+"images/page_main_03.gif width=15 height=12></td></tr>"+
	"		<tr><td background="+path+"images/page_main_04.gif height=100% width=15><img src="+path+"images/spacer.gif width=1 height=1></td>"+
	"		<td>"+
	"		<div class=mainbody3>"+
	"<table class=fixedwidth border=0 cellspacing=2 cellpadding=2>"+
	"<tr><td>")
}

function menu_foot() {
	document.write(
	"</td></tr>"+
	"</table>"+			
	"</div>"+
	"			</td>"+
	"			<td background="+path+"images/page_main_06.gif height=100% width=15><img src="+path+"images/spacer.gif width=1 height=1></td>"+
	"			</tr>"+
	"			<tr><td><img src="+path+"images/page_main_10.gif width=15 height=17></td>"+
	"			<td background="+path+"images/page_main_11.gif width=100%><img src="+path+"images/spacer.gif width=1 height=1></td>"+
	"			<td><img src="+path+"images/page_main_12.gif width=15 height=17></td>"+
	"		</tr></table>"+
	"		</div></div></td>"+
	"	</tr>"+
	"</table>"+
	"<BR><BR><BR>"+
	"&copy Copyright 2004 Guild Software, Inc. All Rights Reserved."+
	"</center>")
}