function checkForm()
{
	var myValues = new Array('salutation','lastname', 'firstname', 'email', 'phone');
	var myNames = new Array('Anrede', 'Nachname', 'Vorname', 'E-Mail Adresse', 'Telefonnummer');
	var errorText = "Es ist ein Fehler aufgetreten.<br />";
	var intro = "Sie m&uuml;ssen noch folgende Felder ausf&uuml;llen:<br />";
	var errors = '';
	var additional = '';

	for ( var x = 0; x < myValues.length; x++) {
			if (document.getElementsByName(myValues[x])[0].value == '') {
				errors += (myNames[x] + ", ");
				document.getElementsByName(myValues[x])[0].style.backgroundColor = "#a00066";
				document.getElementsByName(myValues[x])[0].onfocus = function()
				{
					this.style.backgroundColor = "#fff";
					//delete this.onfocus;
				}
			} else {
				if ((myValues[x] == "phone" || myValues[x] == "zip") && !parseInt(document.getElementsByName(myValues[x])[0].value)) {
					document.getElementsByName(myValues[x])[0].style.backgroundColor = "#a00066";
					document.getElementsByName(myValues[x])[0].onfocus = function()
					{
						this.style.backgroundColor = "#fff";
						//delete this.onfocus;
					}
					additional += "<br />Die " + myNames[x] + " darf nur aus Zahlen bestehen.";
				}
			}
	}

	if(errors.length) {
		errors = intro + errors.substr(0, errors.length-2);
	}

	if (additional.length) {
		errors += additional;
	}

	if (document.getElementsByName('email')[0].value != '') {
		var usr = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
      	var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,5}";
      	var regex = "^"+usr+"\@"+domain+"$";
      	var myrxp = new RegExp(regex);
		var mailcheck = myrxp.test(document.getElementsByName('email')[0].value);
		if (!mailcheck) {
					document.getElementsByName('email')[0].style.backgroundColor = "#a00066";
					document.getElementsByName('email')[0].onfocus = function()
					{
						this.style.backgroundColor = "#fff";
						//delete this.onfocus;
					}
			errors = (errors.length ? errors + "<br />" : "") + "Die angegebene E-Mail Adresse ist nicht g&uuml;ltig.  ";
		}
	}

	if (errors.length) {
		if (document.getElementById('error') == null) {

			// create the error block
			var nF = document.createElement('div');
			nF.setAttribute('id', 'error');
            nF.style.backgroundColor = '#ccc';
            nF.style.padding = '10px';
            nF.style.color = '#555';
            nF.style.margin = '1px 0 0 0';
            nF.style.borderLeft = '5px solid red';

			// structurize the block elements
			document.getElementById('contactForm').parentNode.parentNode.insertBefore(nF, document.getElementById('contactForm').parentNode);

			// add the information
			nF.innerHTML = errorText;
			nF.innerHTML += errors;
		} else {
			document.getElementById('error').innerHTML = errors;
		}
		return false;
	} else {
		return true;
	}
}