Function.prototype.debounce=function(d,a){var c=this,b;return function(){function e(){a||c.apply(f,g);b=null}var f=this,g=arguments;if(b)clearTimeout(b);else a&&c.apply(f,g);b=setTimeout(e,d||100)}};Function.prototype.curry=function(){var d=this,a=Array.prototype.slice.call(arguments);return function(){return d.apply(this,a.concat(Array.prototype.slice.call(arguments)))}};
Function.prototype.partial=function(){var d=this,a=Array.prototype.slice.call(arguments);return function(){for(var c=0,b=0;b<a.length&&c<arguments.length;b++)if(a[b]===undefined)a[b]=arguments[c++];return d.apply(this,a)}};Function.prototype.throttle=function(d){var a=this,c=0,b=false;return function(){var e=this,f=arguments,g=(new Date).getTime()-c;if(g>d){a.apply(e,f);b=false;c=(new Date).getTime()}else b||(b=setTimeout(function(){a.apply(e,f);b=false;c=(new Date).getTime()},d-g))}};
Function.prototype.cycle=function(d){for(var a=this,c,b=-1,e=[],f=1,g=arguments.length,j;f<g;f++)e.push((j=arguments[f])instanceof Array?a.curry.apply(a,j):a.curry(j));var i=function h(){var k=this;b=b==e.length-1?0:++b;e[b].call(k);c&&clearTimeout(c);c=setTimeout(h,d);return h};i.stop=function(h){clearTimeout(c);var k=this;e[b=h||0].call(k)};i.start=function(h){b=h||-1;return i()};return i()};
if(!Array.prototype.indexOf)Array.prototype.indexOf=function(d,a){var c=this.length>>>0;a=Number(a)||0;a=a<0?Math.ceil(a):Math.floor(a);if(a<0)a+=c;for(;a<c;a++)if(a in this&&this[a]===d)return a;return-1};
