/* $Id: core.js 9984 2013-03-20 00:00:04Z john $ */

function backRequest(id, notification_id) {
  en4.core.request.send(scriptJquery.ajax({
    url: en4.core.baseUrl + 'poke/index/back-request',
    dataType: 'json',
    data: {
      format: 'json',
      'id': id,
      'notification_id': notification_id,
    },
    success: function(responseJSON) {
      if( !responseJSON.status ) {
        document.getElementById('notifications_' + notification_id).innerHTML = '<div class="request_success">' + responseJSON.error + '</div>';
      } else {
        document.getElementById('notifications_' + notification_id).innerHTML = '<div class="request_success">' + responseJSON.message + '</div>';
      }
    }
  }));
}

function cancelRequest(id, notification_id) {
  en4.core.request.send(scriptJquery.ajax({
    url: en4.core.baseUrl + 'poke/index/cancel-request',
    dataType: 'json',
    data: {
      format: 'json',
      'id': id,
      'notification_id': notification_id,
    },
    success: function(responseJSON) {
      if( !responseJSON.status ) {
        document.getElementById('notifications_' + notification_id).innerHTML = '<div class="request_success">' + responseJSON.error + '</div>';
      } else {
        document.getElementById('notifications_' + notification_id).innerHTML = '<div class="request_success">' + responseJSON.message + '</div>';
      }
    }
  }));
}
