var m_open = null; // offenes Menü
var donotchange = false;


  // Bildwechsel, action=1 zeigt rollover-Bild, action=0 setzt es zurück
  // Voraussetzung ist das Speichern der Bilder mit der Konvention "_d" an den Dateinamen anzuhängen für ein Rollover-Bild
  function chgImg(bild, action) {
  	var fname = document.getElementById(bild).src;
  	var pos = fname.lastIndexOf("_a.");
  	if (action == 1) {
  		if (pos < 0) {
  			pos = fname.lastIndexOf(".");
  			fname = fname.substring(0, pos) + "_a" + fname.substring(pos, fname.length);
  			donotchange = false;
  		}
  		else { donotchange = true; }
  	}
	else if (action == 0) {
  		if ((pos >= 0) && (donotchange == false)) {
  			fname = fname.substring(0, pos) + fname.substring(pos + 2, fname.length);
  		}
  	}
  	document.getElementById(bild).src = fname;
  }

// Das spezifizierte Menü wird bei action=1 ausgeklappt
function menu(menue, action) {
	var pos = document.getElementById(menue); 
	if (action == 1) {
		if (pos != m_open) { // wenn das zu öffnende Menü noch nicht offen ist
			if (m_open != null) {
				var hide = m_open.id; // das vorher geöffnete muss in jedem Fall geschlossen werden
			}
			m_open = pos;
			window.setTimeout("setVisible(\""+menue+"\",\""+hide+"\")", 200); // mit Verzögerung wird das Menü eingeblendet
		}
	}
	else if (action == 0) { // Menü schließen
	if (pos == m_open) { // wenn noch offen
		m_open = null; // kein Menü mehr geöffnet
		window.setTimeout("setHidden(\""+menue+"\")", 200); // mit Verzögerung verstecken
	}
	}
}

function setVisible(menue, hide) {
	var pos = document.getElementById(menue);
	if ((pos == m_open) && (menue != hide)) { // wenn das spezifizierte Menü überhaupt noch geöffnet werden soll und es nicht gleich dem zu schließenden ist
		document.getElementById(menue).style.visibility = "visible";
	}
}

function setHidden(menue) {
	var pos = document.getElementById(menue);
	if (pos != m_open) { // wenn Menü nicht mehr geöffnet sein soll
		document.getElementById(menue).style.visibility = "hidden";
	}
}

function stay(menue) { // Schließen des Menüs abfangen
	var pos = document.getElementById(menue);
	if (pos != m_open) { 
		m_open = pos;
	}
}

// Menüpunkt beim Überfahren hervorheben
function chgState(punkt, nr, action) {
	var parent = document.getElementById(punkt);
	var a = new Array(parent.childNodes.length); // Workaround für Mozilla, weil Zeilenumbrüche eigene Knoten sind
	var z = 0;
	for (var i = 0; i < parent.childNodes.length; i++) {
		if (parent.childNodes[i].nodeType == 1) { 
			a[z] = parent.childNodes[i]; // die benötigten Elemente werden in zweites Array geschrieben
			z++;
		}
	}
	if (action == 1) { // Menüpunkt wird farblich hervorgehoben
		a[nr].style.backgroundColor = "#4B4B8F";
		//a[nr].firstChild.style.color = "#FFFFFF";
		//a[nr].style.border = "1px solid #BDBDDC";
	}
	if (action == 0) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#181882";
		//a[nr].firstChild.style.color = "#24639C";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 3) { // Menüpunkt wird farblich hervorgehoben
		a[nr].style.backgroundColor = "#128335";
		//a[nr].firstChild.style.color = "#FFFFFF";
		//a[nr].style.border = "1px solid #BDBDDC";
	}
	if (action == 4) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#53a56c";
		//a[nr].firstChild.style.color = "#24639C";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 5) { // Menüpunkt wird farblich hervorgehoben FARBEN FÜR CHROC MENÜ
		a[nr].style.backgroundColor = "#02491d";
		//a[nr].firstChild.style.color = "#FFFFFF";
		//a[nr].style.border = "1px solid #BDBDDC";
	}
	if (action == 6) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#53a56c";
		//a[nr].firstChild.style.color = "#24639C";
		//a[nr].style.border = "1px solid #181882";
	}
}

// Menüpunkt beim Überfahren hervorheben
function chgState2(punkt, nr, action) {
	var parent = document.getElementById(punkt);
	var a = new Array(parent.childNodes.length); // Workaround für Mozilla, weil Zeilenumbrüche eigene Knoten sind
	var z = 0;
	for (var i = 0; i < parent.childNodes.length; i++) {
		if (parent.childNodes[i].nodeType == 1) { 
			a[z] = parent.childNodes[i]; // die benötigten Elemente werden in zweites Array geschrieben
			z++;
		}
	}
	if (action == 1) { // Menüpunkt wird farblich hervorgehoben
		a[nr].style.backgroundColor = "#CDCDCD";
		//a[nr].firstChild.style.color = "#FFFFFF";
		//a[nr].style.border = "1px solid #BDBDDC";
	}
	if (action == 0) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#ECECEC";
		//a[nr].firstChild.style.color = "#181882";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 3) { // Menüpunkt wird farblich hervorgehoben
		a[nr].style.backgroundColor = "#CDCDCD";
		//a[nr].firstChild.style.color = "#181882";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 4) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#ffffff";
		//a[nr].firstChild.style.color = "#181882";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 3) { // Menüpunkt wird farblich hervorgehoben FARBEN FÜR CHROC MENÜ
		a[nr].style.backgroundColor = "#CDCDCD";
		//a[nr].firstChild.style.color = "#181882";
		//a[nr].style.border = "1px solid #181882";
	}
	if (action == 4) { // Menüpunkt wird zurückgesetzt
		a[nr].style.backgroundColor = "#ffffff";
		//a[nr].firstChild.style.color = "#181882";
		//a[nr].style.border = "1px solid #181882";
	}
}



function sizeBottomStripe ()
{
	
	        var rbb_s = document.getElementById("rb-bottom")
		var ct_oh = parseInt(document.getElementById("center-text").offsetHeight);
		//alert(ct_oh.toString());
		
		if (rbb_s){
			var rbb_t = parseInt(rbb_s.offsetTop);
			//alert(rbb_t.toString());
			var h = ct_oh - rbb_t - 1;
			//alert(h.toString());
			rbb_s.style.height = h.toString() + "px";
		}

}

function checkBR()
{
	if (document.all) { document.write("<br>"); }
}

function open_win(fn)

{

fenster=window.open(fn,"hw_hilfe","scrollbars=1,toolbar=0,location=0,directories=0,status=0,resizable=1,width=670,height=500");

}

function open_win_tiny(fn)

{

fenster=window.open(fn,"hw_hilfe","scrollbars=1,toolbar=0,location=0,directories=0,status=0,resizable=1,width=400,height=320");

}

function rollOver (obj, bgcolor, fgcolor) {
		obj.style.backgroundColor = bgcolor;
		obj.firstChild.style.color = fgcolor;
}

function setPaddingZero() {
	if (document.all) {
		//alert(document.getElementById("center-text").toString());
		document.getElementById("center-text").style.paddingRight = "0px";
	}
}
//Mail Addressen Verschlüsselung
function MailCrypt(An, Dn, Cl) {
     		 var LinkText = An + "@" + Dn;
			 document.open();
 		 document.write("<a class=\"" + Cl + "\" href=\"mailto:" + LinkText + "\">" + LinkText + "</a>");
     		 document.close();
     	   }
		   
function LangSelect() {
   if(document.search.language_select.selectedIndex > -1)
   {
      window.location.href = document.search.language_select.options[document.search.language_select.selectedIndex].value;
   }
  
}



function RotatePic(x) { 
      // name des bildes was getauscht werden soll im html-code (img-tag-name) 
      var BildTDTagID = "rdmpic";   
      // ordner, wo die bilder gespeichert wurden 
      var BildOrdner = "images/startup/";     
      // dateiname der bilder ohne nummer 
      var BildName = "startup";             
      // Bildformat (.jpg, .gif, .png, etc.) 
      var BildFormat = ".jpg";         
      //Anzahl der Bilder im Bildordner 
      var AnzahlBilder = x;         
      // Zahlenwert, mit der die bildernummerierung beginnt 
      var StartCounter = 1;         
      // random zahl ermitteln 
      RandBild = Math.round(Math.random()*AnzahlBilder); 
      if( AnzahlBilder == RandBild ) RandBild = 0; 
      rb = BildOrdner + BildName + (RandBild + StartCounter) + BildFormat; 

		if (document.images)
		{
       document.images[BildTDTagID].src=rb; 
	   window.setTimeout("RotatePic(10)", 10000);
		}
}

function printPageView() {
if (document.URL.indexOf("?print") >= 0) {
	var body = document.getElementsByTagName("body")[0];
	var container = document.createElement("div");
	container.style.textAlign = "left";
	container.style.width = "550px";
	container.style.margin = "20px";
	/*container.appendChild(document.getElementById("headline").firstChild.cloneNode(true));*/
	var curNode = document.getElementById("center-text").firstChild;
	while (curNode != null) {
		container.appendChild(curNode.cloneNode(true));
  	curNode = curNode.nextSibling;
	}
	document.getElementById("inner").style.display = "none";
	body.appendChild(container);
	window.setTimeout("window.print()", 2000);
}
}