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);
46 if (!$('#id_presentation').checked) {
47 $('[id^="id_presentation_"]').parent().parent().hide();
49 if (!$('#id_workshop').checked) {
50 $('[id^="id_workshop_"]').parent().parent().hide();
53 $('#id_presentation').change(function() {
55 $('[id^="id_presentation_"]').parent().parent().show('slow');
57 $('[id^="id_presentation_"]').parent().parent().hide('slow');
61 $('#id_workshop').change(function() {
63 $('[id^="id_workshop_"]').parent().parent().show('slow');
65 $('[id^="id_workshop_"]').parent().parent().hide('slow');