var yomotsuRollover = {
	
	main : function() {
		var img = document.images;
		for (var i = 0; i <img.length; i++) {
			if ((img[i].src.match(/_n\./))||(img[i].style.filter)){
				img[i].onmouseover = yomotsuRollover.over;
				img[i].onmouseout  = yomotsuRollover.out;
			}
		}
		
		var input = document.getElementsByTagName("input");
		for (var i = 0; i <input.length; i++) {
			if ((input[i].getAttribute("src"))||(input[i].src.match(/_n\./))){
				input[i].onmouseover = yomotsuRollover.over;
				input[i].onmouseout  = yomotsuRollover.out;
			}
		}		
	},

	over : function() {
		if((this.style.filter)&&(this.style.filter.match(/_n\.png/))){//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_n.png', '_r.png');
		}
		else{
			this.src = this.src.replace('_n.', '_r.');
		}
	},

	out : function(){
		if((this.style.filter)&&(this.style.filter.match(/_r\.png/))){//(IE5.5-6 && png)
			this.style.filter = this.style.filter.replace('_r.png', '_n.png');
		}
		else{
			this.src = this.src.replace('_r.', '_n.');
		}
	},

	addEvent : function(){
		try {
			window.addEventListener('load', yomotsuRollover.main, false);
		} catch (e) {
			window.attachEvent('onload', yomotsuRollover.main);
		}
	}
}

yomotsuRollover.addEvent();
