var nn=document.layers?true:false;
var n6=document.getElementById?true:false;
var ie=document.all?true:false;
if ((ie) && (n6)) n6 = false;

var bn = navigator.appName;
var vn = navigator.appVersion.substring(0,1);
var bClicked = 0;
var sClicked = 0;
var fJS = false;

var bn = navigator.appName;
var vn = navigator.appVersion.substring(0,1);
var anzahl = 9;

menuNor = new Array(anzahl);
menuFoc = new Array(anzahl);
      
function init() {
	if (((bn == "Netscape") && (vn >= "3")) || ((bn == "Microsoft Internet Explorer") && (vn >= "4"))) {
		// Btns vorladen.
		for (i=1; i<=anzahl; i++) {		
			menuNor[i] = new Image();
			menuNor[i].src = "http://www.pfiffige7.de/eas/gif/b_0" + i + "n.gif";
			menuFoc[i] = new Image();
			menuFoc[i].src = "http://www.pfiffige7.de/eas/gif/b_0" + i + "f.gif";
		}
		fJS = true;
		SelectBtn(hauptmenu);
		SelectBtnSub(submenu);
	}
}

function SelectBtn(idx) {
	// Btn fokussiert darstellen.
	bClicked = idx;
	if ((fJS) && (idx != 0)) {
		var s = "b"+idx;
		document.images[s].src = menuFoc[idx].src;
	}
}
function SelectBtnSub(idx) {
	// Btn fokussiert darstellen.
	sClicked = idx;
	if ((fJS) && (idx != 0)) {
		var s = "s"+idx;
		document.images[s].src = "http://www.pfiffige7.de/eas/gif/but_f.gif";
	}
}

function Focus(idx) {
	// Btn fokussiert darstellen.
	if ((fJS) && (idx != bClicked)) {
		var s = "b"+idx;
		document.images[s].src = menuFoc[idx].src;
	}
}
function FocusSub(idx) {
	// Btn fokussiert darstellen.
	if ((fJS) && (idx != sClicked)) {
		var s = "s"+idx;
		document.images[s].src = "http://www.pfiffige7.de/eas/gif/but_f.gif";
	}
}

function Blur(idx) {
	// Btn normal darstellen.
	if ((fJS) && (idx != bClicked)) {
		var s = "b"+idx;
		document.images[s].src = menuNor[idx].src;
	}
}
function BlurSub(idx) {
	// Btn normal darstellen.
	if ((fJS) && (idx != sClicked)) {
		var s = "s"+idx;
		document.images[s].src = "http://www.pfiffige7.de/eas/gif/but_n.gif";
	}
}

var tmpTxt;
function statAnzeige(txt) {
	tmpTxt = txt;
	setTimeout("window.status = tmpTxt;",0);
	return true;
}

function feldGr(feld,inhalt,max) {
	who = feld;
	if (inhalt >= max) {
		alert('Achtung, maximale Feldgröße erreicht!');
		who.value = who.value.substr(0,max-1);
	}
}

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','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) {
	var tmpX = x+20;
	var tmpY = y+100;
	if (id > 0) tmpY = tmpY+20;
	var tmpSc = "no";
	if (tmpY > 500) {
		tmpY = 500;
		tmpSc = "yes";
		tmpX += 30;
	}
	if (scbar == 1) {
		tmpSc = "yes";
		tmpX += 30;
	}
	if (ew != null) if (!ew.closed) ew.close();
	ew = window.open('http://www.pfiffige7.de/eas/zoom.php?id=' + id + '&hoch=' + y + '&breit=' + x + '&bild=' + datei + '&titel=' + alt,'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;
	return;
}

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('http://www.pfiffige7.de/eas/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;
}

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 ieFake(fake) {
	if ((document.all) && (fake)) fake.blur();
}
