function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off.")||images[i].getAttribute("src").match("_current.")){
				images[i].onmouseover = function() {
					if(!this.getAttribute("src").match("_current.")){
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
					}
				}
				images[i].onmouseout = function() {
					if(!this.getAttribute("src").match("_current.")){
						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
					}
				}
				images[i].onclick = function() {
					//class名にcurrentBtnを含んでいるならカレントボタン対応
					if(this.className.match("currentBtn")){
						for(var n=0; n < images.length; n++){
							if(images[n].className == this.className){
								if(images[n].getAttribute("src").match("_current.")){
									images[n].setAttribute("src", images[n].getAttribute("src").replace("_current.", "_off."));
								}
								else if(images[n].getAttribute("src").match("_on.")){
									images[n].setAttribute("src", images[n].getAttribute("src").replace("_on.", "_off."));
								}
							}
						}
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_current."));
					}
					//カレント対応なし
					else{
						//this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
					}
				}
			}
		}
	}
}
if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
}
