function sprawdz()
{
        if (document.form.imie.value.length == 0)
		{
			alert("Prosimy podać imię.\n");
			document.form.imie.focus();
			return false;
		}
	if (document.form.nazwisko.value.length == 0) 
		{
			alert("Prosimy podać nazwisko.\n");
			document.form.nazwisko.focus();
			return false;
		}
	if ((document.form.email.value.length == 0) && (document.form.telefon.value.length == 0))
	{
			alert("Prosimy podać adres email lub telefon.\n");
			document.form.email.focus();
			document.form.email.select();
			return false;
	}
	
        if (document.form.email.value.length != 0)
		if(sprawdzemail(document.form.email) == false)
		{
			alert("Prosimy podać poprawny adres email.\n");
			document.form.email.focus();
			document.form.email.select();
			return false;
		}
	
	if (document.form.zapytanie.value.length == 0) 
	{
		alert("Prosimy wpisać zapytanie.\n");
		document.form.zapytanie.focus();
		return false;
	}
	return true; 
}

function sprawdzemail(adres) 
{	
	a = adres.value.search(/@/i);
	a1 = adres.value.substring(0,a);
	a2 = a1.length;
	
	a = a + 1;
	b = adres.value.indexOf(".");
	b1 = adres.value.substring(a,b);
	b2 = b1.length;
	
	b = b + 1;
	c = adres.value.length;
	c1 = adres.value.substring(b,c);
	c2 = c1.length;

	if(adres.value.indexOf("@") != "-1" && adres.value.indexOf(".") != "-1" && a2 >= 1 && b2 >= 1 && c2 >= 1)
	{
		return true;
	}
	else
	{
		return false;
	}		
}

