function doNav(ingreen, inbis) {
	var nvtxt = ["none","home","projects","history","wargaming","keltenbard","links","mapmaker","blog"];
	var x=document.getElementById('nav');
	var z=document.getElementById('ftr');
	var sep = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
	var navline = "";
	var ckgreen = readCookie('bijbatbis01');
	var isgreen = (ckgreen && (inbis >0)) ? ckgreen : ingreen;
	for (var w=1;w<9;w++) {
		var ac = (w == isgreen) ? "sel" : "mit";
		navline += sep + "<a class='" + ac + "' href='#lyt' onclick='doNav(" + w + ", 0);'>" + nvtxt[w] + "</a>&nbsp;";
	}
	x.innerHTML=navline;
	z.innerHTML=navline;
	
	createCookie('bijbatbis01',isgreen,1);
	
	if (isgreen == 1) doHome();
	else if (isgreen == 2) doProjects();
	else if (isgreen == 3) doHistory();
	else if (isgreen == 4) doWargaming();
	else if (isgreen == 5) doKeltenbard();
	else if (isgreen == 6) doLinks();
	else if (isgreen == 7) doMapMaker();
	else doBlog();
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function doHome() {
	var home=document.getElementById('con');
	home.innerHTML =
	"<h3>Welcome to Bijou Battles</h3><h5>This is my home on the web for wargaming with 2mm scale figures. It is still quite new and much of it is <span style=\"font-style:italic;\">under construction</span>.  There will eventually be pages for:</h5><div style=\"font-size:12pt; font-style:italic; text-align:center;\">Bijou Battles - Basic Rules for Wargaming in 2mm scale<br /><br />Bijou Battles Supplement - Wargaming the English Civil War in 2mm scale<br /><br />Bijou Battles Supplement - Wargaming the Punic Wars in 2mm scale<br /><br />Bijou Battles Supplement - Wargaming the Napoleonic Wars in 2mm scale<br /><br />Bijou Battles Supplement - Wargaming the American Civil War in 2mm scale<br /><br />Bijou Battles Supplement - Wargaming the Boer Wars in 2mm scale<br /><br />Bijou Battles Campaign Rules Supplement<br /><br />Bijou Battles Campaign and Battle Reports<br /><br />A Link page of sites relevant to wargaming in 2mm scale<br /></div>";
}

function doProjects() {
	var proj=document.getElementById('con');
	var greenford = "greenford.html";
	proj.innerHTML =              
	'<h3>There are 3 active projects:</h3><div style="margin-left:25%;"><h5>&nbsp;&nbsp;&nbsp;&nbsp;The construction of this website;</h5><h5>&nbsp;&nbsp;&nbsp;&nbsp;The creation of my MapMaker software;</h5><h5>&nbsp;&nbsp;&nbsp;&nbsp;and planning, playing, and recording the <a href="#lyt" onclick="doReport(\'' + greenford + '\')">Battle of Greenford.</a></h5></div>';
}

function doHistory() {
	var hist=document.getElementById('con');
	hist.innerHTML =              
	'<div style="text-align:center;font-style:italic;">...to be written.</div>';
}

function doWargaming() {
	var warg=document.getElementById('con');
	warg.innerHTML =              
	'<h3>Aspects of Wargaming in 2mm scale</h3><div style="margin-left:33%;font-style:italic; font-size:14pt;"><a href="#lyt" onclick="bbbrOver()">Bijou Battles Basic Rules</a><br /><br /><a href="#lyt" onclick="ecwRoyal()">Photos of my ECW Royalist Forces</a><br /><br /><a href="#lyt" onclick="ecwParl()">Photos of my ECW Parliamentary Forces</a></div>';
}

function doKeltenbard() {
	var kelt=document.getElementById('con');
	var greenford = "greenford.html";
	kelt.innerHTML =              
	'<div style="text-align:left;font-style:italic; color:#000000;">Keltenbard is the fictional setting I use for fighting my English Civil War style <a href="#lyt" onclick="doReport(\'' + greenford + '\')">campaigns and battles.</a><br /><br /><img src="./keltenbard/cK-1t750x634.png" width="750" height="634" style="float:left; margin:5px 35px 5px 10px;" /></div>';
}

function doLinks() {
	var linx=document.getElementById('con');
	linx.innerHTML =              
	'<h3>Links</h3><table style="border: 0; width: 90%; margin-left: 5%;" border="0"><tbody><tr><td valign="top"><h5>Hobby Websites</h5><span style="font-size:11pt;font-style:italic"><ul><li><a href="http://www.angelfire.com/games3/jacksongamer/">Jackson Gamers</a></li><li><a href="http://www.battlefor2mmearth.co.uk/">Battle for 2mm Earth</a></li><li><a href="http://solowargamingshow.mypodcast.com/">Solo Wargaming Show</a></li><li><a href="http://www.lloydianaspects.co.uk/models/2mm.html">2mm scale figures</a></li><li><a href="http://tacw6mm.blogspot.com/">This Accursed 6mm project</a></li><li><a href="http://6mm.wargaming.info/">6mm Wargaming</a></li></ul></span></td><td valign="top"><h5>Commercial Websites</h5><span style="font-size:11pt;font-style:italic"><ul><li><a href="http://www.tinytintroops.co.uk/">Tiny Tin Troops</a></li><li><a href="http://www.irregularminiatures.co.uk/">Irregular Miniatures</a></li><li><a href="https://www.baccus6mm.com/index.php">Baccus 6mm</a></li><li><a href="http://www.wargame-innovations.co.uk/index.htm">Wargame Innovations</a></li><li><a href="http://angelbarracks.co.uk/index.html">Angel Barracks</a></li><li><a href="http://www.spiritgames.co.uk/index.php">Spirit Games</a></li><li><a href="http://www.terrainmat.com/">Terrain Mat</a></li><li><a href="http://www.kallistra.co.uk/">Hexon Terrain at Kallistra</a></li><li><a href="http://totalsystemscenic.com/">Hex tiles at TSS</a></li></ul></span></td><td valign="top"><h5>Society Websites</h5><span style="font-size:11pt;font-style:italic"><ul><li><a href="http://www.pikeandshotsociety.org/index.htm">Pike and Shot Society</a></li><li><a href="http://www.renaissancewargamesociety.com/index.shtm">Renaissance Wargame Society</a></li><li><a href="http://www.bhgs.co.uk">British Historical Games Society</a></li><li><a href="http://www.theiwf.org">International Wargames Federation</a></li></ul></span></td></tr></tbody></table>';
}

function doMapMaker() {
	var mapm=document.getElementById('con');
	mapm.innerHTML =              
	'<div id="thisCanvas" style="background-color:forestgreen; margin-left:0px;margin-top:5px;margin-right:0px; float:left;position:relative;width:700px;height:710px"></div><div id="dash" style="background-color:khaki;padding:15px; margin-left:15px;margin-top:5px;margin-right:0px;text-align:center; float:left;position:relative;width:150px;height:680px;"><formname="board"><input id="blankB" type="button" value="Blank" onclick="drawBlank(0,0,0)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="clearB" type="button" value="Refs" onclick="drawBlank(1,0,0)"><br /><br /><input id="refsB" type="button" value="Terr" onclick="drawBlank(0,0,1)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="refsB" type="button" value="Terr-n-Refs" onclick="drawBlank(1,0,1)"><br /><br /><input id="armyB" type="button" value="Troops" onclick="drawBlank(0,1,1)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input id="fullB" type="button" value="All" onclick="drawBlank(1,1,1)"></form></div>';
}

function doBlog() {
	var gblg=document.getElementById('con');
	gblg.innerHTML =
	'<div style="position:relative; left:50; top:50; width:907; height:807; clip:rect(0,811,911,0); background:#d2b48c;"><iframe src="http://bijoubattles.blogspot.com/" width="907" height="807" marginwidth="0" marginheight="0" frameborder="no" scrolling="yes" style="border-width:2px; border-color:#1c1407; background:#d2b48c	; border-style:solid;"> </iframe></div>';
}

function doReport(mybattle) {
	var brep=document.getElementById('con');
	brep.innerHTML =
	'<div style="position:relative; left:50; top:50; width:907; height:907; clip:rect(0,911,911,0); background:#d2b48c;"><iframe src="' + mybattle + '" width="907" height="907" marginwidth="0" marginheight="0" frameborder="no" scrolling="yes" style="border-width:2px; border-color:#1c1407; background:#d2b48c; border-style:solid;"> </iframe></div>';
}

