function validacjaTYP(cel,typ)
{
	if($(cel))
	{ 
		var vartosc = $(cel).value;
		if(typ=='tekst')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				$(cel).style.backgroundColor="#ECFFEC";
				return true;
			}	
		}
		if(typ=='email')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				if(vartosc.indexOf('@')>-1 && vartosc.indexOf('.')>-1)
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;		
				}
				else
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;
				}
			}	
		}
		if(typ=='liczba')
		{
			if(vartosc=='')
			{
				$(cel).style.backgroundColor="#FFD9D9";
				return false;
			}
			else
			{
				vartosc = parseFloat(vartosc );
				if(isNaN(vartosc))
				{
					$(cel).style.backgroundColor="#FFD9D9";
					return false;	
				}
				else
				{
					$(cel).style.backgroundColor="#ECFFEC";
					return true;	
				}
			}	
		}
	}
}

function sprawdzenie()
{
	var komunikat = '';

	
	if(validacjaTYP('kl_ulica','tekst')==false)		{ komunikat = komunikat + 'Ulica' + '\r\n';      }
	if(validacjaTYP('kl_miasto','tekst')==false)	{ komunikat = komunikat + 'Miasto' + '\r\n';      }
	if(validacjaTYP('kl_tel','tekst')==false)		{ komunikat = komunikat + 'Telefon' + '\r\n';      }
	if(validacjaTYP('kl_imie','tekst')==false)		{ komunikat = komunikat + 'Imie' + '\r\n';      }
	if(validacjaTYP('kl_nazwisko','tekst')==false)	{ komunikat = komunikat + 'Nazwisko' + '\r\n';  }
	if(validacjaTYP('kl_email','email')==false)		{ komunikat = komunikat + 'Email' + '\r\n';     }
	if(validacjaTYP('kl_login','tekst')==false)		{ komunikat = komunikat + 'Login' + '\r\n';     }
	if(validacjaTYP('kl_pass','tekst')==false)		{ komunikat = komunikat + 'Haslo' + '\r\n';     }

	if (komunikat!='') 
	{
		alert ('Wymagane pola: \r\n \r\n' + komunikat);
		return false;
	}
	else
	{
		return true;
	}

}










