function drawTopMenu()
{
	for( var i = 0; i < menuList.length; i++ )
	{
		if( menuList[i][1] == 0 )
		{
			document.write( '<tr><td class="menuTD"><a href="' + menuList[i][3] + '">' +
				unescape( menuList[i][2] ) + '</a></td></tr>' );
		}
	}
}

function drawInteriorMenu( id )
{
	var topCount = 0;
	var retVal = '';
	var selNav;
	for( var i = 0; i < menuList.length; i++ )
	{
		if( menuList[i][1] == 0 )
		{
			topCount += 1;
		}
		if( id == menuList[i][0] )
		{
			if( menuList[i][1] == 0 )
			{
				selNav = menuList[i][0];
			}
			else
			{
				var j = getParent( i );
				if( menuList[j][1] == 0 )
				{
					selNav = menuList[i][1];
				}
				else
				{
					selNav = menuList[j][1];
				}
			}
		}
	}
	var wdth = topCount > 4 ? parseInt( 100 / parseInt( ( topCount / 2 ) + .5 ) ) : parseInt( 100 / topCount );
	retVal = '<tr>';
	for( var i = 0, j = 1; i < menuList.length; i++ )
	{
		if( menuList[i][1] == 0 )
		{
			retVal += '<td class="menuTD" style="height:24px" width="' + wdth + '%"' + 
				( menuList[i][0] == selNav ? '" bgcolor="#cccccc"' : '' ) + 
				' nowrap><a href="' + menuList[i][3] + '">' + unescape( menuList[i][2] ) + '</a></td>';
			if( j == parseInt( ( topCount / 2 ) + .5 )  && topCount > 4 )
			{
				retVal += '</tr><tr>';
			}
			j++;
		}
	}
	if( topCount % 2 == 1 && topCount > 4 )
	{
		retVal += '<td class="menuTD"><a href="/">Home</a></td>';
	}
	retVal += '</tr>';
	document.write( retVal );
}

function drawSideMenu( id )
{
	var retVal = '';
	var selNav;
	var subNav;
	for( var i = 0; i < menuList.length; i++ )
	{
		if( id == menuList[i][0] )
		{
			if( menuList[i][1] == 0 )
			{
				selNav = menuList[i][0];
			}
			else
			{
				var j = getParent( i );
				if( menuList[j][1] == 0 )
				{
					subNav = menuList[i][0];
					selNav = menuList[i][1];
				}
				else
				{
					subNav = menuList[i][1];
					selNav = menuList[j][1];
				}
			}
		}
	}
	retVal = '<table cellpadding="3" style="margin-left:5px;margin-top:35px">'; 
	for( var i = 0; i < menuList.length; i++ )
	{
		if( menuList[i][1] == selNav )
		{
			if( !menuList[i][5] )
			{
				retVal += '<tr><td>&nbsp;</td><td colspan="2"><b class="menuTitle">' + unescape( menuList[i][2] ) + '</b></td><tr>';
			}
			else
			{
				retVal += '<tr><td valign="top"><img src="/images/' + ( menuList[i][0] == subNav ? 'nav_arrow_on.gif">' : 'nav_arrow_off.gif">' ) + 
					'</td><td colspan="2" class="sideMenuTD"><a href="' + menuList[i][3] + '">' + unescape( menuList[i][2] ) + '</a></td></tr>';
			}
		}
		if( menuList[i][1] == subNav )
		{
			retVal += '<tr><td></td><td valign="top">' + ( menuList[i][0] == id ? '<font color="red">></font>' : '>' ) + 
				'</td><td class="sideMenuTD"><a href="' + menuList[i][3] + '">' + unescape( menuList[i][2] ) + '</a></td></tr>';			
		}
	}
	retVal += '</table>';
	document.write( retVal );
}

function getParent( n )
{
	for( var i = 0; i < menuList.length; i++ )
	{
		if( menuList[i][0] == menuList[n][1] )
			return( i );
	}
}

function drawFootMenu()
{
	var topCount = 0;
	var retVal = '';
	
	for( var i = 0; i < menuList.length; i++ )
	{
		if( menuList[i][1] == 0 )
		{
			topCount += 1;
		}
	}

	for( var i = 0, j = 1; i < menuList.length; i++ )
	{
		if( menuList[i][1] == 0 )
		{
			retVal += '<a href="' + menuList[i][3] + '">' + unescape( menuList[i][2] ) + '</a>';
			if( j == parseInt( topCount / 2 + 1 ) && topCount > 4 )
			{
				retVal += '<br>';
			}
			else
			{
				retVal += ' | ';
			}
			j++;
		}
	}
	retVal += '<a href="/">Home</a>';
	document.write( retVal );
}