var nn=document.layers?true:false;
var n6=document.getElementById?true:false;
var ie=document.all?true:false;
if ((ie) && (n6)) n6 = false;

var fJS = false;
var vn = navigator.appVersion.substring(0,1);
var lay_open = -1;


function checkLayout() {
	if ( document.getElementById("mitte").offsetHeight > document.getElementById("rechts").offsetHeight ) {
		var myPos = document.getElementById("mitte").offsetHeight + document.getElementById("mitte").offsetTop+10;
	}
	else {
		var myPos = document.getElementById("rechts").offsetHeight + document.getElementById("rechts").offsetTop+10;
	}
	document.getElementById("unten").style.top = myPos + 'px';
}







function init() {
	checkLayout();
	document.getElementById("unten").style.display = "block";
	/*if (vn >= 4) {
		for (i=0; i<l_anzahl; i++) {
			document.getElementById(lay[i]).style.display = "block";
			if (n6) {
				lay_id[i] = document.getElementById(lay[i]).style;
				hoehe[i] = 5 + document.getElementById(lay[i]).offsetHeight;
				breite[i] = 5 + document.getElementById(lay[i]).offsetWidth;
			}
			if (ie) {
				lay_id[i] = document.all(lay[i]).style;
				hoehe[i] = 5 + document.all(lay[i]).offsetHeight;
				breite[i] = 5 + document.all(lay[i]).offsetWidth;
			}
			if (nn) {
				lay_id[i] = document[lay[i]];
				hoehe[i] = 5 + lay_id[i].document.height;
				breite[i] = 5 + lay_id[i].document.width;
			}
			document.getElementById(lay[i]).style.display = "none";
		}
		if ((ie) || (n6)) {
			document.onmousemove=mouseMove;
		}
		if (nn) {
			window.captureEvents(Event.MOUSEMOVE);
			window.onMouseMove=mouseMove;
		}
		fJS = true;
	}*/
}

function mouseMove(Ereignis) {
	if (nn) {
		xwert = Ereignis.pageX;
		ywert = Ereignis.pageY;
		
		outPos = document.all(lay[lay_open]).offsetTop;
	}
	if (ie) {
		xwert = window.event.clientX;
		ywert = window.event.clientY;
		
		outPos = document.all(lay[lay_open]).offsetTop - document.body.scrollTop;
	}
	if (n6) {
		xwert = Ereignis.pageX;
		ywert = Ereignis.pageY;
		
		outPos = document.all(lay[lay_open]).offsetTop;
	}
	
	
	if ((lay_open >= 0) && (ywert < outPos-5)) Reset();
	if ((lay_open >= 0) && (xwert < parseInt(lay_id[lay_open].left)-175)) Reset();
	if ((lay_open >= 0) && (ywert > outPos+hoehe[lay_open]+20)) Reset();
	if ((lay_open >= 0) && (xwert > parseInt(lay_id[lay_open].left)+breite[lay_open]+5)) Reset();
}

function m_go(lay) {
	if ((fJS) && (lay != lay_open)) {
		for(i=0;i<l_anzahl;i++) {
			if (zustand[i] > 0) {
				lay_id[i].display = "none";
			}
		}
		lay_open = lay;
		zustand[lay] = 1;
//		alert(lay);
		lay_id[lay].display = "block";
	}
}

function Reset() {
	if((fJS) && (lay_open >= 0)) {
		for(i=0;i<l_anzahl;i++) {
			if (zustand[i] != 0) {
				lay_id[i].display = "none";
				zustand[i] = 0;
			}
		}
		lay_open = -1;
	}
}

function ieFake(fake) {
	if ((document.all) && (fake)) fake.blur();
}

var tmpTxt;

function statAnzeige(txt) {
	tmpTxt = txt;
	setTimeout("window.status = tmpTxt;",0);
	return true;
}

var wi = null;
function info(datei,x,y,scbar) {
	tmpScroll = "yes";
	if (scbar == 0) tmpScroll = "no";
	if (!x) var tmpX = 520;
	else var tmpX = x+20;
	if (!y) var tmpY = 350;
	else var tmpY = y+30;
	if (wi != null) if (!wi.closed) wi.close();
	wi = window.open(datei,'Infofenster','left=' + ((screen.availWidth/2)-tmpX/2) + ',top=' + ((screen.availHeight/2)-tmpY/2) + ',marginwidth=0 marginheight=0,leftmargin=0,topmargin=0,scrollbars=' + tmpScroll + ',status=no,width=' + tmpX + ',height=' + tmpY + ',resizable=no');
	if (wi.opener==null) wi.opener=self;
	//if (vn >= "4") wi.moveTo((screen.availWidth/2)-tmpX/2,(screen.availHeight/2)-tmpY/2);
	return;
}

var ew = null;
function zoomFenster(datei,x,y,alt,scbar,id,wo) {
	var tmpX = x+52;
	var tmpY = y+70;
	if (id > 0) tmpY = tmpY+20;
	var tmpSc = "no";
	if (tmpY > 600) {
		tmpY = 600;
		tmpSc = "yes";
		tmpX += 16;
	}
	if (scbar == 1) {
		tmpSc = "yes";
		tmpX += 16;
	}
	if (ew != null) if (!ew.closed) ew.close();
	ew = window.open('zoom.php?id=' + id + '&hoch=' + y + '&breit=' + x + '&bild=' + datei + '&titel=' + alt + '&woher=' + wo,'Bildvergroesserung','left=' + ((screen.availWidth/2)-tmpX/2) + ',top=' + ((screen.availHeight/2)-tmpY/2) + ',marginwidth=0 marginheight=0,leftmargin=0,topmargin=0,scrollbars=' + tmpSc + ',status=no,width=' + tmpX + ',height=' + tmpY + ',resizable=no');
	if (ew.opener==null) ew.opener=self;
	//if (vn >= "4") ew.moveTo((screen.availWidth/2)-tmpX/2,(screen.availHeight/2)-tmpY/2);
	return;
}

var ew = null;

function bildergalerie( bereichid, objektid ) {
	var tmpX = 900;
	var tmpY = 700;
	
	if (ew != null) if (!ew.closed) ew.close();
	ew = window.open('bilder_popup.php?bereich=' + bereichid + '&objekt=' + objektid,'Bildergalerie','left=' + ((screen.availWidth/2)-tmpX/2) + ',top=' + ((screen.availHeight/2)-tmpY/2) + ',marginwidth=0 marginheight=0,leftmargin=0,topmargin=0,scrollbars=yes,status=no,width=' + tmpX + ',height=' + tmpY + ',resizable=no');
	if (ew.opener==null) ew.opener=self;
	return false;
}

function feldGr(feld,inhalt,max) {
	who = feld;
	if (inhalt >= max) {
		alert('Achtung, maximale Feldgröße erreicht!');
		who.value = who.value.substr(0,max-1);
	}
}

function drucken() {
	if (window.print) self.print();
	if(document.all && navigator.appVersion.substring(22,23)==4) {
		self.focus();
	    var OLECMDID_PRINT = 6;
	    var OLECMDEXECOPT_DONTPROMPTUSER = 2;
	    var OLECMDEXECOPT_PROMPTUSER = 1;
	    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH="0" HEIGHT="0" CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
	    document.body.insertAdjacentHTML('beforeEnd',WebBrowser);
	    WebBrowser1.ExecWB(OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER);
	    WebBrowser1.outerHTML = '';
	}
}

function checkMail() {
	var checkMail = document.nletter.newsmail.value.indexOf("@");
	var checkMail1 = document.nletter.newsmail.value.lastIndexOf(".");
	var checkMail2 = document.nletter.newsmail.value.lastIndexOf(" ");
	var checkMailLaenge = document.nletter.newsmail.value.length;
	if ((checkMail2 != -1) || (checkMail1 == -1) || (checkMail < 1) || (checkMail == checkMailLaenge-1) || (checkMail == checkMail1-1) || (checkMail1 > checkMailLaenge-3) || (checkMailLaenge < 6) || (document.nletter.newsmail.value == "eMail eingeben") || (document.nletter.newsmail.value == "")) {
		alert("Eine gültige eMail-Anschrift sollten Sie schon eintragen,\nsonst macht die Anmeldung wenig Sinn!");
		return false;
	}
	return;
}

var nl = null;
function newsl() {
	var mail = document.nletter.newsmail.value;
	if (nl != null) if (!nl.closed) nl.close();
	nl = window.open('newsletter.php?email=' + mail,'Newsletter','left=' + ((screen.availWidth/2)-160) + ',top=' + ((screen.availHeight/2)-110) + ',marginwidth=0 marginheight=0,leftmargin=0,topmargin=0,scrollbars=no,status=no,width=320,height=220,resizable=no');
	if (nl.opener==null) nl.opener=self;
	return;
}
