$$.extend({
  Project18 : {
    Ready : function()
    {
    
    },
    
    CheckResponseCode : function(json, $action)
    {
      var $response = parseInt(json);
      
      if (!isNaN($response) && $response <= 0) {
        var $error = '';
        switch ($response) {
          case 0: {
            $error = 'An unknown error has occurred.';
            break;
          }
          case -1: {
            $error = 'You are not authorized to perform this action.';
            break;
          }
          case -6: {
            $error = 
              "Unable to complete this action because you are no longer logged into the website.\n" +
              "Please login and try again.";
            break;
          }
          case -5: {
            $error = "Required information is missing from the request.\n";
          }
        }
        
        if ($error) {
          alert(
            $action + "\n\n" +
            $error          
          );
          
          return false;
        }
      }

      return true;
    }
  }
});

$(document).ready(
  function() {
    $$.Project18.Ready();
  }
);