/* ロールオーバー処理 */

function Btn(elm) {
	var me = this;
	this.elm = elm;
	this.over = function() { me.changeImage(true); };
	this.out = function() {	me.changeImage(false); };
	this.init();
}

var _Btn = Btn.prototype;

_Btn.init = function() {
	var me = this;
	var img_on = new Image();
	var img_str = this.elm.getAttribute("src");
	img_on.src = img_str.replace("_off", "_on");
	this.setEvent();
};


_Btn.doSelect = function() {
	this.deleteEvent();
	this.changeImage(true);
};


_Btn.setEvent = function() {
	try {
		this.elm.addEventListener("mouseover", this.over, false);
		this.elm.addEventListener("mouseout", this.out, false);
	} catch(e) {
		this.elm.attachEvent("onmouseover", this.over);
		this.elm.attachEvent("onmouseout", this.out);
	}
};


_Btn.deleteEvent = function() {
	try {
		this.elm.removeEventListener("mouseover", this.over, false);
		this.elm.removeEventListener("mouseout", this.out, false);
	} catch(e) {
		this.elm.detachEvent("onmouseover", this.over);
		this.elm.detachEvent("onmouseout", this.out);
	}
};


_Btn.changeImage = function(flag) {
	var img = this.elm.getAttribute("src");
	this.elm.setAttribute("src", (flag) ? img.replace("_off", "_on") : img.replace("_on", "_off"));
};


(function(func) {
	try {
		window.addEventListener("load", func, false);
	} catch(e) {
		window.attachEvent("onload", func);
	}
})(function() {
	var btnArray01 = document.getElementsByTagName("img");
	var btnArray02 = document.getElementsByTagName("input");
	for (var i = 0, ln = btnArray01.length; i < ln; i++) {
		if (btnArray01[i].getAttribute("src").indexOf("_off.") >= 0) new Btn(btnArray01[i]);
	}
	for (var i = 0, ln = btnArray02.length; i < ln; i++) {
		try{
			if (btnArray02[i].getAttribute("src").indexOf("_off.") >= 0) new Btn(btnArray02[i]);
		} catch(e){
		}
	}
	//runRandomBanner();
	jQuery('.unitBlockData,.introduction_case,.unitBlockDataNone,.introductionCaseli').hover(
		function () {
			$(this).css("background-color","#f3f3f5");
		},
		function () {
			$(this).css("background-color","#ffffff");
		}
	);
});

/* top */

$(document).ready(function(){
	$("div#entrepreneur").hover(
		function () {
			$("div#entrepreneur").css("background-color","#f3f3f5");
			$("div#entrepreneur h3 img").attr	("src", "shared/img/h3_title_entrepreneur_divhover.gif");
			$("div#entrepreneur p a").css("color","#666666");
		},
		function () {
			$("div#entrepreneur").css("background-color","#ffffff");
			$("div#entrepreneur h3 img").attr	("src", "shared/img/h3_title_entrepreneur_off.gif");
			$("div#entrepreneur p a").css("color","#666666");
		}
	)
	$("div#nursing").hover(
		function () {
			$("div#nursing").css("background-color","#f3f3f5");
			$("div#nursing h3 img").attr	("src", "shared/img/h3_title_nursing_divhover.gif");
			$("div#nursing p a").css("color","#666666");
		},
		function () {
			$("div#nursing").css("background-color","white");
			$("div#nursing h3 img").attr	("src", "shared/img/h3_title_nursing_off.gif");
			$("div#nursing p a").css("color","#666666");
		}
	)
	$("div#countries").hover(
		function () {
			$("div#countries").css("background-color","#f3f3f5");
			$("div#countries h3 img").attr	("src", "shared/img/h3_title_countries_divhover.gif");
			$("div#countries p a").css("color","#666666");
		},
		function () {
			$("div#countries").css("background-color","white");
			$("div#countries h3 img").attr	("src", "shared/img/h3_title_countries_off.gif");
			$("div#countries p a").css("color","#666666");
		}
	)
	$("div#general").hover(
		function () {
			$("div#general").css("background-color","#f3f3f5");
			$("div#general h3 img").attr	("src", "shared/img/h3_title_general_divhover.gif");
			$("div#general p a").css("color","#666666");
		},
		function () {
			$("div#general").css("background-color","white");
			$("div#general h3 img").attr	("src", "shared/img/h3_title_general_off.gif");
			$("div#general p a").css("color","#666666");
		}
	)
});


/* 会社概要top */

$(document).ready(function(){
	$("div#overview_menu01").hover(
		function () {
			$("div#overview_menu01").css("background-color","#f3f3f5");
			$("div#overview_menu01 h5 img").attr	("src", "../shared/img/h5_title_02.gif");
			$("div#overview_menu01 p a").css("color","#666666");
		},
		function () {
			$("div#overview_menu01").css("background-color","#ffffff");
			$("div#overview_menu01 h5 img").attr	("src", "../shared/img/h5_title_01.gif");
			$("div#overview_menu01 p a").css("color","#666666");
		}
	)
	$("div#overview_menu02").hover(
		function () {
			$("div#overview_menu02").css("background-color","#f3f3f5");
			$("div#overview_menu02 h5 img").attr	("src", "../shared/img/h5_title_04.gif");
			$("div#overview_menu02 p a").css("color","#666666");
		},
		function () {
			$("div#overview_menu02").css("background-color","white");
			$("div#overview_menu02 h5 img").attr	("src", "../shared/img/h5_title_03.gif");
			$("div#overview_menu02 p a").css("color","#666666");
		}
	)
	$("div#overview_menu03").hover(
		function () {
			$("div#overview_menu03").css("background-color","#f3f3f5");
			$("div#overview_menu03 h5 img").attr	("src", "../shared/img/h5_title_06.gif");
			$("div#overview_menu03 p a").css("color","#666666");
		},
		function () {
			$("div#overview_menu03").css("background-color","white");
			$("div#overview_menu03 h5 img").attr	("src", "../shared/img/h5_title_05.gif");
			$("div#overview_menu03 p a").css("color","#666666");
		}
	)
	$("div#overview_menu04").hover(
		function () {
			$("div#overview_menu04").css("background-color","#f3f3f5");
			$("div#overview_menu04 h5 img").attr	("src", "../shared/img/h5_title_08.gif");
			$("div#overview_menu04 p a").css("color","#666666");
		},
		function () {
			$("div#overview_menu04").css("background-color","white");
			$("div#overview_menu04 h5 img").attr	("src", "../shared/img/h5_title_07.gif");
			$("div#overview_menu04 p a").css("color","#666666");
		}
	)
});
