(function($) {
	$.fn.rollover = function(opts) {
		var default_opts = { current : '', ro : '_ro.' };
		var icache = new Array();

		opts = $.extend(default_opts, opts || {});

		var image_name = function(src) {
			var m = src.match(/(.+)\.([^\.]+)$/);
			return m[1] + opts.ro + m[2];
		}

		var set_current = function(o) {
			if (o.length != 0) {
				var cimg = (o.children())[0];
				cimg.src = image_name(cimg.src);
			}
		}

		set_current(this.parent("a[href=" + opts.current + "]"));

		return this.not("[src*=" + opts.ro + "]").each(function(i) {
			var imgsrc = this.src;
			var imgsrc_ro = image_name(this.src);

			icache[i] = new Image();
			icache[i].src = imgsrc_ro;
			$(this).hover(
				function() { this.src = imgsrc_ro; },
				function() { this.src = imgsrc; }
			);
		});
	}
})(jQuery);