/********** script by zorah mari bauer, 26 08 08 ***************/

/************** globale variablen ***************/
var lastMenueID = "";
var lastContentID = "";
var bottomArea = "farbflaecheunten";
var bottomAreaColor = "#FFFFFF";
var menueItemColor = "#000000";


/* funktion zum initialisieren des menues auf der jeweiligen seite */
function initMenue(ueberschrift, menuepunkt) {
  if (ueberschrift!="" && menuepunkt!="") {
    document.getElementById(ueberschrift).style.color = "#ff0000";
    document.getElementById(menuepunkt).style.color = "#ff0000";
  }
}

/************** funktion zum oeffnen externer fenster ***************/

function oeffnen(adresse, breite, hoehe, scroll)  {
  fenster = window.open(adresse, "fenster", "width="+breite+",height="+hoehe+",dependent=no,directories=yes,resizable=yes,menubar=yes,status=yes,toolbar=yes,scrollbars="+scroll+",location=yes")
  fenster.resizeTo(breite,hoehe);
  fenster.focus();
}

function oeffnen2(adresse, breite, hoehe, scroll)  {
  fenster2 = window.open(adresse, "fenster2", "width="+breite+",height="+hoehe+",dependent=no,directories=no,resizable=yes,menubar=no,status=no,toolbar=no,scrollbars="+scroll+",location=no")
  fenster2.resizeTo(breite,hoehe);
  fenster2.focus();
}

/************** menue steuerung ***************/

function menueRollover(menueID, contentID, textColor) {
  if (lastMenueID != menueID) {
	  resetMenue();
	  highlightMenue(menueID, textColor);
	  zeigeEbene(contentID);
	  lastMenueID = menueID;
    lastContentID = contentID;
  }
}

function highlightMenue(id, textColor) {
	document.getElementById(id).style.color = textColor;
	document.getElementById(bottomArea).style.backgroundColor = textColor;
}

function resetMenue() {
  if (lastMenueID != "") {
	  document.getElementById(lastMenueID).style.color = menueItemColor;
	}
	if (lastContentID != "") {
	  verbergeEbene(lastContentID);
	}
}

function reInitialize() {
  if (lastMenueID != "") {
	  document.getElementById(lastMenueID).style.color = menueItemColor;
	}
	if (lastContentID != "") {
	  verbergeEbene(lastContentID);
	}
	document.getElementById(bottomArea).style.backgroundColor = bottomAreaColor;  
  lastMenueID = "";
  lastContentID = "";  
}

function invertMenueColors(id) {	
  menueStyle = getCurrentStyle(id);
  var textColor = menueStyle.color;
  var backgroundColor = menueStyle.backgroundColor;
  document.getElementById(id).style.backgroundColor = textColor;
  document.getElementById(id).style.color = backgroundColor;
}

function zeigeEbene(ebene) {
  document.getElementById(ebene).style.visibility = "visible";
}

function verbergeEbene(ebene) {
  document.getElementById(ebene).style.visibility = "hidden";
}

function toggleEbene(ebene) {
  if (document.getElementById(ebene).style.visibility == "visible") {
    document.getElementById(ebene).style.visibility = "hidden";
  }
  else {
    document.getElementById(ebene).style.visibility = "visible";
  }
}

function getCurrentStyle(ID) {
  if (document.getElementById) {
    if (document.getElementById(ID).currentStyle) {
      return document.getElementById(ID).currentStyle;
    } else if (document.defaultView) {
      if (document.defaultView.getComputedStyle) {
       return document.defaultView.getComputedStyle(document.getElementById(ID), "");
      }
    }
  }
  return document.getElementById(ID).style
}

