function validateForm2(formular) {
	var error = 0;
	var currentField = '';
	var klasse = '';
	var newClass = '';
	
	// Inspect all of the document's labels ...
	for (var i = 0; i < document.getElementsByTagName("input").length; i++) {
		currentField = document.getElementsByTagName("input")[i];

		klasse = currentField.className;
		newClass = currentField.className.replace(/ error/, '');
				
				
				// name
				if (klasse.match(/name/i)) {
					
					if (currentField.value == '' || currentField.value=='Name' || currentField.value=='E-Mail' || currentField.value=='Anschrift') {
						currentField.className = newClass;
						currentField.className += ' error';
						error = 1;
					} else {
						currentField.className = newClass;
					}

				}
				
				// e-mail address
				if (klasse.match(/mail/)) {
					var valid = isMailValid(currentField);
					if (!valid && currentField.value != '') {
						currentField.className = newClass;
						currentField.className += ' error';
						error = 1;
					} else {
						currentField.className = newClass;
					}
					if (!valid && klasse.match(/required/)) {
						currentField.className = newClass;
						currentField.className += ' error';
						error = 1;
					} else {
						if (error == 0) {
							currentField.className = newClass;
						}
					}
				}


		
		
	} // end for

	
	// Return TRUE and proceed sending the form if no errors occured.
	// Return FALSE in case of errors and display the error message,
	// then focus on the ID of the element containing the error message.
	
	// (The window.location.href call comes in handy if the page containing
	//	the form is as high as serveral screens,
	//  but can be safely removed without preventing the script to function properly).
	if (error === 0) {
		return true;
	} else {
		document.getElementById("fehlermeldung02").style.display = 'block';
		window.location.href = "#fehlermeldung02";
		return false;
	}
		
}



// Additional functions for numeric and e-mail validation
function isNumber(field) {
	var returnvar = (isNaN(parseInt(field.value)) == true) ? false : true;
	return returnvar;
}

function isMailValid(field) {
	var returnvar = (field.value.match(/^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$/)) ? true : false;
	return returnvar;
}
