function formValidator(){
	// Make quick references to our fields
	var buero = document.getElementById('buero');
	var vorname = document.getElementById('vorname');
	var nachname = document.getElementById('nachname');	
	var fon = document.getElementById('fon');
	var mobil = document.getElementById('mobil');
	var stadt = document.getElementById('stadt');
	var email = document.getElementById('email');
	var text = document.getElementById('text');
	
	// Check each input in the order that it appears in the form!
	if(madeSelection(buero, "Bitte wählen Sie ein Reisebüro aus")){
		if(isAlphabet(vorname, "Bitte geben Sie Ihren Vornamen an")){
			if(isAlphabet(nachname, "Bitte geben Sie Ihren Nachnamen an")){
				if(isNumeric(fon, "Bitte geben Sie Ihre Telefonnummer an")){
					if(isNumericOrEmpty(mobil, "Bitte geben Sie Ihre Mobiltelefonnummer an")){
						if(isAlphabet(stadt, "Bitte geben Sie Ihren Wohnort an")){
							if(emailValidator(email, "Bitte geben Sie eine gültige E-Mail Adresse an")){
								if(isNotEmpty(text, "Bitte tragen Sie eine Nachricht ein")){
									return true;
								}
							}
						}
					}
				}
			}
		}
	
	
	return false;
	
}

function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return true;
	}
	return false;
}

function isNotEmpty(elem, helperMsg){
	if(elem.value.length != 0){
		return true;
	}
	alert(helperMsg);
	elem.focus(); // set the focus to this input	
	return false;
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9\/ .-]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isNumericOrEmpty(elem, helperMsg){
	var numericExpression = /^[0-9\/ .-]+$/;
	if(elem.value.length == 0){
		return true;
	}else{
		if(elem.value.match(numericExpression)){		
			return true;
		}else{
			alert(helperMsg);
			elem.focus();
			return false;
		}
	}	
}

function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-ZöäüßÖÄÜ]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Bitte wählen"){
		return true;
	}else{
		return true;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}
}
