function checkForm (t) {
	 if (!ChkInput(t.name, "Název receptu", '', 1))  return false;
	 if (!ChkInput(t.synopsis, "Ingredience", '', 1))  return false;
	 if (!ChkInput(t.desc, "Příprava", '', 1))  return false;
	 if (!ChkInput(t.author, "Autor", '', 1))  return false;
	 if (!ChkInput(t.author_email, "Email", '', 1))  return false;
	 

	 var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid email
	 var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid email
	 if (t.author_email.value && ( reg1.test(t.author_email.value) || !reg2.test(t.author_email.value) )) { // if syntax is valid
		alert ("Položka Email není v požadovaném formátu.");
		t.author_email.focus();
		return false;
	}
	
	if (t.foto.value!=""){
  	var valid_extensions = /(.jpg|.png)$/i;
    if (!valid_extensions.test(t.foto.value)){
      alert('Foto musí být formát JPG nebo PNG, max. velikost 2MB');
      t.foto.select();
      t.foto.focus();
      return false;
    }
  }
	
	return true;
}

function checkFotoForm (t) {
	 /*if (!ChkInput(t.name, "Popis fotografie", '', 1))  return false;
	 if (!ChkInput(t.author, "Autor", '', 1))  return false;*/
	 if (!ChkInput(t.author_email, "Email", '', 1))  return false;
	 

	 var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid email
	 var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid email
	 if (t.author_email.value && ( reg1.test(t.author_email.value) || !reg2.test(t.author_email.value) )) { // if syntax is valid
		alert ("Položka Email není v požadovaném formátu.");
		t.author_email.focus();
		return false;
	}
	
	if (t.foto.value!=""){
  	var valid_extensions = /(.jpg|.png)$/i;
    if (!valid_extensions.test(t.foto.value)){
      alert('Foto musí být formát JPG nebo PNG, max. velikost 2MB');
      t.foto.select();
      t.foto.focus();
      return false;
    }
  } 
  else {
    alert('Vyberte fotografii');
    t.foto.select();
    t.foto.focus();
    return false;
  }
	
	return true;
}
