function loadNotificationsPopup(element) {
  group_id = element.children("[@selected]").val();
  if (group_id == "not_req" || group_id == "") {
    alert("Please choose a category first")
  } else {
    $('#notifications_popup_content').html($('#loading-icon').html());
    $('#notifications_popup').show();
    $.ajax({
        type:"GET", 
        url: "/notifications/" + group_id + "/node_group",
        success: function(html) { 
          $('#notifications_popup_content').html(html);
        },
        error: function(html) {
          $('#notifications_popup_content').html("<h1 style='padding-top:100px;'>We are sorry but your request could not be processed at this time.</h1>");
        }
      }
    );
  }
}

function addProviderFromSelect(element) {
  opt = element.children('[@selected]');
  if (opt != null) {
    addProvider(opt.val(), opt.html());
  }
}

function addProvider(provider_id, provider_name) {
  if (provider_id != "" && $('.organisation-' + provider_id).length == 0) {  
    $('#combination_man').append('<span class=\'clearfix organisation-' + provider_id + '\'><input type=\'hidden\' value=\'' + 
      provider_id +
      '\' name=\'service_ids[]\' />' +
      provider_name + '<a href="#" onclick="$(this).parent().remove();return false;">remove</a></span>');
  }
}