$(function() {

// ----------------------------------------------------------------------------
// Jquery Custom work - rotate through the images on the homepage
// TODO:  Probably could generalize this
// ----------------------------------------------------------------------------
    var fade_timer = 2000; // millliseconds

    //
    // All 4 images are stacked on top of each other.  FadeOut
    // will make 4,3,2 all transparent exposing one. To make
    // it appear that Image 4 "rotated" back into place
    // fade img#rotate4 in and then restore the opacity of
    // 3 and 2.
    //
    function FadeIn() {
        $('#rotate4').fadeIn(fade_timer, function () {
            $('#rotate3').fadeIn(0);
            $('#rotate2').fadeIn(0);
            FadeOut();
        });
    }

    //
    // All 4 images are stacked on top of each other with img#rotate4
    // on top.  Fade out 4, then 3 then 2 to expose img#rotate1.
    // Don't fade out img#rotate1 though, this will show a blank spot
    // instead call the fadeIn routine to reset things.
    //
    function FadeOut () {
        $('#rotate4').fadeOut(fade_timer, function () {
            $('#rotate3').fadeOut(fade_timer, function () {
                $('#rotate2').fadeOut(fade_timer, FadeIn());
            });
        });
    }
    FadeOut();

});




