// earthdawn.js
// JavaScript File

init();

function init()
{
	var type = document.anchors[document.anchors.length-1].name;
	isNetscape = ( navigator.appName == "Netscape" );
	margin = ( isNetscape ? 200 : 80 );

	NRDOCS = 5;
	docs = new makeArray( NRDOCS );
	docs[0] = new Doc( 'Earthdawn Adventures - De Ontmoeting', 'hanto01.html' );
	docs[1] = new Doc( 'Earthdawn Adventures - De Voorbereiding', 'hanto02.html' );
	docs[2] = new Doc( 'Earthdawn Adventures - Het Vertrek', 'hanto03.html' );
	docs[3] = new Doc( 'Earthdawn Adventures - Yellowspring', 'hanto04.html' );
	docs[4] = new Doc( 'Earthdawn Adventures - Hanto', 'hanto05.html' );

	docnr = -1;
	for( i = 0; i < NRDOCS; i++ )
	{
		if( document.title == docs[i].name ) docnr = i;
	}

	if( type == "header" )
		writeHeader();
	else if( type == "footer" )
		writeFooter();
	else if( type == "start" )
		writeStart();
	else if( type == "stop" )
		writeStop();
}

function writeStart()
{
	document.writeln( "<table border='0'>" );
	document.writeln( "    <tr>" );
	document.writeln( "        <td width='" + margin + "'>&nbsp;</td>" );
	document.writeln( "        <td>" );
}

function writeStop()
{
	document.writeln( "        </td>" );
	document.writeln( "    </tr>" );
	document.writeln( "</table>" );
}

function writeHeader()
{
	writeStart();
	document.writeln( "<center>" );
	document.writeln( "    <img src='images/adventures.gif'><p>" );
	document.writeln( "    <img src='images/hanto.gif'>" );
	document.writeln( "</center>" );
	writeNavigation();
}

function writeFooter()
{
	writeNavigation();
	writeStop();
}

function writeNavigation()
{
	document.writeln( "<hr>" );
	document.writeln( "<center>" );

	// Back
	document.write( "    <a href='" );
	if( docnr == 0 )
		document.write( "index.html" );
	else
		document.writeln( docs[docnr - 1].file );
	document.write( "' onMouseOver=\"status=\'Back\';return true;\" onMouseOut=\"status=\'\'\">" );
	document.writeln( "<img src='images/back.gif' border='0'></a>" );

	// TOC
	document.writeln( "    <a href='index.html' onMouseOver=\"status=\'Table Of Contents\';return true;\" onMouseOut=\"status=\'\'\">" );
	document.writeln( "<img src='images/toc.gif' border='0'></a>" );

	// Forward
	document.write( "    <a href='" );
	if( docnr == NRDOCS - 1 )
		document.writeln( "index.html" );
	else
		document.writeln( docs[docnr + 1].file );
	document.writeln( "' onMouseOver=\"status=\'Forward\';return true;\" onMouseOut=\"status=\'\'\">" );
	document.writeln( "<img src='images/forward.gif' border='0'></a>" );

	document.writeln( "</center>" );
	document.writeln( "<hr>" );
}

function Doc( name, file )
{
	this.name = name;
	this.file = file;
}

function makeArray( n )
{
	this.length = n;
	for( var i = 1; i <= n; i++ ) this[i] = 0;
	return this;
}