//------------------------------------------------------------
// JavaScript-Datei: funktionen.js
//------------------------------------------------------------
// Autor:   Johannes Mueller
// Kontakt: www.mueller24.info/kontakt.php
//
// last modified: 26.10.2007
//------------------------------------------------------------
// Funktionen:
//   Adr(accountVerkehrt, subdomainVerkehrt, topdomainVerkehrt, modus)
//   Go(url)
//   PopUp(url, breite, hoehe, skalierbar)
//   Runden(zahl, nachkommastellen)
//   SeiteVerlassen()
//------------------------------------------------------------


//------------------------------------------------------------
// Globale Variablen fuer alle Seiten
//------------------------------------------------------------

var popUpFenster;


//------------------------------------------------------------
// Funktionen
//------------------------------------------------------------

function PopUp(url, breite, hoehe, skalierbar)
{
	var eigenschaften, spezial;

	if (popUpFenster)
		if (!popUpFenster.closed)
			popUpFenster.close();

	if ((breite > 0) && (hoehe > 0))
	{
		if (skalierbar)
			spezial = "resizable=yes,scrollbars=yes,dependent=no";
		else
			spezial = "resizable=no,scrollbars=no,dependent=yes";

		eigenschaften =
		"width=" + breite + ",height=" + hoehe + "," +
		"left=0,top=0,menubar=no,toolbar=no,location=no,status=no," +
		spezial;

		popUpFenster = window.open(url, "_blank", eigenschaften);
		popUpFenster.focus();
	}
}


function SeiteVerlassen()
{
	if (popUpFenster)
		if (!popUpFenster.closed)
			popUpFenster.close();
}


function Go(url)
{
	if (url)
	{
		if (popUpFenster)
			if (popUpFenster.closed == false)
				popUpFenster.close();

		if (url.indexOf("http") == 0)
		{
			popUpFenster = window.open(url, "_blank");
			popUpFenster.focus();
		}
		else
			window.location.href = url;
	}
}


function Runden(zahl, nachkommastellen)
{
	var faktor = Math.pow(10, nachkommastellen);
	return Math.round(zahl * faktor) / faktor;
}


function DisplayCheck(neue_url)
{
	if (screen.width <= 360)
	{
		if (document.cookie.indexOf("mobilversion=false") == -1)
		{
			if (confirm("Sie betrachten diese Seite mit einem kleinen Display.\nWollen Sie auf die Mobil-Version wechseln?"))
			{
				window.location.href = neue_url;
				document.cookie = "mobilversion=true"
			}
			else
				document.cookie = "mobilversion=false";
		}
	}
}


function Adr(accountVerkehrt, subdomainVerkehrt, topdomainVerkehrt)
{
	var i;
	var linkwortVerkehrt = ":otliam";

	document.write("<IMG SRC=\"/img/symbol-brief.gif\" WIDTH=13 HEIGHT=9 BORDER=0> ");
	document.write("<A HREF=\"");

	for (i=linkwortVerkehrt.length-1; i>=0; i--)
		document.write(linkwortVerkehrt.charAt(i));
	for (i=accountVerkehrt.length-1; i>=0; i--)
		document.write(accountVerkehrt.charAt(i));
	document.write("&#64;");
	for (i=subdomainVerkehrt.length-1; i>=0; i--)
		document.write(subdomainVerkehrt.charAt(i));
	document.write("&#46;");
	for (i=topdomainVerkehrt.length-1; i>=0; i--)
		document.write(topdomainVerkehrt.charAt(i));
	document.write("\">");

	for (i=accountVerkehrt.length-1; i>=0; i--)
		document.write(accountVerkehrt.charAt(i));
	document.write("&#64;");
	for (i=subdomainVerkehrt.length-1; i>=0; i--)
		document.write(subdomainVerkehrt.charAt(i));
	document.write("&#46;");
	for (i=topdomainVerkehrt.length-1; i>=0; i--)
		document.write(topdomainVerkehrt.charAt(i));

	document.write("</A>");
}

