var nn=document.layers?true:false;
var n6=document.getElementById?true:false;
var ie=document.all?true:false;
if ((ie) && (n6)) n6 = false;

var sichtbar = "visible";
var unsichtbar = "hidden";

var myRegexMail = /^[\w-]+(?:\.[\w-]+)*@(?:[\w-]+\.)+[a-zA-Z]{2,7}$/;
var myRegexURL = /^(ht|f)tp(s?)\:\/\/[a-zA-Z0-9\-\._]+(\.[a-zA-Z0-9\-\._]+){2,}(\/?)([a-zA-Z0-9\-\.\=\?\,\'\/\\\+&%\$#_]*)?$/;

var fJS = false;
var vn = navigator.appVersion.substring(0,1);
var lay_open = -1;
var l_anzahl = 1;

hoehe = new Array(l_anzahl);
breite = new Array(l_anzahl);
lay_id = new Array(l_anzahl);
lay = new Array(l_anzahl);
lay[0] = "members";
zustand = new Array(l_anzahl);

function init() {
	if (vn >= 4) {
		for (i=0; i<l_anzahl; i++) {
			if (n6) {
				lay_id[i] = document.getElementById(lay[i]).style;
				hoehe[i] = document.getElementById(lay[i]).offsetHeight;
				breite[i] = document.getElementById(lay[i]).offsetWidth;
			}
			if (ie) {
				lay_id[i] = document.all(lay[i]).style;
				hoehe[i] = document.all(lay[i]).offsetHeight;
				breite[i] = document.all(lay[i]).offsetWidth;
			}
			if (nn) {
				lay_id[i] = document[lay[i]];
				//alert(lay_id[i] + "/" + lay[i]);
				hoehe[i] = lay_id[i].document.height;
				breite[i] = lay_id[i].document.width;
			}
		}
		if ((ie) || (n6)) {
			document.onmousemove=mouseMove;
		}
		if (nn) {
			sichtbar = "show";
			unsichtbar = "hide";
			window.captureEvents(Event.MOUSEMOVE);
			window.onMouseMove=mouseMove;
		}
		fJS = true;
	}
}

function mouseMove(Ereignis) {
	if (nn) {
		xwert = Ereignis.pageX;
		ywert = Ereignis.pageY;
		var outPos = 45;
	}
	if (ie) {
		xwert = window.event.clientX;
		ywert = window.event.clientY;
		var outPos = 45 - document.body.scrollTop;
	}
	if (n6) {
		//alert("OK");
		xwert = Ereignis.pageX;
		ywert = Ereignis.pageY;
		var outPos = 45;
	}
	//window.status = document.body.scrollTop + "/" + xwert + "/" + ywert;
	if ((lay_open >= 0) && (ywert < outPos)) Reset();
	if ((lay_id[lay_open]) && (lay_open >= 0) && (xwert < parseInt(lay_id[lay_open].left)-0)) Reset();
	if ((lay_open >= 0) && (ywert > outPos+hoehe[lay_open]+30)) Reset();
	if ((lay_id[lay_open]) && (lay_open >= 0) && (xwert > parseInt(lay_id[lay_open].left)+breite[lay_open]+0)) Reset();
}

function m_go(id) {
	if ((fJS) && (id != lay_open)) {
		for(i=0;i<l_anzahl;i++) {
			if (zustand[i] > 0) {
				//alert(zustand[i] + "/" + i);
				if (lay_id[i]) lay_id[i].visibility = unsichtbar;
			}
		}
		lay_open = id;
		zustand[id] = 1;
		//alert(lay[0]);
		if (lay_id[id]) lay_id[id].visibility = sichtbar;
	}
}

function Reset() {
	if((fJS) && (lay_open >= 0)) {
		for(i=0;i<l_anzahl;i++) {
			if (zustand[i] != 0) {
				if (lay_id[i]) lay_id[i].visibility = unsichtbar;
				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;
}

function inhaltCheck(field,txt,url) {
	iCheck = true;

	for(i=0;i<field.value.length;i++) {
		if (field.value.substr(i,1) != ' ') {
			iCheck = false;
			i = field.value.length;
		}
	}
	if (iCheck) {
		alert(txt);
		//return false;
	}
	else document.location.href = url;
}

function loginCheck(inout,seite) {
	iCheck = true;

	for(i=0;i<document.eingabe.benutzername.value.length;i++) {
		if (document.eingabe.benutzername.value.substr(i,1) != ' ') {
			iCheck = false;
			i = document.eingabe.benutzername.value.length;
		}
	}
	for(i=0;i<document.eingabe.passwort.value.length;i++) {
		if (document.eingabe.passwort.value.substr(i,1) != ' ') {
			iCheck = false;
			i = document.eingabe.passwort.value.length;
		}
	}
	if ((document.eingabe.benutzername.value == '') || (document.eingabe.passwort.value == '') || (iCheck)) {
		alert("Please fill in your username and password!");
		return false;
	}
	else {
		if (seite) return inout+".asp?herkunft="+seite;
		else return inout+".asp";
	}
}

var wi = null;
var tmpFensterBreite = 0;
var tmpFensterHoehe = 0;
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;
	tmpFensterBreite = tmpX+2;
	tmpFensterHoehe = tmpY+45;
	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=yes,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+108;
	var tmpY = y+140;
	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 (tmpX < 340) tmpX = 340;
	if (ew != null) if (!ew.closed) ew.close();
	ew = window.open('zoom.asp?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;
}

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 aufzuklappen(feld) {
	if (document.getElementById(feld).style.display == "none") {
		document.getElementById(feld).style.display = "block";
	} else {
		document.getElementById(feld).style.display = "none";
	}
}
