//
function wsf_add(tableOrTag, recordNum, reload) {
  var $           = jQuery; // see: http://docs.jquery.com/Core/jQuery.noConflict
  var addClass    = _wsf_getClassFor(tableOrTag, recordNum, 'add');
  var removeClass = _wsf_getClassFor(tableOrTag, recordNum, 'remove');

  $.ajax({
    cache: false,
    url: '?_wsf_action=add&tableOrTag=' +escape(tableOrTag)+ '&recordNum=' + escape(recordNum),
    success: function(errorMessage){
      if (errorMessage)   { return alert("Error: " + errorMessage); }
      if (reload == true) { return window.location.reload(); }

      $(addClass).hide();
      $(removeClass).show();
      return true;
    }
  });

}

//
function wsf_remove(tableOrTag, recordNum, reload) {
  var $           = jQuery; // see: http://docs.jquery.com/Core/jQuery.noConflict
  var addClass    = _wsf_getClassFor(tableOrTag, recordNum, 'add');
  var removeClass = _wsf_getClassFor(tableOrTag, recordNum, 'remove');

  //
  $.ajax({
    cache: false,
    url: '?_wsf_action=remove&tableOrTag=' +escape(tableOrTag)+ '&recordNum=' + escape(recordNum),
    success: function(errorMessage){
      if (errorMessage)   { return alert("Error: " + errorMessage); }
      if (reload == true) { return window.location.reload(); }

      $(addClass).show();
      $(removeClass).hide();
      return true;
    }
  });
}

// var className = _wsf_getClassFor(tableOrTag, recordNum, action);
function _wsf_getClassFor(tableOrTag, recordNum, action) {
  var className = ".wsf_" + action + '_' + tableOrTag + '_' + recordNum;
  return className;
}
