(function($){

$.fn.rollover = function(opt){
      
    var defaults = {
        type: "simple",
        speed: 300
    };
    
    var options = $.extend(defaults, opt);
    
    var currentImg = $(this).find('img');
        
    if(options.type == "simple"){
        $(currentImg).hover(
            function(){
                $(this).attr('src', $(this).attr('src').split('.').join("_hover."));
            },
            function(){
               $(this).attr('src', $(this).attr('src').split('_hover.').join("."));
           });
    }
    else if(options.type == "fade"){
        
        $(this).find('img').css({float: 'left'});
        
        $(this).hover(
	function(){
                if($(this).find('img').is(':animated')){return};
                $(currentImg).addClass('defaultImg');
                $(this).find('.defaultImg').css({float: 'left'});
                $(this).append('<img class="overImg" />');
                $(this).find('.overImg').
                    //attr('src', $(this).find('.defaultImg').attr('src').split('.').join("_hover.")).
                    //css({display: 'none', float: 'left'}).
                    fadeIn(options.speed);
            },
            

            function(){
                $(this).find('.overImg').fadeOut(options.speed, function(){
                    $(this).find('.overImg').remove();
                    $(this).find('img').removeClass('defaultImg');
                });
            });
    }
};

})(jQuery);