//globale Variablen definieren
var bV=parseInt(navigator.appVersion);
var NS4=(document.layers)?true:false;
var IE4=((document.all)&&(bV>=4))?true:false;
var ver4=(NS4||IE4)?true:false;
var menold="";
var smenold="";
var status=false;

//alle Elemente erstmal verbergen
if (ver4)
{
	with (document)
	{
	write("<STYLE TYPE='text/css'>");
	if (NS4)
	{
		write(".parent {position:absolute; visibility:hidden}");
		write(".child {position:absolute; visibility:hidden}");
		write(".regular {position:absolute; visibility:hidden}");
	}
	write("</STYLE>");
	}
}

//Variable auf eingeklappt setzen
var isExpanded = false;

//gibt Index jedes Elementes zurueck
function getIndex(el)
{
	var ind;
	var whichEl;
	var i;
	ind = null;
	for (i = 0; i < document.layers.length; i++)
	{
		whichEl = document.layers[i];
		if (whichEl.id == el)
		{
			ind = i;
			break;
		}
	}
	return ind;
}

//platzieren der Elemente (nur NS)
function arrange()
{
	var nexty;
	var whichel;
	var i;
	nextY = document.layers[firstInd].pageY + document.layers[firstInd].document.height;
	for (i = firstInd + 1; i < document.layers.length; i++)
	{
		whichEl = document.layers[i];
		if (whichEl.visibility != "hide")
		{
			whichEl.pageY = nextY;
			nextY += whichEl.document.height;
		}
	}
}

//vorbereiten der Funktion expandIt
function expandClient (MenueName)
{
  //if (document.images)
  //{
  expandIt(MenueName);
  //}
}

//Aus-/Einklappen der entsprechenden Elemente
function expandIt(el)
{
	var whichEl;
	var whichIm;
	var whichElold;
	var whichImold;

		if(IE4)
		{
			whichEl = eval(el + "Child");
			whichIm = eval(el+ "Zelle");
			if (whichEl.style.display == "none")
			{
				if(el!=menold&&menold!="")
				{
				whichElold = eval(menold + "Child");
				whichImold = eval(menold+ "Zelle");
				whichElold.style.display = "none";
				//whichImold.background = "images/button01.jpg";
				}
				whichEl.style.display = "block";
				//whichIm.background = "images/button02.jpg";
			}
			else
			{
				whichEl.style.display = "none";
				//whichIm.background = "images/button01.jpg";
			}
		}

		if(NS4)
		{
			var whichEl = eval("document." + el + "Child");
			var whichIm = eval("document." + el + "Zelle");
			if (whichEl.visibility == "hide")
			{
				if(el!=menold&&menold!="")
				{
				whichElold = eval("document." + menold + "Child");
				whichImold = eval("document." + menold+ "Zelle");
				whichElold.visibility = "hide";
				}
				whichEl.visibility = "show";
			}
			else
			{
				whichEl.visibility = "hide";
			}
			arrange();
		}

		if(!ver4)
		{
			whichEl = el + "Child";
			whichIm = el+ "Zelle";
			if (document.getElementById(whichEl).style.display == "none")
			{
				if(el!=menold&&menold!="")
				{
				whichElold = menold + "Child";
				//whichImold = eval(menold+ "Zelle");
				document.getElementById(whichElold).style.display = "none";
				//whichImold.background = "images/button01.jpg";
				}
				document.getElementById(whichEl).style.display = "block";
				//whichIm.background = "images/button02.jpg";
			}
			else
			{
				document.getElementById(whichEl).style.display = "none";
				//whichIm.background = "images/button01.jpg";
			}
		}

		menold=el;
}

//veraendert Hintergrundbild bei Click auf Hauptmenue
function do_bg(el)
{
	var whichEl;
	var whichIm;
	if (!ver4) return;
	whichEl = eval(el + "Child");
	whichIm = eval(el+ "Zelle");
	if (whichEl.style.display == "none")
	{
		//whichIm.background = "images/button02.jpg";
	}
	else
	{
		//whichIm.background = "images/button01.jpg";
	}
}

//zeigt alle Elemente an (nur NS)
function showAll()
{
	var whichEl;
	var i;
	for (i = firstInd; i < document.layers.length; i++)
	{
		whichEl = document.layers[i];
		whichEl.visibility = "show";
	}
}

function hideAll()
{
	var whichEl;
	var i;
	for (i = firstInd; i < document.layers.length; i++)
	{
		//text=eval(document.layers[i].id.indexOf("Child") != -1+"test");
		//alert(text);
		if(document.layers[i].id.indexOf("Child") != -1){
		whichEl = document.layers[i];
		whichEl.visibility = "hide";
		}
	}
}

//blendet alle Client-Divider (Untermenues) standardmaessig aus
function initIt(viewMode)
{
	var whichEl;
	var divColl;
	var i;

	if (viewMode == 0)
	{
		if (NS4)
		{
			for (i = 0; i < document.layers.length; i++)
			{
				whichEl = document.layers[i];
				if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";
			}
			arrange();
		}

		if(IE4)
		{
			divColl = document.all.tags("DIV");
			for (i = 0; i < divColl.length; i++)
			{
				whichEl = divColl(i);
				if (whichEl.className == "child") whichEl.style.display = "none";
			}
		}

		if(!ver4)
		{
			divColl = document.getElementsByTagName("DIV");
			for (i = 0; i < divColl.length; i++)
			{
				if (divColl.item(i).className == "child") divColl.item(i).style.display = "none";
			}
		}
	}
}


//initialisiert die Seite mit 0, alle Clients sind hide
function initPage ()
{
 // if (document.images)
  //{
    initIt(0);
  //}
}

//ein-/ausblenden der Suche-Funktion
function do_submenu(div)
{
	if(IE4)
	{
		if(div!="")
		{
			if(smenold!="")
				parent.frames[0][smenold].style.top=(-(parseInt(parent.frames[0][smenold].style.top)));
			parent.frames[0][div].style.top=(-(parseInt(parent.frames[0][div].style.top)));
		}
		if(div==""&&smenold!="")
		{
			parent.frames[0][smenold].style.top=(-(parseInt(parent.frames[0][smenold].style.top)));
			smenold="";
		}
	}
	if(NS4)
	{
		if(div!="")
		{
			if(smenold!=""&&div!="")
				parent.frames[0].document.layers[smenold].top=(-(parseInt(parent.frames[0].document.layers[smenold].top)));
			parent.frames[0].document.layers[div].top=(-(parseInt(parent.frames[0].document.layers[div].top)));
		}
		if(div==""&&smenold!="")
		{
			parent.frames[0].document.layers[smenold].top=(-(parseInt(parent.frames[0].document.layers[smenold].top)));
			smenold="";
		}
	}
	 if(!ver4)
	{
	  if(div!="")
	  {
	   if(smenold!="")
	   {    parent.frames[0].document.getElementById(smenold).style.top=(-(parseInt(parent.frames[0].document.getElementById(smenold).style.top)));
	   }
	   parent.frames[0].document.getElementById(div).style.top=(-(parseInt(parent.frames[0].document.getElementById(div).style.top)));
 	 }
	 if(div==""&&smenold!="")
	  {   parent.frames[0].document.getElementById(smenold).style.top=(-(parseInt(parent.frames[0].document.getElementById(smenold).style.top)));
	      smenold="";
	  }
	}
 
	smenold=div;
}


