
jQuery.fn.fbfader = function(o) {
 
 // Defaults
 var o = jQuery.extend( {
   speed: 300,
   pause: 3000,
   obj: 'li',
   p: '#default'
 },o);
 
 $(this).each(function(){ 
   //var p = $(this);
   
   // Pause functionality
   
   $(this).hover(function(){
	   clearInterval(t); // Pause
   },function(){
	   transition(o.p); // Resume
   });
   
   // Initial load
   
   $(this).children(o.obj).hide();
   $(this).children(o.obj+':first').show().addClass('fbf_active'); 
   $(this).children(o.obj+':last').addClass('fbf_last');
   transition(o.p);
   
   // Transition interval function
   
   function transition(p){
	   t = setInterval(function(){
		   if($(o.p).children('.fbf_active').hasClass('fbf_last')){
			  $(o.p).children('.fbf_last').removeClass('fbf_active').fadeOut(o.speed);
			  $(o.p).children(o.obj+':first').addClass('fbf_active').fadeIn(o.speed).addClass('fbf_active');
		   }
		   else{
			  $(o.p).children('.fbf_active').removeClass('fbf_active').fadeOut(o.speed).next().fadeIn(o.speed).addClass('fbf_active'); 
		   }
	   },o.pause);
   }
 });
 
};
