// 共通JavaScript ver 0.4
// written by youky_iibuchi@yahoo.co.jp

// ■■■ 読み込み時に実行される部分 ■■■
// フレームブレイカー（お約束）
if (self != top)top.location.href = self.location.href;

// http://archiva.jp/web/html-css/ie6_background_flickr.html
try {
document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}

if(document.getElementsByTagName){ // モダンブラウザ以外排除
// CSS読み込み
	document.write("<link rel=\"stylesheet\" href=\"/common/common.css\" type=\"text/css\" id=\"css0\" />");
	document.write("<link rel=\"stylesheet\" href=\"/common/default.css\" type=\"text/css\" id=\"css1\" />");
	document.write("<!--[if IE 6]><link rel=\"stylesheet\" href=\"/common/alpha_win_ie6.css\" type=\"text/css\" id=\"css2\" /><![endif]-->");
// 初期実行関数読み込み
	document.write("<scr"+"ipt type=\"text/javascript\" src=\"/common/common.js\" charset=\"UTF-8\" id=\"js01\"></scr"+"ipt>");
	document.write("<sc"+"ript type=\"text/javascript\" src=\"/common/fixed.js\" charset=\"UTF-8\" id=\"js02\"></sc"+"ript>");
	document.write("<scrip"+"t type=\"text/javascript\" src=\"http://swfobject.googlecode.com/svn/trunk/swfobject/swfobject.js\" charset=\"UTF-8\" id=\"js03\"></scrip"+"t>");


// ■■■ 読み込み完了後に実行される部分 ■■■
	function globalOnLoad(){
		// ■初期設定
		var sw = convertArg();	// URL引数を連想配列として受け取る
		var obja = document.getElementsByTagName("a"); // a要素一覧
		var objarea = document.getElementsByTagName("area"); // area要素一覧
		// ■cookieを調べて本文文字サイズを設定値にする。
/*		var fontSize = cookie.get("fontSize");
		if(fontSize !=""){zoomText("body", eval(fontSize));}
*/
		// ■リンクオブジェクトのpopupやblankのクラス名をもとに動作を変える
		for(var i=0; i<obja.length; i++){switchLinkMode(obja[i]);}
		for(var i=0; i<objarea.length; i++){switchLinkMode(objarea[i]);}
		// ■パンくずのdelimiterというクラスの付いたspanの中身を置き換える
		if(document.getElementById("breadcrumbs1")){
			var html='<img src="/common/images/breadcrumb_separator.gif" width="17" height="6" alt="/" />';
			var bc=document.getElementById("breadcrumbs1").getElementsByTagName("span");
			for(var i=0;i<bc.length;i++){
				if(bc[i].className.indexOf("delimiter")>-1){bc[i].innerHTML=html;}
			}
			var bc=document.getElementById("breadcrumbs2").getElementsByTagName("span");
			for(var i=0;i<bc.length;i++){
				if(bc[i].className.indexOf("delimiter")>-1){bc[i].innerHTML=html;}
			}
		}
		// 左カラム内ローカルメニューに親カテゴリごとにクラス名を付ける
		if(document.getElementById("body_link")){
			var t = document.getElementById("body_link").getElementsByTagName("a");
			// var h1 = location.href.replace(/(https*:\/\/.+?\/).+/,"$1");
			var h1 = location.protocol+"//"+location.hostname;
			// var h2 = location.href.replace(/https*:\/\/.+?\//,"");
			var h2 = location.pathname;
			var ha = h2.split("/");
			for(var i=0;i<ha.length;i++){
				h1 += ha[i]+"/";
				appendClassNameByUrl("current", h1+"index.html", t);
			}
		//	alert(document.getElementById("body_link").innerHTML);
		}
		// ■Flashを読み込むべき特定のIDがページに存在する場合に実行する
		if(document.getElementById("flashcontent")){ // プロモーションFlashエリアが存在する場合
			swfobject.embedSWF("/promoarea.swf", "flashcontent", "700", "300", "9.0.0");
		}
		if(document.getElementById("blink14_flashh")){ // 地図Flashエリアが存在する場合
			swfobject.embedSWF("/nichidaimap.swf?category=gakubu", "blink9_flash", "464", "400", "8.0.0");
//			swfobject.embedSWF("/nichidaimap.swf", "blink10_flash", "464", "220", "8.0.0");
//			swfobject.embedSWF("/nichidaimap.swf", "blink11_flash", "464", "220", "8.0.0");
//			swfobject.embedSWF("/nichidaimap.swf", "blink12_flash", "464", "220", "8.0.0");
//			swfobject.embedSWF("/nichidaimap.swf", "blink13_flash", "464", "220", "8.0.0");
			swfobject.embedSWF("/nichidaimap.swf?category=fuzoku", "blink14_flash", "464", "400", "8.0.0");
		}


	} // function end
	if (window.attachEvent){
		window.attachEvent('onload', globalOnLoad);
	} else {
		window.addEventListener('load', globalOnLoad, false);
	}
} // if end


// ■■■ 没コード墓場 ■■■

/*
function switchPageMode(){		// ■ロードするflashを振り分ける。ifだらけ。
	if(location.href.indexOf("brandnew.html") >= 0){	// Brand New Day Pageの場合
		if(loginStatus){	// loginStatusがcookieに存在する場合
			if(sw != null){	// URL引数がある場合
				if(sw["movie"]) {
					loadFla(sw.movie);	// URL?movie=xxx.swf の場合読み込み
				} else {	// URL引数にmovieがない場合
					loadFla(d.getElementById("flashmovie").value);
				}
			} else {	// URL引数がない場合
					loadFla(d.getElementById("flashmovie").value);
			}
		} else {	// loginStatusがcookieにない場合
			if((loginid) && (loginpw)){	// loginidとloginpwがcookieに存在する場合
				d.getElementById("loginid").value = loginid;
				d.getElementById("loginpw").value = loginpw;
			}
		}
	} else {	// Brand New Day Page以外
		if((d.getElementById("flashcontent") != null) && (sw != null)) {
		// 特定IDの要素があり、かつURL引数がある場合
			if(sw["movie"]){loadFla(sw.movie);}// URL?movie=xxx.swf の場合読み込み
		}
	}
}


// ログイン情報（念のためHTMLには書かずにJS側に書いておく）ボツ
if(location.href.indexOf("sp.html") <0){	// sp.html以外の場合
document.write("<scr"+"ipt type=\"text/javascript\" src=\"common/js/lo"+"gin.js\" charset=\"UTF-8\"></sc"+"ript>");
}
*/


