//
function wss_add(url, reload) {
  var $ = jQuery; // see: http://docs.jquery.com/Core/jQuery.noConflict

  var searchName = prompt("Enter a name for this search:");
  if (searchName == null) { return false; }
  if (searchName == '')   { return alert("Error: No search name entered!"); }

  $.ajax({
    url: '?_wss_action=add&url=' +encodeURIComponent(url)+ '&name=' + encodeURIComponent(searchName),
    success: function(errorMessage){
      if (errorMessage)   { return alert("Error: " + errorMessage); }
      if (reload == true) { return window.location.reload(); }

      $('.wss_add').hide();
      $('.wss_remove').show();
      return true;
    }
  });

}

//
function wss_remove(url, reload) {
  var $ = jQuery; // see: http://docs.jquery.com/Core/jQuery.noConflict

  //
  $.ajax({
    url: '?_wss_action=remove&url=' +encodeURIComponent(url),
    success: function(errorMessage){
      if (errorMessage)   { return alert("Error: " + errorMessage); }
      if (reload == true) { return window.location.reload(); }

      $('.wss_add').show();
      $('.wss_remove').hide();
      return true;
    }
  });
}

