﻿function theRotator1() {
    $('div#rotator1 ul li').css({ opacity: 0.0 });
    $('div#rotator1 ul li:first').css({ opacity: 1.0 });
    setInterval('rotate1()', 2000);
}
function theRotator2() {
    $('div#rotator2 ul li').css({ opacity: 0.0 });
    $('div#rotator2 ul li:first').css({ opacity: 1.0 });
    setInterval('rotate2()', 2000);
}
function theRotator3() {
    $('div#rotator3 ul li').css({ opacity: 0.0 });
    $('div#rotator3 ul li:first').css({ opacity: 1.0 });
    setInterval('rotate3()', 2000);
}
function theRotator4() {
    $('div#rotator4 ul li').css({ opacity: 0.0 });
    $('div#rotator4 ul li:first').css({ opacity: 1.0 });
    setInterval('rotate4()', 2000);
}

function rotate1() {
    var current = ($('div#rotator1 ul li.show') ? $('div#rotator1 ul li.show') : $('div#rotator1 ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator1 ul li:first') : current.next()) : $('div#rotator1 ul li:first'));
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');
};
function rotate2() {
    var current = ($('div#rotator2 ul li.show') ? $('div#rotator2 ul li.show') : $('div#rotator2 ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator2 ul li:first') : current.next()) : $('div#rotator2 ul li:first'));
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');
};
function rotate3() {
    var current = ($('div#rotator3 ul li.show') ? $('div#rotator3 ul li.show') : $('div#rotator3 ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator3 ul li:first') : current.next()) : $('div#rotator3 ul li:first'));
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');
};
function rotate4() {
    var current = ($('div#rotator4 ul li.show') ? $('div#rotator4 ul li.show') : $('div#rotator4 ul li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator4 ul li:first') : current.next()) : $('div#rotator4 ul li:first'));
    next.css({ opacity: 0.0 })
	.addClass('show')
	.animate({ opacity: 1.0 }, 1000);
    current.animate({ opacity: 0.0 }, 1000)
	.removeClass('show');
};

$(document).ready(function() {

    //Load the slideshow
theRotator1();
theRotator2();
theRotator3();
theRotator4();
});
