(function($){
	
	$.fn.extend({
		
		rollover: function( overSuffix, isSmooth ) {
			
			var overSuffix = overSuffix || '_ov';
			
			this.each(function(){
				var src = $(this).attr('src');
				var osrc = src.replace(/(\.[a-z]+?$)/, overSuffix + '$1');
				
				(new Image).src = osrc;

				if ( isSmooth ) {
					$(this).wrap($('<span></span>').css({
						'display': 'block',
						'background-image': 'url('+osrc+')'
					}));
					$(this).bind('mouseover.smoothRollover', function(){
						$(this).stop(true,true)
							.animate({'opacity':0},10,'swing');
					}).bind('mouseout.smoothRollover', function(){
						$(this).stop(true,true)
							.animate({'opacity':1},200,'swing');
					});
				} else {
					$(this).bind('mouseover.rollover', function(){
						$(this).attr('src', osrc);
					}).bind('mouseout.rollover', function(){
						$(this).attr('src', src);
					});
				}
				
			});
			
			return this;
		}
		
	});
	
})(jQuery);






