var oMenu = new Menu();

var oSubMenu = new SubMenu();



//Main Menu ===================================================================================================

function Menu()

{	this.menuItems = new Array();

	this.addMenuItem = addMenuItem; 

}



function addMenuItem(sID, sText, sHref)

{	//create a new menu item

	var oItem = new MenuItem(sID, sText, sHref);

	//add the item to the menuItems array

	this.menuItems[this.menuItems.length] = oItem;

}



function MenuItem(sID, sText, sHref)

{	this.id = sID;

	this.text = sText;

	this.href = sHref;

}



function initializeMenu()

{	oMenu.addMenuItem("home", "Home", "index.htm");

	oMenu.addMenuItem("accounting", "Accounting &amp; Auditing", "accounting.htm");

	oMenu.addMenuItem("taxes", "Income Taxes", "income_tax.htm");

	oMenu.addMenuItem("brokers", "Broker Dealers", "broker_dealer.htm");

	oMenu.addMenuItem("financial", "Financial Operations Principal", "financial_principle.htm");

	oMenu.addMenuItem("hedgefunds", "Hedge Funds", "hedgefunds.htm");

	oMenu.addMenuItem("consulting", "Business Consulting", "consulting.htm");

	oMenu.addMenuItem("planning", "Financial Planning", "planning.htm");
	
	oMenu.addMenuItem("secure", "Secure File Exchange", "http://liberfarb.leapfile.com");

	oMenu.addMenuItem("about", "About Larry Liberfarb, P.C.", "about.htm");
	
	oMenu.addMenuItem("directions", "Directions", "directions.htm");

	oMenu.addMenuItem("links", "Helpful Links", "links.htm");

}



//Sub Menus======================================================================================================

function SubMenu()

{	this.subMenuItems = new Array();

	this.addSubMenuItem = addSubMenuItem; 

}



function addSubMenuItem(sID, sText, sHref)

{	//create a new menu item

	var oItem = new SubMenuItem(sID, sText, sHref);

	//add the item to the menuItems array

	this.subMenuItems[this.subMenuItems.length] = oItem;

}



function SubMenuItem(sID, sText, sHref)

{	this.id = sID;

	this.text = sText;

	this.href = sHref;

}



function initializeSubMenu(sParent)

{	if(sParent == "category1")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

	

	if(sParent == "category2")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

	

	if(sParent == "category3")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

	

	if(sParent == "category4")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

	

	if(sParent == "category5")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

	

	if(sParent == "category6")

	{	oSubMenu.addSubMenuItem(sParent + "_1", "Sub Item 1", sParent + "_detail1.html");

		oSubMenu.addSubMenuItem(sParent + "_2", "Sub Item 2", sParent + "_detail2.html");

		oSubMenu.addSubMenuItem(sParent + "_3", "Sub Item 3", sParent + "_detail3.html");

	}

}



function createMenu(sMain, bMainSelected, sSub)

{	initializeMenu();

	initializeSubMenu(sMain);

	

	document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" bgcolor=\"#ffffff\">");

	document.write("<tr>");

	document.write("<td class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"21\" height=\"1\" border=\"0\"></td>");

	document.write("<td colspan=\"2\" class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"204\" height=\"15\" border=\"0\"></td>");

	//document.write("<tr>");

	//document.write("<td class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"21\" height=\"1\" border=\"0\"></td>");

	//document.write("<td height=\"15\" colspan=\"2\" class=\"secondary\"><span class=\"subheading\">Categories</span></td>");

	//document.write("</tr>");

	document.write("<tr><td colspan=\"3\" class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"15\" border=\"0\"></td></tr>");

	document.write("<tr><td colspan=\"3\" class=\"line\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\"></td></tr>");

	

	for (var i = 0; i < oMenu.menuItems.length; i++)

	{	var sID = oMenu.menuItems[i].id;

		var sText = oMenu.menuItems[i].text;

		var sHref = oMenu.menuItems[i].href;

		

		document.write("<tr>");

	

		if (sMain == sID)

		{	if (bMainSelected)

			{	var sImage = "menu_on.gif";

				var sDisplay = "<span class=\"selectedmenu\">" + sText + "</span>";

			}

			else

			{	var sImage = "spacer.gif"

				var sDisplay = "<a href=\"" + sHref + "\" class=\"menu\">" + sText + "</a>";

			}

			

			document.write("<td valign=\"top\"><img src=\"images/" + sImage + "\" alt=\"\" width=\"21\" height=\"25\" border=\"0\"></td>");

			document.write("<td width=\"204\" height=\"25\" valign=\"top\">");

			

			//sub items

			document.write("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">");

			document.write("<tr><td colspan=\"2\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"5\" border=\"0\"></td></tr>");

			document.write("<tr><td colspan=\"2\">" + sDisplay + "</td></tr>");

				

				for (x = 0; x < oSubMenu.subMenuItems.length; x++)

				{	var sSubID = oSubMenu.subMenuItems[x].id

					var sSubText = oSubMenu.subMenuItems[x].text

					var sSubHref = oSubMenu.subMenuItems[x].href

					

					if (sMain + "_" + sSub == sSubID)

					{	var sSubImage = "submenu_on.gif";

						var sSubDisplay = "<span class=\"text\">" + sSubText + "</span>";

					}

					else

					{	var sSubImage = "spacer.gif";

						var sSubDisplay = "<a href=\"" + sSubHref + "\" class=\"submenu\">" + sSubText + "</a>";

					}

						

					document.write("<tr>");

					document.write("<td><img src=\"images/" + sSubImage + "\" alt=\"\" width=\"8\" height=\"20\" border=\"0\"></td>");

					document.write("<td width=\"100%\">" + sSubDisplay + "</td>");

					document.write("</tr>");

				}

				

			document.write("<tr><td colspan=\"2\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"5\" border=\"0\"></td></tr>");

			document.write("</table>");

			

			document.write("</td>");

		}

		else

		{	document.write("<td><img src=\"images/spacer.gif\" alt=\"\" width=\"21\" height=\"25\" border=\"0\"></td>");

			document.write("<td width=\"204\" height=\"25\"><a href=\"" + sHref + "\" class=\"menu\">" + sText + "</a></td>");

		}

		

		document.write("<td class=\"line\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"25\" border=\"0\"></td>");

		document.write("</tr>");

		document.write("<tr><td colspan=\"3\" class=\"line\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"1\" border=\"0\"></td></tr>");

	}

	

	document.write("<tr><td colspan=\"3\" class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"15\" border=\"0\"></td></tr>");

	//document.write("<tr>");

	//document.write("<td class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"21\" height=\"1\" border=\"0\"></td>");

	//document.write("<td valign=\"top\" colspan=\"2\" class=\"secondary\">");

	//document.write("<a href=\"javascript:alert('This goes to the site map');\" class=\"tools\">Site Map</a>");

	//document.write("</td>");

	//document.write("</tr>");

	document.write("<tr><td colspan=\"3\" class=\"secondary\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"15\" border=\"0\"></td></tr>");

	document.write("</table>");

}





