// V 1.1

function ExtractFileName( URL )
{
	var docName = URL;

	docName = docName.substring( docName.lastIndexOf("\\") + 1 );
	docName = docName.substring( docName.lastIndexOf("\/") + 1 );

	return docName;
}


function WriteMenuCategory( name )
{
	document.write( '<div class="section">' + name + '</div>' );
}


function WriteMenuItem( basePath, currNavName, name, linkURL, description )
{
	if( currNavName != name )
	{
		document.write( '<a class="item" href="' + basePath + linkURL + '" title="' + description + '" >• ' + name + '</a>' );
	}
	else
	{
		document.write( '<a class="this_item" href="' + basePath + linkURL + '" title="' + description + '" >• ' + name + '</a>' );
	}
}


function WriteSiteIndex( basePath, currNavName )
{
	document.write( '<div class="menubuffer" nowrap>' );
	document.write( '<div class="menu" nowrap>' );

	WriteMenuCategory( 'News' );
		WriteMenuItem( basePath,	currNavName,  'Latest News',		'index.html',					'Read my latest news!' );
		WriteMenuItem( basePath,	currNavName,  'Archived News',		'news_archive.html',			'Read my past news!' );

	WriteMenuCategory( 'Sections' );
		WriteMenuItem( basePath,	currNavName,	'Moto',				'moto/index.html',				'Read about alternative motorcycle designs!' );
		WriteMenuItem( basePath,	currNavName,	'Pyro',				'pyro/index.html',				'Read about my super-pyromania!' );
		WriteMenuItem( basePath,	currNavName,	'Arch',				'arch/index.html',				'Read about alternative architectural designs!' );
		WriteMenuItem( basePath,	currNavName,	'Art',				'art/index.html',				'Check out some digital paintings and drawings I have created!' );
		WriteMenuItem( basePath,	currNavName,	'Silly Stuff',		'silly/index.html',				'Check out some really twisted stuff!' );
		WriteMenuItem( basePath,	currNavName,	'Inventions',		'inventions/index.html',		'Read about some things I have invented and built!' );
/*
		WriteMenuItem( basePath,	currNavName,	'Code',				'code.html',					'Read some articles I\'ve written about software!' );
		WriteMenuItem( basePath,	currNavName,	'Thoughts',			'thoughts.html',				'Read about some of my random thoughts!' );
		WriteMenuItem( basePath,	currNavName,	'Adventures',		'adventures.html',				'Read about some of my crazy adventures!' );
*/
	WriteMenuCategory( 'UberGame' );
		WriteMenuItem( basePath,	currNavName,	'News',				'ubergame/index.html',			'Read UberGame\'s latest news!' );
		WriteMenuItem( basePath,	currNavName,	'News Archive',		'ubergame/news_archive.html',	'Read UberGame\'s past news!' );
		WriteMenuItem( basePath,	currNavName,	'Manifesto',		'ubergame/manifesto.html',		'Find out why the UberGame section exists!' );
		WriteMenuItem( basePath,	currNavName,	'Articles',			'ubergame/articles/index.html',	'Read UberGame articles about vraious aspects of the game industry!' );
		WriteMenuItem( basePath,	currNavName,	'Writers',			'ubergame/writers/index.html',	'Find UberGame articles by author and read those authors bios!' );
		WriteMenuItem( basePath,	currNavName,	'Overview',			'ubergame/overview/index.html',	'Get an overview of the games industy!' );
																										
	WriteMenuCategory( 'About' );																		
		WriteMenuItem( basePath,	currNavName,	'FAQ',				'faq.html',						'Find out why this site exists!' );
		WriteMenuItem( basePath,	currNavName,	'CV/Resume',		'cv/index.html',				'Find out about me!' );
		WriteMenuItem( basePath,	currNavName,	'Contact',			'contact.html',					'Get in contact with me!' );
																									
	WriteMenuCategory( 'Community' );																	
		WriteMenuItem( 'http://www.livejournal.com/users/',	
currNavName,	
'My Journal',			'meico',					
'Read and comment in my journal!' );
		WriteMenuItem( basePath,	currNavName,	'Friends',			'friends.html',					'Meet some of my friends!' );
//		WriteMenuItem( basePath,	currNavName,	'Guestbook',		'guestbook.html',				'Say Hi! Let me know what you think!' );
//		WriteMenuItem( basePath,	currNavName,	'Downloads',		'download.html',				'Download software and libaries!' );
//		WriteMenuItem( basePath,	currNavName,	'Links',			'links.html',					'Check out some of my favorite links!' );

	document.write( '</span>' );
	document.write( '</span>' );	
}

/*
// A more accessible version... but it has problems not shifting about...
var gCurrNaveName = "";

function WritePageStart( basePath, currNavName )
{
	if (typeof basePath == 'undefined')
    {
		basePath='';
	}

	gCurrNavName = currNavName;

	document.write(
		'<table align="left" valign="top" width="100%" border="0" cellspacing="0" cellpadding="0">' +
			'<tr>' +
				'<td colspan="2">' + 
					'<span class="top">' +
						'<a href="' + basePath + 'index.html" title="MeicoCosmos Home" >' +
							'<img src="' + basePath + 'logo.gif" width="270" height="60" border="0" alt="site logo" />' +
						'</a>' +
					'</span>' +
				'</td>' +
			'</tr>' +
			'<tr>' +
				'<td width="*">' +
					'<img src="' + basePath + 'trans.gif" width="1" height="1" alt="">' +
				'</td>' +
				'<td valign="top" align="left" rowspan="2" width="100%">' +
					'<span class="article">'
		);
}


function WritePageEnd( basePath )
{
	if (typeof basePath == 'undefined')
    {
		basePath='';
	}

	var currNavName = gCurrNavName;

	document.write(
					'</span>' +
				'</td>' +
			'</tr>' +
			'<tr>' +
				'<td valign="top" align="left" width="*">' +
					'<script language="JavaScript" type="text/javascript">WriteSiteIndex("' + basePath + '","' + currNavName + '");</script>' +
				'</td>' +
			'</tr>' +
			'<tr> ' +
				'<td colspan="2">' +
					'<span class="bottom">' +
						'<img src="' + basePath + 'foot.gif" width="270" height="18" alt="footer image" />' +
					'</span>' +
				'</td>' +
			'</tr>' +
			'<tr>' +
				'<td colspan="2">' +
					'<span class="footer">' +
						'&copy; Copyleft 2003 - Meico' +
					'</span>' +
				'</td>' +
			'</tr>' +
		'</table>'
		);
}
*/


function WritePageStart( basePath, currNavName )
{
	if (typeof basePath == 'undefined')
    {
		basePath='';
	}

	document.write(
		'  <table align="left" valign="top" width="100%" border="0" cellspacing="0" cellpadding="0">' +
		'   <tr>' +
		'    <td colspan="2"><span class="top"><a href="' + basePath + 'index.html" title="MeicoCosmos Home" ><img src="' + basePath + 'logo.gif" width="270" height="60" border="0" alt="site logo" /></a></span></td>' +
		'   </tr>' +
		'   <tr>' +
		'    <td valign="top" width="*">' +
		'     <a class="skiplink" href="#startcontent" accesskey="2">Skip over navigation</a>' +
		'     <script language="JavaScript" type="text/javascript">WriteSiteIndex("' + basePath + '","' + currNavName + '");</script>' +
		'    </td>' +
		'    <td valign="top" width="100%">' +
		'     <a name="startcontent" id="startcontent"></a>' +
		'     <span class="article">'
		);
}

function WritePageEnd( basePath )
{
	if (typeof basePath == 'undefined')
    {
		basePath='';
	}

	document.write(
		'     </span>' +
		'    </td>' +
		'   </tr>' +
		'   <tr> ' +
		'    <td colspan="2"><span class="bottom"><img src="' + basePath + 'foot.gif" width="270" height="18" alt="footer image" /></span></td>' +
		'   </tr>' +
		'   <tr>' +
		'    <td colspan="2">' +
		'     <span class="footer">' +
		'      &copy; Copyleft 2003 - Meico' +
		'     </span>' +
		'    </td>' +
		'   </tr>' +
		'  </table>'
		);
}


function WriteBadPage( basePath )
{
	document.write(
		'<h1>' +
		'Innacessible Area' +
		'</h1>' +
		'<p>' +
		'Sorry, but you seem to have reached an area that should not have been accessible.' +
		'</p>' +
		'<p>' +
		'Please see <a href="' + basePath + 'index.html">the main page of this site</a>.' +
		'</p>' +
		'<p>' +
		'You may have incorrectly typed in an address.  Please check the URL in your browser.' +
		'</p>' +
		'<p>' +
		'If you have any questions or comments please <a href="' + basePath + 'contact.html" accesskey="9">contact</a> me.' +
		'</p>');
}
