﻿function countdown(year, month, day){
	nowdate = new Date();
	rundate = new Date(year, month - 1, day);
	runsec = nowdate.getTime() - rundate.getTime();
	count = Math.floor(runsec / (1000*60*60*24));
	return count;
}

function print_countdown(year, month, day, length, name){
	print_day = countdown(year, month, day);
	date = new Date();
	hour = date.getHours();
	if(print_day < 0){
		document.write("次の大会(",name,")まで あと",print_day*(-1),"日");
	}else if(print_day <= (length - 1) ){
		if(print_day == (length - 1) && hour >= 17){
			document.write(name,"終了 結果はまもなくUPします");
		}else{
			document.write(name,"開催中");
		}
	}else{
		document.write(name,"終了 結果はまもなくUPします");
	}
}

function resultOtherYearCaption(year){
	if(year == 2009) document.write(" 	<h6>過年度の大会結果</h6> ");
	else document.write(" 	<h6>他年度の大会結果</h6> ");
	document.write(" 	<ul> "); 
	if(year != 2008) document.write(" 	<p><a href=\"../result2008/result-2008.html\" title=\"大会結果-2008\">2008年度</a></p> "); 
	if(year != 2007) document.write(" 	<p><a href=\"../result2007/result-2007.html\" title=\"大会結果-2007\">2007年度</a></p> "); 
	if(year != 2006) document.write(" 	<p><a href=\"../result2006/result-2006.html\" title=\"大会結果-2006\">2006年度</a></p> "); 
	if(year != 2005) document.write(" 	<p><a href=\"../result2005/result-2005.html\" title=\"大会結果-2005\">2005年度</a></p> "); 
	if(year != 2004) document.write(" 	<p><a href=\"../result2004/result-2004.html\" title=\"大会結果-2004\">2004年度</a></p> "); 
	document.write(" 	</ul> ");
}

function caption(year){
	document.write("<a href = \"../index.html\">ホーム</a>&nbsp<img src = \"../image/migi.gif\">&nbsp;");
	document.write("<a href = \"../result.html\">大会結果</a>&nbsp<img src = \"../image/migi.gif\">&nbsp;");
	document.write("<a href = \"../result",year,"/result-",year,".html\">",year,"</a>&nbsp");
}
