(function(a){a.fn.extend({everyTime:function(c,d,e,f,b){return this.each(function(){a.timer.add(this,c,d,e,f,b)})},oneTime:function(b,c,d){return this.each(function(){a.timer.add(this,b,c,d,1)})},stopTime:function(b,c){return this.each(function(){a.timer.remove(this,b,c)})}});a.extend({timer:{guid:1,global:{},regex:/^([0-9]+)\s*(.*s)?$/,powers:{ms:1,cs:10,ds:100,s:1000,das:10000,hs:100000,ks:1000000},timeParse:function(d){if(d==undefined||d==null){return null}var b=this.regex.exec(a.trim(d.toString()));if(b[2]){var c=parseInt(b[1],10);var e=this.powers[b[2]]||1;return c*e}else{return d}},add:function(f,d,e,h,i,c){var b=0;if(a.isFunction(e)){if(!i){i=h}h=e;e=d}d=a.timer.timeParse(d);if(typeof d!="number"||isNaN(d)||d<=0){return}if(i&&i.constructor!=Number){c=!!i;i=0}i=i||0;c=c||false;if(!f.$timers){f.$timers={}}if(!f.$timers[e]){f.$timers[e]={}}h.$timerID=h.$timerID||this.guid++;var g=function(){if(c&&this.inProgress){return}this.inProgress=true;if((++b>i&&i!==0)||h.call(f,b)===false){a.timer.remove(f,e,h)}this.inProgress=false};g.$timerID=h.$timerID;if(!f.$timers[e][h.$timerID]){f.$timers[e][h.$timerID]=window.setInterval(g,d)}if(!this.global[e]){this.global[e]=[]}this.global[e].push(f)},remove:function(d,c,e){var f=d.$timers,b;if(f){if(!c){for(c in f){this.remove(d,c,e)}}else{if(f[c]){if(e){if(e.$timerID){window.clearInterval(f[c][e.$timerID]);delete f[c][e.$timerID]}}else{for(var e in f[c]){window.clearInterval(f[c][e]);delete f[c][e]}}for(b in f[c]){break}if(!b){b=null;delete f[c]}}}for(b in f){break}if(!b){d.$timers=null}}}}});if(a.browser.msie){a(window).one("unload",function(){var e=a.timer.global;for(var b in e){var d=e[b],c=d.length;while(--c){a.timer.remove(d[c],b)}}})}})(jQuery);
