// JavaScript Document

function objMenuItem(n, u, h, height, inc_on_menu)
{
	this.name = n;
	this.url = u;
	this.location = h;
	this.height = height;
	this.include_on_menu = inc_on_menu;
}

var menuArray = new Array();

addMenuItem("welcome", "welcome.htm", '', 19, true);
addMenuItem("about", "aboutus.htm", '', 19, true);
addMenuItem("gprlicensingregs", "licensing.htm", '', 31, true);
addMenuItem("guidelines", "guidelines.htm", '', 31, true);
addMenuItem("members", "members.asp", '', 19, true);
addMenuItem("membership", "membership.htm", '', 19, true);
addMenuItem("associationlife", "associationlife.htm", '', 19, true);
addMenuItem("news", "news.htm", '', 19, true);
addMenuItem("literature", "literature.htm", '', 19, true);
addMenuItem("glossary", "glossary.htm", '', 19, true);
addMenuItem("training", "members/training.htm", '../', 19, true);

addMenuItem("memorandum", "", '', 19, false);
addMenuItem("code", "", '', 19, false);
addMenuItem("practice", "", '', 19, false);
addMenuItem("application", "", '', 19, false);

//addMenuItem("rollofhonour", "rollofhonour.htm", '', 19);
//addMenuItem("news", "news.htm", '', 19);
//addMenuItem("benefits", "benefits.htm", '', 19);
//addMenuItem("application", "application.htm", '', 19);
//addMenuItem("code", "codeofethics.htm", '', 19);
//addMenuItem("practice", "codeofpractice.htm", '', 19);
//addMenuItem("memorandum", "memorandum.htm", '', 19);
addMenuItem("diary", "members/diary.asp", '../', 19);
//addMenuItem("multimedia", "multimedia.htm", '', 19);
//addMenuItem("reading", "recommendedreading.htm", '', 19);
//addMenuItem("contact", "contactus.htm", '', 19);


function addMenuItem(n, u, h, height, inc_on_menu)
{
	menuArray[n] = new objMenuItem(n, u, h, height, inc_on_menu);
}

function outputMenu(a)
{
	var menuwide_location = "", height;

	if (menuArray[a].location == "../")
	{
		menuwide_location = "../";
	}

	for (i in menuArray)
	{
		if (menuArray[i].include_on_menu == true)
		{
			$("#menu_section").append("<tr><td><div id='side_" + menuArray[i].name + "' class='side_menu_item' style='background-image: url(" + menuwide_location + "assets/side_" + menuArray[i].name + ".gif); height: " + menuArray[i].height + "'></div></td></tr>");
			$("#side_" + menuArray[i].name).click(function () {
				var clicked = $(this).attr("id");
				clicked = clicked.substr(5);
				document.location.href = menuArray[a].location + menuArray[clicked].url;
				});
	
			$("#side_" + menuArray[i].name).hover(function () {
				$(this).css("backgroundPosition", "0px -" + $(this).height() + "px");
				}, function () {
				$(this).css("backgroundPosition", "0px 0px");
				});

			if (a == i)
			{
				height = menuArray[i].height;
			}
		}
	}

	//$("#side_" + a).css("backgroundPosition", "0px -" + height * 2 + "px");

	$("#menu_section").append("<tr><td><div class='side_menu_item' style='background-image: url(" + menuwide_location + "assets/side_footnote.gif); margin-top: 30px; height: 26px; background-position: 12px 0px'></div></td></tr>");
}
