var ACTIVE_SUBMENU_PARAM_NAME	=	"selSubMenu";

function getParamActiveSubMenuId()
{
	var selSubMenuId = null;

	var queryString = window.location.href;
	
	// Add "=" to the parameter name (i.e. parameterName=value)
	var parameterName = ACTIVE_SUBMENU_PARAM_NAME + "=";
	if ( queryString.length > 0 ) 
	{
		// Find the beginning of the string
		var begin = queryString.indexOf ( parameterName );
		// If the parameter name is not found, skip it, otherwise return the value
		if (begin != -1 ) 
		{
			// Add the length (integer) to the beginning
			begin += parameterName.length;
			// Multiple parameters are separated by the "&" sign
			end = queryString.indexOf ( "&" , begin );
			if ( end == -1 )
			{
				end = queryString.length;
			}
			// get the parameter value
			selSubMenuId = unescape(queryString.substring(begin, end));
		}

		if (selSubMenuId != null)
		{
			setActiveSubMenu(selSubMenuId);
		}
	}
}


function setActiveSubMenu(aSubMenuId)
{

	var subMenuElem = document.getElementById(aSubMenuId);
	if (subMenuElem == null)
	{
		// alert("Sub Menu with code: '" + aSubMenuId + "' is missing.");
		return;
	}	
	

	subMenuElem.className= "MenuItemSelected";


	// corresponding link has "Link" suffix
	var subMenuLinkElem = document.getElementById(aSubMenuId + "Link");
	if (subMenuLinkElem == null)
	{
		return;
	}	
	subMenuLinkElem.className= "activ";
}


function setMenuFrameVisible(aMenuIFrameID)
{
	var menuIFrameElem = document.getElementById(aMenuIFrameID);
	//menuIFrameElem.src = "../../../en/menu.html";
	
	// test code
	if (menuIFrameElem == null)
	{
		// alert("Menu with code: '" + aMenuIFrameID + "' is missing.");
		return;
	}	
	
	menuIFrameElem.style.visibility = 'visible';
}
