

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("menu").style.fontSize=size+"px";
	document.getElementById("menu2").style.fontSize=size+"px";
	document.cookie="fontsize="+size+"px; path=/";

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

function check()
{
	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 toggleSubMenu(m_id)
{
	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";
		}
	}
}


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 showCounter(pa)
{
	var
		maxlaenge=88,
		laenge=pa.value.length,
		balken_hoehe=8,
		faktor=balken_hoehe / maxlaenge,
		hoehe_aktuell,hoehe_neu;

	if (laenge <= maxlaenge)
	{
		hoehe_neu=balken_hoehe-laenge*faktor+"em";
		document.getElementById("balken").style.height=hoehe_neu;
		document.getElementById("nachricht_absenden").disabled=false;
		document.getElementById("nachricht_absenden").style.visibility='visible';
		document.getElementById("nachricht").style.color="";
	}
	else
	{
		document.getElementById("nachricht_absenden").disabled=true;
		document.getElementById("nachricht_absenden").style.visibility='hidden';
// 		document.getElementById("nachricht").disabled=true;
		document.getElementById("nachricht").style.color="gray";
// 		alert(document.getElementById("nachricht").value);
		document.getElementById("nachricht").value=document.getElementById("nachricht").value.substr(1,maxlaenge);
	}
}


// Thx to http://webmatze.de/webdesign/javascript/tooltips.htm

var wmtt = null;
document.onmousemove = updateWMTT;

function updateWMTT(e)
{
	x = (document.all) ? window.event.x + document.body.scrollLeft : e.pageX;
	y = (document.all) ? window.event.y + document.body.scrollTop  : e.pageY;
}

function chooseTarget(pa)
{
	fenster=document.getElementById("targetCh");

	if (window.innerWidth) iw=window.innerWidth;
	else if (document.body && document.body.offsetWidth) iw=document.body.offsetWidth;

	if (window.innerHeight) ih=window.innerHeight;
	else if (document.body && document.body.offsetHeight) ih=document.body.offsetHeight;

// alert (x); alert (y)

	if (x > iw-200) x=iw-200;
	if (y > ih-100) y=ih-100;
	if (x < 0) x=0;
	if (y < 0) y=0;


	fenster.style.left=(x)+"px";
	fenster.style.top=(y)+"px";

	fenster.style.display="block";

// 	fenster.innerHTML="<a id=\"X\" href=\"javascript:hideWindow();\" title=\"Abbrechen\">&times;<\/a><h5>Externer Link<\/h5><p><strong>Sie verlassen OmniintrO.de<\/strong><\/p<p><a href=\""+pa.href+"\" target=\"_self\">In <b>diesem Fenster<\/b> &ouml;ffnen<\/a><br \/><a href=\""+pa.href+"\" target=\"_blank\">In <b>neuem Fenster<\/b> &ouml;ffnen<\/a><br \/><strong>F&uuml;r Inhalte externer Seiten sind die jeweiligen Betreiber verantwortlich.<\/strong><\/p>";

	fenster.innerHTML="<a id=\"X\" href=\"javascript:hideWindow();\" title=\"Abbrechen\">&times;<\/a><h5>Externer Link:<\/h5><p>&middot; <a id=\"ch_w\" href=\""+pa.href+"\" target=\"_self\">In <b>diesem<\/b> Fenster &ouml;ffnen<\/a><br \/>&middot; <a href=\"#\" onclick=\"window.open('"+pa.href+"','Fenster2','scrollbars=yes,location=yes,menubar=yes,resizable=yes,status=yes,toolbar=yes');return false;\">In <b>neuem<\/b> Fenster &ouml;ffnen<\/a></p><p><strong>Sie verlassen OmniintrO.de<br \/>F&uuml;r Inhalte externer Seiten sind die jeweiligen Betreiber verantwortlich.<\/strong><\/p>";

	document.getElementById('ch_w').focus();

	return false;
}
function hideWindow()
{
	fenster=document.getElementById("targetCh");
	fenster.style.display="none";fenster.innerHTML="";
}

function switchCSS(pa)
{
	document.getElementById('screencss').href='../css/'+pa.value+'.css';
	if (document.forms['einstellform'].elements['cookieOK'].checked)
	{
		cookiewert="cssfile="+pa.value+"; path=/";
		document.cookie=cookiewert;
		cookiewert=document.cookie;
	}
}

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();
}
