function przeslij(form)
{
 if (form.event.value=='')
 {
  alert('Nie opisano zdarzenia!');
  form.event.focus();
  return false;
 }
 if (form.title.value=='')
 {
  alert('Nie podano autora (podpis pod zdjęciami i tekstem)!');
  form.event.focus();
  return false;
 }
 if (form.state.selectedIndex==0)
 {
  alert('Nie wybrano województwa!');
  form.state.focus();
  return false;
 }
 if (form.name.value=='')
 {
  alert('Nie podano imienia!');
  form.name.focus();
  return false;
 }
 if (form.surname.value=='')
 {
  alert('Nie podano nazwiska!');
  form.surname.focus();
  return false;
 }
 if (form.email)
 {
  if (!check_email(form.email.value))
  { 
   alert('Podano błedny email');
   form.email.focus();
   return false;
  } 
 }
 if (form.phone.value=='')
 {
  alert('Nie podano numeru telefonu!');
  form.phone.focus();
  return false;
 }
 if (!form.regulamin.checked)
 {
  alert('Musisz zakceptować regulamin serwisu');
  form.regulamin.focus();
  return false;
 }
 if (form.code.value=='')
 {
  alert('Nie podano kodu z obrazka!');
  form.code.focus();
  return false;
 }
 form.submit();
}
var curImg = 0;
function eraseImg(id)
{
 var iField = document.getElementById('imageField');
 var img = document.getElementById(id);
 var imageBtn = document.getElementById('imageBtn');
 var imgCount = iField.childNodes.length;
 
 img.parentNode.removeChild(img);
 
 if (imgCount==1) imageBtn.value = 'Dodaj zdjęcie >>';
 if (imgCount <= 3) 
  {
   imageBtn.style.display = 'inline';
  }
}
function showUploadForm()
{
  var iField = document.getElementById('imageField');
  var imgCount = iField.childNodes.length+1;
  var imageBtn = document.getElementById('imageBtn');
  
  if (imgCount>=1) imageBtn.value = 'Dodaj inne zdjęcie »»';
  
  if (imgCount<=3)
  {
  idImg = "oneImage"+curImg;
  html = "<div class='get-field'>"
       + "<div class='get-field-title'>Wybierz zdjęcie do dodania</div>" 
       + "<div class='get-field-input'><input class='buttony' type='file' name='imagesrc[]' accept='image/jpeg' /><input type='button' class='buttony' value='Usuń zdjęcie' onclick='eraseImg("+"\""+idImg+"\""+")' /></div>"
       + "</div>"
       + "<div class='get-field'>"
       + "<div class='get-field-title'>Opisz zdjęcie</div>"
       + "<div class='get-field-input'><textarea class='event' name='content[]'></textarea></div>"
       + "</div>";
   
  tmp = document.createElement('div');
  tmp.className = 'oneImage';
  tmp.id = idImg;
  tmp.innerHTML = html;
  iField.appendChild(tmp);     
  

  curImg++;
  } 
  
  imgCount = iField.childNodes.length+1;
  
  if (imgCount > 3) 
  {
   imageBtn.style.display = 'none';
  }
  
}
