/* -------------------------------------------------------------------------- */
/*
   (c) 2004-2005 U.S. Robotics Corporation.
*/
/* -------------------------------------------------------------------------- */


/* --------------------------------------------------------------------------

	Define the information for a single menu item (both main bar and sub-menu).
	Each menu item has an associated filename, title, and description.
	The title and description are translated, but not the filename.

*/

function MenuItem(strFilename, strTitle, strDescription, menuSub)
{
	this.strFilename = strFilename;
	this.strTitle = strTitle;
	this.strDescription = strDescription;
	this.menuSub = menuSub;
}


/* --------------------------------------------------------------------------

	These represent the various menus. There is a main menu bar and some sub-menus.

	The second and third strings in each item need to be translated.
	The first string is a filename and does not need to be translated.

	This is the only section that contains text to be translated.

	The below tag must not be modified. It is used by
	Translation to extract the text to be translated.

	*** TRANSLATION START -->
*/

/*
	The value of this variable is the title of each page, output by the script below.
	The product name "Wireless <i>MAX<\/i>g Router" is not translated,
	but the text "User Guide" is, and the arrangement of that text
	can be changed to suit the target language's grammar.
*/
var strTitle = "Wireless <i>MAX<\/i>g Router User Guide";

// N.B.: All filenames must be in lowercase here.

var menuHome = new Array(
									new MenuItem("index.html",					"Introduction",	"Introduction to the router"),
									new MenuItem("features.html",				"Features",			"Features of the router"),
									new MenuItem("warranty.html",				"Warranty",			"The limited warranty"),
									new MenuItem("regulatory.html",			"Regulatory",		"Regulatory information")
								);

var menuInstall = new Array(
									new MenuItem("install.html",				"Router",			"How to install the router"),
									new MenuItem("printer.html",				"Printer",			"How to install a network USB printer")
								
								);


var menuRouter = new Array(
									new MenuItem("wui.html",					"Login",				"Information on configuring the router"),
									new MenuItem("status.html",				"Status",			"Information on router's Status page"),
									new MenuItem("log.html",					"Log",				"Information on router's Log page"),
									new MenuItem("internet.html",				"Internet",			"Information on router's Internet page"),
									new MenuItem("security.html",				"Security",			"Information on router's Security page"),
									new MenuItem("firewall.html",				"Firewall",			"Information on router's Firewall page"),
									new MenuItem("wireless.html",				"Wireless",			"Information on router's Wireless page"),
									new MenuItem("lan.html",					"LAN",				"Information on router's LAN page"),
									new MenuItem("device.html",				"Device",			"Information on router's Device page")
								);

var menuHelp = new Array(
									new MenuItem("troubleshooting.html",	"Troubleshooting",	"Information on solving problems"),
									new MenuItem("faq.html",					"FAQs",					"Frequently-asked questions"),
									new MenuItem("support.html",				"Support",				"Technical support")
								);

var menuMain = new Array(
									new MenuItem("index.html",					"Home",				"View product information",			menuHome),
									new MenuItem("install.html",				"Installation",	"How to install the router",		menuInstall),
									new MenuItem("wui.html",					"Configuration",	"How to configure the router",		menuRouter),
									new MenuItem("tutorials.html",			"Tutorials",		"How to accomplish your goals"),
									new MenuItem("troubleshooting.html",	"Help",				"Troubleshooting tips and FAQs",		menuHelp)
								);

/*
	<-- TRANSLATION END ***

	Nothing after this needs to be translated.
	The above tag must not be modified. It is used by
	Translation to extract the text to be translated.
*/


/* --------------------------------------------------------------------------

	Page header and footer functions

*/

/*
	This function returns the filename of the current page.
	It looks for both slash and backward slash.

	N.B.:	It returns the filename in lowercase because
			comparisons shouldn't be case-sensitive.
*/
function getPageFilename()
{
	var strFilename = document.URL;
	var ixSeparator = strFilename.lastIndexOf("/");
	var ixSeparator2 = strFilename.lastIndexOf("\\");
	if (ixSeparator2 > ixSeparator)
		ixSeparator = ixSeparator2;
	if (ixSeparator != -1)
		strFilename = strFilename.substr(ixSeparator + 1);
	return strFilename.toLowerCase();
}

/*
	This writes out a page's header, including the optional menu bar.
	The title parameter is optional. If passed, it's written out
	as the header text.

	Example:

	<img id="idImgHeader" src="images/banner.gif">
	<div id="idHeader">Wireless <i>MAX</i>g Router User Guide</div>

	<div id="idMenu">
		<span class="clsMenuItemActive">Home</span>
		<a class="clsMenuItemInactive" href="two.html">Installation</a>
		<a class="clsMenuItemInactive" href="eleven.html">Router</a>
		<a class="clsMenuItemInactive" href="nine.html">Warranty</a>
	</div>
	<div id="idMenu2">
		<span class="clsMenuItemActive">Status</span>
		<a class="clsMenuItemInactive" href="lan.html">LAN</a>
		<a class="clsMenuItemInactive" href="device.html">Device</a>
	</div>
*/
function writeHeader()
{
	var strFilename = getPageFilename();		  /* get filename of current page */

	document.write("<img id=\"idImgHeader\" src=\"images/banner.gif\" width=\"180\" height=\"30\">");
	document.write("<img id=\"idImgHeader\" src=\"images/device.gif\" width=\"100\" height=\"80\">");
	document.write("<div id=\"idHeader\">" + strTitle + "<\/div>");

	document.write("<div id=\"idMenu\">");
	var menuSub = null;
	for (var i = 0; i < menuMain.length; ++i)
	{
		/*
			Determine if this is the current page.
			First, compare this filename with the current main menu item.
			If that's not it, check any of the current item's sub-menu items.
		*/
		var bCurrentPage = false;
		if (menuMain[i].strFilename == strFilename)
			bCurrentPage = true;
		else if (menuMain[i].menuSub != null)
		{
			for (var j = 0; j < menuMain[i].menuSub.length; ++j)
			{
				if (menuMain[i].menuSub[j].strFilename == strFilename)
				{
					bCurrentPage = true;
					break;
				}
			}
		}

		// the newline is required for there to be space between the tabs
		if (bCurrentPage)
		{
			document.write("<span class=\"clsMenuItemActive\">" + menuMain[i].strTitle + "<\/span>\n");
			menuSub = menuMain[i].menuSub;
		}
		else
			document.write("<a class=\"clsMenuItemInactive\" href=\"" + menuMain[i].strFilename + "\" title=\"" + menuMain[i].strDescription + "\">" + menuMain[i].strTitle + "<\/a>\n");
	}
	document.write("<\/div>");

	/*
		If the current menu item has a sub-menu, output it too.
	*/
	if (menuSub != null)
	{
		document.write("<div id=\"idMenu2\">");
		for (var i = 0; i < menuSub.length; ++i)
		{
			if (menuSub[i].strFilename == strFilename)
				document.write("<span class=\"clsMenuItemActive\">" + menuSub[i].strTitle + "<\/span>\n");
			else
				document.write("<a class=\"clsMenuItemInactive\" href=\"" + menuSub[i].strFilename + "\" title=\"" + menuSub[i].strDescription + "\">" + menuSub[i].strTitle + "<\/a>\n");
		}
		document.write("<\/div>");
	}

	document.write("<div id=\"idContent\">");
}


function writeFooter()
{
	document.write("<\/div>");

   document.write("<p id=\"idCopyright\">&copy; 2004-" + (new Date).getFullYear() + " U.S. Robotics Corporation<\/p>");
}
