Here you can find the source of delay(timeout)
Function.prototype.delay = function(timeout){ return setTimeout(this, timeout); };
window.Delay = (function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); }; })();