function validate()
{
  if(document.getElementById('person').value==""){
	  document.getElementById('person').focus();
    alert("Podaj osobę kontaktowa");
	  return false;    		
  }
  
  if(document.getElementById('email').value==""){
	  document.getElementById('email').focus();
    alert("Podaj adres e-mail");
	  return false;    		
  }
  
  if(document.getElementById('telephone').value==""){
	  document.getElementById('telephone').focus();
    alert("Podaj telefon kontaktowy");
	  return false;    		
  }
  
  if(document.getElementById('company_name').value==""){
	  document.getElementById('company_name').focus();
    alert("Podaj nazwę firmy");
	  return false;    		
  }
  
  if(document.getElementById('address').value==""){
	  document.getElementById('address').focus();
    alert("Podaj adres firmy");
	  return false;    		
  }
  
  if(document.getElementById('postal_code').value==""){
	  document.getElementById('postal_code').focus();
    alert("Podaj kod pocztowy");
	  return false;    		
  }
  
  if(document.getElementById('city').value==""){
	  document.getElementById('city').focus();
    alert("Podaj miejscowosc");
	  return false;    		
  }
  
  if(document.getElementById('nip').value==""){
	  document.getElementById('nip').focus();
    alert("Podaj NIP");
	  return false;    		
  }
  
  if(document.getElementById('invoice_company_name').value==""){
	  document.getElementById('invoice_company_name').focus();
    alert("Podaj nazwę firmy do faktury");
	  return false;    		
  }
  
  if(document.getElementById('invoice_address').value==""){
	  document.getElementById('invoice_address').focus();
    alert("Podaj adres firmy do faktury");
	  return false;    		
  }
  
  if(document.getElementById('invoice_postal_code').value==""){
	  document.getElementById('invoice_postal_code').focus();
    alert("Podaj kod pocztowy do faktury");
	  return false;    		
  }
  
  if(document.getElementById('invoice_city').value==""){
	  document.getElementById('invoice_city').focus();
    alert("Podaj miejscowosc do faktury");
	  return false;    		
  }
  
  if(document.getElementById('invoice_nip').value==""){
	  document.getElementById('invoice_nip').focus();
    alert("Podaj NIP do faktury");
	  return false;    		
  }
  
}

function person_equal_invoice_func()
{
  if(document.getElementById('person_equal_invoice').checked==true){
  
    document.getElementById('invoice_company_name').value = document.getElementById('company_name').value;
    document.getElementById('invoice_address').value = document.getElementById('address').value;
    document.getElementById('invoice_postal_code').value = document.getElementById('postal_code').value;
    document.getElementById('invoice_city').value = document.getElementById('city').value;
  	document.getElementById('invoice_nip').value = document.getElementById('nip').value;
  
  } else {
  
    document.getElementById('invoice_company_name').value = "";
    document.getElementById('invoice_address').value = "";
    document.getElementById('invoice_postal_code').value = "";
    document.getElementById('invoice_city').value = "";
  	document.getElementById('invoice_nip').value = "";  
  
  }
  
}
