
function checkEmail(email) {
	posk = email.indexOf("@");
	posp = email.indexOf(".");
	if ((posk <= 0) || (posk == email.length-1))
		return false;
	else 
		if ((posp <= 0) || (posp == email.length-1) || (posp == posk+1) || (posp == posk-1))
			return false;
		else
			return true;
}

function checkForm() {
	if (document.anfrage.Name.value == "" ||
		document.anfrage.Strasse.value == "" ||
		document.anfrage.PLZ.value == "" ||
		document.anfrage.Ort.value == "" ||
		document.anfrage.Email.value == "") {
		alert("Bitte geben Sie Ihre Adresse mit Email an!");
    if (document.anfrage.Name.value == "") {
			document.anfrage.Name.focus();
			return false;
		}		
 		if (document.anfrage.Strasse.value == "") {
			document.anfrage.Strasse.focus();
			return false;
		}
 		if (document.anfrage.PLZ.value == "") {
			document.anfrage.PLZ.focus();
			return false;
		}
 		if (document.anfrage.Ort.value == "") {
			document.anfrage.Ort.focus();
			return false;
		}
 		if (document.anfrage.Email.value == "") {
			document.anfrage.Email.focus();
			return false;
		}
	}
	else {
		if ((document.anfrage.Email.value !="") && (checkEmail(document.anfrage.Email.value) == false)) {
			alert(unescape("Bitte geben Sie eine g%FCltige Email-Adresse an!"));
			document.anfrage.Email.focus();
			return false;
		}
		else {
			document.anfrage.submit_by.value = document.anfrage.Email.value;
			document.anfrage.submit_to.value = "verkehrsamt-seehausen" + "@" + "t-online.de";
			return true;
		}
	}
}

