	
//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 newsi = new Array();
var news=0;


var events = new Array();
var eventsi=0;


var cwoi = new Array();
var cwo = 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>');
		}
	}
}

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,"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,"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"))
	{
		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>Pacman\'s Wonderpage<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 > 0)
	{
		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>');
}

function makeCurrentlyWorkingOn() 
{
	document.write('<table cellspacing=0 cellpadding=0>');
	document.write('<tr><td colspan=6><h3 class="galleryHeader">Pacman is currently working on');
	document.write('<tr><th>Date<td>&nbsp;<Th>Work Item<td><th>Link<th>Status');
	for (var i=0;(i<cwoi.length) && (i<5);i++)
	{
		fontClass="";
		if ((i%2)==0)
		{
			fontClass="greyline";
		} else {
			fontClass="";
		} 
		document.write ('<tr class="'+fontClass+'">');
		document.write ('<td class="'+fontClass+'">'+cwoi[i][0]+'<td class="'+fontClass+'">&nbsp;&nbsp;&nbsp;<td class="'+fontClass+'">'+cwoi[i][1]+'<td class="'+fontClass+'">&nbsp;&nbsp;&nbsp;'); //Date
		if (cwoi[i][2]!=null)
		{
			document.write ('<td class="'+fontClass+'"><a href="'+cwoi[i][2]+'">[More Info]'+'</a>');
		}
		else
		{
			document.write ('<td class="'+fontClass+'">&nbsp;</a>');
		}
		if (cwoi[i][3]==1)
		{
			document.write ('<td class="'+fontClass+'">&nbsp;&nbsp;Complete!');
		}
		else
		{
			document.write ('<td class="'+fontClass+'">&nbsp;&nbsp;In Progress</a>');
		}

	}
	document.write ('</table></dir>');
}

///////////////////////////////////////////////////
///////////////////////////////////////////////////
// RPG Index Page
///////////////////////////////////////////////////
///////////////////////////////////////////////////

var rpg = new Array();

function ListRPGPages() 
{
	document.write('<table cellspacing=0 cellpadding=0 class="center">');
	for (var i=0;(i<rpg.length);i++)
	{
		var class='';
		if ((i%2)==0)
		{
			class='greyline';
		} else {
			class='';
		} 
		document.write ('<tr><td class="'+class+'"><a href="'+rpg[i][1]+'">'+rpg[i][0]+'</a><Td class="'+class+'">&nbsp;&nbsp;&nbsp;<td class="'+class+'">'+rpg[i][2]+'</td>');
		if (!rpg[i][3])
			document.write ('<Td class="'+class+'">&nbsp;&nbsp;&nbsp;<td class="'+class+'">Not played anymore</td>');
		else
			document.write ('<Td class="'+class+'">&nbsp;&nbsp;&nbsp;<td class="'+class+'">&nbsp;&nbsp;&nbsp;</td>');
	}
	document.write ('</table>');
}

///////////////////////////////////////////////////
///////////////////////////////////////////////////
// White Wolf NPCs
///////////////////////////////////////////////////
///////////////////////////////////////////////////
var chronicles = ["JP's Characters","Camelot 810","Alicante 1200","Transylvania 1310","Passau 1450","Paris 1789","Montreal 1995","New Orleans 1997","Exalted - Solar"];
var i=0;

var exaltedNpc = new Array();
var vampireNpc = new Array();
var werewolfNpc = new Array();
var mageNpc = new Array();
var changelingNpc = new Array();
var exaltedIdx=0;
var vampireIdx=0;
var werewolfIdx=0;
var mageIdx=0;
var faeIdx=0;

function ListChronicles() 
{
	document.write('<table cellspacing=0 cellpadding=0>');
	document.write ('<tr><td><a href="http://chapleau.us/RPG/WW_NPC/showNpc.php?chronicle=all" target="NPC">All</a></td>');
	for (var i=0;(i<chronicles.length);i++)
	{
		if ((i%2)==0)
		{
			document.write ('<tr class="greyline">');
		} else {
			document.write ('<tr>');
		} 
		document.write ('<td><a href="http://chapleau.us/RPG/WW_NPC/showNpc.php?chronicle='+chronicles[i]+'" target="NPC">'+chronicles[i]+'</a></td>');
	}
	document.write ('</table>');
}

function ListNPC(Setting)
{
	if (Setting==undefined)
	{
		document.write("<p>Select a Chronicle on the left");
		return;
	}
	else
	{
		document.write('<p class=h1>NPCs for '+Setting+'');
		document.write('<center><table cellspacing=0 cellpadding=0>');
		j=0;
		for (i=0;(i<vampireNpc.length);i++)
			{
				j=ListNpcDetails(Setting, vampireNpc[i],j);
			}
		for (i=0;(i<werewolfNpc.length);i++)
			{
				j=ListNpcDetails(Setting, werewolfNpc[i],j);
			}
		for (i=0;(i<mageNpc.length);i++)
			{
				j=ListNpcDetails(Setting, mageNpc[i],j);
			}
		for (i=0;(i<changelingNpc.length);i++)
			{
				j=ListNpcDetails(Setting, changelingNpc[i],j);
			}
		for (i=0;(i<exaltedNpc.length);i++)
			{
				j=ListNpcDetails(Setting, exaltedNpc[i],j);
			}
		document.write ('</table></center>');
	}
}

function ListNpcDetails (setting,npc,j)
{
	var i=0;
	for (i=0;i<npc[4].length;i++)
	{
		if ((npc[4][i]==setting)||(setting=='all'))
		{
			if ((j%2)==0)
			{
				document.write ('<tr class="greyline">');
			} else {
				document.write ('<tr>');
			} 
			document.write ('<td>'+npc[3]+'<td>&nbsp;&nbsp;<td><a href="'+npc[0]+'">'+npc[1]+'</a><td>&nbsp;&nbsp;<td>'+npc[2]);
			return j+1;
		}
	}
	return j;
}

function WerewolfStat (statValue)
{
	for (var i=0;i<statValue;i++)
	{
		document.write ('&nbsp;<img src="Img/WolfPaw.gif" width=15>');
	}
}

function WerewolfTemp (numberOfSquares)
{
	for (var i=0;i<numberOfSquares;i++)
	{
		document.write ('&nbsp;<img src="Img/square.jpg" width=15>');
	}
}



