$(document).ready(function() {
	initRollovers();
});

function initRollovers() {

	// setup hover events to show roll image.
	$(":image.roll,img.roll").hover(
        function() {
        	var osrc = $(this).attr("src");
        	var ftype = osrc.substring(osrc.lastIndexOf('.'), osrc.length);
        	var hsrc = osrc.replace(ftype, "_o" + ftype);
        	$(this).attr("osrc", osrc);
        	$(this).attr("src", hsrc);
        },
        function() {
        	$(this).attr("src", $(this).attr("osrc"));
        }
    );


	//var preLoad = new Array();
	// preload images.
	$(":image.roll,img.roll").each(function() {
		var osrc = $(this).attr("src");
		var ftype = osrc.substring(osrc.lastIndexOf('.'), osrc.length);
		var hsrc = osrc.replace(ftype, "_o" + ftype);
		/// preload over image.
		var himg = new Image()
		himg.src = hsrc;
	});

}

