/*
============================================================
	menu
============================================================
*/
var _path;
var _startLoad = 0;
var _menuItem = new Array ();
var _smenuItem = new Array ();

function menuPreload (path, content) {

	switch (path) {
		case "search":
			_path = "http://www.momijibank.co.jp/";
			break;

		case 1:
			_path = "./";
			break;

		default:
			_path = "";
			for (var _i = 1; _i < path; _i ++) {
				_path += "../";
			}
			break;
	}

	_menuItem[0] = new Image (); _menuItem[0].src = _path + "img/menu_portal_off.gif";
	_menuItem[1] = new Image (); _menuItem[1].src = _path + "img/menu_portal_on.gif";
	_menuItem[2] = new Image (); _menuItem[2].src = _path + "img/menu_personal_off.gif";
	_menuItem[3] = new Image (); _menuItem[3].src = _path + "img/menu_personal_on.gif";
	_menuItem[4] = new Image (); _menuItem[4].src = _path + "img/menu_corporate_off.gif";
	_menuItem[5] = new Image (); _menuItem[5].src = _path + "img/menu_corporate_on.gif";
	_menuItem[6] = new Image (); _menuItem[6].src = _path + "img/menu_recruit_off.gif";
	_menuItem[7] = new Image (); _menuItem[7].src = _path + "img/menu_recruit_on.gif";
	_menuItem[8] = new Image (); _menuItem[8].src = _path + "img/menu_outline_off.gif";
	_menuItem[9] = new Image (); _menuItem[9].src = _path + "img/menu_outline_on.gif";

	switch (content) {
		case "portal":
			_smenuItem[0] = new Image (); _smenuItem[0].src = _path + "img/" + content + "/smenu_news_off.gif";
			_smenuItem[1] = new Image (); _smenuItem[1].src = _path + "img/" + content + "/smenu_news_on.gif";
			_smenuItem[2] = new Image (); _smenuItem[2].src = _path + "img/" + content + "/smenu_safety_off.gif";
			_smenuItem[3] = new Image (); _smenuItem[3].src = _path + "img/" + content + "/smenu_safety_on.gif";
			_smenuItem[4] = new Image (); _smenuItem[4].src = _path + "img/" + content + "/smenu_information_off.gif";
			_smenuItem[5] = new Image (); _smenuItem[5].src = _path + "img/" + content + "/smenu_information_on.gif";
			_smenuItem[6] = new Image (); _smenuItem[6].src = _path + "img/" + content + "/smenu_link_off.gif";
			_smenuItem[7] = new Image (); _smenuItem[7].src = _path + "img/" + content + "/smenu_link_on.gif";
			break;

		case "personal":
			_smenuItem[0] = new Image (); _smenuItem[0].src = _path + "img/" + content + "/smenu_campaign_off.gif";
			_smenuItem[1] = new Image (); _smenuItem[1].src = _path + "img/" + content + "/smenu_campaign_on.gif";
			_smenuItem[2] = new Image (); _smenuItem[2].src = _path + "img/" + content + "/smenu_save_off.gif";
			_smenuItem[3] = new Image (); _smenuItem[3].src = _path + "img/" + content + "/smenu_save_on.gif";
			_smenuItem[4] = new Image (); _smenuItem[4].src = _path + "img/" + content + "/smenu_operating_off.gif";
			_smenuItem[5] = new Image (); _smenuItem[5].src = _path + "img/" + content + "/smenu_operating_on.gif";
			_smenuItem[6] = new Image (); _smenuItem[6].src = _path + "img/" + content + "/smenu_borrow_off.gif";
			_smenuItem[7] = new Image (); _smenuItem[7].src = _path + "img/" + content + "/smenu_borrow_on.gif";
			_smenuItem[8] = new Image (); _smenuItem[8].src = _path + "img/" + content + "/smenu_prepare_off.gif";
			_smenuItem[9] = new Image (); _smenuItem[9].src = _path + "img/" + content + "/smenu_prepare_on.gif";
			_smenuItem[10] = new Image (); _smenuItem[10].src = _path + "img/" + content + "/smenu_convenience_off.gif";
			_smenuItem[11] = new Image (); _smenuItem[11].src = _path + "img/" + content + "/smenu_convenience_on.gif";
			break;

		case "corporate":
			_smenuItem[0] = new Image (); _smenuItem[0].src = _path + "img/" + content + "/smenu_finance_off.gif";
			_smenuItem[1] = new Image (); _smenuItem[1].src = _path + "img/" + content + "/smenu_finance_on.gif";
			_smenuItem[2] = new Image (); _smenuItem[2].src = _path + "img/" + content + "/smenu_consultation_off.gif";
			_smenuItem[3] = new Image (); _smenuItem[3].src = _path + "img/" + content + "/smenu_consultation_on.gif";
			_smenuItem[4] = new Image (); _smenuItem[4].src = _path + "img/" + content + "/smenu_efficiency_off.gif";
			_smenuItem[5] = new Image (); _smenuItem[5].src = _path + "img/" + content + "/smenu_efficiency_on.gif";
			_smenuItem[6] = new Image (); _smenuItem[6].src = _path + "img/" + content + "/smenu_risk-hedge_off.gif";
			_smenuItem[7] = new Image (); _smenuItem[7].src = _path + "img/" + content + "/smenu_risk-hedge_on.gif";
			break;

		case "recruit":
///* 2011.02.14 ｻﾌﾞﾒﾆｭｰ復活!!
			_smenuItem[0] = new Image (); _smenuItem[0].src = _path + "img/" + content + "/smenu_fresh_off.gif";
			_smenuItem[1] = new Image (); _smenuItem[1].src = _path + "img/" + content + "/smenu_fresh_on.gif";
			_smenuItem[2] = new Image (); _smenuItem[2].src = _path + "img/" + content + "/smenu_career_off.gif";
			_smenuItem[3] = new Image (); _smenuItem[3].src = _path + "img/" + content + "/smenu_career_on.gif";
			_smenuItem[4] = new Image (); _smenuItem[4].src = _path + "img/" + content + "/smenu_part_off.gif";
			_smenuItem[5] = new Image (); _smenuItem[5].src = _path + "img/" + content + "/smenu_part_on.gif";
			_smenuItem[6] = new Image (); _smenuItem[6].src = _path + "img/" + content + "/smenu_business_off.gif";
			_smenuItem[7] = new Image (); _smenuItem[7].src = _path + "img/" + content + "/smenu_business_on.gif";
			_smenuItem[8] = new Image (); _smenuItem[8].src = _path + "img/" + content + "/smenu_new_off.gif";
			_smenuItem[9] = new Image (); _smenuItem[9].src = _path + "img/" + content + "/smenu_new_on.gif";
//*/
			break;

		default:
			break;
	}

	_startLoad = 1;
}

function menuRoll (imgName, num) {
	if (_startLoad == 1) {
		if (document.images) document.images[imgName].src=_menuItem[num].src;
	}
}

function smenuRoll (imgName, num) {
	if (_startLoad == 1) {
		if (document.images) document.images[imgName].src=_smenuItem[num].src;
	}
}


/*
============================================================
	Open Window
============================================================
*/
function openFullWin (uri, wName, toolbarFlg, locationFlg, menubarFlg) {
	var option = "width=780";
		option += ",left=0";
		option += ",top=0";
		if (toolbarFlg) {
			option += ",toolbar=yes";
		} else {
			option += ",toolbar=no";
		}
		if (locationFlg) {
			option += ",location=yes";
		} else {
			option += ",location=no";
		}
		if (menubarFlg) {
			option += ",menubar=yes";
		} else {
			option += ",menubar=no";
		}
		option += ",directories=no";
		option += ",status=yes";
		option += ",scrollbars=yes";
		option += ",resizable=yes";

	window.open (uri, wName, option).focus ();
}

function openInternetBanking (content, type) {
	switch (content) {
		case "personal":
			switch (type) {
				case "login":
					this.openFullWin ('https://www.inb.momijibank.chance.co.jp/int/banking?_TRANID=INBLGNLGN001_001', content + "_" + type, 0, 1, 1);

					break;

				case "online":
					this.openFullWin ('https://www.inb.momijibank.chance.co.jp/signup/int?_TRANID=INBONLTOP001_001', content + "_" + type, 0, 1, 1);
					break;

				case "guide":
					if (_path) {
						location.href = _path + "personal/convenience/i-banking/";
					}
					break;

				case "kikan":
					this.openFullWin (_path +"personal/convenience/i-banking/sample/kikan.html", content + "_" + type, 0, 1, 1);
					break;

				default:
					break;
			}
			break;

		case "corporate":
			switch (type) {
				case "login":
					if (_path) {
						this.openFullWin (_path + "corporate/i-banking/login.htm", content + "_" + type, 0, 1, 1);
					}
					break;

				case "ssl":
					if (_path) {
						this.openFullWin (_path + "corporate/i-banking/sample/ssl.html", content + "_" + type, 0, 1, 1);
					}
					break;

				case "guide":
					if (_path) {
						location.href = _path + "corporate/i-banking/";
					}
					break;

				default:
					break;
			}
			break;

		default:
			break;
	}
}


/*
============================================================
	Window Close
============================================================
*/
function windowClose () {
	window.opener = window;
	var win = window.open (location.href, "_self");
	win.close ();
}


/*
============================================================
	Open Google Maps API
============================================================
*/
function openGmaps (area, point) {
	if (area && point && _path) {
		var uri = _path + "outline/store/map/" + area + "_" + point + ".html";

		var option = "width=467";
			option += ",height=488";
			option += ",left=0";
			option += ",top=0";
			option += ",toolbar=yes";
			option += ",location=no";
			option += ",menubar=no";
			option += ",directories=no";
			option += ",status=no";
			option += ",scrollbars=yes";
			option += ",resizable=yes";

		window.open (uri, area + "_" + point, option).focus ();
	}
}

function setGmapsWindow (area, point) {
	if (area && point) {
		resizeGmapsWindow ();
		document.getElementById ("gmapIframe").innerHTML = '<iframe src="./gmaps_' + area + '_' + point + '.html" scrolling="no" frameborder="0" title="g_map"></iframe>';

		window.onresize = resizeGmapsWindow;
	}
}

function resizeGmapsWindow () {
	var minWidth = 450;
	var minHeight = 450;

	var windowWidth = window.innerWidth || document.body.clientWidth || document.documentElement.clientWidth || document.body.outerWidth;
	var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight || document.body.outerHeight;

	if (minWidth < windowWidth) {
		var width = "100%";
	} else {
		var width = minWidth + "px";
	}

	if (minHeight + 35 < windowHeight) {
		var height = (windowHeight - 35) + "px";
	} else {
		var height = minHeight + "px";
	}

	if (document.layers) {
		document.layers["titleArea"].width = width;
		document.layers["gmapIframe"].width = width;
		document.layers["gmapIframe"].height = height;
	} else if (document.all) {
		document.all ("titleArea").style.width = width;
		document.all ("gmapIframe").style.width = width;
		document.all ("gmapIframe").style.height = height;
	} else if (!document.all && document.getElementById) {
		document.getElementById ("titleArea").style.width = width;
		document.getElementById ("gmapIframe").style.width = width;
		document.getElementById ("gmapIframe").style.height = height;
	}
}


/*
============================================================
	get year
============================================================
*/
function getYear () {
	var dateObj = new Date ();
	document.write (dateObj.getFullYear ());
}
