﻿var NavCaptions = '';
var activeButton = '';

function CBOXAddButton(whatButton)
	{
	if (NavCaptions.length > 1)
		{ NavCaptions = NavCaptions + ','; }

	NavCaptions = NavCaptions + whatButton;
	}

function CBOXDropDownCheck()
	{
	if (activeButton.length > 0)
		{
		activeButton = '';
		CBOXDropDownCloseAll();
		}
	}

function CBOXDropDownCloseAll()
	{
	// Wir machen aus der Liste erstmal ein praktischeres Array
	NavCaptionsList = NavCaptions.split(",");

	// Wir blenden alle Dropdowns aus
	for(var i=0; i <= NavCaptionsList.length; i++)
		{
		if (document.getElementById(NavCaptionsList[i] + "DropDown"))
			{
			document.getElementById(NavCaptionsList[i] + "DropDown").style.display = 'none';
			document.getElementById(NavCaptionsList[i] + "Button").className = 'head';
			}
		}
	}

function CBOXDropdown(whatButton)
	{
	CBOXDropDownCloseAll();

	if (whatButton.length > 0)
		{
		// Wenn der momentane Button bereits aktiv ist, soll das Fenster geschlossen werden
		if (activeButton == whatButton)
			{
			document.getElementById(whatButton + "Button").className = 'head';
			activeButton = '';
			}
		// Ist das Fenster neu da, öffnen wir das DropDown
		else
			{
			activeButton = whatButton;
			document.getElementById(whatButton + 'DropDown').style.display = 'block';
			document.getElementById(whatButton + "Button").className = 'headactive';
			}
		}
	}
	
function CBOXDropDownMouseOver(whatButton)
	{
	if (whatButton != 'meineseite')		
		{
		if (activeButton.length > 0)
			{
			if(activeButton != whatButton)
				{
				CBOXDropdown(whatButton);
				}
			}
		}
	else
		{
		CBOXDropDownCloseAll();
		}
	}
