//Textfelder highlighten
function changeCSSClass
(element,newClass)
{
document.getElementById(element.id).className = newClass;
}

//WWG-Ueberpruefung folgender Felder: Frage an, Name, E-Mail, Anliegen
function validateForm() {
  var errors=0;
  var pflicht=false;
  var checkform=document.data;
  var i=0;
  var ergebnis=0;	
  
  if (!checkform.name.value) {
    errors += 1;
	pflicht=true;
    document.getElementById("err_msg_name_color").style.color="#e4036d";
	checkform.name.focus();
	}
  else {
  	document.getElementById("err_msg_name_color").style.color="#9ba133";
  };
  
 if ((!checkform.from_mail.value) || (!checkform.from_mail.value.match(/\S+@\S+\.\S+/))) {
    errors += 1;
	pflicht=true;
    document.getElementById("err_msg_from_mail_color").style.color="#e4036d";
	checkform.from_mail.focus();
    }
  else {
  	document.getElementById("err_msg_from_mail_color").style.color="#9ba133";
  };

  if (!checkform.mail_body.value) {
    errors += 1;
	pflicht=true;
    document.getElementById("err_msg_mail_body_color").style.color="#e4036d";
	checkform.mail_body.focus();
	}
  else {
  	document.getElementById("err_msg_mail_body_color").style.color="#9ba133";
  };

  pflicht == true ? document.getElementById("err_msg").style.visibility="visible" : document.getElementById("err_msg").style.visibility="hidden";
  
document.returnValue = (errors == '');
}

window.onError = null;