1 $(document).ready(function(){
3 var $slides = $("ul.promobox li");
4 var $switchers = $("ul#promobox-switcher li");
6 var change_slide = function(slide_no) {
7 var $slide = $($slides.get(slide_no));
8 var $switcher = $($switchers.get(slide_no));
10 $slides.filter('.active').fadeOut();
11 $slides.filter('.active').removeClass('active');
12 $switchers.filter('.active').removeClass('active');
14 $slide.addClass('active');
15 $switcher.addClass('active');
20 $switchers.each(function(i, e) {
21 $(e).click(function(e) {
29 var cycle_slide = function() {
30 var current = $slides.filter('.active').index();
31 change_slide((current + 1) % $slides.length);
33 var reset_timeout = function() {
34 clearTimeout(timeout);
35 timeout = setTimeout(cycle_slide, 5000);
37 timeout = setTimeout(cycle_slide, 3000);