/*
	  Copyright (c) 2001 Moonstone Interactive, Inc.
      All Rights Reserved. No portion of this file, including but
      not limited to any associated code, documents or images, may be
      copied, retransmitted, reposted, duplicated or otherwise
      used without the express written permission of Moonstone Interactive, Inc.

*/		


function build_menu()
{
menutext='';

if(current_nav==1)
{
	image_path="images/";
} 
else 
{
	image_path="../images/";
}

for(index=1; index<nav_length; index++)
{	
	menutext+='<tr>';
		menutext+='<td width="84" align="right">'
		menutext+='<table background="' + image_path + 'tpg_nav_offarrow.gif" bgcolor="#990000" align="right" cellpadding="0" cellspacing="0" border="0">';
			if ((index>1) && (eval('nav_type_' + index)!="sub"))
			{
				menutext+='<tr>';
					menutext+='<td colspan="2" width="84">';
					menutext+='<img src="';
					menutext+=image_path;						
					menutext+='tpg_spacer_pixel_white.gif" width="84" height="1" alt="" border="0">';
					menutext+='</td>';
				menutext+='</tr>';
			}
			menutext+='<tr align="right">';
				menutext+='<td colspan="1" align="right">';
				
				//current_page is set by calling page.
				//when building menu for current page
				//disable link to itself.
				if (index==current_nav)
				{
					menutext+='<a>';
				} else {
					menutext+='<a href="';
					menutext+=eval('nav_link_' + index) + '"';
					menutext+=" onmouseover=\"document.images['nav_" + index + "'].src='" + eval('nav_rollover_' + index) + "';\" ";
					menutext+=" onmouseout=\"document.images['nav_" + index + "'].src='" + eval('nav_image_' + index) + "';\">";														
				}
				
				menutext+='<img src="';
				menutext+=eval('nav_image_'+ index);
				menutext+='"';
				menutext+=' width="75" border="0" name="nav_' + index + '">';
				menutext+='</a>';
				menutext+='</td>';
				menutext+='<td width="9" align="left" valign="middle">';
				menutext+='<img src="';
				menutext+=image_path;
				
				if (index==current_nav)
				{
					menutext+='tpg_nav_onarrow.gif" width="9" height="10" alt="" border="0">';
				}
				else
				{
					menutext+='tpg_nav_offarrow.gif" width="9" height="10" alt="" border="0">';
				}
										
				menutext+='</td>';
			menutext+='</tr>';
	
    	menutext+='</table>';
		menutext+='</td>';
	menutext+='</tr>';
	}
	menutext+='<tr>';
	menutext+='<td colspan="2" width="84">';
	menutext+='<img src="';
	menutext+=image_path;						
	menutext+='tpg_spacer_pixel_white.gif" width="84" height="1" alt="" border="0">';
	menutext+='</td>';
	menutext+='</tr>';
}






function preload_nav_images()
{
	if (document.images) {	
		for (count = 1; count < nav_length; count ++) {
			if (count != current_nav) {
				var next_image	= new Image();
				next_image.src = eval('nav_rollover_' + count);
			}
		}
	}
}