/* 
 */
(function($){
    
    $.fn.switchImage = function(parentEl){
        var images = parentEl.children('img'),
            cur = $(images).closest('.display'), next;
            next = (cur.next('img').size()) ? cur.next('img') : $(images).eq(0);
            cur.fadeOut('slow', function(){
                $(this).removeClass('display');
                next.fadeIn('fast').addClass('display');
            });


    }
    
    $.fn.imageRotator = function(options){
        //private vars
        var widget = $(this);
        
        //set the default popup options
        var defaults = {
            displayClass: 'display'
        };
        
        //extend options with defaults
        var options = $.extend(defaults, options);
        
        setInterval(function(){
            $.fn.switchImage(widget);
        }, 8000);
        
    };
    
})(jQuery);

$(document).ready(function() {
    $('#rotate').imageRotator();
});