// グローバルメニューを初期化する
function initGlobalMenu() {
	
	if (document.getElementById("global-menu")) {
		
		if (location.href.match(/http:\/\/.*?\//)) {
			var currentPath = location.href.replace(/http:\/\/.*?\//, "/");	// フルパスをルート相対パスに変換する
		} else if (location.href.match(/https:\/\/.*?\//)) {
			var currentPath = location.href.replace(/https:\/\/.*?\//, "/");	// フルパスをルート相対パスに変換する
		}
		var aElements = document.getElementById("global-menu").getElementsByTagName("a");
		
		if (currentPath == "/seino/" || currentPath == "/seino/index.htm") {
			// トップページの場合
			aElements[0].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/service/") == 0) {
			// サービスの場合
			aElements[1].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/branch/") == 0) {
			// 営業所検索の場合
			aElements[2].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/webservice/kangaroo/") == 0 || currentPath.indexOf("/seino/webservice/chilled/") == 0) {
			// 運賃お見積りの場合
			aElements[3].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/company/") == 0) {
			// 会社情報の場合
			aElements[4].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/recruit/") == 0) {
			// 採用情報の場合
			aElements[5].parentNode.className += " current";
			
		} else if (currentPath == "/seino/shd/" || currentPath == "/seino/shd/index.htm") {
			// セイノーホールディングス トップページの場合
			aElements[0].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/news/shd/") == 0) {
			// セイノーホールディングス お知らせの場合
			aElements[1].parentNode.className += " current";
			
		} else if (currentPath.indexOf("/seino/shd/") == 0) {
			if (currentPath.indexOf("/seino/shd/ir/") == 0 || currentPath == "/seino/shd/koukoku/index.htm") {
				// セイノーホールディングス IR情報の場合
				aElements[3].parentNode.className += " current";
			} else if (currentPath.indexOf("/seino/shd/ir_eng/") == 0) {
				// 英語版IRの場合は何もしない
			} else if (currentPath.indexOf("/seino/shd/contactus/") == 0) {
				// お問い合わせの場合は何もしない
			} else if (currentPath.indexOf("/seino/shd/sitemap/") == 0) {
				// サイトマップの場合は何もしない
			} else {
				// セイノーホールディングス 会社情報の場合
				aElements[2].parentNode.className += " current";
			}
		}
	}
}

// ウィンドウにイベントを追加する
if (window.addEventListener) {
	window.addEventListener("load", initGlobalMenu, false);
} else if (window.attachEvent) {
	window.attachEvent("onload", initGlobalMenu);
}
