function error(tekst) {
	if (czy_blad) return;
		window.alert(tekst);
czy_blad = true;
}
function sprawdzenie() {
	czy_blad = false;
	var bledy = "";
		var nazwisko = document.formularz.nazwisko.value;
		var email = document.formularz.email.value;
		var telefon = document.formularz.telefon.value;
		if(nazwisko.match(/^((.))+$/) == null)	{bledy += "Brak imienia i nazwiska.\n";	}	
		if(email.match(/^([A-Za-z0-9\-\.]+\w)+@+([A-Za-z0-9\-]*\w)+(\.[A-Za-z]*\w)+$/) == null)	{bledy += "Brak lub błąd emaila.\n";}
		if(telefon.match(/^([0-9\-\(\)\[\]\s])+$/) == null)	{bledy += "Brak lub błąd nr telefonu\n";}		
        if (document.formularz.zapytanie.value == "") bledy += "Nie podałeś treści zapytania.";
		if (bledy != "")  error(bledy); 
	spr_nazwisko();
	spr_email();
	spr_telefon();
return !czy_blad;
}
function spr_nazwisko(){
	var nazwisko = document.formularz.nazwisko.value;
	if(nazwisko.match(/^((.))+$/) == null){
		document.formularz.nazwisko.style.border = "solid 1px red";
		document.getElementById('info_spr_nazwisko').style.color = "red";
		document.getElementById('info_spr_nazwisko').innerHTML = "Wpisz imię i nazwisko";
	} else {
		document.formularz.nazwisko.style.border = "solid 1px green";
		document.getElementById('info_spr_nazwisko').style.color = "green";
		document.getElementById('info_spr_nazwisko').innerHTML = "ok";
	}
}
function spr_email(){
	var email = document.formularz.email.value;
	if(email.match(/^([A-Za-z0-9\-\.]+\w)+@+([A-Za-z0-9\-]*\w)+(\.[A-Za-z]*\w)+$/) == null){
		document.formularz.email.style.border = "solid 1px red";
		document.getElementById('info_spr_email').style.color = "red";
		document.getElementById('info_spr_email').innerHTML = "Niepoprawny adres e-mail";
	} else {
		document.formularz.email.style.border = "solid 1px green";
		document.getElementById('info_spr_email').style.color = "green";
		document.getElementById('info_spr_email').innerHTML = "ok";
	}
}
function spr_telefon(){
	var telefon = document.formularz.telefon.value;
	if(telefon.match(/^([0-9\-\(\)\[\]\s])+$/) == null){
		document.formularz.telefon.style.border = "solid 1px red";
		document.getElementById('info_spr_telefon').style.color = "red";
		document.getElementById('info_spr_telefon').innerHTML = "Wpisz swój nr telefonu";
	} else {
		document.formularz.telefon.style.border = "solid 1px green";
		document.getElementById('info_spr_telefon').style.color = "green";
		document.getElementById('info_spr_telefon').innerHTML = "ok";
	}
}
