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);

if(window.navigator.systemLanguage && !window.navigator.language) {
	function hoverIE() {
    	if (document.getElementById("Navigation")) {
			var LI = document.getElementById("Navigation").firstChild;
			do {
				if (sucheUL(LI.firstChild)) {
					LI.onmouseover=einblenden; LI.onmouseout=ausblenden;
				}
				LI = LI.nextSibling;
			}
			while(LI);
		}
	}

	function sucheUL(UL) {
		do {
			if(UL) UL = UL.nextSibling;
			if(UL && UL.nodeName == "UL") return UL;
		}
		while(UL);
		return false;
	}

	function einblenden() {
		var UL = sucheUL(this.firstChild);
		UL.style.display = "block"; UL.style.backgroundColor = "";
	}
	
	function ausblenden() {
		sucheUL(this.firstChild).style.display = "none";
	}
	window.onload=hoverIE;
}

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+25;
	var tmpY = y+80;
	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 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 checkStichwortSuche() {
	var iCheck = true;
	for(i=0;i<document.stichwortsuche.stichwort.value.length;i++) {
		if (document.stichwortsuche.stichwort.value.substr(i,1) != ' ') {
			iCheck = false;
			i = document.stichwortsuche.stichwort.value.length;
		}
	}
	if ((document.stichwortsuche.stichwort.value == '') || (iCheck)) {
		alert("Bitte geben Sie ein Stichwort ein,\nnachdem gesucht werden soll.");
		return false;
	}
	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("Bitte geben Sie eine gültige eMail-Adresse ein.");
		return false;
	}
	return;
}

function bildwechsel(name,bild) {
	tmpBild = new Image();
	tmpBild.src = bild;
	document.images[name].src = tmpBild.src;
}
/* Font-Size changer */
var normalFontSize = 12;
var actualFontSize = 0;
var contentareaid  = 'mitte';
var oberegrenze	   = 16;
var unteregrenze   = 10;
var ajaxfile 	   = 'ajax.php';

function setActualFontSize(fs)
{
	if ( fs && fs != "undefined" )
	{
		actualFontSize = fs;
	}
	else
	{
		actualFontSize = normalFontSize;
	}
}

function increaseFont()
{
	if(actualFontSize == 0)
	{
		actualFontSize = normalFontSize;
	}
	if(actualFontSize <= oberegrenze)
	{
		actualFontSize += 1;
	}
	setFontSize();
	return 0;
}

function setFontSize()
{
	setAjaxRequest();
	var element = document.getElementById(contentareaid).style;
	element.fontSize = actualFontSize+'px';
}

function setToNormalFont()
{
	actualFontSize = normalFontSize;
	setFontSize();
	return 0;
}

function decreaseFont()
{
	if(actualFontSize == 0)
	{
		actualFontSize = normalFontSize;
	}
	if(actualFontSize >= unteregrenze)
	{
		actualFontSize -= 1;
	}
	setFontSize();
	return 0;
}

function setAjaxRequest()
{
	if (window.XMLHttpRequest)
	{
		request = new XMLHttpRequest(); // Mozilla, Safari, Opera
	}
	else if (window.ActiveXObject)
	{
		try
		{
			request = new ActiveXObject('Msxml2.XMLHTTP'); // IE 5
		}
		catch (e)
		{
			try
			{
				request = new ActiveXObject('Microsoft.XMLHTTP'); // IE 6
			}
			catch (e) {}
		}
	}
    
	var params = "fontsize="+actualFontSize;

	if (!request)
	{
		alert("Kann keine XMLHTTP-Instanz erzeugen");
		return false;
	}
	else
	{
		var url = ajaxfile;
		request.open('post', url, true);
		request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        request.setRequestHeader("Content-length", params.length);
        request.setRequestHeader("Connection", "close");

		request.send(params);
	}
}