
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 if(BrowserVersion==7)
			return 'IE7';
		else
			return 'IE7';
	}
	else
	{
		return 'IE7';
	}
}
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=yes,menubar=yes,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 'NS6':
			document.images[BildName].src=NewImage;
		break;
		case 'IE5':
			document.images[BildName].src=NewImage;
		break;
		case 'IE6':
			document.images[BildName].src=NewImage;
		break;
		case 'IE7':
			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 'NS6':
			document.getElementById(DivName).style.visibility="hidden";
		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 'IE7':
			document.getElementById(DivName).style.visibility="hidden";
			// fix, weil es immer grau bleibt
			SetTopPosition(DivName,-1000);
		break;
		default:
			document.getElementById(DivName).style.visibility="hidden";
		break;				
	}
}
function HideTopDiv(DivName)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
		break;
		case 'NS6':
			top.document.getElementById(DivName).style.visibility="hidden";
		break;
		case 'IE4':
		break;
		case 'IE5':
			top.document.getElementById(DivName).style.visibility="hidden";
		break;
		case 'IE6':
			top.document.getElementById(DivName).style.visibility="hidden";
			// fix, weil es immer grau bleibt
			SetTopPosition(DivName,-1000);
		break;
		case 'IE7':
			top.document.getElementById(DivName).style.visibility="hidden";
			// fix, weil es immer grau bleibt
			SetTopTopPosition(DivName,-1000);
		break;
		default:
			top.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 'NS6':
			document.getElementById(DivName).style.visibility="visible";
		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 'IE7':
			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 'NS6':
			document.getElementById(DivName).style.visibility="hidden";
		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 'IE7':
			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 'NS6':
			document.getElementById(DivName).style.visibility="visible";
		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 'IE7':
			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 'NS6':
			document.getElementById(LayerName).style.left=Position+"px";  
		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 'IE7':
			document.getElementById(LayerName).style.left=Position+"px";
		break;
		default:
			document.getElementById(LayerName).style.left=Position+"px";
		break;				
	}
}
function SetTopLeftPosition(LayerName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			top.document.layers[LayerName].left=Position;
		break;
		case 'NS6':
			top.document.getElementById(LayerName).style.left=Position+"px";  
		break;
		case 'IE4':
			top.document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'IE5':
			top.document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'IE6':
			top.document.all[LayerName].style.pixelLeft=Position;
		break;
		case 'IE7':
			top.document.getElementById(LayerName).style.left=Position+"px";
		break;
		default:
			top.document.getElementById(LayerName).style.left=Position+"px";
		break;				
	}
}



function SetTopPosition(LayerName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			document.layers[LayerName].top=Position;
		break;
		case 'NS6':
			document.getElementById(LayerName).style.top=Position+"px";  
		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 'IE7':
			document.getElementById(LayerName).style.top=Position+"px";
		break;
		default:
			document.getElementById(LayerName).style.top=Position+"px";
		break;				
	}
}
function SetTopTopPosition(LayerName,Position)
{
	switch(Browser)
	{
		case 'NS3':
		break;
		case 'IE3':
		break;
		case 'NS4':
			top.document.layers[LayerName].top=Position;
		break;
		case 'NS6':
			top.document.getElementById(LayerName).style.top=Position+"px";  
		break;
		case 'IE4':
			top.document.all[LayerName].style.pixelTop=Position;
		break;
		case 'IE5':
			top.document.all[LayerName].style.pixelTop=Position;
		break;
		case 'IE6':
			top.document.all[LayerName].style.pixelTop=Position;
		break;
		case 'IE7':
			top.document.getElementById(LayerName).style.top=Position+"px";
		break;
		default:
			top.document.getElementById(LayerName).style.top=Position+"px";
		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;
            //MouseX = event.pageX || event.clientX + document.body.scrollLeft;
            //MouseY = event.pageY || event.clientY + document.body.scrollTop;
		break;
		default:
            MouseX = event.clientX;
            MouseY = event.clientY;
		break;				
	}
}



function GetScrollPosition()
{
	switch(Browser)
	{
		case 'IE5':
			return document.body.scrollTop;
		break;
		case 'IE6':
			return document.documentElement.scrollTop;
		break;
		case 'IE7':
			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 'NS6':
			document.getElementById(ID).className=NewClassName;
		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 'IE7':
			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;
	}
}

function ChangeAHref(aID,url)
{
	document.getElementById(aID).href=url;
}
function ChangeLinkText(aID,linkText)
{
	document.getElementById(aID).innerHTML="+++ "+linkText+" +++";
}
function StartChangeLinkText(aID,linkText)
{
	var subString="";
	for(i=0;i<linkText.length;i++)
	{
		//subString+=linkText[i];
		subString=linkText.slice(0,i);
		setTimeout('ChangeLinkText("'+aID+'","'+subString+'")',25*i);
	}
}
function StartTenderTicker(linkText,URL)
{
	StartChangeLinkText('atenderticker',linkText);
	ChangeAHref('atenderticker',URL);
}
function InitTenderTicker()
{
	//divtenderticker
	//atenderticker
	for(i=0;i<TenderTickerURLArray.length;i++)
	{
		setTimeout('StartTenderTicker("'+TenderTickerLinkTextArray[i]+'","'+TenderTickerURLArray[i]+'")',ChangingTime*i);
	}
}
function AddBookmark() 
{
	var PageURL = document.URL;
	var PageTitle = document.title;
	if (window.sidebar) 
	{
		window.sidebar.addPanel(PageTitle,PageURL,"");
	} 
	else if(document.all) 
	{
		window.external.AddFavorite(PageURL,PageTitle);
	} 
	else 
	{
		return true;
	}
}

function GetWindowWith() 
{
  if (window.innerWidth) 
  {
    return window.innerWidth;
  } 
  else if (document.body && document.body.offsetWidth) 
  {
    return document.body.offsetWidth;
  } 
  else 
  {
    return 1000;
  }
}
function GetWindowHeight () 
{
  if (window.innerHeight) 
  {
    return window.innerHeight;
  } 
  else if (document.body && document.body.offsetHeight) 
  {
    return document.body.offsetHeight;
  } 
  else 
  {
    return 700;
  }
}
function NewBuild() 
{
	if(WindowWith != GetWindowWith() || WindowHeight != GetWindowHeight())
	{
		location.href = location.href;
	}
}
if(!window.WindowWith && document.body && document.body.offsetWidth) 
{
	window.onresize = NewBuild;
	WindowWith = GetWindowWith();
	WindowHeight = GetWindowHeight();
}

