/*******************************************************************\
* ©2002 stefan wagner | e-werk.net
* all rights reserved.
* this code was originaly done for Software AG (http://www.softwareag.com).
*
* you may use this code on a public web site only if this entire
* copyright notice appears unchanged and you publicly display
* on the Web page a link to http://www.e-werk.net
* contact: info@e-werk.net | http://e-werk.net
\*******************************************************************/
var agt=navigator.userAgent.toLowerCase();
var ns4 = (document.layers)? true:false
var ie4 = (document.all) ? (!document.getElementById) ? true :false : false;
var iens6 = (document.getElementById) ? true : false;
var mac = (agt.indexOf("mac") != -1) ? true : false;
var mac_ie = (mac && (navigator.appName.indexOf("Netscape"))) ? true : false;
var mac_ns = (mac && (navigator.appName.indexOf("Microsoft"))) ? true : false;
var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
var is_opera6 = (agt.indexOf("opera 6") != -1 || agt.indexOf("opera/6") != -1);
var is_opera7 = (agt.indexOf("opera 7") != -1 || agt.indexOf("opera/7") != -1);
var opera = is_opera5 ? true : is_opera6 ? true : is_opera7 ? true : false;
var DOM = iens6 && !opera && !mac ? true : false;	//16.11.02 - Da dynamische Positionierungen für MAC Probleme bereiten,
													//wurde die Bedingung "!mac" mit in die Variable DOM aufgenommen.
													//Damit werden dynamische Inhalte (zB. Teaser-Zone) nicht auf einem MAC dargestellt.
var linux = (agt.indexOf("inux")!=-1) ? true : false;
/*
if((iens6||ie4||mac_ns)&&(!linux)) document.write("<link rel='stylesheet' type='text/css' href='screen_iens6.css'>");
if(linux) document.write("<link rel='stylesheet' type='text/css' href='screen_linux.css'>");
if(ns4||mac_ie) document.write("<link rel='stylesheet' type='text/css' href='screen_ns4.css'>");
*/

var hideItem = "";
var popTimer;
var colDIV = new Array();

function show(id, submenu, evt) {
	window.clearTimeout(popTimer);
	if (ns4) {
		var cDIV = document.layers;
		for(i=0;i<cDIV.length;i++) {
			if(cDIV[i].id.indexOf("SUBDIV")!=-1) {
				cDIV[i].visibility = "hide";
			}
		}
		document.layers[id].visibility = "show";
		
		if((id==colDIV[0].id)||(id==colDIV[1].id)||(id==colDIV[2].id)) {
			document.layers['divSearchForm'].visibility="hide";
		}
		else {
			document.layers['divSearchForm'].visibility="show";
		}
	}
	if (ie4) {
		var cDIV = SubContainer.children;
		for(i=0;i<cDIV.length;i++) {
			cDIV[i].style.visibility = "hidden";
		}
		document.all[id].style.visibility = "visible"
	}
	else if (iens6) {
		if(opera)
		{
			if((id==colDIV[0].id)||(id==colDIV[1].id)||(id==colDIV[2].id)) {
				var cSearchFrm = document.forms['txtSearch'];
				cSearchFrm[0].style.visibility = "hidden";
			}
		}
		
		else if(opera)	{
			if((id!=colDIV[0].id)||(id!=colDIV[1].id)||(id!=colDIV[2].id)) {
				var cSearchFrm = document.forms['txtSearch'];
				cSearchFrm[0].style.visibility = "visible";
			}
		}
		if(submenu)	{
			if(evt)	{
				evt.removeEventListener();
			}
			return;
		}
		if(!submenu) {
			var containerDIV = document.getElementById("SubContainer");
			var cDIV = containerDIV.getElementsByTagName("DIV");
			for(i=0;i<cDIV.length;i++) {
				cDIV[i].style.visibility = "hidden";
			}
			document.getElementById(id).style.visibility = "visible";
		}
	}
}

function hide() {
	if (ns4) {
		document.layers[hideItem].visibility = "hide";
		document.layers['divSearchForm'].visibility = "show";
	}
	if (ie4) {
		document.all[hideItem].style.visibility = "hidden";//Auch hier ein Workaround für den OPERA ;-)
	}
	else if (iens6)	{
		if(opera) {
			var cSearchFrm = document.forms['txtSearch'];
			cSearchFrm[0].style.visibility = "visible";
		}
		document.getElementById(hideItem).style.visibility = "hidden";
	}
}

function fnOut(id) {
	window.clearTimeout(popTimer);
	hideItem = id;
	popTimer = window.setTimeout("hide()",500);
}

function initSubPop() {
	if (ns4) {
		var cDIV = document.layers;
		var j=0;
		for(i=0;i<cDIV.length;i++) {
			if(cDIV[i].id.indexOf("SUBDIV")!=-1) {
				cDIV[i].visibility = "hide";
				colDIV[j] = cDIV[i];
				j += 1;
			}
		}
		document.layers['divSearchForm'].visibility = "show"; //Toller Netscape Workaround ;-)
		if(document.layers['headContent']) {
			document.layers['headContent'].visibility = "show";
		}
		document.layers['ctrlDIV'].visibility = "show";
	}
	if (ie4) {
		var cDIV = SubContainer.children;
		for(i=0;i<cDIV.length;i++) {
			cDIV[i].style.visibility = "hidden";
			cDIV[i].style.width="10";
		}
	}
	if(opera) {
		var containerDIV = document.getElementById("SubContainer");
		var cDIV = containerDIV.getElementsByTagName("DIV");
		var j=0;
		for(i=0;i<cDIV.length;i++) {
			colDIV[j] = cDIV[i];
			j += 1;
		}
	}
	else if (iens6) {
		var containerDIV = document.getElementById("SubContainer");
		var cDIV = containerDIV.getElementsByTagName("DIV");
		for(i=0;i<cDIV.length;i++) {
			cDIV[i].style.visibility = "hidden";
		}
	}
}

/******************************************************************\
* Mini-Page Scroller
\******************************************************************/
var speed=5;
var moveUpvar;
var moveDownvar;

function divScroller(objContainer, objContent) {
	// private member data
	this.Container	= document.getElementById(objContainer);
	this.Content	= document.getElementById(objContent);
	this.contH		= this.Content.offsetHeight;
	this.containH	= this.Container.offsetHeight;
	// methods
	this.scrollUp	= divScroller_scrollUp;
	this.scrollDown	= divScroller_scrollDown;
	this.stopScroll	= divScroller_stopScroll;
	this.goTop		= divScroller_goTop;
	this.goEnd		= divScroller_goEnd;
}

function divScroller_scrollUp() {
	this.stopScroll;
	if(parseInt(this.Content.style.top)<=-3) {
		this.Content.style.top=parseInt(this.Content.style.top)+speed;
	}
}

function divScroller_scrollDown() {
	this.stopScroll;
	if(parseInt(this.Content.style.top)>=(this.contH*(-1)+this.containH)) {
		this.Content.style.top=parseInt(this.Content.style.top)-speed;
	}	
}

function divScroller_goTop() {
	this.stopScroll;
	this.Content.style.top=0;
}

function divScroller_goEnd() {
	this.stopScroll;
	this.Content.style.top=(this.contH*(-1)+this.containH);
}

function divScroller_stopScroll() {
	if (window.moveUpvar) clearTimeout(moveUpvar)
	if (window.moveDownvar) clearInterval(moveDownvar)
}

function scroll_down(what) {
	moveDownvar = window.setInterval(what+".scrollDown()", 100);
}

function scroll_up(what) {
	moveUpvar = window.setInterval(what+".scrollUp()", 100);
}

/**************************************************************************\
* Methoden zur Steuerung der Selects
\**************************************************************************/
function fnShowSelect(id, showhide) {
	if(ns4||opera) {
		return;
	}
	if(ie4)	{
		var oDIV = document.all[id];
		oDIV.style.display = showhide;
	}
	if((iens6))	{
		var oDIV = document.getElementById(id);
		oDIV.style.display = showhide;
	}
}

/*************************************************************************\
* Content Finders
* Synopsis:		Steuert das Ein- und Ausblenden des Content Finders
*				als Cross-Browser-Lösung
* Parameter:	keine
* Returns:		keine
\*************************************************************************/
var shHde=1;
function showCntFinder() {
	if(ns4) {
		var oDiv = document.layers['cntFindWrap'];
		var cDiv = document.layers['ctrlDIV'];
		oDiv.visibility = (shHde==1) ? "show" : "hide";
		cDiv.visibility = (shHde==1) ? "hide" : "show";
	}
	if(iens6) {
		var oDiv = document.getElementById("cntFindWrap");
		var cDiv = document.getElementById("ctrlDIV");
		oDiv.style.visibility = (shHde==1) ? "visible" : "hidden";
		cDiv.style.visibility = (shHde==1) ? "hidden" : "visible";
	}
	if(ie4) {
		cntFindWrap.style.visibility	= (shHde==1) ? "visible" : "hidden";
		ctrlDIV.style.visibility		= (shHde==1) ? "hidden" : "visible";
	}
	shHde = (shHde==1) ? 0 : 1;
}

/*************************************************************************\
* +++ FAQ Content +++
* Synopsis:		Steuert das Ein- und Ausblenden der Answers
*				für DOM-fähige Browser.
* Parameter:	keine
* Returns:		keine
\*************************************************************************/
function formatFAQ() {	
	if(document.getElementById("ansMainContainer")) {
		var colTab = document.getElementById("ansMainContainer").getElementsByTagName("TABLE");
		var questCO = document.getElementById("faqQuestContainer");
		var colA = questCO.getElementsByTagName("A");

		for(i=0;i<colTab.length;i++) {
			colTab[i].style.position = "absolute";
			colTab[i].style.top="366";
			colTab[i].style.display="none";
		}
		document.getElementById("ansTab1").style.display="inline";
		document.getElementById("ansContent1").style.visibility = "hidden";
		document.getElementById("scrollCtrl").style.display = "none";
	
		for(i=0;i<colA.length;i++) {
			colA[i].style.fontWeight = "normal";
			colA[i].style.textDecoration = "none";
		}
	}
	else {
		return;
	}
}

function showFAQ(num) {
	if(DOM) {
		// Object Definition
		var colTab = document.getElementById("ansMainContainer").getElementsByTagName("TABLE");
		var aTab = document.getElementById("ansTab"+num);
		var questCO = document.getElementById("faqQuestContainer");
		var colA = questCO.getElementsByTagName("A");
		var aLI = document.getElementById("li"+num);

		// Methoden
		for(i=0;i<colTab.length;i++) {
			colTab[i].style.display="none";
		}
		aTab.style.display="inline";
		if(num=="1") document.getElementById("ansContent1").style.visibility = "visible";
		for(i=0;i<colA.length;i++) {
			colA[i].style.fontWeight = "normal";
			colA[i].style.textDecoration = "none";
			colA[i].parentNode.style.fontWeight = "normal";
		}
		aLI.style.fontWeight = "bold";
		aLI.style.textDecoration = "underline";
		aLI.parentNode.style.fontWeight = "bold";
		
		// Scroller-Objekt Properties
		ansScroller = null;
		ansScroller = new divScroller("ansContainer"+num, "ansContent"+num);
		ansScroller.Content.style.top=0;
		faqAnsCnt = document.getElementById("ansContent"+num);
		faqAnsCont = document.getElementById("ansContainer"+num);
		ansScroller.contH = faqAnsCnt.offsetHeight;
		ansScroller.containH = faqAnsCont.offsetHeight;
		document.getElementById("scrollCtrl").style.display = (ansScroller.contH <= ansScroller.containH) ? "none" : "inline";
	}
	else {
		location.href="#answ"+num;
	}
}

/*************************************************************************\
* Allgemeine Methoden
\*************************************************************************/
function fnLoad() {
	initSubPop();
	if(DOM) {
		formatFAQ();
	}
}

function fnResize() {
	if(ns4)	{
		location.reload();
	}
	else {
		return;
	}
}

function openSitemap(sitemapURL) {
	var siteWindow = window.open(sitemapURL, "siteWindow", "status=0,height=409,width=509,resizable=0,scrollbars=1,toolbar=0");
	siteWindow.focus();
}




/*************************************************************************\
* Exklusive Methoden zur Steuerung innerhalb der Sitemap
\*************************************************************************/
function fnGoto(url) {
	window.opener.location.href = url;
}

function SiteMaphide(fireObj) {
	var tObj = (document.all) ? fireObj.parentNode.nextSibling.lastChild : fireObj.parentNode.nextSibling.nextSibling.lastChild.previousSibling;
	tObj.style.display = ((tObj.style.display=="none")||(tObj.style.display=="")) ? "block" : "none";
	fireObj.src = ((tObj.style.display=="none")||(tObj.style.display=="")) ? "/images/plus.gif" : "/images/minus.gif";
}
