jQuery.fn.newsfade = function(options) {
  var defaults = {
    speed: 1000,
    pause: 5000,
    hover_pause: 1200,
    width: $(this).children().width(),
    height: $(this).children().height()
  };
  
  options = $.extend(defaults, options);
  
  var $this = $(this);
  var content_current = 0;
  var is_working = false;
  var child_count = $this.children().size();
  
  for(var i = 0; i < child_count; i++) {
    if($this.children().eq(i).width() > options.width)
      options.width = $this.children().eq(i).width();
      
    if($this.children().eq(i).height() > options.height)
      options.height = $this.children().eq(i).height();
  }
  
  options.height += 10;
    
  function effect() {
    if(is_working) return false;
     
    is_working = true;
    
    var content_next = content_current + 1;
    if(content_next == child_count) content_next = 0;
    
    $this.children().eq(content_current).slideUp(options.speed,
      function() {
            $this.children().eq(content_next).slideDown(options.speed,
          function() { content_current = content_next; is_working = false; }
        );
      }    
    );
    
    return true;
  }
  
  function set_interval() {
    $.i = setInterval( function() {
      effect();
    }, options.pause);
  }
  
  function clear_interval() {
    if($.i) clearInterval($.i);
    if($.t) clearTimeout($.t);
  }
  
  if (child_count > 1) {  
    $this.wrap('<div></div>');
    
    $this.parent().css({
      overflow: 'hidden',
      position: 'relative',
      width: options.width,
      height: options.height
    });
    
    $this.children().css({
      position: 'absolute',
      width: options.width,
      display: 'none'
    });
    
    $this.children(':first').css({
      display: 'block'
    });
    
    $this.parent().hover(function(){
      clear_interval();
    }, function(){
      $.t = setTimeout(function(){
        effect();
        set_interval();
      }, options.hover_pause);
    });
    
    set_interval();
  }
}
