//ボタンロールオーバー
function Rollover() {
	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."));
				}
			}
		}
	}
}

//トップページコースリンク
function top_roll(on_id){
	var f = 'wp-content/themes/shimoda/img/';
	var imageNum = "";
	var targ = ""
	var mt_url = "";
	
	//調理師科
	if (on_id == 'top_cook'){
		imageNum = 'btn_t_cook';
		targ = 'btn_c';
		my_url = 'cook/index.html';
	}
	//ソムリエワインコーディネーター科
	if (on_id == 'top_wine'){
		imageNum = 'btn_t_wine';
		targ = 'btn_w';
		my_url = 'wine/index.html';
	}
	//国際フードビジネス
	if (on_id == 'top_inter'){
		imageNum = 'btn_t_inter';
		targ = 'btn_i';
		my_url = 'international/index.html';
	}
	//介護食士養成過程
	if (on_id == 'top_nur'){
		imageNum = 'btn_t_nur';
		targ = 'btn_n';
		my_url = 'nursing/index.html';
	}
	if (document.images) document.getElementById(targ).src = f + imageNum + '_on.jpg';
	
	//クリック・マウスアウトイベント
	document.getElementById(on_id).onclick = function() {
		location.href = my_url;
	}
	document.getElementById(on_id).onmouseout = function(){
		document.getElementById(targ).src = f + imageNum + '_off.jpg';
	}
	document.getElementById(on_id + '_b').onmouseout = function(){
		document.getElementById(targ).src = f + imageNum + '_off.jpg';
	}
}

if(window.addEventListener) {
	window.addEventListener("load", Rollover, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", Rollover);
}

function RandomImg(){
	ranimg = new Array();
	ranimg[0] = "wp-content/themes/shimoda/img/main.jpg";
	ranimg[1] = "wp-content/themes/shimoda/img/main2.jpg";
	ranimg[2] = "wp-content/themes/shimoda/img/main3.jpg";
	chip = Math.floor(ranimg.length * Math.random());
	ranimg = ranimg[Math.floor(chip)];
	document.write('<img src="'+ ranimg +'" alt="健康と食にかける情熱" width="573" height="240" />');
}

function openWin(theURI,takasa) {
	var arg = 'scrollbars=1,' + 'width=580,' + 'height=' + takasa + ',resizable=1,directories=0,toolbar=0,status=1,location=0';
	PopUpWin=window.open(theURI,'theWin',arg);
	PopUpWin.focus();
}

