
// Poprawiona i bardziej szczegółowa kontrola danych zamawiającego przed wysłaniem zamówienia.
function kontrola()
{
  if (document.Formularz.imie_i_nazwisko.value == "")
  {
    alert("Proszę podać Imię i Nazwisko lub nazwę firmy !");
    return;
  };
	
  if (document.Formularz.adres.value == "")
  {
    alert("Proszę podać adres !");
    return;
  };	
	
  if (document.Formularz.nip.value == "")
  {
    alert("Proszę podać NIP lub PESEL (osoby prywatne)!");
    return;
  };	  
    
 if (document.Formularz.telefon.value == "")
  {
    alert("Proszę podać numer telefonu wraz z numerem kierunkowym !\nLub numer telefonu komórkowego.");
    return;
  };
	
	
  var dobryEmail=/^[^@]+@([a-z0-9\-]+\.)+[a-z]{2,4}$/i;
	
  if (document.Formularz.adresEmail.value != "")
  {
  
  		if (dobryEmail.test(document.Formularz.adresEmail.value)){
  		
		}else {
  				alert('"' + document.Formularz.adresEmail.value+'" to nie jest poprawny adres e-mail!');
				return;
		}

  };		
	
	
	
	sel = document.getElementById('idadrDost');
	idImieNazwiskoDost = document.getElementById('idImieNazwiskoDost');
	idAdresDost = document.getElementById('idAdresDost');
	idTelefonDost = document.getElementById('idTelefonDost');	
	if(sel.checked != true){
		
		if(idImieNazwiskoDost.value=='' || idAdresDost.value=='' || idTelefonDost.value==''){
			alert("Proszę podać dane dostawy !");
    		return;
		}
	}
  
  
	
	if (document.Formularz.akceptacjaWarunkow.checked != true)
	 {
	   alert("Proszę zaakceptować warunki sprzedaży i gwarancji !");
	   return;
	 };	


	 document.Formularz.submit();

}




function fnc_pokazAdresDostawy(){
	
	sel = document.getElementById('idadrDost');
	selbox = document.getElementById('idDaneDostawy');
	idImieNazwisko = document.getElementById('idImieNazwisko');
	idAdres = document.getElementById('idAdres');
	idTelefon = document.getElementById('idTelefon');
	idImieNazwiskoDost = document.getElementById('idImieNazwiskoDost');
	idAdresDost = document.getElementById('idAdresDost');
	idTelefonDost = document.getElementById('idTelefonDost');
	
	if(sel.checked == true){
		selbox.style.display = 'none';
	}else{
		selbox.style.display = 'block';
		idImieNazwiskoDost.value = idImieNazwisko.value;
		idAdresDost.value = idAdres.value;
		idTelefonDost.value = idTelefon.value;
	}

}




