var Timer;
var name;
var menu;

function Menue(name)
{

if (document.layers)
    {
	for(var i=0; i<=1; i++)
	{
	menuname="M" + i;	
	document.layers[menuname].visibility="hidden";
	}			
	document.layers[name].visibility="visible";
	clearTimeout(Timer);
	}

else
	{			
	for(var i=0; i<=1; i++)
	{
	menuname="M" + i;	
	document.getElementById(menuname).style.visibility="hidden";
	}
	
	{
	document.getElementById(name).style.visibility="visible";
	clearTimeout(Timer);	
	}
	
	}
}

function aus(menu)
{
if(document.layers)	
	{
	document.layers[menu].visibility="hidden";
	linkname=menu+1;
	}	
else
	{
	document.getElementById(menu).style.visibility="hidden";
	}
}

function MenueAus(name)
{	
	menu=name;		
	Timer = setTimeout("aus(menu);",1);
}

function MenueAusLang(name)
{	
	menu=name;		
	Timer = setTimeout("aus(menu);",500);
}










var Delay=0;
var MouseOver=true;
var MouseDown=false;
var Browser=GetBrowser();
function GetBrowser()
{
	var BrowserName=navigator.appName;
	var BrowserVersion=navigator.appVersion;
	var BrowserVersion=parseInt(BrowserVersion.substr(0,1));
	// wichtig: der ie 5.0, 5.5 und 6.0 meldet sich vorne immer mit 4.0 ... compatible
	// daher ist die versionsabfrage beim ie genauer noetig
	if(BrowserName=='Microsoft Internet Explorer')
	{
		if(BrowserVersion==4)
		{
			BrowserVersion=navigator.appVersion;
			BrowserVersion=parseInt(BrowserVersion.substr(22,1));
		}		
	}

	if(BrowserName=='Netscape')
	{
		if(BrowserVersion==3)
			return 'NS3';
		else if(BrowserVersion==4)
			return 'NS4';
		else if(BrowserVersion==5) // netscape 6 ist netscape 5 bzw. mozilla 0.9x hat version 5.0
			return 'NS6'; 
		else
			return 'NS6';
	}
	else if(BrowserName=='Microsoft Internet Explorer')
	{
		if(BrowserVersion==3)
			return 'IE3';
		else if(BrowserVersion==4)
			return 'IE4';
		else if(BrowserVersion==5)
			return 'IE5';
		else if(BrowserVersion==6)
			return 'IE6';
		else
			return 'KeineAhnung';
	}
	else
		return 'IE5';
}
// abgleich mit der styledatei notwendig
var BGIColor="8fb3c7";
var BGAColor="#8fb3c7";
var CIColor="#e3f0ea";
var CAColor="#2e5571";
// background aktiv farbe setzen
// fuer netscape braucht man 2 ids!
function BGA(ID1,ID2)
{
	ChangeBackgroundColor(ID1,ID2,BGAColor);
}
// background inaktiv farbe setzen
// fuer netscape braucht man 2 ids!
function BGI(ID1,ID2)
{
	ChangeBackgroundColor(ID1,ID2,BGIColor);
}
// color (textcolor) aktiv farbe setzen
function CA(ID)
{
	ChangeTextColor(ID,CAColor);
}
// color (textcolor) inaktiv farbe setzen
function CI(ID)
{
	ChangeTextColor(ID,CIColor);
}
function HREF(URL)
{
	window.location.href=URL;
}
// setzen einer beliebigen farbe fuer den hintergrund von irgendwas
// unterscheidung der anweisung nach unterschiedlichen browsern
function ChangeBackgroundColor(ID1,ID2,BackgroundColor)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			// es gibt layer, die nicht in layer geschachtelt wurden, dann gibt es auch nur ID1
			// ID2 ist parent-layer
			if(ID2)
				document.layers[ID2].document.layers[ID1].bgColor=BackgroundColor;
			else
				document.layers[ID1].bgColor=BackgroundColor;
		break;
		case 'IE4':
			document.all[ID1].style.background=BackgroundColor;
		break;
		case 'IE5':
			document.getElementById(ID1).style.background=BackgroundColor;
		break;
		case 'IE6':
			document.getElementById(ID1).style.background=BackgroundColor;
		break;
		case 'NS6':
			document.getElementById(ID1).style.background=BackgroundColor;
		break;
		default:
			document.getElementById(ID1).style.background=BackgroundColor;
		break;				
	}
}
// setzen einer beliebigen farbe fuer den text von irgendwas
// unterscheidung der anweisung nach unterschiedlichen browsern
function ChangeTextColor(ID,TextColor)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		break;
		case 'IE4':
			document.all[ID].style.color=TextColor;
		break;
		case 'IE5':
			document.getElementById(ID).style.color=TextColor;
		break;
		case 'IE6':
			document.getElementById(ID).style.color=TextColor;
		break;
		case 'NS6':
			document.getElementById(ID).style.color=TextColor;
		break;
		default:
			document.getElementById(ID).style.color=TextColor;
		break;				
	}
}
function OpenNewWindow(WindowName,WebSiteLocation,WidthX,WidthY)
{
	ScreenWidth=screen.width;
	ScreenHeight=screen.height;
	PosX=(ScreenWidth/2)-(WidthX/2+5);
	PosY=(ScreenHeight/2)-(WidthY/2+10);
	WindowHandle=window.open(WebSiteLocation,WindowName,"width="+WidthX+",height="+WidthY+",status=no,scrollbars=no,resizeable=yes");
	WindowHandle.focus();
	window.WindowHandle.moveTo(PosX,PosY);
}
function OpenNewWindowToolbar(WindowName,WebSiteLocation,WidthX,WidthY)
{
	ScreenWidth=screen.width;
	ScreenHeight=screen.height;
	PosX=(ScreenWidth/2)-(WidthX/2+5);
	PosY=(ScreenHeight/2)-(WidthY/2+10);
	WindowHandle=window.open(WebSiteLocation,WindowName,"width="+WidthX+",height="+WidthY+",status=no,scrollbars=yes,resizeable=yes,dependent=no,locationbar=no,menubar=no,toolbar=yes");
	WindowHandle.focus();
	window.WindowHandle.moveTo(PosX,PosY);
}
function SwapImage(DivName,BildName,NewImage)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[DivName].document.images[BildName].src=NewImage;
		break;
		case 'IE4':
			document.images[BildName].src=NewImage;
		break;
		case 'IE5':
			document.images[BildName].src=NewImage;
		break;
		case 'IE6':
			document.images[BildName].src=NewImage;
		break;
		case 'NS6':
			document.images[BildName].src=NewImage;
		break;
		default:
			document.images[BildName].src=NewImage;
		break;				
	}
}
function HideDiv(DivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[DivName].visibility="hide";
		break;
		case 'IE4':
			// problem im ie4, der ist schon "out of div", wenn er ueber einem anderen div innerhalb des divs ist
			// klingt seltsam
			// loesung, ermittlung, ob die maus ausserhalb des divs ist
			// idee von www.jasc.com, danke
			leftDiv=document.all[DivName].offsetLeft +2;
			rightDiv=document.all[DivName].offsetLeft + document.all[DivName].clientWidth -2;
			topDiv=document.all[DivName].offsetTop +2;
			bottomDiv=document.all[DivName].offsetTop + document.all[DivName].clientHeight -2;
			if(window.event.clientY > bottomDiv || window.event.clientY < topDiv || window.event.clientX < leftDiv || window.event.clientX > rightDiv)
			{
				document.all[DivName].style.visibility="hidden";
			}
		break;
		case 'IE5':
			document.getElementById(DivName).style.visibility="hidden";
		break;
		case 'IE6':
			document.getElementById(DivName).style.visibility="hidden";
		break;
		case 'NS6':
			document.getElementById(DivName).style.visibility="hidden";
		break;
		default:
			document.getElementById(DivName).style.visibility="hidden";
		break;				
	}
}
function ShowDiv(DivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[DivName].visibility="show";
		break;
		case 'IE4':
			document.all[DivName].style.visibility="visible";
		break;
		case 'IE5':
			document.getElementById(DivName).style.visibility="visible";
		break;
		case 'IE6':
			document.getElementById(DivName).style.visibility="visible";
		break;
		case 'NS6':
			document.getElementById(DivName).style.visibility="visible";
		break;
		default:
			document.getElementById(DivName).style.visibility="visible";
		break;				
	}
}
function SetLeftPosition(LayerName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[LayerName].left=Position;
		break;
		case 'IE4':
			document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'IE5':
			document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'IE6':
			document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'NS6':
			document.getElementById(LayerName).style.left=Position+"px";  
		break;
		default:
			document.all[LayerName].style.pixelLeft=Position;
		break;				
	}
}
function SetTopPosition(LayerName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[LayerName].top=Position;
		break;
		case 'IE4':
			document.all[LayerName].style.pixelTop=Position;
		break;
		case 'IE5':
			document.all[LayerName].style.pixelTop=Position;
		break;
		case 'IE6':
			document.all[LayerName].style.pixelTop=Position;
		break;
		case 'NS6':
			document.getElementById(LayerName).style.top=Position+"px";  
		break;
		default:
			document.all[LayerName].style.pixelTop=Position;
		break;				
	}
}
function GetLeftPosition(LayerName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			return document.layers[LayerName].left;
		break;
		case 'IE4':
			return document.all[LayerName].style.pixelLeft;
		break;
		case 'IE5':
			return document.all[LayerName].style.pixelLeft;
		break;
		case 'IE6':
			return document.all[LayerName].style.pixelLeft;
		break;
		case 'NS6':
			return document.getElementById(LayerName).style.left; // sendet '???px' zurueck
		break;
		default:
			return document.all[LayerName].style.pixelLeft;
		break;				
	}
}
function GetTopPosition(LayerName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			return document.layers[LayerName].top;
		break;
		case 'IE4':
			return document.all[LayerName].style.pixelTop;
		break;
		case 'IE5':
			return document.all[LayerName].style.pixelTop;
		break;
		case 'IE6':
			return document.all[LayerName].style.pixelTop;
		break;
		case 'NS6':
			return document.getElementById(LayerName).style.top; // sendet '???px' zurueck
		break;
		default:
			return document.all[LayerName].style.pixelTop;
		break;				
	}
}
function GetWidth(LayerName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			return document.layers[LayerName].document.width;
		break;
		case 'IE4':
			return document.all[LayerName].offsetWidth;
		break;
		case 'IE5':
			return document.all[LayerName].offsetWidth;
		break;
		case 'IE6':
			return document.getElementById(LayerName).offsetWidth;
		break;
		case 'NS6':
			return document.getElementById(LayerName).offsetWidth; // sendet '???px' zurueck
		break;
		default:
			return document.all[LayerName].offsetWidth;
		break;				
	}
}
function GetHeight(LayerName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			return document.layers[LayerName].document.height;
		break;
		case 'IE4':
			return document.all[LayerName].offsetHeight;
		break;
		case 'IE5':
			return document.all[LayerName].offsetHeight;
		break;
		case 'IE6':
			return document.getElementById(LayerName).offsetHeight;
		break;
		case 'NS6':
			return document.getElementById(LayerName).offsetHeight; // sendet '???px' zurueck
		break;
		default:
			return document.all[LayerName].offsetHeight;
		break;				
	}
}
function ScrollLayer(LayerName,Direction,StartTop,EndTop) //StartTop=Beginn der Layer, EndTop=Wie weit muss hochgescrollt werden? EndTop meist negativ
{	
	ScrollMax=EndTop-GetHeight(LayerName)-50;
	if(Direction=="Down" && MouseOver && parseInt(GetTopPosition(LayerName))<=StartTop)	 // parseInt, weil NS6 immer '???px' sendet
	{
		if(MouseDown)
		{
			NeuePosition=parseInt(GetTopPosition(LayerName))+20;  // parseInt, weil NS6 immer '???px' sendet
			SetTopPosition(LayerName,NeuePosition);
			setTimeout('ScrollLayer("'+LayerName+'","'+Direction+'","'+StartTop+'","'+EndTop+'")',Delay)
		}
		else
		{	
			NeuePosition=parseInt(GetTopPosition(LayerName))+3;	 // parseInt, weil NS6 immer '???px' sendet
			SetTopPosition(LayerName,NeuePosition);
			setTimeout('ScrollLayer("'+LayerName+'","'+Direction+'","'+StartTop+'","'+EndTop+'")',Delay)
		}
	}
	else if(Direction=="Up" && MouseOver && parseInt(GetTopPosition(LayerName))>=ScrollMax)	 // parseInt, weil NS6 immer '???px' sendet
	{
		if(MouseDown)
		{
			NeuePosition=parseInt(GetTopPosition(LayerName))-20;	 // parseInt, weil NS6 immer '???px' sendet
			SetTopPosition(LayerName,NeuePosition);
			setTimeout('ScrollLayer("'+LayerName+'","'+Direction+'","'+StartTop+'","'+EndTop+'")',Delay);
		}
		else
		{	
			NeuePosition=parseInt(GetTopPosition(LayerName))-3;	 // parseInt, weil NS6 immer '???px' sendet
			SetTopPosition(LayerName,NeuePosition);
			setTimeout('ScrollLayer("'+LayerName+'","'+Direction+'","'+StartTop+'","'+EndTop+'")',Delay);
		}
	}
}
function MoveLayerVertical(LayerName,TopPosition,Count)
{
	XStart=parseInt(GetTopPosition(LayerName));	// parseInt, weil NS6 immer '???px' sendet
	if(XStart==TopPosition)
	{
	}
	else
	{
		if(XStart<TopPosition)
		{
			setTimeout('MoveLayerVertical("'+LayerName+'",'+TopPosition+','+Count+')',Delay);
			SetTopPosition(LayerName,parseInt(GetTopPosition(LayerName))+Count);
		}
		else
		{
			setTimeout('MoveLayerVertical("'+LayerName+'",'+TopPosition+','+Count+')',Delay);
			SetTopPosition(LayerName,parseInt(GetTopPosition(LayerName))-Count);
		}
	}
}
function MoveLayerHorizontalLeftNow(LayerName,LeftPosition)
{
	clearTimeout(TimeOut);
	XStart=parseInt(GetLeftPosition(LayerName)); // parseInt, weil NS6 immer '???px' sendet
	if(XStart<=LeftPosition)
	{
	}
	else
	{
		TimeOut=setTimeout('MoveLayerHorizontalLeftNow("'+LayerName+'","'+LeftPosition+'")',0);
		SetLeftPosition(LayerName,parseInt(GetLeftPosition(LayerName))-10);
	}
}
function MoveLayerHorizontalLeft(LayerName,LeftPosition)
{
	clearTimeout(TimeOut);
	TimeOut=setTimeout('MoveLayerHorizontalLeftNow("'+LayerName+'","'+LeftPosition+'")',250);
}
function MoveLayerHorizontalRightNow(LayerName,LeftPosition)
{
	clearTimeout(TimeOut);
	XStart=parseInt(GetLeftPosition(LayerName)); // parseInt, weil NS6 immer '???px' sendet
	if(XStart>=LeftPosition)
	{
	}
	else
	{
		TimeOut=setTimeout('MoveLayerHorizontalRightNow("'+LayerName+'","'+LeftPosition+'")',0);
		SetLeftPosition(LayerName,parseInt(GetLeftPosition(LayerName))+10);
	}
}
function MoveLayerHorizontalRight(LayerName,LeftPosition)
{
	clearTimeout(TimeOut);
	TimeOut=setTimeout('MoveLayerHorizontalRightNow("'+LayerName+'","'+LeftPosition+'")',250);
}
function MoveLayerHorizontalUpNow(LayerName,TopPosition)
{
	clearTimeout(TimeOut);
	XStart=parseInt(GetTopPosition(LayerName)); // parseInt, weil NS6 immer '???px' sendet
	if(XStart<=TopPosition)
	{
	}
	else
	{
		TimeOut=setTimeout('MoveLayerHorizontalUpNow("'+LayerName+'","'+TopPosition+'")',0);
		SetTopPosition(LayerName,parseInt(GetTopPosition(LayerName))-10); // parseInt, weil NS6 immer '???px' sendet
	}
}
function MoveLayerHorizontalUp(LayerName,TopPosition)
{
	clearTimeout(TimeOut);
	TimeOut=setTimeout('MoveLayerHorizontalUpNow("'+LayerName+'","'+TopPosition+'")',250);
}
function MoveLayerHorizontalDownNow(LayerName,TopPosition)
{
	clearTimeout(TimeOut);
	XStart=parseInt(GetTopPosition(LayerName)); // parseInt, weil NS6 immer '???px' sendet
	if(XStart>=TopPosition)
	{
	}
	else
	{
		TimeOut=setTimeout('MoveLayerHorizontalDownNow("'+LayerName+'","'+TopPosition+'")',0);
		SetTopPosition(LayerName,parseInt(GetTopPosition(LayerName))+10); // parseInt, weil NS6 immer '???px' sendet
	}
}
function MoveLayerHorizontalDown(LayerName,TopPosition)
{
	clearTimeout(TimeOut);
	TimeOut=setTimeout('MoveLayerHorizontalDownNow("'+LayerName+'","'+TopPosition+'")',250);
}


