//<script>

	// モジュール変数群
	var dteToday = new Date();
	var dte10000day = new Date(2005, 5 - 1, 24);
	var lngMemorialDay = (dte10000day.getTime() - dteToday.getTime()) / (24 * 60 * 60 * 1000);

	var intYear = dteToday.getYear();
	if (intYear < 2000) {
		intYear = intYear + 1900;
	}
	var intMonth = dteToday.getMonth() + 1;
	var intDay = dteToday.getDate();
	var strDayOfWeekArray = new Array('日', '月', '火', '水', '木', '金', '土');
	var strDayOfWeek = strDayOfWeekArray[dteToday.getDay()];
	var intHour = dteToday.getHours();
	var intMinute = dteToday.getMinutes();
	var intSecond = dteToday.getSeconds();

	var strHPURL = 'http://www.justmeet.net/';
	var strHPTitle = 'そんだらばいっちょうやってみっか的ホームページ';
	var strHorseRacing = '';

	// 競馬日程オブジェクトの配置、レース名セット
	function SetG1InfoObject() {
		document.write('<OBJECT ID="dbG1Info" CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">');
		document.write('<PARAM NAME="CharSet" VALUE="Shift_JIS">');
		document.write('<PARAM NAME="DataURL" VALUE="fjy/data/g1info.txt">');
		document.write('<PARAM NAME="UseHeader" VALUE="true">');
		document.write('<PARAM NAME="FieldDelim" VALUE="&#9;">');
		document.write('</OBJECT>');
	}

	// オンロード処理
	function PageLoaded() {
		RefuseLivedoor();
		ShowPopUp();
		ShowMarquee();
		ShowBirthday(5);
		ShowGeisho(4);
	}

	// ライブドアお断り
	function RefuseLivedoor() {
		strReferrer = document.referrer;
		if (strReferrer.match(/livedoor/)){
			alert('ライブドア関連サイトからのリンクは固くお断りします。\n即刻立ち去りなさい。');
			window.location.href = "http://www.1242.com/info/seimei/";
		}
	}

	// ポップアップウィンドウを開く
	function ShowPopUp(){
		var strWindow = '';
		if (intMonth == 1) {
				strWindow = 'maji/radetzky.htm';
		} else if (intMonth == 12) {
				strWindow = 'maji/choral.htm';
		} else if (intMonth == 13) {
				strWindow = 'maji/pomp1.htm';		// ジャイアンツ優勝時
		}
		if (strWindow != '') {
			window.open(strWindow, '', 'toolbar = no, location = no, status = no, menubar = no, scrollbar = no, width = 256, height = 128');
		}
	}

	// お気に入りに追加する
	function AddBookmark() {
		if (document.all) {
			window.external.addFavorite(strHPURL, strHPTitle);
		}
	}

	// ケータイ用ページ URL を表示する
	function ShowCellularPage() {
		alert('携帯用ページの URL は ' + strHPURL + 'i/ です。');
	}

	// トップ画像を表示する
	function ShowTitleImage() {
		var strResult;
		var strSupply = '';
		var strCopyRight = '';
		
		if (intDay == 13 && strDayOfWeek == '金') {
			strResult = '<img src="fjy/data/sonoko.jpg" alt="　　　　　　　　　　　　　　　　　　　　　　　　" />';
//		} else if (intYear == 2005 && intMonth == 3 && intDay >= 18) {
//			strResult = '<img src="fjy/data/7th_aniv.jpg" alt="Thank You for 7th Anniversary" />';
//			strCopyRight = '(c) F.J.Y.';
		} else if (intMonth == 3 && intDay >= 18) {
			strResult = '<img src="fjy/data/plingles.gif" alt="Thank You for ' + (intYear - 1998) + 'th Anniversary" />';
			strCopyRight = '(c) 腹黒やすし';
		} else if (intDay == 18) {
			strResult = '<img src="fjy/data/plingles.gif" alt="ジーペムーホ的かっみてっやうょちっいばらだんそ" />';
			strCopyRight = '(c) 腹黒やすし';
		} else if (intMonth == 11 && intDay == 11) {
			strResult = '<img src="fjy/data/pocky.gif" alt="♪あなたもわたしもワッキー〜" />';
		} else if (intYear == 2005 && intMonth == 1) {
			strResult = '<img src="fjy/data/newyear.png" alt="A Happy New Year!" />';
			strCopyRight = '(c) F.J.Y.';
		} else if (intMonth == 4) {
			var strAlt = ' alt="桜 桜 桜 桜 桜 桜 桜 桜 桜" ';
			strResult = '<img src="fjy/data/sakura17.jpg" usemap="#sakura" border="0"' + strAlt + '/>';
			strResult += '<map name="sakura">';
			strResult += '<area shape="rect" coords="  0,  0,213,161" href="fjy/data/sakura1.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="213,  0,427,161" href="fjy/data/sakura2.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="427,  0,640,161" href="fjy/data/sakura3.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="  0,161,213,321" href="fjy/data/sakura4.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="213,161,427,321" href="fjy/data/sakura5.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="427,161,640,321" href="fjy/data/sakura6.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="  0,321,213,480" href="fjy/data/sakura7.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="213,321,427,480" href="fjy/data/sakura8.jpg"' + strAlt + '/>';
			strResult += '<area shape="rect" coords="427,321,640,480" href="fjy/data/sakura9.jpg"' + strAlt + '/>';
			strResult += '</map>';
			strCopyRight = '(c) F.J.Y.';
		} else {
			strResult = '<img src="fjy/data/welcome.jpg" alt="Welcome to www.justmeet.net" />';
			strCopyRight = '(c) F.J.Y.';
		}
		
		document.write('<p><table border="0" cellspacing="0" cellpadding="0">');
		document.write('<tr><td colspan="2">' + strResult + '</td></tr>');
		document.write('<tr><td align="left"><font size="1">' + strSupply + '</font></td>');
		document.write('<td align="right"><font size="1">' + strCopyRight + '</font></tr>');
		document.write('</table></p>');
	}

	// カウンターを表示する（自ホスト対策）
	function ShowCounter() {
		var strCounter;
		if (location.protocol == 'file:') {
			strCounter = 'http://www.justmeet.net/cgi-bin/tc.cgi?top&a';
		} else {
			strCounter = 'http://www.justmeet.net/cgi-bin/tc.cgi?top&a&1';
		}
		document.write('You are the <a href="fjy/members.htm"><img src="' + strCounter + '" border="0" alt="キリ番ゲットの方は「常連さん名簿」へごあんな〜い。"></a> th visiter.<p>');
	}

	// 「アクセスした時刻は〜」のくだりを表示する
	function ShowAccessTime() {
		document.write('<div>アクセスした時刻は ' + intYear + '年' + intMonth + '月' + intDay + '日（' + strDayOfWeek + '）' + intHour + '時' + intMinute + '分' + intSecond + '秒です</div>');
		if (lngMemorialDay > 0) {
			document.write('<div><b>＜福澤さんご生誕 10,000日目まで あと ' + Math.ceil(lngMemorialDay) + '日＞</b></div>');
		}
		if (intMonth == 12 && intDay > 24) {
			document.write('<div>年内の更新は終了いたしました。 新年も当ページをよろしくお願いいたします。</div>');
		}
		if (intMonth == 1) {
			document.write('<div>あけましておめでとうございます。 本年も当ページをよろしくお願いいたします。</div>');
		}
	}

	// マーキー文字列を表示する
	function ShowMarquee() {
		// 競馬日程を検索しておく
		var rs = dbG1Info.recordset;
		rs.moveFirst();
		while (rs.EOF == false) {
			if (intHour > 5 && intHour < 16 && rs.Fields('Year').value == intYear && rs.Fields('Month').value == intMonth && rs.Fields('Day').value == intDay) {
				strHorseRacing = '<a href="http://www.jra.go.jp/indext.html" target="top">';
				strHorseRacing += '<img src="fjy/links/jra.gif" border="0" align="absmiddle"></a> ';
				strHorseRacing += '<marquee width="400">今日のメインレースは ';
				strHorseRacing += '<a href="' + rs.Fields('Fanfare').value + '">';
				strHorseRacing += '<font size="+3">「' + rs.Fields('Name').value + '」</font></a>'
				strHorseRacing += '（G' + rs.Fields('Grade').value + '／' + rs.Fields('Place').value + '競馬場：';
				strHorseRacing += rs.Fields('Type').value + ' ' + rs.Fields('length').value + 'm）です。</marquee>';
				break;
			} else {
				rs.moveNext();
			}
		}
		
		// 処理本編
		var strResult = '';
		if (intMonth == 1 && intDay == 6) {
			strResult = '<a href="mailto:福澤ジャストミート諭吉&lt;r-kinoshita@justmeet.net&gt;?subject=お誕生日おめでとう！ …うっさい無理して祝わんでもええねん。"><img src="fjy/data/yukichi.gif" border="0" height="60" align="absmiddle"></a> <marquee width="400">福澤さんは今日で ' + (intYear - 1978) + '歳になっちゃいましたエ゛ヘヘ（(c)<b>ミスター</b>）。　結婚してみる？</marquee>'
		} else if (intMonth == 3 && intDay >= 18) {
			strResult = '<img src="fjy/data/plingles.gif" height="40" height="30" align="absmiddle" /> <marquee width="400">当ホームページは 3月18日で<font size="+3">開設 ' + (intYear - 1998) + '周年</font>を迎えました。　ありがとうございます。</marquee>';
		} else if (strHorseRacing != '') {
			strResult = strHorseRacing;
		} else if (strDayOfWeek == '月' || strDayOfWeek == '水' || strDayOfWeek == '金') {
			strResult = '<a href="maji/mimicopy/attack25.jpg" target="top"><img src="maji/mimicopy/attack25.jpg" border="0" height="50" align="absmiddle"></a> <marquee width="400">本日も「そんだらば〜」にご来場いただきましてありがとうございます。　お別れの曲は<a href="maji/mimicopy/attack25.mid"><font size="+3">「アタック 25」</font></a>です。</marquee>';
		} else {
			strResult = '<a href="http://www.justmeet.net/cgi-bin/tvote.cgi?event=miyuki_favorite"><img src="gdb/100weak.gif" border="0" align="absmiddle"></a> <marquee width="320"><font size="+2">「あなたが選ぶ中島みゆき大賞」</font>　10票ずつ入れて入れて入れて〜。</marquee>';
		}

		if (strResult != '') {
			ShowMarqueeArea.innerHTML = strResult;
		}
	}
	
//</script>

