/*
 * Author: Ravneet Singh
 * Email: thecheatah@gmail.com
 * This code can only be used if Ravneet Singh has authorized to do so.
 */

function objfn(fn, obj)
  {
  this.fn = fn;
  this.obj = obj;
  }

objfn.prototype.runArr = function(arr)
  {
  if (this.obj == null)
    {
    return this.fn.apply(this, arr);
    }else
    {
    return this.obj[this.fn].apply(this.obj, arr);
    }
  }

objfn.prototype.run = function()
  {
  if (this.obj == null)
    {
    return this.fn.apply(this, arguments);
    }else
    {
    return this.obj[this.fn].apply(this.obj, arguments);
    }
  }

function threadBreakCaller(ofn)
  {
  this.ofn = ofn;
  }

threadBreakCaller.prototype.runArr = function(arr)
  {
  var parent = this;
  var fn = function()
    {
    parent.ofn.runArr(arr);
    }
  setTimeout(fn, 1);
  }

threadBreakCaller.prototype.run = function()
  {
  var origArgs = arguments;
  var parent = this;
  var fn = function()
    {
    (new objfn('run', parent.ofn)).runArr(origArgs);
    }
  setTimeout(fn, 1);
  }
