(function($) {

    $.fn.cn_crossFade = function(options) {

        var defaults = {			
    		speed: 1000,
            pause: 10000
    	};
	
        var options = $.extend(defaults, options);
        
        this.each(function(){
            
            var obj = $(this);
        
            function cn_crossSlide(x) { 
    
                $('li:animated', obj).stop();
    
                var iteLen = $('li', obj).length;
    
                var toIndex = parseInt(x);
                var nextIndex = toIndex != (iteLen - 1) ? parseInt(toIndex + 1) : 0;
                var prevIndex = toIndex != 0 ? parseInt(toIndex - 1) : parseInt(iteLen - 1);
                
                $($('li', obj).get(prevIndex)).fadeOut('fast', function(){
                    $(obj).hide().show();
                    $($('li', obj).get(toIndex)).fadeIn('slow');
                });
                
                crossSlideTimeout = setTimeout(function(){
    				cn_crossSlide(nextIndex);
    			}, options.pause);
    
            }

            var items = $('li', obj);
            items.hide();
            items.first().show();

            crossSlideTimeout = setTimeout(function(){
    			cn_crossSlide(1);
    		}, options.pause);    
        });
    };
    
})(jQuery);
