/**
 * Augment JavaScript
 *
 * Many of the functions here come from Douglas Crockford's book "JavaScript: 
 * The Good Parts".
 */
(function () {

  Object.beget = function (o) {
    var F = function () {};
    F.prototype = o;
    return new F();
  };

  Function.prototype.method = function (name, func) {
    this.prototype[name] = func;
    return this;
  };

  Number.method('integer', function () {
    return Math[this < 0 ? 'ceiling' : 'floor'](this);
  });

  String.method('trim', function () {
    return this.replace(/^\s+|\s+$/g, '');
  });

})();

