var swapImage = new Class({
	options: {
		auto: true
	},
	initialize: function(options){
		this.setOptions(options);
		this.load = [];
		if(! this.options.auto) return;
		$$('img').each(function(el){
			this.setImage(el);
		}.bind(this));
	},
	setImage: function(el){
		if(el.src.match(/^(.+_)off(\..+)$/)){
			el.off = el.src;
			el.on  = RegExp.$1 + 'on' + RegExp.$2;
			el.addEvent('mouseover', this.swap );
			el.addEvent('mouseout', this.swap );
			if(! this.load[el.on]){;
				this.load[el.on] = true;
				(new Image).src = el.on;
			}
		}
	},
	swap: function(e){
		var el = e.target || e.srcElement;
		if(el.src.match(/o(n|ff)\..+?$/)){
			el.src = (e.type == 'mouseover') ? el.on : el.off;
		}
	}
});
swapImage.implement(new Options);
