$(document).ready(function() {      
     
    //Execute the slideShow, set 7.5 seconds for each images
    quoteSlideShow(7500);
 
});
 
function quoteSlideShow(qspeed) {
  
    //Set the opacity of all images to 0
    $('ul.quote_slideshow li').css({opacity: 0.0});
     
    //Get the first image and display it (set it to full opacity)
    $('ul.quote_slideshow li:first').css({opacity: 1.0}).addClass('show');
     
    //Call the gallery function to run the slideshow    
    var quote_timer = setInterval('rotateGallery()', qspeed);
     
    //pause the slideshow on mouse over
    $('ul.quote_slideshow').hover(
        function () {
            clearInterval(quote_timer);   
        },
        function () {
            quote_timer = setInterval('rotateGallery()',qspeed);         
        }
    );
     
}
 
function rotateGallery() {
 
 
    //if no IMGs have the show class, grab the first image
    var current_quote = $('ul.quote_slideshow li.show');
    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
    var next_quote = ((current_quote.next().length) ? ((current_quote.next().attr('id') == 'slideshow-caption')? $('ul.quote_slideshow li:first') :current_quote.next()) : $('ul.quote_slideshow li:first'));
    //Set the fade in effect for the next image, show class has higher z-index
    next_quote.css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
 
    //Hide the current image
    current_quote.animate({opacity: 0.0}, 1000).removeClass('show');
 
}
