| 1 |
// $Id$
|
| 2 |
var rotor_items = new Array();
|
| 3 |
var actual_item = 0;
|
| 4 |
var rotor_interval = null;
|
| 5 |
$(window).load(
|
| 6 |
function() {
|
| 7 |
// Checks that the rotor enabled variable has being set to true
|
| 8 |
// this must be done also by setting the rotor_time variable and the
|
| 9 |
// rotor div. This is done by the drupal module.
|
| 10 |
if(typeof rotor_enabled != 'undefined' && rotor_enabled) {
|
| 11 |
//debugger;
|
| 12 |
$('.rotor_content > .rotor_tab').click(function() {
|
| 13 |
//clearInterval(rotor_interval);
|
| 14 |
//rotor_interval = null;
|
| 15 |
animate_rotor_item($(this).parent());
|
| 16 |
});
|
| 17 |
animate_rotor_item();
|
| 18 |
wait_next_rotor();
|
| 19 |
}
|
| 20 |
}
|
| 21 |
);
|
| 22 |
|
| 23 |
function animate_rotor_item(rotor_item) {
|
| 24 |
if(typeof rotor_item == "undefined" || typeof rotor_item == "number"){
|
| 25 |
rotor_item = $('.rotor_content').get(actual_item);
|
| 26 |
}
|
| 27 |
$('#rotor > .rotor_content > .rotor_content').hide();
|
| 28 |
$('#rotor > .rotor_content > .rotor_tab').removeClass('selected');
|
| 29 |
$('.rotor_content', rotor_item).show();
|
| 30 |
$('.rotor_tab', rotor_item).addClass('selected');
|
| 31 |
var contents = $('.rotor_content');
|
| 32 |
var actual = contents.get(actual_item);
|
| 33 |
actual_item = (actual_item + 1) % contents.length;
|
| 34 |
}
|
| 35 |
|
| 36 |
function wait_next_rotor() {
|
| 37 |
var contents = $('.rotor_content');
|
| 38 |
if(contents.length > 0) {
|
| 39 |
if (!rotor_interval) {
|
| 40 |
rotor_interval = setInterval(animate_rotor_item, rotor_time * 1000);
|
| 41 |
}
|
| 42 |
}
|
| 43 |
}
|