function MainMenu(header)
{
	this.header = header;
	this.items = new Array();
	this.selectedItem = 0;
	
	this.addItem = function(name, title)
	{
		var obj = new Object();
		obj.name = name;
		obj.title = title;
		
		this.items[this.items.length] = obj;
	}
	
	this.getItem = function(i)
	{
		if (i >= 0 && i < this.getItemCount())
			return this.items[i];
		else
			return null;
	}

	this.getItemCount = function()
	{
		return this.items.length;
	}
	
	this.getSelectedItem = function()
	{
		return this.selectedItem;
	}
	
	this.setSelectedItem = function(i)
	{
		if (i >= 0 && i < this.getItemCount())
			this.selectedItem = i;
	}
		
	this.Draw = function()
	{
		document.write(this.toString());
	}

	this.toString = function()
	{
		var str = '<TABLE HEIGHT="100%" CELLPADDING="3" CELLSPACING="0"><TR><TD WIDTH="40"></TD>';
		for (var i = 0; i < this.getItemCount(); i++) {
			var item = this.getItem(i);
			str += '<TD CLASS="menu-seperator"></TD>';
			if (i == this.getSelectedItem()) {
				str += '<TD CLASS="selected-menu-button" ONCLICK="mainMenu.action(\'' + item.name + '\')" ONMOUSEOVER="mainMenu.overMenu(this)" ONMOUSEOUT="mainMenu.outMenu(this)">' + item.title + '</TD>';
			}
			else {
				str += '<TD CLASS="menu-button" ONCLICK="mainMenu.action(\'' + item.name + '\')" ONMOUSEOVER="mainMenu.overMenu(this)" ONMOUSEOUT="mainMenu.outMenu(this)">' + item.title + '</TD>';
			}
		}
		str += '</TR></TABLE>';
		return str;
	}

	this.action = function(name)
	{
		location.href = name + ".html";
	}
	
	this.overMenu = function(col)
	{
		if (col.className == "selected-menu-button")
			col.className = "over-selected-menu-button";
		else
			col.className = "over-menu-button";
	}
	
	this.outMenu = function(col)
	{
		if (col.className == "over-selected-menu-button")
			col.className = "selected-menu-button";
		else
			col.className = "menu-button";
	}
	
	this.setHeader = function(header)
	{
		this.header();
	}
	
	this.StartPage = function()
	{
		document.write(
			'<CENTER>' +
			'<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0" HEIGHT="100%" BORDER="0">' +
				'<TR HEIGHT="100%">' +
					'<TD HEIGHT="100%" CLASS="margin">&nbsp;</TD>' +
					'<TD WIDTH="5"></TD>' +
					'<TD WIDTH="800" VALIGN="top" HEIGHT="100%">' +
						'<TABLE WIDTH="100%" HEIGHT="100%" CELLPADDING="0" CELLSPACING="0" BORDER="0">' +
							'<TR>' +
								'<TD>' +
									'<TABLE WIDTH="100%" CELLPADDING="0" CELLSPACING="0">' +
										'<TR><TD><IMG SRC="images/logo.jpg"></TD></TR>' +
										'<TR><TD HEIGHT="5"></TD></TR>' +
										'<TR><TD>' + this.toString() + '</TD></TR>' +
									'</TABLE>' +
								'</TD>' +
							'</TR>' +
							'<TR><TD CLASS="header">' + this.header + '</TD></TR>' +
							'<TR><TD CLASS="page" HEIGHT="100%" VALIGN="top">'
		);
	}

	this.EndPage = function()
	{
		document.write('</TD></TR><TR><TD ALIGN="center" CLASS="copy">&copy; 2004 Villa\'s Authentic Sauces</TD></TR></TABLE></TD><TD WIDTH="5"></TD><TD CLASS="margin">&nbsp;</TD></TR></TABLE></CENTER>');
	}

	this.EndHomePage = function()
	{
		document.write('</TD></TR><TR><TD ALIGN="center" CLASS="copy">&copy; 2004 Villa\'s Authentic Sauces<BR>Web design by <A HREF="http://www.professionalservices.net" TARGET="bhmm" CLASS="copy">BHMM Corporation</A></TD></TR></TABLE></TD><TD WIDTH="5"></TD><TD CLASS="margin">&nbsp;</TD></TR></TABLE></CENTER>');
	}

	this.addAllItems = function()
	{	
		this.addItem("index", "Home");
		this.addItem("products", "Products");
		this.addItem("recipes", "Recipes");
		this.addItem("reviews", "Reviews");
//		this.addItem("tips", "Questions");
		this.addItem("about", "About Us");
		this.addItem("contact", "Contact Us");
	}

}
