(function($) { 
        
	// plugin definition 
	$.fn.randomize = function(options) { 
	
		// build main options before element iteration 
		var opts = $.extend({}, $.fn.randomize.defaults, options); 

		// iterate and reformat each matched element 
		return this.each(function() { 
			$this = $(this); 
			// build element specific options 
			var o = $.metadata ? $.extend({}, opts, $this.metadata()) : opts; 

			//functionality

			var int = o.interval;
			var els = $this.children();
			var show = o.showClass;
			setTimeout(function(){
				$(els).removeClass(show);					
			}, int);
		
			setInterval(function() {
				shuffle(generateRandom());
			}, int);
			
			function generateRandom(){
				var num = Math.floor(els.length * Math.random());
				return num;
			};
		
			function shuffle(idx){
				$(els[idx]).fadeIn('slow');
				setTimeout(function () {
					$(els[idx]).hide();
				}, int-400);
			};
			
			///
		}); 
	}; 
	
	// plugin defaults 
	$.fn.randomize.defaults = { 
			interval: 6000,
			showClass: 'default'
	}; 
})(jQuery); 