bioBlog = {
    
};

bioBlog.clickNodeRemove = function(id)
{
  if(!id)
    return;
  modalWindow.confirm('Удалить запись?', function() {bioBlog.removeNode(id)}, false);
};

bioBlog.removeNode = function(id) {
  if(!id)
    return;
  bioUtils.ajax({
    url: '/member_blog/ajax_remove',
    data: {id: id},
    success: function(data)
    {
      if(data.message)
      {
        alert(data.message);  
      }
      if(data.location)
        window.location = data.location;
      else
        window.location.reload();
      return true;
    }
  });
};

bioBlog.setBest = function(el, id) {
  el = jQuery(el.parentNode).find('#mod_set_best');
  if(!id || !el.length)
    return;
  var value = 0 + el.attr('checked');
  bioUtils.ajax({
    url: '/member_blog/ajax_set_best',
    data: {id: id, value: value},
    success: function(data)
    {
      if(data.error)
      {
        alert(data.error);
        return;
      }
      if(data.message)
        alert(data.message);
      return true;
    }
  });
};


