function writeLog(logseite) {
$.post('writeLog.php', { seite: logseite}, function(data) {});
}
function validEmail(email)
{
  var strReg = "^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$";
  var regex = new RegExp(strReg);
  return(regex.test(email));
}
function eingaben_ueberpruefen_tell_a_friend() {
    var ret_pruefen=true;
    var count_error=0;
      document.getElementById('check_tell_a_friend').style.visibility='hidden';

    document.getElementById('tell_a_friend_name').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_emailadresse').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_wunschnummer').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_namefreund1').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_namefreund2').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_namefreund3').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_namefreund4').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_namefreund5').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_mailfreund1').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_mailfreund2').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_mailfreund3').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_mailfreund4').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_mailfreund5').style.backgroundColor='#000000';
    document.getElementById('tell_a_friend_nachricht').style.backgroundColor='#000000';
    if(document.tellafriend.tell_a_friend_name.value.length < 3) {
        document.getElementById('tell_a_friend_name').style.backgroundColor='#990000';
        count_error++;
    	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_emailadresse.value.length < 3) {
        document.getElementById('tell_a_friend_emailadresse').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    } else {
      if(!validEmail(document.tellafriend.tell_a_friend_emailadresse.value))   {
        document.getElementById('tell_a_friend_emailadresse').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
      }
    }
    if(document.tellafriend.tell_a_friend_namefreund1.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund1.value.length ==0) {
        document.getElementById('tell_a_friend_mailfreund1').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund2.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund2.value.length ==0) {
        document.getElementById('tell_a_friend_mailfreund2').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund3.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund3.value.length ==0) {
        document.getElementById('tell_a_friend_mailfreund3').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund4.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund4.value.length ==0) {
        document.getElementById('tell_a_friend_mailfreund4').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund5.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund5.value.length ==0) {
        document.getElementById('tell_a_friend_mailfreund5').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }

    if(document.tellafriend.tell_a_friend_namefreund1.value.length == 0 && document.tellafriend.tell_a_friend_mailfreund1.value.length > 0) {
        document.getElementById('tell_a_friend_namefreund1').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund2.value.length == 0 && document.tellafriend.tell_a_friend_mailfreund2.value.length > 0) {
        document.getElementById('tell_a_friend_namefreund2').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund3.value.length == 0 && document.tellafriend.tell_a_friend_mailfreund3.value.length > 0) {
        document.getElementById('tell_a_friend_namefreund3').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund4.value.length == 0 && document.tellafriend.tell_a_friend_mailfreund4.value.length > 0) {
        document.getElementById('tell_a_friend_namefreund4').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund5.value.length == 0 && document.tellafriend.tell_a_friend_mailfreund5.value.length  > 0) {
        document.getElementById('tell_a_friend_namefreund5').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }

    if(document.tellafriend.tell_a_friend_namefreund1.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund1.value.length >0  && (! validEmail(document.tellafriend.tell_a_friend_mailfreund1.value))) {
        document.getElementById('tell_a_friend_mailfreund1').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund2.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund2.value.length >0  && (! validEmail(document.tellafriend.tell_a_friend_mailfreund2.value))) {
        document.getElementById('tell_a_friend_mailfreund2').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund3.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund3.value.length >0  && (! validEmail(document.tellafriend.tell_a_friend_mailfreund3.value))) {
        document.getElementById('tell_a_friend_mailfreund3').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund4.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund4.value.length >0  && (! validEmail(document.tellafriend.tell_a_friend_mailfreund4.value))) {
        document.getElementById('tell_a_friend_mailfreund4').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(document.tellafriend.tell_a_friend_namefreund5.value.length > 0 && document.tellafriend.tell_a_friend_mailfreund5.value.length >0 && (! validEmail(document.tellafriend.tell_a_friend_mailfreund5.value))) {
        document.getElementById('tell_a_friend_mailfreund5').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(! validEmail(document.tellafriend.tell_a_friend_mailfreund5.value)
        && ! validEmail(document.tellafriend.tell_a_friend_mailfreund4.value)
        && ! validEmail(document.tellafriend.tell_a_friend_mailfreund3.value)
        && ! validEmail(document.tellafriend.tell_a_friend_mailfreund2.value)
        && ! validEmail(document.tellafriend.tell_a_friend_mailfreund1.value)
    ) {
        document.getElementById('tell_a_friend_mailfreund1').style.backgroundColor='#990000';
        count_error++;
        document.getElementById('tell_a_friend_mailfreund2').style.backgroundColor='#990000';
        count_error++;
        document.getElementById('tell_a_friend_mailfreund3').style.backgroundColor='#990000';
        count_error++;
        document.getElementById('tell_a_friend_mailfreund4').style.backgroundColor='#990000';
        count_error++;
        document.getElementById('tell_a_friend_mailfreund5').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }

    if(ret_pruefen==false) {
      document.getElementById('check_tell_a_friend').style.visibility='visible';
      if(count_error > 1) {
          document.getElementById('check_tell_a_friend').innerHTML="Bitte &uuml;berpr&uuml;fen Sie Ihre Daten in den rot markierten Feldern.";
      } else {
          document.getElementById('check_tell_a_friend').innerHTML="Bitte &uuml;berpr&uuml;fen Sie Ihre Daten im rot markierten Feld.";
      }
    }

    return ret_pruefen;

}
function eingaben_ueberpruefen()
{
  var ret_pruefen=true;
  var count_error=0;
  document.getElementById('check').style.visibility='hidden';
  document.getElementById('vorname').style.backgroundColor='#000000';
  document.getElementById('nachname').style.backgroundColor='#000000';
  document.getElementById('email').style.backgroundColor='#000000';
  document.getElementById('strasse').style.backgroundColor='#000000';
  document.getElementById('plz_ort').style.backgroundColor='#000000';
  document.getElementById('agb').style.color='#000000';

    if (document.wunschabschicken.vorname.value.length < 2){
        document.getElementById('vorname').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen=false;
    }
    if (document.wunschabschicken.nachname.value.length < 4) {
        document.getElementById('nachname').style.backgroundColor='#990000';
        count_error++;
  	ret_pruefen= false;
    }
    if (document.wunschabschicken.strasse.value.length < 4) {
        document.getElementById('strasse').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if (document.wunschabschicken.plz_ort.value.length < 4) {
        document.getElementById('plz_ort').style.backgroundColor='#990000';
        count_error++;
        ret_pruefen= false;
    }
    if (!validEmail(document.wunschabschicken.email.value)) {
        document.getElementById('email').style.backgroundColor='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if (document.wunschabschicken.chk_agb.checked == false) {
        document.getElementById('agb').style.color ='#990000';
        count_error++;
	ret_pruefen= false;
    }
    if(ret_pruefen==false) {
      document.getElementById('check').style.visibility='visible';
      if(count_error > 1) {
          document.getElementById('check').innerHTML="Bitte &uuml;berpr&uuml;fen Sie Ihre Daten in den rot markierten Feldern.";
      } else {
          document.getElementById('check').innerHTML="Bitte &uuml;berpr&uuml;fen Sie Ihre Daten im rot markierten Feld.";

      }
    }
    return ret_pruefen;
}

