	
//configure below variable for menu width, position on page
var menuwidth=106;

var news = new Array();
var topMenuItems=5;
var title2 = '';
var title3 = '';
var firstLayer = 0;
var secondLayer = 0;

var ns4=document.layers?1:0;
var ie4=document.all?1:0;
var ns6=document.getElementById&&!document.all?1:0;


var events = new Array();
var eventsi=0;


function writeLeftMenu(menuArray)
{
	var j=0;
	for (var i=0;i<=menuArray.length-1;i++)
	{
	
		if ((menuArray[i][0]==1) && (!j))
		{
			j=1;
			document.write('<TR><Th class="MenuHeader">'+title2+'&nbsp;</th></TR>');
		}
		if (menuArray[i][0]<=1) {
			document.write('<TR><TD class=\'menublank\' ONCLICK="location=\''+menuArray[i][2]+'\'" onmouseover="className=\'menuhighlight\'" onMouseout="className=\'menublank\'"><CENTER>'+menuArray[i][1]+'</TD></TR>');
		}
	}
}


///////////////////////////////////////////////////
///////////////////////////////////////////////////
// RPGs
///////////////////////////////////////////////////
///////////////////////////////////////////////////

function loadRPG()
{
	var rpg = new Array();
	var rpgIdx = 0;
	rpg[rpgIdx++] = ["Adventure Library", "http://chapleau.us/scenariotheque", "A Collection of adventures friends & I wrote that are now on-line.",1];

	rpg[rpgIdx++] = ["7th Sea","http://chapleau.us/RPG/7thSeaGreece.php","Ancient Greece modification to 7th Sea",0];
	rpg[rpgIdx++] = ["Chaosium","http://chapleau.us/RPG/coc.php","Makers of Call of Cthulhu, favorite game ever!",1];
	rpg[rpgIdx++] = ["Dark Heresy","/RPG/DH.php","Warhammer 40k RPG",0];
	rpg[rpgIdx++] = ["Deadlands","/RPG/deadlands.php","Spaghetti western with meat!",0];
	rpg[rpgIdx++] = ["D&D 3.5","http://chapleau.us/RPG/D20.php", "Dungeons and Dragons 3.5 (includes Pathfinder).",1];
	rpg[rpgIdx++] = ["D&D 4.0","/RPG/DND4e.php","Living Forgotten Realms. Crap can only lead to more crap.",0];
	rpg[rpgIdx++] = ["Legend of the Five Rings", "http://chapleau.us/RPG/l5r.php","I played a lot of this game in the early 00s.",0];
	rpg[rpgIdx++] = ["Palladium","http://chapleau.us/RPG/palladium.php","I played this a lot in the 90s. Games like Rifts, Robotech &amp; Macross ][",0];
	rpg[rpgIdx++] = ["Pathfinder","http://chapleau.us/RPG/PFRPG.php","The Pathfinder page, heir to 3.5",1];
	rpg[rpgIdx++] = ["Shattered Empires","http://chapleau.us/RPG/Arcanis.php", "Arcanis, 3.5 and Shattered Empires RPG.",1];
	rpg[rpgIdx++] = ["Star Wars","/RPG/StarWars.php","Star Wars Page with a character of mine.",1];
	rpg[rpgIdx++] = ["Super Heroes","/RPG/Superheroes.php","Small Super Heroes page with Marvel Super Heroes &amp; Mutants and Masterminds",0];
	rpg[rpgIdx++] = ["Warhammer Fantasy Roleplay","/RPG/whfrp.php","During the 90s, I played WHFRP on and off as an alternative to D&amp;D.",1];
	rpg[rpgIdx++] = ["World of Darkness","http://chapleau.us/RPG/wwolf.php","I played a lot of WoD from the 90s into the early 00s.",0];
	return rpg;
}

function makeBaseMenu()
{
	var menui = new Array();
	var j=0;
	menui[j++]=[0,"Home", "http://chapleau.us"];
	menui[j++]=[0,"Personal","http://chapleau.us/persoindex.php"];
	menui[j++]=[0,"Miniatures","http://chapleau.us/Gallery"];
	menui[j++]=[0,"MMORPG","http://chapleau.us/MMORPG"];
	menui[j++]=[0,"Role-Playing","http://chapleau.us/RPG"];
	menui[j++]=[0,"Wargames","http://chapleau.us/Wargames"];
	menui[j++]=[0,"Rss Feed","http://chapleau.us/rss.php"];
	menui[j++]=[0,"Awards","http://chapleau.us/awards.php"];
	menui[j++]=[0,"Links","http://chapleau.us/links.php"];
	menui[j++]=[0,"Email Pacman","mailto:Webmaster@chapleau.us"];
	return menui;
}

function getMenuElements(menuname)
{
	var menui = new Array();
	var j=0;
	if ((menuname=="WG")||(menuname=="40k")||(menuname=="WAB")||(menuname=="Gallery")||(menuname=="WeeSim"))
	{
		title2='War Games';
		menui[j++]=[1,"Ancients","http://chapleau.us/Wargames/wab.php"];
		menui[j++]=[1,"Gladiators","http://chapleau.us/Wargames/MoritariTeSalutamus_Eng.php"];
		menui[j++]=[1,"WH 40k","http://chapleau.us/Wargames/wh40k.php"];
		menui[j++]=[1,"WH Colonial","http://chapleau.us/Wargames/warhammercolonial.php"];
		menui[j++]=[1,"WH Fantasy","http://chapleau.us/Wargames/wfb.php"];
		menui[j++]=[1,"WWIISIM","http://chapleau.us/Wargames/WWIISIM_Eng.php"];
		menui[j++]=[1,"Napol&eacute;on Facile", "http://chapleau.us/Wargames/napoleon.php"];
		menui[j++]=[1,"Mini Gallery","http://chapleau.us/Gallery"];
		firstLayer = 1;

		if (menuname=="WeeSim")
		{
			title3='WeeSim Pages';
			menui[j++]=[2,"WWII v1.5","http://chapleau.us/Wargames/WWIISIM_Eng.php"];
			menui[j++]=[2,"WWII Armies","http://chapleau.us/Wargames/WWIISIM_Rules.php"];
			menui[j++]=[2,"WWII (Fr) v1.1","http://chapleau.us/Wargames/WWIISIM_FR.php"];
			menui[j++]=[2,"Colonial v1.5","http://chapleau.us/Wargames/Colonial_rules.php"];
			menui[j++]=[2,"Colonial Armies","http://chapleau.us/Wargames/Colonial_rules.php"];
			menui[j++]=[2,"Colonial AAR1","http://chapleau.us/Wargames/colonialbattle01.php"];
			menui[j++]=[2,"Colonial AAR2","http://chapleau.us/Wargames/colonialbattle02.php"];
			secondLayer = 1;
		}
		if (menuname=="Gallery")
		{
			title3='Galleries';
			menui[j++]=[2,"Commissions","http://chapleau.us/Gallery/gallery_commission.php"];
			menui[j++]=[2,"Ancients","http://chapleau.us/Gallery/gallery_anc.php"];
			menui[j++]=[2,"Medievals", "http://chapleau.us/Gallery/gallery_medieval.php"];
			menui[j++]=[2,"Napoleonic", "http://chapleau.us/Gallery/gallery_nap.php"];
			menui[j++]=[2,"Colonials", "http://chapleau.us/Gallery/gallery_colo.php"];
			menui[j++]=[2,"World War II", "http://chapleau.us/Gallery/gallery_wwii.php"];
			menui[j++]=[2,"Other Historicals","http://chapleau.us/Gallery/gallery_1617.php"];
			menui[j++]=[2,"Warhammer 40k","http://chapleau.us/Gallery/gallery_40k.php"];
			menui[j++]=[2,"Old 40k", "http://chapleau.us/Gallery/gallery_40k2.php"];
			menui[j++]=[2,"Wargods","http://chapleau.us/Gallery/gallery_wargods.php"];
			menui[j++]=[2,"Warhammer FB", "http://chapleau.us/Gallery/gallery_wfb.php"];
			menui[j++]=[2,"Warmachine", "http://chapleau.us/Gallery/gallery_WarMachine.php"];
			menui[j++]=[2,"D&D Fantasy", "http://chapleau.us/Gallery/gallery_fantasy.php"];
			menui[j++]=[2,"Terrain", "http://chapleau.us/Gallery/gallery_terrain.php"];
			menui[j++]=[2,"Tournaments","http://chapleau.us/Gallery/gallery_tournament.php"];
			menui[j++]=[2,"Others", "http://chapleau.us/Gallery/gallery_misc.php"];	
			secondLayer = 1;
		}
		if (menuname=="40k")
		{
			title3='40k Armies';
			menui[j++]=[2,"Chaos Daemons", "http://chapleau.us/Wargames/40k_Daemon.php"];
			menui[j++]=[2,"Orks", "http://chapleau.us/Wargames/40k_Orks.php"];
			menui[j++]=[2,"Sisters of Battle", "http://chapleau.us/Wargames/40k_SistersOfBattle.php"];
			menui[j++]=[2,"Space Marines","http://chapleau.us/Wargames/40k_SpaceMarines.php"];
			menui[j++]=[2,"Codices","http://chapleau.us/Wargames/40k_OnlineCodices.php"];
			secondLayer = 1;
		}
		if (menuname=="WAB")
		{
			title3='WH Ancients';
			menui[j++]=[2,"WAB Page", "http://chapleau.us/Wargames/Wab.php"];
			menui[j++]=[2,"Ptolemaic List", "http://chapleau.us/Wargames/Wab.Ptolemy.php"];
			secondLayer = 1;
		}
	}
	
	if ((menuname=="RPG")||(menuname=="COCInt"))
	{
		var rpg = loadRPG();
		title2='Active RPGs';
		title3='Related';
		firstLayer = 1;
		secondLayer = 1;
		for (var z=0; z<rpg.length;z++)
		{
			if (rpg[z][3])
			{
				menui[j++]=[1,rpg[z][0],rpg[z][1]];
			}
		}
		menui[j++]=[2,"Byakhee CDA 1.3","http://chapleau.us/RPG/DarkAges.zip"];
		menui[j++]=[2,"Byakhee Invictus 1.1","http://chapleau.us/RPG/DarkAges.zip"];
		if (menuname=="COCInt")
		{
			menui[j++]=[2,"CoC Interactive","http://chapleau.us/RPG/coc_interactif.php"];
		}
		menui[j++]=[2,"Le Heraut","http://chapleau.us/LeHeraut"];
	}

	if (menuname=='Perso')
	{
		title3='Photos Albums';
		menui[j++]=[2,"Jean-Patrick", "http://chapleau.us/Jul09JeanPatrick"];	
		menui[j++]=[2,"Apr 09", "http://chapleau.us/Apr09"];	
		menui[j++]=[2,"Mar 09", "http://chapleau.us/Mar09"];	
		menui[j++]=[2,"Dec 08", "http://chapleau.us/Dec08"];	
		menui[j++]=[2,"Kitty's Party", "http://chapleau.us/Sept08/PartyKitty2A.php"];	
		menui[j++]=[2,"Sept 08", "http://chapleau.us/Sept08"];	
		menui[j++]=[2,"Austin & Marla", "http://chapleau.us/Sept08/AustinMarlaWedding.php"];	
		menui[j++]=[2,"La Maison", "http://chapleau.us/Sept08/Maison.php"];	
		menui[j++]=[2,"May 08", "http://chapleau.us/May08"];	
		menui[j++]=[2,"Mar 08", "http://chapleau.us/Mar08"];	
		menui[j++]=[2,"Jan 08", "http://chapleau.us/Jan08"];	
		menui[j++]=[2,"Nov 07", "http://chapleau.us/Nov07"];	
		menui[j++]=[2,"Qu&eacute;bec 07", "http://chapleau.us/Nov07/Quebec_2007.html"];	
		menui[j++]=[2,"Sept 07", "http://chapleau.us/Aug07"];	
		menui[j++]=[2,"Mars 07", "http://chapleau.us/Mar07"];
		menui[j++]=[2,"Janvier 07", "http://chapleau.us/Jan07"];
		menui[j++]=[2,"Kitty", "http://chapleau.us/MK"];
		menui[j++]=[2,"2005-2006", "http://chapleau.us/Josiane"];
		menui[j++]=[2,"2004-2005", "http://chapleau.us/Gallery/Josiane"];
		menui[j++]=[2,"Mes Chars", "http://chapleau.us/Gallery/gallery_char.php"];
		firstLayer = 0;
		secondLayer = 1;

	}
	return menui;
}


function makeMenu(menuname) 
{
	var elements = getMenuElements(menuname);
	document.write('<CENTER><TABLE BORDER="0" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" class="Menu">');
	document.write('<TR><TH class="MenuHeader"><CENTER><a href=\"http://chapleau.us\"><img src= \"http://chapleau.us/Img/SmallWonderpage.png\" width=\"104\" alt=\"Pacman\'s Wonderpage\"></a><br><IMG SRC="http://counter.digits.com/wc/-d/4/PacCount" ALIGN=middle WIDTH=60 HEIGHT=20 BORDER=0 HSPACE=4 VSPACE=2><br>');
	
	writeLeftMenu(makeBaseMenu());
	document.write('<TR><Th class="MenuHeader">&nbsp;</th></TR>');
	document.write('</TABLE></center>');
	
	document.write('<br>');
	
	if (firstLayer)
	{
		document.write('<CENTER><TABLE BORDER="0" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" class="Menu">');
		writeLeftMenu(elements);
		document.write('<TR><Th class="MenuHeader">&nbsp;</th></TR>');
		document.write('</TABLE></center>');
	}
	firstLayer = 0;
	
}


function writeRightSecondaryMenu(menuArray)
{
	if (!secondLayer)
	{
		return;
	}
	document.write('<CENTER><TABLE BORDER="0" width="'+menuwidth+'" CELLPADDING="0" CELLSPACING="0" class="Menu">');
	document.write('<TR><Th class="MenuHeader">'+title3+'&nbsp;</th></TR>');
	for (var i=0;i<menuArray.length;i++)
	{
		if (menuArray[i][0]==2) {
			document.write('<TR><TD class=\'menublank\' ONCLICK="location=\''+menuArray[i][2]+'\'" onmouseover="className=\'menuhighlight\'" onMouseout="className=\'menublank\'"><CENTER>'+menuArray[i][1]+'</TD></TR>');
		}
	}
	document.write('<TR><Th class="MenuHeader">&nbsp;</th></TR>');	
	document.write('</TABLE></center>');
	document.write('<br>');	
	secondLayer = 0;
}


function makeRightMenu(menuname) 
{
	var menuElements = getMenuElements(menuname);
	if (menuElements.length > 0) {
		writeRightSecondaryMenu(menuElements);
	}
	secondLayer=0;
}

function makeEventsForMainPage() 
{
	document.write('<table cellspacing=0 cellpadding=0>');
	document.write('<tr><td colspan=6><h3 class="galleryHeader">Events I am involved in');
	document.write('<tr><Th>Date(s)<td><th>Event<td><th>Location');
	for (var i=0;(i<events.length);i++)
	{
		var fontClass;
		if ((i%2)===0)
		{
			fontClass="greyline";
		} else {
			fontClass="";
		} 
		document.write ('<tr><td class="'+fontClass+'">');
		
		document.write (events[i][0]+'<td class="'+fontClass+'">&nbsp;&nbsp;&nbsp;'); //Date
		document.write ('<td class="'+fontClass+'">'); 
		if (events[i][2]!="")
		{
			document.write ('<a href="'+events[i][2]+'">');
		}
		document.write (events[i][1]); 
		if (events[i][2]!="")
		{
			document.write ('</a>');
		}
		document.write ('<td class="'+fontClass+'">&nbsp;&nbsp;&nbsp;<td class="'+fontClass+'">'+events[i][3]); 
	}
	document.write ('</table></dir>');
}


