

function popup(ziel, w, h, windowname) {
	/* 1. Position des Browserfensters relativ zum Ursprung (0, 0) finden
	 * 2. Höhe der Frames oberhalb von "content" finden
	 * 3. Popup über "content" positionieren
	 * Unsinn, da die Höhe der Browser-Leisten nicht herauszufinden ist
	 */
	// --- 1 ---
	/*
	var iWidth  = (document.layers) ? window.innerWidth  : document.body.clientWidth;
	var iHeight = (document.layers) ? window.innerHeight : document.body.clientHeight;
	alert("iWidth = " + iWidth + ", iWidth = " + iWidth);
	*/

	if (w < 30) w = 30;
	if (h < 40) h = 40;
	var pos_x = Math.round((screen.width  - w) / 2);
	var pos_y = Math.round((screen.height - h) / 2);
	popup_win = window.open(ziel, windowname, "top="+pos_y+",left="+pos_x+",width="+w+",height="+h+",resizable=no,status=no");
	popup_win.focus();
}

function jsMouseOver(zaehler) {
	jsSetBGCol(MM_findObj('i-jsml-td1-' + zaehler), MM_findObj('i-jsml-a1-' + zaehler), '#FFFFFF');
	jsSetBGCol(MM_findObj('i-jsml-td2-' + zaehler ), MM_findObj('i-jsml-a2-' + zaehler), '#FFFFFF');
}

function jsMouseOut(zaehler) {
	jsUnsetBGCol(MM_findObj('i-jsml-td1-' + zaehler), MM_findObj('i-jsml-a1-' + zaehler), '#FFB103');
	jsUnsetBGCol(MM_findObj('i-jsml-td2-' + zaehler ), MM_findObj('i-jsml-a2-' + zaehler), '#000000');
}

function jsSetBGCol(obj1, obj2, textColor) {
	var bgColor = "#FFCF39";

	if (obj1) {
    	if (obj1.style) obj1 = obj1.style;
    	obj1.backgroundColor = bgColor;
    }

    if (obj2) {
	    if (obj2.style) obj2 = obj2.style;
	    	obj2.color = textColor;
    }
}

function jsUnsetBGCol(obj1, obj2, textColor) {
	var bgColor = "#FFF7D6";

	if (obj1) {
    	if (obj1.style) obj1 = obj1.style;
    	obj1.backgroundColor = bgColor;
	}

	if (obj2) {
    	if (obj2.style) obj2 = obj2.style;
    	obj2.color = textColor;
    }
}

/* Gruppen Zahlen:
	10 = Walther Flender
	11 = Deussen
	12 = Maschinenlager

	Alle Menues die mit diesen Zahlen Anfangen gehören zur Gruppe
*/
function getGruppenFarbe(zaehler, prefix, ebene){
	var gruppen_farben = new Array();
	gruppen_farben["mouseOver"] = "#FFCF39";
	gruppen_farben["mouseOut"]  = "#FFF7D6";
	var pref = new String(prefix);
	var gruppen_erstezahl = pref.substr(5, 1); //5 = länge 'menue'

	if (gruppen_erstezahl == '1'){
		var gruppen_zahlen = (ebene == 1)? gruppen_erstezahl + zaehler : pref.substr(5, 2);
		//alert(gruppen_zahl);

		switch(gruppen_zahlen) {

			case '10':
				gruppen_farben["mouseOver"] = "#3273B9";
				gruppen_farben["mouseOut"] = (ebene == 1)? "#FFF7D6" : "#CEDEEE";
				break;

			case '11':
				gruppen_farben["mouseOver"] = "#87C653";
				gruppen_farben["mouseOut"] = (ebene == 1)? "#FFF7D6" : "#E2F1D6";
				break;

			case '12':
				gruppen_farben["mouseOver"] = "#83BABA";
				gruppen_farben["mouseOut"] = (ebene == 1)? "#FFF7D6" : "#F0F6F6";
				break;

			default: ;
		}

	}
	return gruppen_farben;
}

function setAlleGruppenBgcolor(){
	for (i = 0; i < alle_layer.length; i++) {
		if (alle_layer[i] == '§§ENDE§§') break;

		var work = new String(alle_layer[i]);
		var gruppen_zahlen = work.substr(5, 2); //5 = länge 'menue'
		var prefix_zahlen = work.substr(5); // Zahlen die nach 'menue' stehen abschneiden

		switch(gruppen_zahlen) {

			case '10':
				jsSetBGCol(MM_findObj("jsmlmenue" + prefix_zahlen), "#CEDEEE");
				setAlleMenuItemsBgcolor(alle_layer[i], "#CEDEEE");
				break;

			case '11':
				jsSetBGCol(MM_findObj("jsmlmenue" + prefix_zahlen), "#E2F1D6");
				setAlleMenuItemsBgcolor(alle_layer[i], "#E2F1D6");
				break;

			case '12':
				jsSetBGCol(MM_findObj("jsmlmenue" + prefix_zahlen), "#F0F6F6");
				setAlleMenuItemsBgcolor(alle_layer[i], "#F0F6F6");
				break;

			default: ;
		}
	}
}
