var MouseX=0;
var MouseY=0;
var Browser=GetBrowser();
var ImgArray=new Array();
function AddImgArray(Img00,Img01) 
{
    this.Img00=new Image();
    this.Img00.src=Img00;
    this.Img01=new Image();
    this.Img01.src=Img01;
}
function MOver(ImgName)
{
    document[ImgName].src=ImgArray[ImgName].Img01.src; 
}
function MOut(ImgName)
{
    document[ImgName].src=ImgArray[ImgName].Img00.src; 
}
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 'IE6';
	}
	else
	{
		return 'IE6';
	}
}
function HREF(URL)
{
	window.location.href=URL;
}
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 OpenNewWindowScrolling(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+",toolbar=1,scrollbars=yes");
	WindowHandle.focus();
	window.WindowHandle.moveTo(PosX,PosY);
}
function SwapImage(BildName,NewImage,DivName)
{
	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,ParentDivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			// schachtelung beachten
			if(ParentDivName)
				document.layers[ParentDivName].document.layers[DivName].visibility="hide";
			else
				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";
			// fix, weil es immer grau bleibt
			//SetTopPosition(DivName,-1000);
		break;
		case 'NS6':
			document.getElementById(DivName).style.visibility="hidden";
		break;
		default:
			document.getElementById(DivName).style.visibility="hidden";
		break;				
	}
}
function ShowDiv(DivName,ParentDivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			// schachtelung beachten
			if(ParentDivName)
				document.layers[ParentDivName].document.layers[DivName].visibility="show";
			else
				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 HideIframe(DivName,ParentDivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		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 ShowIframe(DivName,ParentDivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		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 GetMousePosition(e) 
{
	switch(Browser)
	{
		case 'IE5':
			MouseX=event.x;
			MouseY=event.y;
		break;
		case 'IE6':
			MouseX=event.x;
			MouseY=event.y;
		break;
		case 'NS6':
			MouseX=e.clientX;
			MouseY=e.clientY;
		break;
		default:
			MouseX=event.x;
			MouseY=event.y;
		break;				
	}
}
function GetScrollPosition()
{
	switch(Browser)
	{
		case 'IE5':
			return document.body.scrollTop;
		break;
		case 'IE6':
			return document.documentElement.scrollTop;
		break;
		case 'NS6':
			return window.pageYOffset;
		break;
		default:
			return window.pageYOffset;
		break;				
	}
}
function EventMouseMove()
{
	switch(Browser)
	{
		case 'IE5':
			document.onmousemove=GetMousePosition;
		break;
		case 'IE6':
			document.onmousemove=GetMousePosition;
		break;
		case 'NS6':
			document.onmousemove=GetMousePosition;
		break;
		default:
			document.onmousemove=GetMousePosition;
		break;				
	}
}
function ChangeClassName(ID,NewClassName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		break;
		case 'IE4':
			document.all[ID].className=NewClassName;
		break;
		case 'IE5':
			document.getElementById(ID).className=NewClassName;
		break;
		case 'IE6':
			document.getElementById(ID).className=NewClassName;
		break;
		case 'NS6':
			document.getElementById(ID).className=NewClassName;
		break;
		default:
		break;				
	}
}
function AddOption(FormName,OptionName,NewOptionValue,NewOptionText)
{
	NewOption=new Option();
	NewOption.value=NewOptionValue;
	NewOption.text=NewOptionText;
	document.forms[FormName].elements[OptionName].options[document.forms[FormName].elements[OptionName].length]=NewOption;
}
function RemoveOption(FormName,OptionName,OptionID)
{
	document.forms[FormName].elements[OptionName].options[OptionID]=null;
}
function SelectMove(FormName,OptionNameSource,OptionNameDest)
{
	while(document.forms[FormName].elements[OptionNameSource].selectedIndex > -1)
	{
		var OptionID=document.forms[FormName].elements[OptionNameSource].selectedIndex;
		var Value=document.forms[FormName].elements[OptionNameSource].options[OptionID].value;
		var Text=document.forms[FormName].elements[OptionNameSource].options[OptionID].text;
		AddOption(FormName,OptionNameDest,Value,Text);
		RemoveOption(FormName,OptionNameSource,OptionID);
	}
}
function SelectAll(FormName,OptionName)
{
	for(var i=0;i<document.forms[FormName].elements[OptionName].length;i++)
	{
		document.forms[FormName].elements[OptionName].options[i].selected=true;
	}
}

