﻿/*----------------------------------------*/
/*  breadCrumb.js ( 2009/5/6 )
/*  http://tshinobu.com/lab/breadCrumbJs/
/*  readcrumb (topicpath) generator by javascript
/*----------------------------------------*/

breadCrumbJsData = function(){
	/*----------------------------------------*/
	/*  index.html をパンくずリスト生成に含めるかどうか定義します。
	/*  false ... index.html を無視する
	/*  true ... index.html を無視しない
	/*----------------------------------------*/
	this.indexMatch = false;
	/*----------------------------------------*/
	/*  パンくずリストに表示する名前を定義してください。
	/*  (書式) "ディレクトリ名" : "表示名"
	/*----------------------------------------*/
	this.contentName = {
		"home" : "トップページ", // この行は残してください。
		"/staff.html" : "ホスト一覧",
		"/ranking.html" : "月間ランキング",
		"/schedule.html" : "月間スケジュール",
		"/system.html" : "店舗システム",
		"/map.html" : "店舗マップ",
		"/blog.html" : "ブログ一覧",
		"/topics.html" : "トピックス",
		"/media.html" : "マスメディア各位",
		"/movie.html" : "シュガー動画",
		"/qa.html" : "よくある質問と答え",
		"/staff/" : "ホスト一覧",
		"/staff/nanba_takuma/" : "難波拓真",
		"/staff/asakura_kotaro/" : "浅倉幸太郎",
		"/staff/naniwa_tetsuji/" : "浪速哲司",
		"/staff/sendo_aoi/" : "千堂葵",
		"/staff/hasegawa_yukio/" : "はせがわゆきお",
		"/staff/kumono_keiji/" : "雲之慶次",
		"/staff/oretachino_hizuki/" : "俺達乃氷月",
		"/staff/yagami_shinba/" : "夜神心絆",
		"/staff/tatsuyoshi_joichiro/" : "辰吉丈一郎",
		"/staff/nagareboshi_ginga/" : "流星銀河",
		"/staff/saotome_pochi/" : "早乙女ぽち",
		"/staff/kadoma_yu/" : "門間優",
		"/staff/yukino_misaki/" : "雪野未咲",
		"/staff/tobita_getto/" : "飛田月斗",

		"/recruit/" : "求人トップページ",
		"/recruit/msessage.html" : "代表者メッセージ",
		"/recruit/boshu.html" : "募集要項",
		"/recruit/flow.html" : "面接の流れ",
		"/recruit/qa.html" : "よくある質問と答え",
		"/recruit/info.html" : "お問い合わせ",
		"/recruit/shoukai.html" : "ホスト紹介",
		"/recruit/mikeiken.html" : "未経験の方へ",
		"/recruit/keiken.html" : "経験者の方へ",
		"/recruit/tafuken.html" : "他府県にお住まいの方へ",
		"/recruit/recruit_special.html" : "SUGARが選ばれる理由",
		"" : "" //この行は残してください。
	};
	/*----------------------------------------*/
	/*  パンくずリスト生成検索処理
	/*----------------------------------------*/
	this.funcIndexSearch = function(){
		keyword = breadCrumbJsData.contentName[arguments[0]];
		if(keyword == undefined){
			return arguments[0].match(/(.*?)\//g).pop().replace("/","");
		} else{
			return keyword;
		}
	};
}
var breadCrumbJsData = new breadCrumbJsData();

function breadCrumbJs(){
	/*----------------------------------------*/
	/*  以下条件分岐 / 表示処理部分
	/*----------------------------------------*/
	var thisURL = window.location.pathname.match(/(.*?)\//g);
	var fileName =  window.location.pathname.match(/([^¥/]+?)$/);
	if ( fileName && (!( fileName[0].match("index") && !breadCrumbJsData.indexMatch )) ){ thisURL.push( fileName[0] ); }
	var drw = document.getElementById("breadCrumb");
	var rootingPath = "";
	if ( drw.tagName == "P" | drw.tagName == "DIV" ){
		for( i=0; i<thisURL.length; i++){
			rootingPath += thisURL[i];
			if ( i == 0 ){
				drw.innerHTML = '<a href="/">' + breadCrumbJsData.funcIndexSearch('home') + '</a>';
			} else if ( i == thisURL.length - 1 ){
				drw.innerHTML += ' &gt; <strong>' + breadCrumbJsData.funcIndexSearch(rootingPath) + '</strong>';
			} else {
				drw.innerHTML += ' &gt; <a href="'+rootingPath+'">' + breadCrumbJsData.funcIndexSearch(rootingPath) + '</a>';
			}
		}
	}
	if ( drw.tagName == "UL" | drw.tagName == "OL" ){
		for( i=0; i<thisURL.length; i++){
			rootingPath += thisURL[i];
			if ( i == 0 ){
				drw.innerHTML = '<li><a href="/">' + breadCrumbJsData.funcIndexSearch('home') + '</a></li>';
			} else if ( i == thisURL.length - 1 ){
				drw.innerHTML += ' <li class="active"><strong>' + breadCrumbJsData.funcIndexSearch(rootingPath) + '</strong></li>';
			} else {
				drw.innerHTML += ' <li><a href="'+rootingPath+'">' + breadCrumbJsData.funcIndexSearch(rootingPath) + '</a></li>';
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", breadCrumbJs, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", breadCrumbJs);
}
