/**
 * SNAMP JS Library
 *
 * Just a namespace and handful of functions to make life a little easier.
 */

if (typeof jQuery == 'undefined') {
  if (typeof console != 'undefined') {
    console.error("jQuery is missing! snamp.js requires jQuery, so you'll " +
                  "need to include jQuery before including this library");
  };
  throw "jQuery is missing! snamp.js requires jQuery, so you'll " +
        "need to include jQuery before including this library";
};

// Let's create a namespace for our custom code
var SNAMP = function() {
  return {};
}();

// Just a convenience function for toggling the text in an element.
SNAMP.toggleText = function(elt, first, second) {
  if (elt.text() == first) { elt.html(second); }
  else { elt.html(first); };
};

// Just a convenience function for toggling the text in an element.
SNAMP.toggleClasses = function(elt, first, second) {
  if (elt.hasClass(first)) { 
    elt.removeClass(first);
    elt.addClass(second);
  }
  else {
    elt.removeClass(second);
    elt.addClass(first);
  };
};

