ptm(function(){ _slideautochange = setinterval("ptm.slideautochange()",3500); ptm('#wk_slide-nav li.wk_nav-bullet-container').click(function(){ clearinterval(_slideautochange); ptm('#wk_slide-nav li.wk_nav-bullet-container').removeclass('active').eq(ptm(this).index()).addclass('active'); ptm('.wk_slide-wrap li').removeclass('wk_selected').eq(ptm(this).data('index')).addclass('wk_selected'); _slideautochange = setinterval("ptm.slideautochange()",3500); }) ptm.extend({ slideautochange:function(){ curr = ptm('.wk_slide-wrap li.wk_selected'); if(curr.next().size()>0){ next = curr.next(); } else{ next = ptm('.wk_slide-wrap li:first'); } curr.removeclass('wk_selected'); next.addclass('wk_selected'); ptm('#wk_slide-nav li.wk_nav-bullet-container').removeclass('active').eq(next.index()).addclass('active'); } }) //_slideautochange = setinterval("ptm.slideautochange()",5000); });