$(document).ready(function()
		{
			$('#formularz').ajaxForm({						
					target: 		'#potwierdzenie',
					beforeSubmit: 	validateForm,
					success:       koniec
			});	
			
			//hide error containers
			$("#nazwisko_error").hide();
			$("#imie_error").hide();
			$("#telefon_error").hide();
			$("#mail_error").hide();
			

		
		
		
		$('#formularz_kup').ajaxForm({						
					target: 		'#potwierdzenie',
					beforeSubmit: 	validateForm_kup,
					success:       koniec
			});	
			
			//hide error containers
			$("#email_error").hide();
			

		});
		
		
		
		
		function koniec() {
		$(".wyslij").hide();
		$("#formularz").hide();
		
		}
				function validateForm()
		{
			$("#nazwisko_error").empty().hide();
			$("#imie_error").empty().hide();
			$("#telefon_error").empty().hide();
			$("#mail_error").empty().hide();
			
			
			var nazwisko 		= $("#imie_nazwisko").val();
			var telefon = $("#telefon").val();
			var mail = $("#mail").val();
			
			var errors 				= 0;
			

			
			
			if (nazwisko == null || nazwisko == '' ||   nazwisko.length  <= '2')   
			{
				$("#nazwisko_error").show().append("Proszę podać nazwisko/ Enter your name");
				errors++;
			}			
			
	
			if (mail == null || mail == '' ||   mail  <= '2')   
			{
				$("#mail_error").show().append("Proszę podać adres email/ Enter your email");
				errors++;
			}
			
			
	
			
			if (errors > 0)
			{
				alert ("Znaleziono błędy w formularzu!/ Thera are errors in the form");
				return false;
			}

		}		
		
		function isNumeric(form_value)
		{
			if (form_value.match(/^\d+$/) == null)
				return false;
			else
				return true;
		}
		

		function validateForm_kup()
		
		{
			$("#nazwisko_error").empty().hide();
			$("#email_error").empty().hide();
			
			
			var nazwisko = $("#imie_nazwisko").val();
			var mail = $("#email").val();
			
			var errors 				= 0;
			

			
			
			if (nazwisko == null || nazwisko == '' ||   nazwisko.length  <= '2')   
			{
				$("#nazwisko_error").show().append("Proszę podać nazwisko/ Enter your name");
				errors++;
			}			
			
	
			if (mail == null || mail == '' ||   mail  <= '2')   
			{
				$("#email_error").show().append("Proszę podać adres email/ Enter your email");
				errors++;
			}
			
			
			if (errors > 0)
			{
				alert ("Znaleziono błędy w formularzu!/ Thera are errors in the form");
				return false;
			}

		}
