/* slider with hover effect is a script from Queness by Kevin-liew and adapted by Prathap.karumanchi */

    $(document).ready(function() {
        //Execute the slideShow
        slideShow();
        gallery();
    });

function slideShow() {
    $('#gallery li').css({opacity: 0.0});
    $('#gallery li:first').css({opacity: 1.0});
    $('#gallery .caption').css({opacity: 0.7});
    $('#gallery .caption').css({width: $('#gallery li').find('img').css('625')});
    $('#gallery .content').html($('#gallery li:first').find('a')).animate({opacity: 0.7}, 1000);

    setInterval('gallery()',4000);
}

function gallery() {
    var current = ($('#gallery li.show')?  $('#gallery li.show') : $('#gallery li:first'));
    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery li:first') :current.next()) : $('#gallery li:first'));
    var caption = next.find('img').attr('a');

    $('#gallery .caption').animate({opacity: 0.7}, 100 ).slideDown('slow'), ({ queue:true, duration:50 });
    $('#gallery .caption').animate({opacity: 0.7}, 2500 ).slideUp('slow'), ({ queue:true, duration:500 });
    $('#gallery .content').html(caption);

        //Set the fade in effect for the next image, show class has higher z-index
    next.css({opacity: 0.0})
    .addClass('show')
    .animate({opacity: 1.0}, 1000);

    //Hide the current image
    current.animate({opacity: 0.0}, 1000)
    .removeClass('show');
}
