$(function() {

$(".comment_button").click(function() 
{


var element = $(this);
   
    var boxval = $("#content").val();
	
    var dataString = 'content='+ boxval;
	
	if(boxval=='')
	{
	alert("Sisesta tekst");
	
	}
	else
	{
	$("#flash").show();
	$("#flash").fadeIn(400).html('<img src="/images/ajax.gif" align="absmiddle">&nbsp;<span class="loading">Laen kommentaari...</span>');
$.ajax({
		type: "POST",
  url: "/include/comments/update_data.php",
   data: dataString,
  cache: false,
  success: function(html){
 
  $("ol#update").prepend(html);
  $("ol#update li:first").slideDown("slow");
   document.getElementById('content').value='';
  $("#flash").hide();
	
  }
 });
}
return false;
	});


$('.delete_update').live("click",function() 
{
var ID = $(this).attr("id");
 var dataString = 'msg_id='+ ID;
 
if(confirm("Sure you want to delete this update? There is NO undo!"))
{

$.ajax({
type: "POST",
 url: "/include/comments/delete_data.php",
  data: dataString,
 cache: false,
 success: function(html){
 $(".bar"+ID).slideUp('slow', function() {$(this).remove();});
 }
});

}

return false;
});




});
