//------------------------------------------------------------------
// ヘッダのメニュー画像切替(onMouseOver処理)
//------------------------------------------------------------------
function ChangeImg(pNm, pSrcPt)
{
	document.images[pNm].src = pSrcPt;
}
//------------------------------------------------------------------
// 画面遷移処理
//------------------------------------------------------------------
function ChangeURL(pUrl)
{
	location.href = pUrl;
}
//------------------------------------------------------------------
// 中分類クリックでSPANタグ表示・非表示設定
//------------------------------------------------------------------
function ChangeShowMode(pId)
{
	var m = pId + "_MARK";

	if(document.getElementById(pId).style.display == "")
	{
		SetCookie(pId, "1");	//CLOSE→1
		document.getElementById(pId).style.display = "none";
		document.getElementById(m).src = "../../joho/images/joho_close.gif";
//		document.getElementById(m).innerText = "＋";
	}
	else
	{
		SetCookie(pId, "0");	//OPEN→0
		document.getElementById(pId).style.display = "";
		document.getElementById(m).src = "../../joho/images/joho_open.gif";
//		document.getElementById(m).innerText = "−";
	}
}
//------------------------------------------------------------------
// クッキー設定
//------------------------------------------------------------------
function SetCookie(key, val)
{
	document.cookie = key + "=" + escape(val) + ";expires=Fri, 31-Dec-2030 23:59:59;";
}
//------------------------------------------------------------------
// クッキー取得
//------------------------------------------------------------------
function GetCookie(key)
{
	var tmp = document.cookie + ";";
	var index1 = tmp.indexOf(key, 0);
	if(index1 != -1){
		tmp = tmp.substring(index1,tmp.length);
		var index2 = tmp.indexOf("=",0) + 1;
		var index3 = tmp.indexOf(";",index2);
		return(unescape(tmp.substring(index2,index3)));
	}
	return("");
}
//------------------------------------------------------------------
// list_s.htmのonLoad処理
//------------------------------------------------------------------
function LoadListS()
{
	//cookieから情報を取得し、前回の画面終了状態を設定
	ckary = document.cookie.split("; ");

	i = 0;
	for(i=0; i<ckary.length; i++)
	{
		if (ckary[i].substr(0,4) == "SPN_")
		{
			//[=]の位置取得
			var pos = ckary[i].indexOf("=");
			//key取得
			key = ckary[i].substr(0, pos);
			val = ckary[i].substr(pos+1, ckary[i].length);

			//keyが8桁、合計12桁(SPN_XXXXXXXX)の判定
			if(key.length == 12)
			{
				if(val == "0")
				{
					if(document.getElementById(key) != null)
					{
						document.getElementById(key).style.display = "";		//OPEN
						document.getElementById(key + "_MARK").src = "../../joho/images/joho_open.gif";
					}
				}
				else
				{
					if(document.getElementById(key) != null)
					{
						document.getElementById(key).style.display = "none";	//CLOSE
						document.getElementById(key + "_MARK").src = "../../joho/images/joho_close.gif";
					}
				}
			}
		}
	}
}
//------------------------------------------------------------------
// list_c.htmのonLoad処理
//------------------------------------------------------------------
function LoadListC()
{
	//cookieから情報を取得し、前回の画面終了状態を設定
	ckary = document.cookie.split("; ");
	i = 0;
	for(i=0; i<ckary.length; i++)
	{
		if(ckary[i].substr(0,4) == "SPN_")
		{
			//[=]の位置取得
			var pos = ckary[i].indexOf("=");
			//key取得
			key = ckary[i].substr(0, pos);
			val = ckary[i].substr(pos+1, ckary[i].length);

			//keyが6桁、合計10桁(SPN_XXXXXX)の判定
			if(key.length == 10)
			{
				if(val == "0")
				{
					if(document.getElementById(key) != null)
					{
						document.getElementById(key).style.display = "";		//OPEN
						document.getElementById(key + "_MARK").src = "../../joho/images/joho_open.gif";
					}
				}
				else
				{
					if(document.getElementById(key) != null)
					{
						document.getElementById(key).style.display = "none";	//CLOSE
						document.getElementById(key + "_MARK").src = "../../joho/images/joho_close.gif";
					}
				}
			}
		}
	}
}
//------------------------------------------------------------------
// index.htmのonLoad処理
//------------------------------------------------------------------
function LoadIndex()
{
//	//クッキーの削除
//	ckary = document.cookie.split("; ");
//	i = 0;
//	for(i=0; i<ckary.length; i++)
//	{
//		if (ckary[i].substr(0,4) == "SPN_")
//		{
//			spn = ckary[i].substr(0, 14);
//			str = ckary[i].substr(15, ckary[i].length);
//			document.cookie = spn + "=" + escape(str) + ";expires=Fri, 31-Dec-1999 23:59:59;";
//		}
//	}
}
//------------------------------------------------------------------
// トップ画像の設定(写真部分)  * ブラウザ更新で画像切替
//------------------------------------------------------------------
function SetTopImg()
{
	//------------------------------------
	//----->>月単位の名所画像の切替<<-----
	//------------------------------------
	//当月の取得
	var wToday = new Date();
	var wMonth = wToday.getMonth() + 1;
	wMonth = "" + wMonth;
	if(wMonth.length == 1) wMonth = "0" + wMonth;

	wImg = new Array();	
	wImg[0]  = "/hopweb/joho/images/top_image/month_" + wMonth + "01.jpg";
	wImg[1]  = "/hopweb/joho/images/top_image/month_" + wMonth + "02.jpg";
	wImg[2]  = "/hopweb/joho/images/top_image/month_" + wMonth + "03.jpg";
	wImg[3]  = "/hopweb/joho/images/top_image/month_" + wMonth + "04.jpg";
	wImg[4]  = "/hopweb/joho/images/top_image/month_" + wMonth + "05.jpg";
	wImg[5]  = "/hopweb/joho/images/top_image/month_" + wMonth + "06.jpg";
	wImg[6]  = "/hopweb/joho/images/top_image/month_" + wMonth + "07.jpg";
	wImg[7]  = "/hopweb/joho/images/top_image/month_" + wMonth + "08.jpg";
	wImg[8]  = "/hopweb/joho/images/top_image/month_" + wMonth + "09.jpg";
	wImg[9]  = "/hopweb/joho/images/top_image/month_" + wMonth + "10.jpg";

	//ランダムに画像を決定
	n = Math.floor(Math.random()*wImg.length);

	//画像を設定
	document.getElementById("IMG_TOP").src = wImg[n];
}
//------------------------------------------------------------------
// ヘッダ画像の設定(ヘッダ帯部分)  * 時間帯によって画像切替
// 		引数[i]  pKai : ﾌｫﾙﾀﾞ階層( (1)１階層上  (2)２階層上 )
//
//------------------------------------------------------------------
function DrawHeader(pKai)
{
	//現時刻取得
	var tm = parseInt((new Date()).getHours());

	//画像ディレクトリ設定
	var wDir = "";
	if((4<=tm) && (8>tm))
	{
		//午前４時〜午前８時	-->日の出・日の入
		wDir = "sunset";
	}
	else if((8<=tm) && (16>tm))
	{
		//午前８時〜午後１６時	-->昼間
		wDir = "daytime";
	}
	else if((16<=tm) && (20>tm))
	{
		//午後１６時〜午後２０時	-->日の出・日の入
		wDir = "sunset";
	}
	else
	{
		//その他の時刻(午後２０時〜午前４時)	-->夜
		wDir = "night";
	}

	//ファイル階層の決定
	var wKai = "";
	if(pKai == 1)
	{
		wKai = "../";
	}
	else if(pKai == 2)
	{
		wKai = "../../";
	}

	var wHtml = "";
	wHtml = wHtml + "<TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' WIDTH='100%' >";
	wHtml = wHtml + "  <TR>";
	wHtml = wHtml + "    <TD VALIGN='top' BACKGROUND='/hopweb/joho/images/top_bg.gif'>";
	wHtml = wHtml + "      <TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0' WIDTH='100%' BACKGROUND='/hopweb/joho/images/top/" + wDir + "/bg.jpg'>";
	wHtml = wHtml + "        <TR VALIGN='bottom'>";
	wHtml = wHtml + "          <TD VALIGN='bottom' ALIGN='left' WIDTH='70' ><IMG SRC='/hopweb/joho/images/top/" + wDir + "/sun.gif'  WIDTH='70'  HEIGHT='70' BORDER='0'></TD>";
	wHtml = wHtml + "          <TD VALIGN='top'    ALIGN='left' WIDTH='190'>";
	wHtml = wHtml + "            <A HREF='" + wTopUrl + "'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/logo.gif' WIDTH='190' HEIGHT='70' BORDER='0' ALT='トップページへ'></A>";
	wHtml = wHtml + "          </TD>";
	wHtml = wHtml + "          <TD VALIGN='bottom' WIDTH='90%' ALIGN='right'>";
	wHtml = wHtml + "            <TABLE BORDER='0' CELLPADDING='0' CELLSPACING='0'>";
	wHtml = wHtml + "              <TR>";
	wHtml = wHtml + "                <TD COLSPAN='3' ALIGN='center'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif' WIDTH='1' HEIGHT='5' BORDER='0' ALT=''></TD>";
	wHtml = wHtml + "              </TR>";
	wHtml = wHtml + "              <TR VALIGN='bottom'>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5' ALIGN='right'     ><IMG SRC='/hopweb/joho/images/top/" + wDir + "/light_lt.gif' WIDTH='5' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' HEIGHT='5' bgcolor='#FFFF88'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif'   WIDTH='1' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5' ALIGN='left'      ><IMG SRC='/hopweb/joho/images/top/" + wDir + "/light_rt.gif' WIDTH='5' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "              </TR>";
	wHtml = wHtml + "              <TR bgcolor='#FFFF88'>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif' WIDTH='1' HEIGHT='30' BORDER='0'></TD>";

	//灯台文字列の読込み
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' NOWRAP   >" + wTodai + "</TD>";

	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif' WIDTH='1' HEIGHT='30' BORDER='0'></TD>";
	wHtml = wHtml + "              </TR>";
	wHtml = wHtml + "              <TR VALIGN='top'>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5'  ALIGN='right'    ><IMG SRC='/hopweb/joho/images/top/" + wDir + "/light_lb.gif' WIDTH='5' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' HEIGHT='5' BGCOLOR='#FFFF88'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif'   WIDTH='1' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "                <TD BACKGROUND='images/spacer.gif' WIDTH='5'  ALIGN='left'     ><IMG SRC='/hopweb/joho/images/top/" + wDir + "/light_rb.gif' WIDTH='5' HEIGHT='5' BORDER='0'></TD>";
	wHtml = wHtml + "              </TR>";
	wHtml = wHtml + "              <TR>";
	wHtml = wHtml + "                <TD COLSPAN='3' ALIGN='center'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/spacer.gif' WIDTH='1' HEIGHT='22' BORDER='0' ALT=''></TD>";
	wHtml = wHtml + "              </TR>";
	wHtml = wHtml + "            </TABLE>";
	wHtml = wHtml + "          </TD>";
	wHtml = wHtml + "          <TD ROWSPAN='2' ALIGN='right' WIDTH='300'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/toudai-main.gif' WIDTH='300' BORDER='0'></TD>";
	wHtml = wHtml + "        </TR>";
	wHtml = wHtml + "        <TR VALIGN='bottom'>";
	wHtml = wHtml + "          <TD COLSPAN='2' ALIGN='left' BACKGROUND='images/sea.gif'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/logo_under.gif' WIDTH='260' BORDER='0'></TD>";
	wHtml = wHtml + "          <TD ALIGN='right' BACKGROUND='/hopweb/joho/images/top/" + wDir + "/sea.gif' WIDTH='90%'><IMG SRC='/hopweb/joho/images/top/" + wDir + "/light_under.gif' WIDTH='200' BORDER='0'></TD>";
	wHtml = wHtml + "        </TR>";
	wHtml = wHtml + "      </TABLE>";
	wHtml = wHtml + "    </TD>";
	wHtml = wHtml + "  </TR>";
	wHtml = wHtml + "</TABLE>";

	//ヘッダhtmlの書出し
	document.write(wHtml);
}
