all           = "";
subCityText   = "";
subPeopleText = "";
subGameText   = "";

historyText   = "";
hometext      = "";

highlightText = "<font color='red'><u>";
highlightText2= "</u></font>";

subCityOn   = false;
subPeopleOn = false;
subGameOn   = false;

cityOn = false;
peopleOn = false;
gameOn = false;

level = 0;

function createText (level)
{
   sub = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>&raquo;</b> ";
   homeText      =        "<a href='" + repeatText("../", level) + "index.html'>Home</a><br>";
   subCityText   =  sub + "<a href='" + repeatText("../", level) + "map.html'>Map</a><br>";
   subCityText   += sub + "<a href='" + repeatText("../", level) + "demographics.html'>Demographics</a><br>";
   subCityText   += sub + "<a href='" + repeatText("../", level) + "locations.html'>Locations</a><br>";
   subPeopleText =  sub + "<a href='" + repeatText("../", level) + "citizens.html'>Citizens</a><br>";
   subPeopleText += sub + "<a href='" + repeatText("../", level) + "organizations.html'>Organizations</a><br>";
   historyText   =        "<a href='" + repeatText("../", level) + "history.html'>The History</a><br>";
   subGameText   =  sub + "<a href='" + repeatText("../", level) + "parties.html'>Parties</a><br>";
   subGameText   += sub + "<a href='" + repeatText("../", level) + "options.html'>Options</a><br>";
   subGameText   += sub + "<a href='" + repeatText("../", level) + "deities.html'>Deities</a><br>";
   subGameText   += sub + "<a href='" + repeatText("../", level) + "srd.html'>SRD</a><br>";
}

function repeatText (text, numberOfLoops)
{
   var output = "";
   
   for (i = 0; i < numberOfLoops; i++)
   {
      output += text;
   }
   
   return output;
}

function createStandard ()
{
	 level = 0;
	 createTextBox('menu', 'Menu', 150, document.getElementById("menuBox"));
	 createTextBox('contactUs', 'Contact Us', 215, document.getElementById("contactUsBox"));
	 createMenu(document.getElementById("menu"), level);
	 createContactUs(document.getElementById("menu"));
}

function createStandard (itemsOn)
{
	 level = 0;

	 createTextBox('menu', 'Menu', 150, document.getElementById("menuBox"));
	 createTextBox('contactUs', 'Contact Us', 215, document.getElementById("contactUsBox"));
	 
	 if (itemsOn == "the_people") subPeopleOn = true;
	 if (itemsOn == "the_city")   subCityOn = true;
	 if (itemsOn == "the_game")   subGameOn = true;
	 
	 createMenu(document.getElementById("menu"), level);
	 createContactUs(document.getElementById("menu"));
}

function createStandard (itemsOn, newLevel)
{
	 level = newLevel;

	 createTextBox('menu', 'Menu', 150, document.getElementById("menuBox"));
	 createTextBox('contactUs', 'Contact Us', 215, document.getElementById("contactUsBox"));
	 
	 if (itemsOn == "the_people") subPeopleOn = true;
	 if (itemsOn == "the_city")   subCityOn = true;
	 if (itemsOn == "the_game")   subGameOn = true;
	 
	 createMenu(document.getElementById("menu"));
	 createContactUs(document.getElementById("contactUs"));
}

function highlight (mainmenu)
{
   if (mainmenu == "city" && !cityOn)
	 {
	    cityOn = true;
			peopleOn = false;
			gameOn   = false;
			createMenu(document.getElementById("menu"));
	 }
	 else if (mainmenu == "people" && !peopleOn)
	 {
	    peopleOn = true;
			cityOn = false;
			gameOn = false;
			createMenu(document.getElementById("menu"));
	 }
	 else if (mainmenu == "game" && !gameOn)
	 {
	    gameOn = true;
			peopleOn = false;
			cityOn = false;
			createMenu(document.getElementById("menu"));
	 }
}

function dehighlight (mainmenu)
{
   if (mainmenu == "city" && cityOn)
	 {
	    cityOn = false;
			createMenu(document.getElementById("menu"));
	 }
	 else if (mainmenu == "people" && peopleOn)
	 {
	    peopleOn = false;
			createMenu(document.getElementById("menu"));
	 }
	 else if (mainmenu == "game" && gameOn)
	 {
	    gameOn = false;
			createMenu(document.getElementById("menu"));
	 }
	 else if (mainmenu = "all")
	 {
	    any = false;
			
	    if (cityOn)
			{
			   cityOn = false;
				 any = true;
			}
			if (peopleOn)
			{
			   peopleOn = false;
				 any = true;
			}
			if (gameOn)
			{
			   gameOn = false;
				 any = true;
			}
			
			if (any) createMenu(document.getElementById("menu"));
	 }
}

function show (submenu)
{
   if (submenu == "subCity" && !subCityOn) subCityOn = true;
	 else if (submenu == "subCity" && subCityOn) subCityOn = false;
   else if (submenu == "subPeople" && !subPeopleOn) subPeopleOn = true;
	 else if (submenu == "subPeople" && subPeopleOn) subPeopleOn = false;
	 else if (submenu == "subGame" && !subGameOn) subGameOn = true;
	 else if (submenu == "subGame" && subGameOn) subGameOn = false;
	 
	 createMenu(document.getElementById("menu"));
}

function createMenu(obj)
{
   createText (level);
   text = "<b>&raquo;</b> " + homeText;
	 text+= "<b>&raquo;</b> <a onMouseOver=\"highlight('city')\" onMouseOut=\"dehighlight('city')\" onClick=\"show('subCity')\">";
	 if (cityOn) text += highlightText;
	 text += "The City";
	 if (cityOn) text += highlightText2;
	 text += "</a><br>";
	 if (subCityOn) text += subCityText;
	 text += "<b>&raquo;</b> <a onMouseOver=\"highlight('people')\" onMouseOut=\"dehighlight('people')\"onClick=\"show('subPeople')\">";
	 if (peopleOn) text += highlightText;
	 text += "The People";
	 if (peopleOn) text += highlightText2;
	 text += "</a><br>";
	 if (subPeopleOn) text += subPeopleText;
	 text += "<b>&raquo;</b> " + historyText;
   text += "<b>&raquo;</b> <a onMouseOver=\"highlight('game')\" onMouseOut=\"dehighlight('game')\"onClick=\"show('subGame')\">";
	 if (gameOn) text += highlightText;
	 text += "The Game";
	 if (gameOn) text += highlightText2;
	 text += "</a><br>";
	 if (subGameOn) text += subGameText;
	 text += "<b>&raquo;</b> <a href='http://itoh.acalltoduty.com'>ITOH</a>";
	 
	 obj.innerHTML = text;
}

function createContactUs (obj)
{
   	 text = "<center>";
	 text += "<b>City Manager & Fate</b><br>";
	 text += "Joe Caldwell<br>";
	 text += "<a href='mailto:fatejoec@itoh.acalltoduty.com'>FateJoeC@itoh.acalltoduty.com</a><br>";
	 text += "<br>";
	 text += "<center>";
	 text += "<b>Game Manager</b><br>";
	 text += "Brett Lynam<br>";
	 text += "<a href='mailto:gm@itoh.acalltoduty.com'>GM@itoh.acalltoduty.com</a>";
	 text += "</center>";
	 
	 obj.innerHTML = text;
}


function createTextBox(name, textName, size, obj)
{
   var init = obj.innerHTML;
   text  = "<table border=0 cellspacing=0 cellpadding=0 width=" + size + " align='center'>";
	 text += "<tr>";
	 text += "<td bgcolor='#F2F7F3' width=7><img src='" + repeatText("../", level) + "images/left_rounded_border.gif'></td>";
   text += "<td bgcolor='#D6E1D6' style='font-size: 14px'><center><b><font face='Verdana'>";
	 text += textName;
	 text += "</font></b></center></td>";
   text += "<td bgcolor='#F2F7F3' width=7><img src='" + repeatText("../", level) + "images/right_rounded_border.gif'></td>";
   text += "</tr>";
	 text += "</table>";
	 text += "<table style='border: 1px #D6E1D6 solid' cellspacing=0 cellpadding=0 width=" + size + " align='center'>";
	 text += "<tr><td>";
	 text += "<table border=0 cellspacing=0 cellpadding=0>";
	 text += "<tr height=10><td></td></tr>";
	 text += "<tr>";
	 text += "<td width=15>&nbsp;</td>";
	 text += "<td><div id='";
	 text += name;
	 text += "' style='font-size:13px; font-family: Arial'>" + init + "</div></td>";
	 text += "<td width=15>&nbsp;</td>";
   text += "</tr>";
	 text += "<tr height=10><td></td></tr>";
	 text += "</table>";															
   text += "</td>";
   text += "</tr>";
	 text += "</table>";
	 
	 obj.innerHTML = text;
}

function createThinTextBox(name, textName, size, obj)
{
   var init = obj.innerHTML;
   text  = "<table border=0 cellspacing=0 cellpadding=0 width=" + size + ">";
	 text += "<tr>";
	 text += "<td bgcolor='#F2F7F3' width=7><img src='" + repeatText("../", level) + "images/left_rounded_border.gif'></td>";
   text += "<td bgcolor='#D6E1D6' style='font-size: 14px'><center><b><font face='Verdana'>";
	 text += textName;
	 text += "</font></b></center></td>";
   text += "<td bgcolor='#F2F7F3' width=7><img src='" + repeatText("../", level) + "images/right_rounded_border.gif'></td>";
   text += "</tr>";
	 text += "</table>";
	 text += "<table style='border: 1px #D6E1D6 solid' cellspacing=0 cellpadding=0 width=" + size + ">";
	 text += "<tr><td>";
	 text += "<div id='";
	 text += name;
	 text += "' style='font-size:13px; font-family: Arial'>" + init + "</div>";															
   text += "</td>";
   text += "</tr>";
	 text += "</table>";
	 
	 obj.innerHTML = text;
}