function validateForm()
{
	if (document.mailform.adres.value.length<3)
	{
		alert("Proszę uzupełnić pole 'Adres'");
		document.mailform.adres.focus();
		return false;
	}
	
	if ((document.mailform.opis.value.length)<3)
	{
		alert("Proszę wpisać swój opis w polu 'Opis'.");
		document.mailform.opis.focus();
		return false;
	}
	
	if ((document.mailform.opis.value.length)>250)
	{
		alert("Można wpisać maksymalnie 250 znaków w polu 'Opis'");
		document.mailform.opis.focus();
		return false;
	}
	
	if (document.mailform.cena.value.length<2)
	{
		alert("Proszę uzupełnić pole 'Sugerowana cena'");
		document.mailform.cena.focus();
		return false;
	}
	
	if (document.mailform.cena.value.length>=2)
	{
		var Cena = document.mailform.cena.value;
		var theChar = "x";
		for (var i=0; i < Cena.length; i++)
		{
			theChar = Cena.charAt(i);
			if ((theChar == ","))
			{
				Cena = Cena.substring(0,i)+'.'+Cena.substring(i+1,50);
			}
		}

		Cena=Cena*1.0;
		
		if((Cena<=0)||(isNaN(Cena)==true))
		{
			alert("Proszę wpisać poprawnie cenę");
			document.mailform.cena.focus();
			return false;
		}
	}

	if (document.mailform.imienazwisko.value.length<2)
	{
		alert("Proszę uzupełnić pole 'Imię i nazwisko'");
		document.mailform.imienazwisko.focus();
		return false;
	}
	
	if (document.mailform.tel.value.length<7)
	{
		alert("Proszę uzupełnić pole 'Nr telefonu'");
		document.mailform.tel.focus();
		return false;
	}
	
	if (document.mailform.tel.value.length>=7) 
	{
		var ncyfra = 0;var theChar = "x";
		
		for (var i=0; i < document.mailform.tel.value.length; i++)
		{
			theChar = document.mailform.tel.value.charAt(i);
			
			if ((theChar < "0") || (theChar > "9"))
			{
				if ((theChar != " ") && (theChar != "-") && (theChar != "(") && (theChar != ")") && (theChar != "[") && (theChar != "]") && (theChar != "+") && (theChar != ",") && (theChar != "."))
				{
					ncyfra++;
				}   
			}
		}
		
		if (ncyfra>0)
		{
			alert("Proszę wpisać poprawnie nr telefonu, dopuszczalne oprócz cyfr są znaki: minus,plus i nawiasy oraz spacje");
			document.mailform.tel.focus();
			return false;
		}
	}

	
		
	if(!document.mailform.email.value.match(/[^@]+@[a-z0-9-]+\.[a-z0-9-\.]*[a-z]+$/i))
	{
		alert("Wpisano nieporawny adres e-mail");
		return false;
	}
 
	if (document.mailform.zgoda.checked!=true)
	{
		alert("Aby zamieścić ogłoszenie, trzeba wyrazić zgodę\nna przetwarzanie danych zgodnie z zapisem na tej stronie.\n\nJeśli nie wyrażasz takiej zgody, nie zamieszczaj ogłoszenia.");
		document.mailform.zgoda.focus();
		return false;
	}

	return true;
}