<!--
var keyPaths;
			
function GroupItem(groupID, parentID, description, thread)
{
	this.groupID = groupID;
	this.parentID = parentID;
	this.description = description;
	this.thread = thread;
}

function addControlsForParent(parentID, level, controlMainSectionName, controlName)
{
	var oMainSection = document.all(controlMainSectionName);
	
	var index = oMainSection.children.length;
	for (var i = 0; i < oMainSection.children.length; i++)
	{
		if (oMainSection.children(i) != null)
		{
			if (oMainSection.children(i).id >= level)
			{
				index = i;
				break;
			}
		}
	}
	var indexTo = oMainSection.children.length;
	for (var i = index; i < indexTo; i++)
	{
		oMainSection.removeChild(oMainSection.children(index));
	}

	var oSubSection = null;
	for (var i = 0; i < oMainSection.children.length; i++)
	{
		if (oMainSection.children(i) != null)
		{
			if (oMainSection.children(i).id == level)
			{
				oSubSection = oMainSection.children(i);
				break;
			}
		}
	}
	if (oSubSection == null)
	{
		oSubSection = document.createElement("div");
		oSubSection.id = level;
		oMainSection.appendChild(oSubSection);
	}

	var nextLevel = level + 1;
	var lastThread = -1;							
	for (var i = 0; i < keyPaths.length; i++)
	{
		if (keyPaths[i].parentID == parentID)
		{
			if (lastThread == -1 || (lastThread != keyPaths[i].thread && parentID > 0))
			{
				var oSelect = document.createElement("select");
				oSelect.id = controlName + "_level" + level;
				oSelect.name = controlName + "_level" + level;
				oSelect.onchange = function (evt) { addControlsForParent(this.options[this.selectedIndex].value,nextLevel,controlMainSectionName,controlName); };
				oSubSection.appendChild(oSelect);
				lastThread = keyPaths[i].thread;
				
				//Add default option
				var oDefaultOption = document.createElement("OPTION");
				oSelect.options.add(oDefaultOption);
				oDefaultOption.innerText = "please select";
				oDefaultOption.value = -1;
			}
						
			var blnDuplicate = false;
			for (var j = 0; j < oSelect.options.length; j++)
			{
				if (oSelect.options[j].value == keyPaths[i].groupID)
				{
					blnDuplicate = true;
				}
			}
						
			if (!blnDuplicate)
			{
				var oOption = document.createElement("OPTION");
				oSelect.options.add(oOption);
				oOption.innerText = keyPaths[i].description;
				oOption.value = keyPaths[i].groupID;
			}
		}
	}
}

function setValue(groupID, level, controlMainSectionName, controlName)
{
	var oMainSection = document.all(controlMainSectionName);
				
	var oSubSection = null;
	for (var i = 0; i < oMainSection.children.length; i++)
	{
		if (oMainSection.children(i) != null)
		{
			if (oMainSection.children(i).id == level)
			{
				oSubSection = oMainSection.children(i);
				break;
			}
		}
	}
	if (oSubSection != null)
	{
					
		for (var i = 0; i < oSubSection.children.length; i++)
		{
			if (oSubSection.children(i) != null)
			{
				if (oSubSection.children(i).id == controlName + "_level" + level)
				{
					var oSelect = oSubSection.children(i);
					for (var j = 0; j < oSelect.options.length; j++)
					{
						if (oSelect.options[j].value == groupID)
						{
							oSelect.options[j].selected = true;
						}
					}
				}
			}
		}
	}
}
-->
