$(function() {
	var conf = {
		className : 'swap',
		postfix : '_over'
	};
	$('.'+conf.className).each(function(){
		this.originalSrc = this.src;
		this.rolloverSrc = this.originalSrc.replace(/(\.gif|\.jpg|\.png)/, conf.postfix+"$1");
		preloadImage(this.rolloverSrc);
	}).hover(function() {
		this.src = this.rolloverSrc;
	},function() {
		this.src = this.originalSrc;
	});
});

//preload
preloadedImages = [];
function preloadImage(url) {
	var p = preloadedImages;
	var l = p.length;
	p[l] = new Image();
	p[l].src = url;
}
