$.gritter
    $.gritter.options
    $.gritter.add
    $.gritter.remove
    $.gritter.removeAll
    Gritter
        add
        _countRemoveWrapper
        _fade
        _hoverState
        removeSpecific
        _restoreItemIfFading
        _runSetup
        _setFadeTimer
        stop
        _str_replace
        _verifyWrapper
$.gritter = {};

Set it up as an object under the jQuery namespace


$.gritter.options = {

Set up global options that the user can over-ride


$.gritter.add = function(params){

Add a gritter notification to the screen
see Gritter#add();


$.gritter.remove = function(id, params){

Remove a gritter notification from the screen
see Gritter#removeSpecific();


$.gritter.removeAll = function(params){

Remove all notifications
see Gritter#stop();


var Gritter = {

Big fat Gritter object
constructor (not really since it's object literal)


add: function(params){

Add a gritter notification to the screen
param {Object} params The object that contains all the options for drawing the notification
return {Integer} The specific numeric id to that gritter notification


_countRemoveWrapper: function(unique_id, e){

If we don't have any more gritter notifications, get rid of the wrapper using this check
private
param {Integer} unique_id The ID of the element that was just deleted, use it for a callback
param {Object} e The jQuery element that we're going to perform the remove() action on


_fade: function(e, unique_id, params, unbind_events){

Fade out an element after it's been on the screen for x amount of time
private
param {Object} e The jQuery element to get rid of
param {Integer} unique_id The id of the element to remove
param {Object} params An optional list of params to set fade speeds etc.
param {Boolean} unbind_events Unbind the mouseenter/mouseleave events if they click (X)


_hoverState: function(e, type){

Perform actions based on the type of bind (mouseenter, mouseleave)
private
param {Object} e The jQuery element
param {String} type The type of action we're performing: mouseenter or mouseleave


removeSpecific: function(unique_id, params, e, unbind_events){

Remove a specific notification based on an ID
param {Integer} unique_id The ID used to delete a specific notification
param {Object} params A set of options passed in to determine how to get rid of it
param {Object} e The jQuery element that we're "fading" then removing
param {Boolean} unbind_events If we clicked on the (X) we set this to true to unbind mouseenter/mouseleave


_restoreItemIfFading: function(e, unique_id){

If the item is fading out and we hover over it, restore it!
private
param {Object} e The HTML element to remove
param {Integer} unique_id The ID of the element


_runSetup: function(){

Setup the global options - only once
private


_setFadeTimer: function(e, unique_id){

Set the notification to fade out after a certain amount of time
private
param {Object} item The HTML element we're dealing with
param {Integer} unique_id The ID of the element


stop: function(params){

Bring everything to a halt
param {Object} params A list of callback functions to pass when all notifications are removed


_str_replace: function(search, replace, subject, count){

An extremely handy PHP function ported to JS, works well for templating
private
param {String/Array} search A list of things to search for
param {String/Array} replace A list of things to replace the searches with
return {String} sa The output


_verifyWrapper: function(){

A check to make sure we have something to wrap our notices with
private