function BindToObject(fn, self, opt_args) {
  var boundargs = fn.boundArgs_ || [];
  boundargs = boundargs.concat(Array.slice(arguments, 2, arguments.length));

  if (fn.boundSelf_)
    self = fn.boundSelf_;
  if (fn.boundFn_)
    fn = fn.boundFn_;

  var newfn = function() {
    // Combine the static args and the new args into one big array
    var args = boundargs.concat(Array.slice(arguments));
    return fn.apply(self, args);
  }

  newfn.boundArgs_ = boundargs;
  newfn.boundSelf_ = self;
  newfn.boundFn_ = fn;

  return newfn;
}
/**
 * Partially applies a function to a particular "this object" and zero or
 * more arguments. The result is a new function with some arguments of the first
 * function pre-filled and the value of |this| "pre-specified".
 *
 * Remaining arguments specified at call-time are appended to the pre-
 * specified ones.
 *
 * Usage:
 * var barMethBound = BindToObject(myFunction, myObj, "arg1", "arg2");
 * barMethBound("arg3", "arg4");
 *
 * @param fn {string} Reference to the function to be bound
 *
 * @param self {object} Specifies the object which |this| should point to
 * when the function is run. If the value is null or undefined, it will default
 * to the global object.
 *
 * @returns {function} A partially-applied form of the speficied function.
 */
Partially applies a function to a particular "this object" and zero or
more arguments. The result is a new function with some arguments of the first
function pre-filled and the value of |this| "pre-specified".

Remaining arguments specified at call-time are appended to the pre
specified ones.



@param fn {string} Reference to the function to be bound

@param self {object} Specifies the object which |this| should point to
when the function is run. If the value is null or undefined, it will default
to the global object.

@returns {function} A partially-applied form of the speficied function.
Partially applies a function to a particular " this object " and zero or more arguments . The result is a new function with some arguments of the first function pre - filled and the value of |this| " pre - specified " . Remaining arguments specified at call - time are appended to the pre specified ones . @param fn { string } Reference to the function to be bound @param self { object } Specifies the object which |this| should point to when the function is run . If the value is null or undefined it will default to the global object . @returns { function } A partially - applied form of the speficied function .
function BindToObject(fn, self, opt_args) {
  var boundargs = fn.boundArgs_ || [];
  boundargs = boundargs.concat(Array.slice(arguments, 2, arguments.length));
  if (fn.boundSelf_)
    self = fn.boundSelf_;
  if (fn.boundFn_)
    fn = fn.boundFn_;
  var newfn = function() {
    var args = boundargs.concat(Array.slice(arguments));
    return fn.apply(self, args);
  }
  newfn.boundArgs_ = boundargs;
  newfn.boundSelf_ = self;
  newfn.boundFn_ = fn;
  return newfn;
}
function BindToObject ( fn , self , opt_args ) { var boundargs = fn . boundArgs_ || [ ] ; boundargs = boundargs . concat ( Array . slice ( arguments , 2 , arguments . length ) ) ; if ( fn . boundSelf_ ) self = fn . boundSelf_ ; if ( fn . boundFn_ ) fn = fn . boundFn_ ; var newfn = function ( ) { var args = boundargs . concat ( Array . slice ( arguments ) ) ; return fn . apply ( self , args ) ; } newfn . boundArgs_ = boundargs ; newfn . boundSelf_ = self ; newfn . boundFn_ = fn ; return newfn ; }
Partially applies a function to a particular "this object" and zero or
 more arguments.
Partially applies a function to a particular " this object " and zero or more arguments .
// Combine the static args and the new args into one big array