﻿function myAgreeNext(){　//フォームの約款
    if( document.getElementById("first_check").checked == false ){
        alert("お申し込みには、約款への同意が必要です。");
        return false;
    }
}

function myFavorite(){//お気に入りのコマンド
	if( document.getElementById("favorite") ){
		with( document.getElementById("favorite") ){
			onmouseover=function(){this.style.cursor='pointer';};
			onmouseout=function(){this.style.cursor='text';};
		}
	}
}



//　サイトマップページの左右のdiv=BOXの高さをそろえる調整（左右の行数が違った場合には、高いほうにそろえる）
function makeDivSameHeight(){
	var str = 'initH';
	var L, R, h;
	var hAry = new Array();
	var ary = new Array();
	ary = document.getElementsByTagName("div");
	for( var i = 0; i < ary.length; i++ ){
		if( ( ary[i].attributes['id'] ) && ( ary[i].attributes['id'].value.substr( 0, str.length ) == str ) ){
			hAry[ parseInt( ary[i].attributes['id'].value.substr( str.length ) ) ] = ary[i];
		}
	}
	for( var i = 1; i < hAry.length; i++ ){
		L = hAry[i];
		R = hAry[++i];
		h = Math.max( L.offsetHeight, R.offsetHeight );
		L.style.height = h + "px";
		R.style.height = h + "px";
	}
}





function newSmallWindow( url, w, h ){　//下のopenSmallWindow内にあるコードの別箇所に記入・・・長くなるため
	var newWin = window.open( url, "_blank", "width=" + w + ",height=" + h + ",resizable=yes,scrollbars=yes" );
}
function openSmallWindow(){   // スモールウィンドウの指定
	var keyStr = 'openSmallWindow';  // class="openSmallWindow_700_450"  // openSmallWindow();
	var ary = new Array();
	var arr = new Array();
	ary = document.getElementsByTagName("a");
	for( var i = 0; i < ary.length; i++ ){
		if( ary[i].attributes['class'] ){
			var str = ary[i].attributes['class'].value;
			arr = str.split( '_' );
			if( arr[0] == keyStr ){
				if( ( ! arr[1] ) || ( isNaN( arr[1] ) ) ) arr[1] = 700;  // w
				if( ( ! arr[2] ) || ( isNaN( arr[2] ) ) ) arr[2] = 450;  // h
				var url = ary[i].attributes['href'].value;
				ary[i].setAttribute("href","javascript:newSmallWindow('"+url+"',"+arr[1]+","+arr[2]+");");
				ary[i].setAttribute("target","");
			}
		}
	}
}





function myChiikiListShowHide( doType ){
	var listAry = new Array( "list_je", "list_jw" );
	for( var i = 0; i < ( listAry.length ); i++ ){
		if( document.getElementById( listAry[i] ) ){
			if( doType ){
				document.getElementById( listAry[i] ).onmouseover = function(){
						document.getElementById("na1_c").style.zIndex = "-2";
                        if( document.getElementById("na2") ) document.getElementById("na2").style.zIndex = "-1";
                        if( document.getElementById("I2011") ) document.getElementById("I2011").style.zIndex = "-1";
                        if( document.getElementById("navi2a0") ) document.getElementById("navi2a0").style.zIndex = "-1";

						if( document.getElementById("mainv") ) document.getElementById("mainv").style.zIndex = "-1";//東日本・西日本ヘッダーのドロップダウン画像表示にページ内直下のMVのIDをこの（）中の２箇所に入れる
						if( document.getElementById("intr_mv") ) document.getElementById("intr_mv").style.zIndex = "-1";
                        if( document.getElementById("cmp_plc_mv") ) document.getElementById("cmp_plc_mv").style.zIndex = "-1";
                        if( document.getElementById("ecoll_mv") ) document.getElementById("ecoll_mv").style.zIndex = "-1";
                        if( document.getElementById("lowc_mv") ) document.getElementById("lowc_mv").style.zIndex = "-1";
                        if( document.getElementById("reen_mv") ) document.getElementById("reen_mv").style.zIndex = "-1";
                        if( document.getElementById("rsn_idx_mv") ) document.getElementById("rsn_idx_mv").style.zIndex = "-1";
                        if( document.getElementById("rsup_mv") ) document.getElementById("rsup_mv").style.zIndex = "-1";
                        if( document.getElementById("tuse_mv") ) document.getElementById("tuse_mv").style.zIndex = "-1";
                        if( document.getElementById("hnan_mv") ) document.getElementById("hnan_mv").style.zIndex = "-1";
                        if( document.getElementById("hite_mv") ) document.getElementById("hite_mv").style.zIndex = "-1";
                        if( document.getElementById("tytt_mv") ) document.getElementById("tytt_mv").style.zIndex = "-1";
                        if( document.getElementById("jttt_mv") ) document.getElementById("jttt_mv").style.zIndex = "-1";
                        if( document.getElementById("bup_mv") ) document.getElementById("bup_mv").style.zIndex = "-1";
                        if( document.getElementById("certi_mv") ) document.getElementById("certi_mv").style.zIndex = "-1";
                        if( document.getElementById("colex_mv") ) document.getElementById("colex_mv").style.zIndex = "-1";
                        if( document.getElementById("freeex_mv") ) document.getElementById("freeex_mv").style.zIndex = "-1";
                        if( document.getElementById("hix_mv") ) document.getElementById("hix_mv").style.zIndex = "-1";
                        if( document.getElementById("hig_mv") ) document.getElementById("hig_mv").style.zIndex = "-1";
                        if( document.getElementById("jux_mv") ) document.getElementById("jux_mv").style.zIndex = "-1";
                        if( document.getElementById("juni_mv") ) document.getElementById("juni_mv").style.zIndex = "-1";
                        if( document.getElementById("prot_mv") ) document.getElementById("prot_mv").style.zIndex = "-1";
                        if( document.getElementById("schi_mv") ) document.getElementById("schi_mv").style.zIndex = "-1";
                        if( document.getElementById("spop_mv") ) document.getElementById("spop_mv").style.zIndex = "-1";
                        if( document.getElementById("totut_mv") ) document.getElementById("totut_mv").style.zIndex = "-1";
                        if( document.getElementById("uare_mv") ) document.getElementById("uare_mv").style.zIndex = "-1";
                        if( document.getElementById("usgu_mv") ) document.getElementById("usgu_mv").style.zIndex = "-1";
                        if( document.getElementById("usad_mv") ) document.getElementById("usad_mv").style.zIndex = "-1";
                        if( document.getElementById("uidy_mv") ) document.getElementById("uidy_mv").style.zIndex = "-1";
                        if( document.getElementById("ussc_mv") ) document.getElementById("ussc_mv").style.zIndex = "-1";
                        if( document.getElementById("usol_mv") ) document.getElementById("usol_mv").style.zIndex = "-1";

						var imgsAry = this.getElementsByTagName("img");
						imgsAry[0].src = myGetSrcChangeImg( imgsAry[0].src, '2b' );

						this.style.overflow = "visible";

				};
				document.getElementById( listAry[i] ).onmouseout = function(){
						document.getElementById("na1_c").style.zIndex = "0";
						if( document.getElementById("na2") ) document.getElementById("na2").style.zIndex = "0";
						if( document.getElementById("I2011") ) document.getElementById("I2011").style.zIndex = "0";
						if( document.getElementById("navi2a0") ) document.getElementById("navi2a0").style.zIndex = "0";

						if( document.getElementById("mainv") )document.getElementById("mainv").style.zIndex = "0";//東日本・西日本ヘッダーのドロップダウン画像表示にページ内直下のMVのIDをこの（）中の２箇所に入れる
						if( document.getElementById("intr_mv") ) document.getElementById("intr_mv").style.zIndex = "0";
						if( document.getElementById("cmp_plc_mv") ) document.getElementById("cmp_plc_mv").style.zIndex = "0";
						if( document.getElementById("ecoll_mv") ) document.getElementById("ecoll_mv").style.zIndex = "0";
						if( document.getElementById("lowc_mv") ) document.getElementById("lowc_mv").style.zIndex = "0";
						if( document.getElementById("reen_mv") ) document.getElementById("reen_mv").style.zIndex = "0";
						if( document.getElementById("rsn_idx_mv") ) document.getElementById("rsn_idx_mv").style.zIndex = "0";
						if( document.getElementById("rsup_mv") ) document.getElementById("rsup_mv").style.zIndex = "0";
						if( document.getElementById("tuse_mv") ) document.getElementById("tuse_mv").style.zIndex = "0";
						if( document.getElementById("hnan_mv") ) document.getElementById("hnan_mv").style.zIndex = "0";
						if( document.getElementById("hite_mv") ) document.getElementById("hite_mv").style.zIndex = "0";
						if( document.getElementById("tytt_mv") ) document.getElementById("tytt_mv").style.zIndex = "0";
						if( document.getElementById("jttt_mv") ) document.getElementById("jttt_mv").style.zIndex = "0";
						if( document.getElementById("bup_mv") ) document.getElementById("bup_mv").style.zIndex = "0";
						if( document.getElementById("certi_mv") ) document.getElementById("certi_mv").style.zIndex = "0";
						if( document.getElementById("colex_mv") ) document.getElementById("colex_mv").style.zIndex = "0";
						if( document.getElementById("freeex_mv") ) document.getElementById("freeex_mv").style.zIndex = "0";
						if( document.getElementById("hix_mv") ) document.getElementById("hix_mv").style.zIndex = "0";
						if( document.getElementById("hig_mv") ) document.getElementById("hig_mv").style.zIndex = "0";
						if( document.getElementById("jux_mv") ) document.getElementById("jux_mv").style.zIndex = "0";
						if( document.getElementById("juni_mv") ) document.getElementById("juni_mv").style.zIndex = "0";
						if( document.getElementById("prot_mv") ) document.getElementById("prot_mv").style.zIndex = "0";
						if( document.getElementById("schi_mv") ) document.getElementById("schi_mv").style.zIndex = "0";
						if( document.getElementById("spop_mv") ) document.getElementById("spop_mv").style.zIndex = "0";
						if( document.getElementById("totut_mv") ) document.getElementById("totut_mv").style.zIndex = "0";
						if( document.getElementById("uare_mv") ) document.getElementById("uare_mv").style.zIndex = "0";
						if( document.getElementById("usgu_mv") ) document.getElementById("usgu_mv").style.zIndex = "0";
						if( document.getElementById("usad_mv") ) document.getElementById("usad_mv").style.zIndex = "0";
						if( document.getElementById("uidy_mv") ) document.getElementById("uidy_mv").style.zIndex = "0";
						if( document.getElementById("ussc_mv") ) document.getElementById("ussc_mv").style.zIndex = "0";
						if( document.getElementById("usol_mv") ) document.getElementById("usol_mv").style.zIndex = "0";

						var imgsAry = this.getElementsByTagName("img");
						imgsAry[0].src = myGetSrcChangeImg( imgsAry[0].src, '2a' );

						this.style.overflow = "hidden";

				};
			}else{
				var elm = document.getElementById( listAry[i] );
				var imgsAry = elm.getElementsByTagName("img");
				for( var i = 0; i < ( imgsAry.length ); i++ ){
					var foo = myGetSrcChangeImg( imgsAry[ i ].src, '2a' );
					if( foo != "" ){
						imgsAry[ i ].src = foo;
					}
				}
				elm.style.overflow = "hidden";
			}
		}
	}
}
function myGetSrcChangeImg( str, doType ){
	var pos = str.lastIndexOf(".");
	if( pos != -1 ){
		var foo = str.substr( ( pos - 1 ), 1 );
		if( doType == '2b' ){
			foo = str.substring( 0, ( pos - 1 ) ) + "b" + str.substring( pos );
		}else if( doType == '2a' ){
			foo = str.substring( 0, ( pos - 1 ) ) + "a" + str.substring( pos );
		}else{
			foo = "";
		}
	}else{
		foo = "";
	}
	return foo;
}
function myChiikiListZIndex(){
	if( document.getElementById("na1_d") ){
		var liAry = document.getElementById("na1_d").getElementsByTagName("li");
		for( var i = 0; i < liAry.length; i++ ){
			liAry[ i ].style.fontSize = "0px";
			liAry[ i ].style.lineHeight = "0px";
		}
	}
}





//################//
// ロールオーバー //
//################//
// HTML例：<a href="reason/index.html" id="rlov0001"><img src="img_css_js/seven_a.gif" alt="７つの特徴" /></a>
// ロールオーバーさせる A タグの ID を、ここ（↓）に追加して下さい。
rolloverIdAry = new Array("rlov0001","rlov0002","rlov0003","fst01","fst02","fst03","fst04","fst05","toku7","1mu","sucam","coco1","husin","tokuten","protyu","protyu2","teiryo","tokuten2","husin2","ai01","ai02","ai03","ai04","ai05","ottoi","rryo","ci01","ci02","ci03","ci04","ci05","co01","co02","co03","co04","co05","ib01","ib02","ib03","ib04","ib05","ka01","ka02","ka03","ka04","ka05","oo01","oo02","oo03","oo04","oo05","oo06","sa01","sa02","sa03","sa04","sa05","si01","si02","si03","si04","si05","si06","si07","si08","si09","tk01","tk02","tk03","tk04","tk05","tk06","are01","are02","are03","are04","are05","are06","are07","are08","are09","com01","com02","com03","rec0e","rec0","rec01","rec02","rec03","rec04","rec05","sj01","sj02","iq01","iq02","iq03","iq0es","iq0ex","iq0re","dis0","se0","se0t","se0s","sh01","sh02","sh03","sh04","sju01","sju02","sju03","sju04","ssh01","ssh02","ssh03","ssh04","ssh05","mub01","mub02","mub03","mub04","mub05","fex0","fex01","pex0","pex01","pro01","pro02","pro03","exp01","tu01","tu02","tu03","tu04","us01","us02","subnavi1","subnavi2","subnavi3","subnavi4","rlov0004","rlov0005","rlov0006","rlov0007","rlov0008","rlov0009","rlov0010","rlov0011","rlov0012","rlov0013","rlov0014","rlov0015","rlov0016","rlov0017","byty01","byty02","rlov_b01","rlov_b02","rlov_b03","rlov_b04","rlov_b05","rlov_b06","rlov_b07","rlov_b08","rlov_b09","rlov_r01","rlov_r02","rlov_r03","rlov_r04","rlov_r05","rlov_r06","rlov_r07","rlov_r08","rlov_r09","rlov_r10","tokyo_2","tokyo_3","tokyo_4","pr01","ju01","hi01","otoi","otoif","otois","mone1","mone2","mone3","mone4","mone5","mone6","mone7","mone8","mone9","mone10","mone11","mone12","mone13","mone14","mone15","mone16","mone17","mone18","mone19","mone20","mone21","mone22","mone23","mone24","mone25","rlov_a01","rlov_a02","rlov_a03","rlov_b_1","rlov_b_2","rlov_b_3","rlov_b_4","rlov_b_5","rlov_b_6","rlov_b_7","rlov_b_8","rlov_b_9","rlov_d_1","rlov_d_2","rlov_e_1","rlov_e_2","btn_exp","btn_pro","pri_2","jun_2","hi_2","tok1","tok2","tok3","psr_1","psr_2","tp_3","tp_4","psr_6","pro_1","top001","rlov0018","t_search","jupr","roi001","roi002","roi003","roi004","roi005","roi006","roi007","roi008","roi009","roi010","roi011","roi012","roi013","roi014","roi015","roi016","roi017","roi018","roi019","roi020","ro_1p","ro_1j","ro_1h","ro_2p","ro_2j","ro_2h","ro_3p","ro_3j","ro_3h","ro_4p","ro_4j","ro_4h","ro_5p","ro_5j","ro_5h","ro_6p","ro_6j","ro_6h");
function rollover(){
	var ary = new Array();
	for( var i = 0; i < rolloverIdAry.length; i++ ){
		var id = rolloverIdAry[ i ];
		var elm = document.getElementById( id );
		if( elm ){
			ary[ id ] = new Array();
			ary[ id ]["aElm"] = elm;
			ary[ id ]["iElm"] = ary[ id ]["aElm"].getElementsByTagName("img")[0];
			if( ary[ id ]["iElm"] ){
				ary[ id ]["srcA"] = ary[ id ]["iElm"].src;
				ary[ id ]["width"] = ary[ id ]["iElm"].width;
				ary[ id ]["height"] = ary[ id ]["iElm"].height;
				ary[ id ]["iElm"].style.border = "0px solid transparent";
				if( ( ary[ id ]["srcA"] ) && ( ary[ id ]["width"] ) && ( ary[ id ]["height"] ) ){
					var n = ary[ id ]["srcA"].lastIndexOf(".");
					if( n != -1 ){
						var str = ary[ id ]["srcA"].substr( ( n - 1 ), 1 );
						if( str == "a" ){
							ary[ id ]["srcB"] = ary[ id ]["srcA"].substr( 0, ( n - 1 ) ) + 'b' + ary[ id ]["srcA"].substr( n );
						}else if( str == "b" ){
							ary[ id ]["srcB"] = ary[ id ]["srcA"].substr( 0, ( n - 1 ) ) + 'a' + ary[ id ]["srcA"].substr( n );
						}else{
							continue;
						}
						ary[ id ]["imgB"] = new Image( ary[ id ]["width"], ary[ id ]["height"] );
						ary[ id ]["imgB"].src = ary[ id ]["srcB"];
						ary[ id ]["aElm"].onmouseover = function(){
							ary[ this.id ]["iElm"].src = ary[ this.id ]["imgB"].src;
						}
						ary[ id ]["aElm"].onmouseout = function(){
							ary[ this.id ]["iElm"].src = ary[ this.id ]["srcA"];
						}
					}
				}
			}
		}
	}
}




//　↓そのページを読み込んだらここを実行する
window.onload = function(){
	myFavorite(); //　ヘッダーのお気に入り登録ボタン　で使用

	makeDivSameHeight(); // サイトマップのページコードこれを実行します（コードが多いから本ページ内で別のところに書いてある・・目視したときにわかりやすくするため）
	rollover();// ロールオーバー実行します（コードが多いから本ページ内で外部化した感じ・・目視したときにわかりやすくするため）


//　　　　　　　　　　　　　　　　　　　　　　↓ネーム値＝名前
	var arr = document.getElementsByName("btn_balloon");//alert( arr.length );

//もし上↑のネーム値が１つだけの場合は↓これを実行します。ここでは画像の位置指定はしていません。元々ある場所div内で画像を切り替える。
                  //　↓449　202　の数値は反転させる画像の大きさ　　
    if( ( arr ) && ( arr.length == 1 ) ){
		( new Image( 449, 202 ) ).src = "img_css_js/main-btn1-b.jpg";// 5月～8月は 5-8mvbtn1-b.jpg   9月～4月は main-btn1-b.jpg
		( new Image( 449, 202 ) ).src = "img_css_js/main-btn2-b.jpg";// 5月～8月は 5-8mvbtn2-b.jpg   9月～4月は main-btn2-b.jpg
		( new Image( 449, 202 ) ).src = "img_css_js/main-btn3-b.jpg";// 5月～8月は 5-8mvbtn3-b.jpg   9月～4月は main-btn3-b.jpg
		( new Image( 449, 202 ) ).src = "img_css_js/main-btn4-b.jpg";// 5月～8月は 5-8mvbtn4-b.jpg   9月～4月は main-btn4-b.jpg
		var ary = arr[0].getElementsByTagName("area");   //　上で読んだネーム値内で、順番が0のものはこれを参照する。マウスオーバーなら-b.jpの画像、マウスアウトならmain-btn.jpgを。順番は0から始まる0,1,2,3・・・の順に
		ary[0].onmouseover = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn1-b.jpg"; }; // 5月～8月は 5-8mvbtn1-b.jpg    9月～4月は main-btn1-b.jpg
		ary[0].onmouseout = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn.jpg"; };　　 // 5月～8月は 5-8mvbtn.jpg    9月～4月は main-btn.jpg
		ary[1].onmouseover = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn2-b.jpg"; }; // 5月～8月は 5-8mvbtn2-b.jpg    9月～4月は main-btn2-b.jpg
		ary[1].onmouseout = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn.jpg"; };　　 // 5月～8月は 5-8mvbtn.jpg   9月～4月は main-btn.jpg
		ary[2].onmouseover = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn3-b.jpg"; }; // 5月～8月は 5-8mvbtn3-b.jpg   9月～4月は main-btn3-b.jpg
		ary[2].onmouseout = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn.jpg"; };　　 // 5月～8月は 5-8mvbtn.jpg   9月～4月は main-btn.jpg
		ary[3].onmouseover = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn4-b.jpg"; }; // 5月～8月は 5-8mvbtn4-b.jpg   9月～4月は main-btn4-b.jpg
		ary[3].onmouseout = function(){ document.getElementById("btnBalloon").src = "img_css_js/main-btn.jpg"; };　　 // 5月～8月は 5-8mvbtn.jpg   9月～4月は main-btn.jpg
	}

	myChiikiListZIndex();
	myChiikiListShowHide(1);

}
window.onunload = function(){
	myChiikiListShowHide(0);
}

