function toggleSection(level, ulID, hidID, xorSections)
{
	var ulSection = document.getElementById(ulID);
    var hidExpanded = document.getElementById(hidID);
    var liSection = document.getElementById(ulID.replace(new RegExp('_ulSection', 'gi'), '_liSection'));
	var aExpanded;
	var li;
	// Check if current section is visible
	if (ulSection.style.display == "")
	{
		// Yes, hide it and remove it from hidExpanded
		liSection.className = "cmsSectionLevel" + level;
		ulSection.style.display = "none";
		if (xorSections)
		{
			// Hide all the other expanded sections
			if (!hidExpanded.value == "")
			{
				aExpanded = hidExpanded.value.split(",");
				for (i = 0; i < aExpanded.length; i++)
				{
					document.getElementById(aExpanded[i]).style.display = "none";
					li = document.getElementById(aExpanded[i].replace(new RegExp('_ulSection', 'gi'), '_liSection'));
					li.className = "cmsSectionLevel" + level;
				}
			}
			hidExpanded.value = "";
		}
		else
		{
			aExpanded = hidExpanded.value.split(",");
			for (i = 0; i < aExpanded.length; i++)
				if (aExpanded[i] == ulID)
					break;
			for (i = i; i < aExpanded.length - 1; i++)
				aExpanded[i] = aExpanded[i + 1];
			aExpanded.length -= 1;
			hidExpanded.value = aExpanded.join(",");
		}
	}
	else
	{
		// No, it is hidden. Show it by setting display to an empty string
		if (xorSections)
		{
			// Hide all the other expanded sections
			if (!hidExpanded.value == "")
			{
				aExpanded = hidExpanded.value.split(",");
				for (i = 0; i < aExpanded.length; i++)
				{
					document.getElementById(aExpanded[i]).style.display = "none";
					li = document.getElementById(aExpanded[i].replace(new RegExp('_ulSection', 'gi'), '_liSection'));
					li.className = "cmsSectionLevel" + level;
				}
			}
			hidExpanded.value = ulID;
		}
		else
		{
			if (hidExpanded.value != "")
				hidExpanded.value += ",";
			hidExpanded.value += ulID;
		}
		ulSection.style.display = "";
		liSection.className = "cmsSectionLevel" + level + "expanded";
	}
}

function section()
{}

function showSection(isHorizontal, level, ulID, useIndicator, expandedIndicatorImage)
{
	var ulSection = document.getElementById(ulID);
    var liSection = document.getElementById(ulID.replace(new RegExp('_ulSection', 'gi'), '_liSection'));
	if (level > 0 || !isHorizontal)
	{
		ulSection.style.marginTop = - liSection.offsetHeight - 0 + "px";
	}
	if (useIndicator)
	{
		var a = liSection.getElementsByTagName("img");
		for (i = 0; i < a.length; i++)
			if (a[i].className == "indicator")
				break;
		a[i].src = expandedIndicatorImage;
	}
}

function cmsMenuSwapImg(id, file)
{
	document.getElementById(id).style.backgroundImage = "url(" + file + ")";
}

