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');
21 var cycle_slide = function() {
22 var current = $slides.filter('.active').index();
23 change_slide((current + 1) % $slides.length);
27 var reset_timeout = function() {
28 clearTimeout(timeout);
29 timeout = setTimeout(cycle_slide, 5000);
33 if ($slides.length > 1) {
34 $switchers.each(function(i, e) {
35 $(e).click(function(e) {
41 timeout = setTimeout(cycle_slide, 3000);