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 fJS = false;
var vn = navigator.appVersion.substring(0,1);
var anzahl = 14;
var bClicked = 0;


/*Banner rotator anfang */
var anzahlSponsoren = 7;
a = 1 + anzahlSponsoren*(Math.random());
a = Math.round(a);
var countSponsoren = a-1;

sponsorBild = new Array(anzahlSponsoren);
sponsorURL = new Array(anzahlSponsoren);

sponsorBild[0] = "logo_schmiedwirt.gif";
sponsorBild[1] = "logo_eham.gif";
sponsorBild[2] = "logo_holzer.gif";
sponsorBild[3] = "logo_musikant.gif";
sponsorBild[4] = "logo_bergmuehle.gif";
sponsorBild[5] = "logo_itmedia.gif";
sponsorBild[6] = "logo_ifac.gif";

sponsorURL[0] = "http://www.schmiedwirt-elbach.de";
sponsorURL[1] = "http://www.eham-bio.de";
sponsorURL[2] = "http://www.holzer-elektro.de";
sponsorURL[3] = "http://www.dermusikant.de";
sponsorURL[4] = "http://www.bergmuehle.info";
sponsorURL[5] = "http://www.intec-it-media.de";
sponsorURL[6] = "http://www.i-fac.de";

function bildwechsel() {
	if ( document.images['l1'] )
	{
		if (countSponsoren == anzahlSponsoren) countSponsoren = 0;
		document.images['l1'].src = "gif/"+sponsorBild[countSponsoren];
		countSponsoren = countSponsoren + 1;
		action = setTimeout("bildwechsel()", 3000);
	}
}	

function getSponsor() {
	window.open(sponsorURL[countSponsoren-1]);
}
/*Banner rotator ende */




menuNor = new Array(anzahl);
menuFoc = new Array(anzahl);

function init() {
	if (vn >= 4) {
		for (i=1; i<=anzahl; i++) {
			tmp = i;
			if ( i < 10 )
			{
				tmp = "0" + i;
			}
			menuNor[i] = new Image();
			menuNor[i].src = "gif/b_" + tmp + "n.gif";
			menuFoc[i] = new Image();
			menuFoc[i].src = "gif/b_" + tmp + "f.gif";
		}
		if (nn) {
			sichtbar = "show";
			unsichtbar = "hide";
		}
		fJS = true;
		if ( hauptmenu > 0 ) {
			document.images["b"+hauptmenu].src = menuFoc[hauptmenu].src;
		}
		bClicked = hauptmenu;
	}
	bildwechsel();
}

function ieFake(fake) {
	if ((document.all) && (fake)) fake.blur();
}

function Focus(idx) {
	// Btn fokussiert darstellen.
	if ((fJS) && (idx != bClicked)) {
		var s = "b"+idx;
		document.images[s].src = menuFoc[idx].src;
	}
}
function Blur(idx) {
	// Btn normal darstellen.
	if ((fJS) && (idx != bClicked)) {
		var s = "b"+idx;
		document.images[s].src = menuNor[idx].src;
	}
}

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+20;
	var tmpY = y+170;
	if (id > 0) tmpY = tmpY+20;
	var tmpSc = "no";
	if (tmpX < 520) tmpX = 520;
	if (tmpY > 580) {
		tmpY = 580;
		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;
}

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.newsletter.newsmail.value.indexOf("@");
	var checkMail1 = document.newsletter.newsmail.value.lastIndexOf(".");
	var checkMail2 = document.newsletter.newsmail.value.lastIndexOf(" ");
	var checkMailLaenge = document.newsletter.newsmail.value.length;
	if ((checkMail2 != -1) || (checkMail1 == -1) || (checkMail < 1) || (checkMail == checkMailLaenge-1) || (checkMail == checkMail1-1) || (checkMail1 > checkMailLaenge-3) || (checkMailLaenge < 6) || (document.newsletter.newsmail.value == "eMail eingeben") || (document.newsletter.newsmail.value == "")) {
		alert("Eine gültige eMail-Anschrift sollten Sie schon eintragen,\nsonst macht die Anmeldung wenig Sinn!");
		return false;
	}
	return;
}
