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].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					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);
}


//backToTop
function backToTop() { 
	var x1 = x2 = x3 = 0; 
	var y1 = y2 = y3 = 0; 
	
	if (document.documentElement) { 
		x1 = document.documentElement.scrollLeft || 0; 
		y1 = document.documentElement.scrollTop || 0; 
	} 
	
	if (document.body) { 
		x2 = document.body.scrollLeft || 0; 
		y2 = document.body.scrollTop || 0; 
	} 
	
	x3 = window.scrollX || 0; 
	y3 = window.scrollY || 0; 
	
	var x = Math.max(x1, Math.max(x2, x3)); 
	var y = Math.max(y1, Math.max(y2, y3)); 
	
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2)); 
	
	if (x > 0 || y > 0) { 
		window.setTimeout("backToTop()", 25); 
	} 
}

//input typeのロールオーバー（高さ：47px）
function btnConform(){
	var inputs = document.getElementsByTagName("input");
	for( var i=0,j=inputs.length; i<j; i++){
		var btn = inputs[i]; 
		if(btn.getAttribute("class") == "input_btn"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -47px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
		if(btn.getAttribute("className") == "input_btn"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -47px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
		if(btn.getAttribute("class") == "input_btn_90free01"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -58px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
		if(btn.getAttribute("className") == "input_btn_90free01"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -58px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
		if(btn.getAttribute("class") == "input_btn_90free02"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -64px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
		if(btn.getAttribute("className") == "input_btn_90free02"){
			btn.onmouseover = function(){
				this.style.backgroundPosition = '0 -64px';
				return false;
			}
			btn.onmouseout = function(){
				this.style.backgroundPosition = '0 0';
				return false;
			}
		}
	}
}
window.onload = btnConform;


/*
** クリッカブルマップにロールオーバー
*/
window.onload = function() {
	//3階層目キービジュアル
	images = new Array();
	images[0] = "../../images/layer3_img01.jpg";
	images[1] = "../../images/layer3_img02.jpg";
	
	//ソースリスト
	var srcs = new Array();
	for(var i=0 ; i<images.length ; i++) {
		srcs[i] = new Image();
		srcs[i].src = images[i];
	}
}
	
//ロールオーバー
var mapRollOver = function(id) { document.getElementById('mapImage').src = images[id]; }

//ロールアウト
var mapRollOut = function(id) { document.getElementById('mapImage').src = images[0]; }
