var Browser=GetBrowser();
var MouseX=0;
var MouseY=0;
if(document.layers)
{
	document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove=GetMousePosition
function GetMousePosition(e) 
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			MouseX=e.pageX;
			MouseY=e.pageY;
		break;
		case 'IE4':
			MouseX=event.x+document.body.scrollLeft;
			MouseY=event.y+document.body.scrollTop;
		break;
		case 'IE5':
			MouseX=event.x+document.body.scrollLeft;
			MouseY=event.y+document.body.scrollTop;
		break;
		case 'IE6':
			MouseX=event.x+document.body.scrollLeft;
			MouseY=event.y+document.body.scrollTop;
		break;
		case 'NS6':
			MouseX=e.pageX;
			MouseY=e.pageY;
		break;
		default:
		break;				
	}
}
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';
}
// 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:
		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:
		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=yes,resizeable=no");
	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:
		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:
		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:
		break;				
	}
}
function ShowDivPositioned(DivName,Top,Left)
{
	SetTopPosition(DivName,Top);
	SetLeftPosition(DivName,Left);
	ShowDiv(DivName);
}
function SetLeftPosition(DivName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[DivName].left=Position;
		break;
		case 'IE4':
			document.all[DivName].style.pixelLeft=Position;
		break;
		case 'IE5':
			document.all[DivName].style.pixelLeft=Position;
		break;
		case 'IE6':
			document.all[DivName].style.pixelLeft=Position;
		break;
		case 'NS6':
			document.getElementById(DivName).style.left=Position+"px";  
		break;
		default:
		break;				
	}
}
function SetTopPosition(DivName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[DivName].top=Position;
		break;
		case 'IE4':
			document.all[DivName].style.pixelTop=Position;
		break;
		case 'IE5':
			document.all[DivName].style.pixelTop=Position;
		break;
		case 'IE6':
			document.all[DivName].style.pixelTop=Position;
		break;
		case 'NS6':
			document.getElementById(DivName).style.top=Position+"px";  
		break;
		default:
		break;				
	}
}
// content innerhalb eines tags aendern
// unterscheidung der anweisung nach unterschiedlichen browsern
function ChangeTagContent(ID1,Content)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		break;
		case 'IE4':
			document.all[ID1].innerText=Content;
		break;
		case 'IE5':
			document.getElementById(ID1).innerText=Content;
		break;
		case 'IE6':
			document.getElementById(ID1).innerText=Content;
		break;
		case 'NS6':
			document.getElementById(ID1).firstChild.nodeValue=Content;
		break;
		default:
		break;				
	}
}

// help layer stuff
var TimerOut=0;
// nach einer weile geht der helpdiv wieder weg
function StartTimerHideHelpDiv(DivName)
{
	TimerOut=setTimeout('HideDiv("'+DivName+'")',10000);
}
function OnSelectBoxChange(FormName,SelectBoxName)
{
	clearTimeout(TimerOut);
	StartTimerHideHelpDiv('helpdiv');
	ShowDivPositioned('helpdiv',MouseY,165);
	ChangeTagContent('helptd',SelectedValueHelpArray[document.forms[FormName].elements[SelectBoxName].selectedIndex]);
}
function OnCheckBoxChange(FormName,CheckBoxName,Content)
{
	clearTimeout(TimerOut);
	StartTimerHideHelpDiv('helpdiv');
	ShowDivPositioned('helpdiv',MouseY,165);
	ChangeTagContent('helptd',Content);
}

