function Farbe (id) {
	if (id=='AA' || id=='BB' || id=='CC' || id=='DD' || id=='EE' || id=='FF' || id=='GG' || id=='HH') {
		return id;
	}
	else if (id.slice(0,3)=='MEN') 
		return "MEN";
	else if (id.slice(0,2)=='RR') 
		return "RR";
	else {
		return "";
	}
}

	var akt     = "";
function EIN(id) {
	if (id!=akt && document.getElementById(id)) {
		var P = document.getElementById(id);
		P.className = "EIN" + Farbe(id);
	}
}
function AUS(id) {
	if (id!=akt && document.getElementById(id)) {
		var P = document.getElementById(id);
		if (id.slice(0,3)=='MEN')
			P.className = "AUSMEN";
		else if (id.slice(0,2)=='RR') 
			P.className = "AUSRR";
		else P.className = "AUS";
	}
}
function CLI(id,x,y) {
	if (document.getElementById(id)) {
		var P = document.getElementById(id);
		var ai = akt;
		akt = id;
		AUS(ai);
		P.className = "CLI" + Farbe(id);
		if (y=="" || y=="_parent") { 
			parent.location.href = x;
		}
		else if (y=="_blank" || y=="_top") { 
			window.open(x,y);
		}
		else if (y=="java") { 
			var s = eval(x);
		}
		else if (y=="haupt") { 
			z = x.split("?");
			s = "?x=" + z[0];
			if (z.length > 1) s = s + "&" + z[1];
			parent.frames["innen"].location.href = "altseite.asp" + s;
		}
		else { 
			parent.frames[y].location.href = x;
		}
		if (CLI.arguments.length==5) {
			var z = CLI.arguments[3];
			var t = CLI.arguments[4];
			parent.frames[CLI.arguments[4]].location.href = z;
		}
	}
}


	var verlauf = new Array(0)		// speichert die IDs der Menüs!

function getMenueVerlauf(x) {
	var n = verlauf.length;
	if (n==0) return true;	
	if (verlauf[n-1]==x) return false;
	return true;
}
function addMenueVerlauf(id,url,tgt,txt) {
	var x = 0;
	var n = verlauf.length;
	if (n>0) x = verlauf[n-1][0];
	if (x!=id) {
		var a = new Array(id,url,tgt,txt);
		var z = verlauf.push(a);
		updMenueVerlauf();
	}
	
}
function updMenueVerlauf() {			// aktualisiert den Verlauf
	if (!parent.frames.titel.document.getElementById('verlauf')) return;
	var p = parent.frames.titel.document.getElementById('verlauf');
	var v = "";
	for (var i=0; i<verlauf.length; i++) {
		v = v + "<a class=verlauf href='" + verlauf[i][1] + "' target='" + verlauf[i][2] + "'> &raquo; " + verlauf[i][3] + "</a>"
	}
	p.innerHTML = v;	
}

var aktiv;					// Quick Menü Steuerung
var unter;
function zeige(id,x) {
	if (x==0) return;
	clearTimeout(aktiv);
	if (unter && unter!=id) verstx(unter);
	BannerAUS();
	unter = id;
	if (document.getElementById(id)) {
		var men = document.getElementById(id);
		men.style.visibility = "visible";
	}
}
function verst(id,x) {
	if (x==0) return;
	aktiv = setTimeout("verstx('" + id + "')",1000);
}
function verstx(id) {
	BannerEIN();
	if (document.getElementById(id)) {
		var men = document.getElementById(id);
		men.style.visibility = "hidden";
	}
}

function rotein(id) {
	if (document.getElementById(id)) {
		var but = document.getElementById(id);
		but.className = "OhneRot";
	}
}
function rotaus(id) {
	if (document.getElementById(id)) {
		var but = document.getElementById(id);
		but.className = "Ohne";
	}
}

function jumpto(men,inn) {
	if (parent.menue) {
		parent.menue.location.href = men;
	}
	if (parent.innen) {
		parent.innen.location.href = inn;
	}
}

function OpenPassTest() {
	fenster = window.open("/VVI-web/Adressbuch/Admin/Passwesen-DruckForm.asp","PassFenster","width=490,height=350,scrollbars=no,resizable=no");
	fenster.focus();
}
function OpenLizenzTest() {
	fenster = window.open("/VVI-web/Adressbuch/Admin/Trainer-DruckForm.asp","LizenzFenster","width=490,height=350,scrollbars=no,resizable=no");
	fenster.focus();
}
function OpenRadio(dat,art) {
	fenster = window.open("/VVI-web/HockeyRadio/Radio.asp?datei="+dat+"&var="+art,"RadioFenster","width=300,height=130,scrollbars=no,resizable=no");
	fenster.focus();
}

// Hilfe Bild ein/aus schalten
var HilfeBild = new Array(2);
	HilfeBild[0] = new Image();
	HilfeBild[0].src = "/VVI-web/Include/Hilfe_pas.gif";
	HilfeBild[1] = new Image();
	HilfeBild[1].src = "/VVI-web/Include/Hilfe_akt.gif";
function HilfeAnim(name,x) {
	if (document[name]) document[name].src=HilfeBild[x].src;
}

function OpenFenster(inhalt,breit,hoch) {
        var y = "width=" + breit + ",height=" + hoch + ",left=0,top=0,toolbar=no,directories=no,status=yes,scrollbars=yes,resizable=yes,menubar=no";
        var x = window.open(inhalt, "HilfeFenster", y);
        x.focus();
}

function SeitenTyp(url) {			// 0 = Titel, 1 = Menü, 2 = sonst, 3 = Mobil
	var x = url.split("/");
	var seite = x[x.length-1];
	if (seite.slice(0,6).toLowerCase() == "titel-") return 0;
	if (seite.slice(0,6).toLowerCase() == "menue-") return 1;
	if (seite.slice(0,6).toLowerCase() == "mobil-") return 3;
	return 2;
}
if ((SeitenTyp(location.pathname) != 3) && (top.frames.length == 0)) {			// Teile in Frame Rahmen laden
	var lokal = "lokal=";
	var param = "";
	var qarr = location.search.slice(1).split("&");
	for (var i = 0; i < qarr.length; i++) {
		if (qarr[i].slice(0,5).toLowerCase() == "lokal") {
			lokal = qarr[i];
		}
		else {
			param = param + "&" + qarr[i];
		}
	}
	var Link = "/VVI-web/default.asp?" + lokal;
	if (SeitenTyp(location.pathname) == 2) {	
		Link = Link + "&innen=" + location.pathname + param;
	}
	location.href = Link;
}
