// array that contains menu elements
// arr[0] -> menu name
// arr[1] -> id of menu when in inactive mode
// arr[2] -> id of menu when in active mode
// e.g. menus = ['pengantar', pengantar-0, pengantar-1]
var menus = new Array();

// active menu
var activeMenu;

function InitMenu(menuElms)
{
	// register menu elements
	menus = $w(menuElms);
}

function GetMouseHover(name, hoverState)
{
	var indx = menus.indexOf(name); // get array index from value name
	
	if(indx != -1) // index was found
	{
		var id0 = menus[indx + 1];
		var id1 = menus[indx + 2];
		
		if(name != activeMenu)
		{
			if(hoverState) // hoverState == 1
			{
				$(id0).hide();
				$(id1).show();
			}
			else
			{
				$(id1).hide();
				$(id0).show();
			}
		}
	}
}

function ClickMenu(name, url)
{
	if(menus.size() > 2) // size of menus array must be at least 3
	{
		var indx = menus.indexOf(name);
		
		if(indx != -1)
		{
			for(i = 0; i < menus.size(); i = i+3)
			{
				var id0 = menus[i+1];
				var id1 = menus[i+2];
				
				if(i == indx) // menu that wanted to be activated
				{
					$(id0).hide();
					$(id1).show();
				}
				else
				{
					$(id1).hide();
					$(id0).show();
				}
			}
			
			// update active menu
			activeMenu = name;
			
			// goto url
			if(url != '#')
				{ location.href = url; }
		}
	}
}

function GoToUrl(url)
{
	location.href = url;
}

function UpdateContainer(idContainer, idContent)
{
	var cont = $F(idContent);
	$(idContainer).update(cont);
	$(idContainer).show();
}

function GetBrowserInfo()
{
	var browser = new Array();
	browser[0] = navigator.appCodeName;
	browser[1] = navigator.appName;
	browser[2] = navigator.userAgent;
	browser[3] = navigator.platform;
	
	return browser;
}