/*Mailto-Link*/
function UnCryptMailto(s, shift) {
	var n = 0;
	var r = "";
	for (var i = 0; i < s.length; i++) {
		n = s.charCodeAt(i);
		if (n >= 8364) {
			n = 128;
		}
		r += String.fromCharCode(n - (shift));
	}
	return r;
}
function linkTo_UnCryptMailto(s, shift) {
	location.href = UnCryptMailto(s, shift);
}
/*Popup*/
function FensterOeffnen(Bezeichner,Breite,Hoehe) {
	Fenster = window.open('popup_' + Bezeichner + '.htm', 'Popup_' + Bezeichner, 'width=' + Breite + ',height=' + Hoehe + ',left=0,top=0,resizable=yes');
	Fenster.focus();
}
/*Bisherige Ausstellungen*/
function Next(Ausstellung,Fotoanzahl) {
	if (document.images) {
		var CurrentSRC = document.images[Ausstellung].src;
		var nStart = CurrentSRC.lastIndexOf("_") + 1;
		/*var nStart = CurrentSRC.length - 5;*/
		var nEnd = CurrentSRC.length - 4;
		var nCurrentNr = eval(CurrentSRC.substring(nStart,nEnd));
		if (nCurrentNr + 1 < Fotoanzahl) {
			var nNextNr = nCurrentNr + 1;
		}
		else {
			var nNextNr = 0;
		}
		var Next = new Image();
		if (Ausstellung == "200806mehrere" && nNextNr ==0) {
			Next.src = "../images/" + Ausstellung + "_" + nNextNr + ".gif";
		}
		else {
			Next.src = "../images/" + Ausstellung + "_" + nNextNr + ".jpg";
		}
		document.images[Ausstellung].src = Next.src;
		var AltFoto = " - Foto: Mahns-Techau";
		if (Ausstellung == "200010besser") {
			var Alt = "Manfred Besser HAFENSTRICH Oktober 2000";
			document.images[Ausstellung].alt = (nNextNr == 4) ? Alt + AltFoto : Alt;
			document.images[Ausstellung].title = (nNextNr == 4) ? Alt + AltFoto : Alt;
		}
		if (Ausstellung == "200012spadoni") {
			var Alt = "Roberto Spadoni EISENZEIT Dezember 2000";
			document.images[Ausstellung].alt = (nNextNr == 4) ? Alt + AltFoto : Alt;
			document.images[Ausstellung].title = (nNextNr == 4) ? Alt + AltFoto : Alt;
		}
		if (Ausstellung == "200104ladwig") {
			var Alt = "Roland Ladwig AUGENSICHT April 2001";
			document.images[Ausstellung].alt = (nNextNr == 1) ? Alt + AltFoto : Alt;
			document.images[Ausstellung].title = (nNextNr == 1) ? Alt + AltFoto : Alt;
		}
		var AltFoto = " - Foto/Copyright: Oliver Heissner";
		if (Ausstellung == "200904seidel") {
			var Alt = "Esther Seidel SILENZIO April 2009";
			document.images[Ausstellung].alt = (nNextNr >= 27 && nNextNr <= 35) ? Alt + AltFoto : Alt;
			document.images[Ausstellung].title = (nNextNr >= 27 && nNextNr <= 35) ? Alt + AltFoto : Alt;
		}
	}
}
/*Virtuelle Galerie*/
if (document.images) {
	var Checkbox = new Array(2);
	for (i=0; i < 2; ++i) {
		Checkbox[i] = new Image();
		Checkbox[i].src = "../../images/btn_order_" + i + ".gif";
	}
}
function Check(ImgName,Modus) {
	if (document.images) {
		this.document.images[ImgName].src = Checkbox[Modus].src;
	}
}
/*Kontakt: Verteiler-Formular*/
function Markieren(Option) {
	if (this.document.Verteiler.PerEMail.checked == false && this.document.Verteiler.PerPostkarte.checked == false) {
		this.document.Verteiler.elements[Option].checked = true;
	}
	if (document.images) {
		var Kreuz = new Image(); Kreuz.src = "../images/kreuz.gif";
		var KeinKreuz = new Image(); KeinKreuz.src = "../images/pixel.gif";
		if (this.document.Verteiler.elements[Option].checked == true) {
			if (Option == "PerEMail") {
				this.document.images["XEMail"].src = Kreuz.src;
			}
			if (Option == "PerPostkarte") {
				this.document.images["XVorname"].src = Kreuz.src;
				this.document.images["XNachname"].src = Kreuz.src;
				this.document.images["XStrasse"].src = Kreuz.src;
				this.document.images["XPLZ"].src = Kreuz.src;
				this.document.images["XOrt"].src = Kreuz.src;
			}
		}
		else {
			if (Option == "PerEMail") {
				this.document.images["XEMail"].src = KeinKreuz.src;
			}
			if (Option == "PerPostkarte") {
				this.document.images["XVorname"].src = KeinKreuz.src;
				this.document.images["XNachname"].src = KeinKreuz.src;
				this.document.images["XStrasse"].src = KeinKreuz.src;
				this.document.images["XPLZ"].src = KeinKreuz.src;
				this.document.images["XOrt"].src = KeinKreuz.src;
			}
		}
	}
}
function CheckInput() {
	if (this.document.Verteiler.PerPostkarte.checked == true) {
		if (this.document.Verteiler.Vorname.value == "") {
			alert ("Geben Sie bitte Ihren Vornamen ein!");
			this.document.Verteiler.Vorname.focus();
			return false;
		}
		if (this.document.Verteiler.Nachname.value == "") {
			alert ("Geben Sie bitte Ihren Nachnamen ein!");
			this.document.Verteiler.Nachname.focus();
			return false;
		}
	}
	if (this.document.Verteiler.PerEMail.checked == true) {
		var Input = this.document.Verteiler.EMail.value;
		var Laenge = Input.length;
		var Leer = Input.indexOf(" ");
		var ErstesAt = Input.indexOf("@");
		var LetztesAt = Input.lastIndexOf("@");
		if (Laenge < 6 || Leer != -1 || ErstesAt < LetztesAt || ErstesAt < 1 || LetztesAt > Laenge - 5) {
			alert ("Geben Sie bitte Ihre E-Mail-Adresse ein!");
			this.document.Verteiler.EMail.focus();
			return false;
		}
	}
	if (this.document.Verteiler.PerPostkarte.checked == true) {
		if (this.document.Verteiler.Strasse.value == "")
			{
			alert ("Geben Sie bitte Ihre Adresse ein!");
			this.document.Verteiler.Strasse.focus();
			return false;
		}
		if (this.document.Verteiler.PLZ.value == "") {
			alert ("Geben Sie bitte Ihre Adresse ein!");
			this.document.Verteiler.PLZ.focus();
			return false;
		}
		if (this.document.Verteiler.Ort.value == "") {
			alert ("Geben Sie bitte Ihre Adresse ein!");
			this.document.Verteiler.Ort.focus();
			return false;
		}
	}
	if (this.document.Verteiler.EMail.value != "") {
		this.document.Verteiler.EMail.value = " " + this.document.Verteiler.EMail.value;
	}
	return true;
}
