
function commentFormClose(){
		          $("#comment_form_dialog").hide('slow');
		          $("#comment_form_dialog").remove();        
}
		    
function commentFormSend(){
    
         $("#comment_form_button input").hide();
         $("#comment_form_dialog .error").html('<div><img  src="/_items/img/facebox/loading.gif" alt="Wysyłanie..."></div>');

          var data = $("#comment_form_dialog #comment_form").serialize();
    			$.ajax({
    				type: "POST",
    				url: "/ajax.php",
    				data: data,
            dataType: "json",
    
            success: function(json) {
              
              if(json.error) {
                  var message='';
    
    				      for(i=0;i< json.error.length; i++) {
                     message+='<div>'+ json.error[i].message+ '<\/div>';
                  }
                  $("#comment_form_button input").show();
                  $("#comment_form_dialog .error").html('<div>'+message+'<\/div>');
                  
                  return;
              }
              
              else if(json.success) {
                  $("#comment_form_dialog .content").html('<div class="success">'+json.success.message+'<\/div>');
                  $("#comment_form_dialog .footer").hide();
                  return;
              }
          }
          });
}

