﻿  //// COMMON FUNCTIONS -- clone(), supplant(), and trim() courtesy of Douglas Crockford
  ////

  // General Object Constructor, Used For Prototyping
  function clone(o) { 
    function F() {}
    F.prototype = o;
    return new F();
  }

  // Extend String With A Supplant Method
  String.prototype.supplant = function(o) {
    return this.replace(/{([^{}]*)}/g,
      function (a,b) {
        var r = String(o[b]);
        return typeof r === "string" ?
        r : a
      }
    );
  };

  // Extend String With A Trim Method
  String.prototype.trim = function() { return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1"); }  
  
  ////
  //// END COMMON FUNCTIONS
