/** jquery timer, by viticm( viticm@126.com ) **/ !function(a,b){a.timer=a.timer||{},a.timer.console=a.timer.console||{},"undefined"==typeof console?a.extend(a.timer.console,{error:function(a){alert("[error] "+a)},warn:function(a){alert("[warning] "+a)},log:function(a){alert("[log] "+a)}}):a.timer.console=console,a.extend(a.timer,{version:"1.0.1",options:{itimerdelay:1e3,irepeatcount:10,icurrentcount:0,brunning:!1,crepeattype:null==this.irepeatcount||1>this.irepeatcount?"interval":"timeout",bcompleted:!1,timereventrun:{bbubbles:!1,bcancleable:!1},timereventcomplete:{bbubbles:!1,bcancleable:!1},funclistener:null,bdebug:!1,name:"",obj_startdate:null,userdata:{}},itimerid:0,obj_timereventrun:null,obj_timereventcomplete:null,handler:{}}),a.extend(a.timer,{init:function(b){a.extend(this.options,this.options,b||{}),this.obj_timereventrun=this.timerevent.init(this.timereventrun),this.obj_timereventcomplete=this.timerevent.init(this.timereventcomplete);var c=[];return c[this.timerevent.timer]=[],c[this.timerevent.timer_complete]=[],this.handler=c,a.extend(!0,{},this)}}),a.extend(a.timer,{timerevent:{ctype:"timer",bbubbles:!1,bcancleable:!1,init:function(a){var a="undefined"==typeof a?{}:a;return this.ctype=b===a.ctype?this.ctype:a.ctype,this.bbubbles=a||b===a.bbubbles?this.bbubbles:a.bbubbles,this.bcancleable=b===a.bcancleable?this.bcancleable:a.bcancleable,this},timer:"timer",timer_complete:"timercomplete",tostring:function(){return"[timerevent type="+this.ctype+" bubbles="+this.bbubbles+" cancleable="+this.bcancleable+"]"}}}),a.extend(a.timer,{addeventlistener:function(b,c,d){(this.timerevent.timer==b||this.timerevent.timer_complete==b)&&(c||!0!==this.options.bdebug||a.timer.console.warn("not found listener function! timer name: "+this.options.name),!0===d?this.handler[b].splice(0,0,[c]):this.handler[b].push(c))},removeeventlistener:function(a,b){var c,d;if(this.timerevent.timer===a||this.timerevent.timer_complete===a)if(b){for(c=this.handler[a],d=0;c>d;d++)if(b===c[d]){c.splice(d,1);break}}else this.handler[a]=[]},delayexecute:function(a){var b=this;this.dispatchlistener(a,this.obj_timereventrun),this.options.icurrentcount++,this.options.icurrentcount