/* Javascript by Armin Priesner */

function fnBuchung() {
	var form = document.buchungsForm;
	var anrede = form.elements['anrede'];
	var inputError = false;
	
	if(!anrede[0].checked && !anrede[1].checked) {
		alert("Bitte das Feld Anrede ausfüllen!");
		inputError = true;
	}
	
	if(form.Vorname.value == "") {
		form.Vorname.style.borderColor = "#FF0000";
		inputError = true;
	}
	else {
		form.Vorname.style.borderColor = "#000000";
	}
	
	if(form.Nachname.value == "") {
		form.Nachname.style.borderColor = "#FF0000";
		inputError = true;
	}
	else {
		form.Nachname.style.borderColor = "#000000";
	}
	
	if(form.Telefon.value == "" && form.Email.value == "") {
		form.Telefon.style.borderColor = "#FF0000";
		form.Email.style.borderColor = "#FF0000";
		inputError = true;
	}
	else {
		form.Telefon.style.borderColor = "#000000";
		form.Email.style.borderColor = "#000000";
	}
	
	if(inputError) {
		alert("Bitte füllen Sie alle Pflichtfelder aus!");
		return false;
	}
}



function fnCharCount(stringInput) {
	var charLimit = 900;
	
	if(stringInput.length > charLimit) {
		var text = "Bitte nicht mehr als "+charLimit+" Zeichen eingeben!\n";
		text += "Anzahl eingebener Zeichen: "+stringInput.length;
		
		document.buchungsForm.Mitteilung.value = stringInput.substr(0,charLimit);
		
		alert(text);
	}
}
