//p = console.log;
Event.observe(window, 'load', setMouseOverImages, false);
function setMouseOverImages(){
  var conf = {
    className : 'btn',
    postfix : '_on'
  };
  $A(document.getElementsByClassName(conf.className)).each(function (node){
    node.originalSrc = node.src;
    node.rolloverSrc = node.originalSrc.replace(/(\.gif|\.jpg|\.png)/, conf.postfix+"$1");
    preloadImage(node.rolloverSrc);
    Event.observe(node, 'mouseover', function(){
      this.src = this.rolloverSrc;
    }, false);
    Event.observe(node, 'mouseout', function(){
      this.src = this.originalSrc;
    }, false);
  });
};

//プリロード
preloadedImages = [];
function preloadImage(url){
	var p = preloadedImages;
	var l = p.length;
	p[l] = new Image();
	p[l].src = url;
}
