function FormEDTUsrDataValidator(theForm){
  if (theForm.imie.value == ""){
     alert("Dla ułatwienia kontaktu proszę podać swoje imię.");
	 theForm.imie.focus();
	 return (false);
  }

  if (theForm.nazwisko.value == ""){
   	 alert("Dla ułatwienia kontaktu proszę podać swoje nazwisko.");
	 theForm.nazwisko.focus();
	 return (false);
  }
  //czy wypelnione pole dzien ur
  if (theForm.stanowisko.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać swoje stanowisko w pracy.");
	 theForm.stanowisko.focus();
	 return (false);
  }

  if (theForm.firma.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać nazwę firmy.");
	 theForm.firma.focus();
	 return (false);
  }
  
  if (theForm.miasto.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać miasto, w którym znajduje się siedziba firmy.");
	 theForm.miasto.focus();
	 return (false);
  }
  
  var alertsay = "";
  if (theForm.nip.value.length < 13){
 	alert("Dla ułatwienia kontaktu proszę podać NIP firmy.");
	theForm.nip.focus();
	return (false);
  }
  
  if (theForm.kod.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać kod pocztowy firmy.");
	 theForm.kod.focus();
	 return (false);
  }
  
  if (theForm.telefon.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać telefon kontaktowy.");
	 theForm.telefon.focus();
	 return (false);
  }
  
  if (theForm.adres.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać adres firmowy.");
	 theForm.adres.focus();
	 return (false);
  }

  if (theForm.wojew.value == 0){
  	 alert("Dla ułatwienia kontaktu proszę podać województwo, w którym działa firma.");
	 theForm.wojew.focus();
	 return (false);
  }
  
  //sprawdza miala
  var checkEmail = "@ .";
  var checkStr = theForm.email.value;
  var EmailValid = false;
  var EmailAt = false;
  var EmailPeriod = false;
  var EmailSpace = false;
  for (i = 0;  i < checkStr.length;  i++){
  	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkEmail.length;  j++){
	  	  if (ch == checkEmail.charAt(j) && ch == "@") EmailAt = true;
		  if (ch == checkEmail.charAt(j) && ch == ".") EmailPeriod = true;
		  if (ch == checkEmail.charAt(j) && ch == " ") EmailSpace = true;
		  if (EmailAt && EmailPeriod && (!EmailSpace)) break;
		  if (j == checkEmail.length) break;
	  }
	  // if both the @ and . were in the string
	  if (EmailAt && EmailPeriod && (!EmailSpace)){
		  EmailValid = true
		  break;
	  }
  }
  if (!EmailValid){
  	 alert("Nieprawidłowa składnia w polu Email lub brak wpisu");
	 theForm.email.focus();
	 return (false);
  }
}

function FormEDTUsrPasValidator(theForm){
 var alertsay = "";
 if (theForm.sernik.value.length < 5){
 	alert("Długość Hasła musi mieć przynajmniej 5 znaków.");
	theForm.sernik.focus();
	return (false);
 }

 if (theForm.login.value == ""){
 	alert("Login nie został wypełnione.");
	theForm.login.focus();
	return (false);
 }
}

function FormSerchUsrDataValidator(theForm){
 var alertsay = "";
 if (theForm.nsearchname.value.length < 3){
 	alert("Proszę podać co najmniej 3 litery nazwiska.");
	theForm.nsearchname.focus();
	return (false);
 }
}
function FormSerch2UsrDataValidator(theForm){
 var alertsay = "";
 if (theForm.nsearchalbum.value.length < 3){
 	alert("Proszę podać co najmniej 3 znaki numeru albumu.");
	theForm.nsearchalbum.focus();
	return (false);
 }
}

function checkWiadomosc(pFormularz){
  //sprawdza miala
  var formularz = document.forms[pFormularz];	
  alert(formularz.action);
  var checkEmail = "@ .";
  var checkStr = formularz.pocztaOd.value;
  var EmailValid = false;
  var EmailAt = false;
  var EmailPeriod = false;
  var EmailSpace = false;
  var EmailTemat = false;
  var EmailWiadomosc = false;
  var WiadomoscOK = false;
  for (i = 0;  i < checkStr.length;  i++){
  	  ch = checkStr.charAt(i);
	  for (j = 0;  j < checkEmail.length;  j++){
	  	  if (ch == checkEmail.charAt(j) && ch == "@") EmailAt = true;
		  if (ch == checkEmail.charAt(j) && ch == ".") EmailPeriod = true;
		  if (ch == checkEmail.charAt(j) && ch == " ") EmailSpace = true;
		  if (EmailAt && EmailPeriod && (!EmailSpace)) break;
		  if (j == checkEmail.length) break;
	  }
	  // if both the @ and . were in the string
	  if (EmailAt && EmailPeriod && (!EmailSpace)){
		  EmailValid = true
		  break;
	  }
  }
  if (!EmailValid){
  	 alert("Nieprawidłowa składnia w polu Email lub brak wpisu");
	 formularz.pocztaOd.focus();
	 return false;
  }
  if (formularz.temat.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać nazwę firmy.");
	 formularz.temat.focus();
	 return false;
  }else{ EmailTemat = true; }
  
  if (formularz.wiadomosc.value == ""){
  	 alert("Dla ułatwienia kontaktu proszę podać nazwę firmy.");
	 formularz.wiadomosc.focus();
	 return false;
  }else{ EmailWiadomosc = true; }
	  
}