
var Hoehe,Weite;

/* Überwachung von Netscape initialisieren */
if (!window.Weite && window.innerWidth)
{
// 	window.onresize = checkCSS;
	window.onload = checkCSS;
	Weite = Fensterweite();
	Hoehe = Fensterhoehe();
}


function Fensterweite () {
	if (window.innerWidth) {
		return window.innerWidth;
	} else if (document.body && document.body.offsetWidth) {
		return document.body.offsetWidth;
	} else {
		return 0;
	}
}

function Fensterhoehe () {
	if (window.innerHeight) {
		return window.innerHeight;
	} else if (document.body && document.body.offsetHeight) {
		return document.body.offsetHeight;
	} else {
		return 0;
	}
}

function checkCSS()
{
	if (Fensterweite()<600) document.getElementById("screen_css").href="../css/mobil.css";
	else document.getElementById("screen_css").href="../css/screen.css";
}

window.onload=jsInit;

function jsInit()
{
	// Schrift initialisieren

// 	var
// 		font_size=document.forms['font_resizer'].elements['fontsize'].value;
// 		alert(font_size);
/*
	if (parseInt(font_size)<5)
	{
		alert ("Fehler in Fontsize");
		font_size="14px";
	}

	document.getElementsByTagName("body")[0].style.fontSize=font_size;
	document.getElementById("menues").style.fontSize=font_size;
// 	document.getElementById("header").style.fontSize=font_size;*/

	menuInit();abbrInit();
}


// 		window.onload=function(){abbrInit();};

		function abbrInit()
		{
			var
				abbrs,i;

			abbrs=document.getElementsByTagName('abbr');
			for(i=0;i<abbrs.length;i++)
			{
				abbrs[i].tabIndex="0";
				abbrs[i].onclick=function(){toggleAbbr(this);};
				abbrs[i].onkeypress=function(){toggleAbbr(this);};
			}
		}

		function toggleAbbr(pa)
		{
			var t,h;

			t=pa.title;
			h=pa.innerHTML;
			pa.title=h;
			pa.innerHTML=t;
		}











function menuInit()
{
 var
 ul_id,
 h3_id,
 a_id,
 aktiv,
 submenu_nr=1;

 // Obermenuepunkt des aktiven Punktes ermitteln
 if (document.getElementById("aktiv")) aktiv=document.getElementById("aktiv").parentNode.id;

 ul_id='ul_id_'+submenu_nr;
 h3_id='h3_id_'+submenu_nr;
 a_id='a_id'+submenu_nr;

 while (document.getElementById(ul_id))
 {
 if (ul_id != aktiv)
 {
 document.getElementById(ul_id).className="aus";
 document.getElementById(h3_id).className="zu";
 document.getElementById(h3_id).title="Aufklappen";
 document.getElementById(a_id).href='javascript:toggleSubMenu('+submenu_nr+');';
 }
 else // Initialisierung notwendig
 {
 document.getElementById(ul_id).className="an";
 document.getElementById(h3_id).className="auf";
 document.getElementById(h3_id).title="Zuklappen";
 document.getElementById(a_id).href='javascript:toggleSubMenu('+submenu_nr+');';
 }
 submenu_nr++;
 ul_id='ul_id_'+submenu_nr;
 h3_id='h3_id_'+submenu_nr;
 a_id='a_id'+submenu_nr;
 }

//  startH1Anim();
}




function toggleSubMenu(m_id)
{
// alert("Ja")
	var h3_id;
	with (document.getElementById('ul_id_'+m_id))
	{
		if (className == 'an')
		{
			className='aus';
			h3_id='h3_id_'+m_id; //Beschriftung des Oberpunktes
			document.getElementById(h3_id).className="zu";
			document.getElementById(h3_id).title="Aufklappen";
		}
		else
		{
			className='an';
			h3_id='h3_id_'+m_id; //Beschriftung des Oberpunktes
			document.getElementById(h3_id).className="auf";
			document.getElementById(h3_id).title="Zuklappen";
		}
	}
}










var size,oldsize=0,newsize=0;

function fontResize(pa)
{

	oldsize=document.getElementsByTagName("body")[0].style.fontSize;

	size=parseInt(oldsize);
	if (pa.value==1) size++; else size--;
	document.getElementsByTagName("body")[0].style.fontSize=size+"px";
	document.getElementById("menues").style.fontSize=size+"px";
// 	document.getElementById("header").style.fontSize=size+"px";
	document.cookie="fontsize="+size+"px; path=/";

	document.getElementById("showzoom").innerHTML=size;
// 	window.scrollTo();
	newsize=document.getElementsByTagName("body")[0].style.fontSize;
}

function check()
{
// 	global oldsize,newsize;
	return (oldsize==newsize)
}




/* bewirkt bei Beruehren eines *internen* Links im Inhaltsbereich, dass der
	dazu gehoerende Eintrag im Menue gleichzeitig hervorgehoben wird */

function remoteHover(pa_link)
{
	var
		an_aus,
		menu_id,
		link_url=pa_link.href;

	menu_id=link_url.substring(0,link_url.lastIndexOf(".php"));
	menu_id='a_'+menu_id.substring(menu_id.lastIndexOf("/")+1,menu_id.length);

// alert(menu_id)
	if (menu_id=='a_index' || menu_id=='a_')
	{
		menu_id=link_url.substring(0,link_url.lastIndexOf("/"));
		menu_id='a_'+menu_id.substring(menu_id.lastIndexOf("/")+1,menu_id.length);
	}

// alert(menu_id)

	if (!document.getElementById(menu_id)) return;
	if (document.getElementById(menu_id).className=="aktiv") return;

	document.getElementById(menu_id).className="remotehover";

}

function remoteUnHover(pa_link)
{
	var
		an_aus,
		menu_id,
		link_url=pa_link.href;

	menu_id=link_url.substring(0,link_url.lastIndexOf(".php"));
	menu_id='a_'+menu_id.substring(menu_id.lastIndexOf("/")+1,menu_id.length);

	if (menu_id=='a_index' || menu_id=='a_')
	{
		menu_id=link_url.substring(0,link_url.lastIndexOf("/"));
		menu_id='a_'+menu_id.substring(menu_id.lastIndexOf("/")+1,menu_id.length);
	}


	if (!document.getElementById(menu_id)) return;
	if (document.getElementById(menu_id).className=="aktiv") return;

	document.getElementById(menu_id).className="";

}


function H1Anim()
{
	posx=document.getElementsByTagName('h1')[0].style.backgroundPosition;
	posxint=parseInt(posx);
	posxint++;
	if (posxint > 1278 ) posx=0;

	document.getElementsByTagName('h1')[0].style.backgroundPosition=posxint+"px";
}



function markInputField(pa_id)
{
	if (document.all && !window.opera) return;  /* IE sux*/
	xid=pa_id.getAttribute('for');
	document.getElementById(xid).className="markinput";
}

function unMarkInputField(pa_id)
{
	if (document.all && !window.opera) return;  /* IE sux*/
	xid=pa_id.getAttribute('for');
	document.getElementById(xid).className="";
}

function confirm_del()
{
	return confirm ("Sind Sie sicher, dass Sie\n"+document.forms[0].elements['delete_filename'].value+" loeschen wollen?");
}



function switchFont(pa)
{
	document.getElementsByTagName('body')[0].style.fontSize=pa.value;

	if (document.forms['einstellform'].elements['cookieOK'].checked)
	{
		cookiewert="fontsize="+pa.value+"; path=/";
		document.cookie=cookiewert;
		cookiewert=document.cookie;
	}
// 	location.reload();
}
