Function.prototype.executePeriodically = function (){ var s = this; if (typeof arguments[0].callee != 'undefined'){ var arquments = arguments[0]; } else { var arquments = arguments; } var delay = arquments[0]; var timesToExecute = arquments[1]; this.__INTERVAL__ = null; var args = []; for (var i=2; i 0){ this.__INTERVAL__ = setTimeout (function (){ arquments[1] = timesToExecute; s.executePeriodically(arquments); },delay); } return s; }