
function validateReactForm()
{
 var ret = false;
 
 if($("#reactName").val()=="") $("#reactFormMessageName").html("Prosím uveďte Vaše jméno");
 else
  {
  if($("#reactText").val()=="") $("#reactFormMessageText").html("Prosím vyplňte text příspěvku");   
  else ret = true; 
  }
 return ret;
}

function addReact(phpsessid)
//call handling script, add reaction and close react
{ 
 $("#postReactButton").attr("disabled","disabled");
 //call with php sessid
 $.post("/utils/addReact.php", { PHPSESSID:phpsessid,reactName:$("#reactName").val(),reactText:$("#reactText").val(),postId:$("#postId").val(),token:$("#token").val()},
  function(data){
  //get new html
  var newReactHTML = data;
  //add html
  //alert(data);
  $("#reactions").append('<div class="reaction">'+newReactHTML+'</div>');
   //null text
 $("#reactText").val('');       
  
 $("#postReactButton").attr("disabled","");
  }, "text");

}

