<!--
/////////////////////////////////////////////////////////////////////////////
// 越前ウインドアンサンブル ウェブサイト
// 
// ファイル:practice.js
// 説　　明:練習カレンダー (JavaScript)
/////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// 基本設定

/////////////////////////////////////////////////////////////////////////////
// 月設定
month = makeObjectArray(12);
i = 0;
month[i].name =	 "１";		month[i].totalDays = 31;		month[i++].startPos = 0;
month[i].name =	 "２";		month[i].totalDays = 29;		month[i++].startPos = 3;
month[i].name =	 "３";		month[i].totalDays = 31;		month[i++].startPos = 2;
month[i].name =	 "４";		month[i].totalDays = 30;		month[i++].startPos = 5;
month[i].name =	 "５";		month[i].totalDays = 31;		month[i++].startPos = 0;
month[i].name =	 "６";		month[i].totalDays = 30;		month[i++].startPos = 3;
month[i].name =	 "７";		month[i].totalDays = 31;		month[i++].startPos = 5;
month[i].name =	 "８";		month[i].totalDays = 31;		month[i++].startPos = 1;
month[i].name =	 "９";		month[i].totalDays = 30;		month[i++].startPos = 4;
month[i].name = "１０";		month[i].totalDays = 31;		month[i++].startPos = 6;
month[i].name = "１１";		month[i].totalDays = 30;		month[i++].startPos = 2;
month[i].name = "１２";		month[i].totalDays = 31;		month[i++].startPos = 4;

/////////////////////////////////////////////////////////////////////////////
// 日定義
days = new Array();
days[1]  = "　１";	days[2]  = "　２";	days[3]  = "　３";	days[4]  = "　４";	days[5]  = "　５";
days[6]  = "　６";	days[7]  = "　７";	days[8]  = "　８";	days[9]  = "　９";	days[10] = "１０";
days[11] = "１１";	days[12] = "１２";	days[13] = "１３";	days[14] = "１４";	days[15] = "１５";
days[16] = "１６";	days[17] = "１７";	days[18] = "１８";	days[19] = "１９";	days[20] = "２０";
days[21] = "２１";	days[22] = "２２";	days[23] = "２３";	days[24] = "２４";	days[25] = "２５";
days[26] = "２６";	days[27] = "２７";	days[28] = "２８";	days[29] = "２９";	days[30] = "３０";
days[31] = "３１";

/////////////////////////////////////////////////////////////////////////////
// 曜日定義
weeks = new Array();
weeks[0] = "日";	weeks[1] = "月";	weeks[2] = "火";	weeks[3] = "水";
weeks[4] = "木";	weeks[5] = "金";	weeks[6] = "土";

/////////////////////////////////////////////////////////////////////////////
// 練習日程設定
// P - 練習日
// M - 運営委員会
// E - イベント
// H - 祝日
// L - イベント＋祝日
//
// function makeSchedule( mode, newChange, content )
// arguments: mode      - P ... Practice
//                        M ... Meeting
//                        E ... Event
//                        H ... Holiday
//                        L ... Sunday or Holiday & Event
//                        N ... Sunday or Holiday & Practice
//            newChange - 0 ... normal
//                        1 ... new
//                        2 ... change
//                        3 ... strike
//            content   - "schedule's content"
//
dayList = new Array();
// ------------------------------------- 　１月
dayList[1] = new Array();
dayList[1][1]	= makeSchedule("H", 0, null);
dayList[1][8]	= makeSchedule("E", 0, "総会＆新年会");
dayList[1][9]	= makeSchedule("H", 0, null);
dayList[1][10]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[1][17]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[1][24]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[1][31]	= makeSchedule("P", 0, "ハーモニーホール　２３");
// ------------------------------------- 　２月
dayList[2] = new Array();
dayList[2][11]	= makeSchedule("H", 0, null);
dayList[2][7]	= makeSchedule("P", 0, "ハーモニーホール　");
dayList[2][14]	= makeSchedule("P", 0, "ハーモニーホール　");
dayList[2][21]	= makeSchedule("P", 0, "ハーモニーホール　");
dayList[2][26]	= makeSchedule("P", 0, "門徒会館　合同");
dayList[2][28]	= makeSchedule("P", 0, "ハーモニーホール　");
// ------------------------------------- 　３月
dayList[3] = new Array();
dayList[3][20]	= makeSchedule("H", 0, null);
// ------------------------------------- 　４月
dayList[4] = new Array();
dayList[4][5]	= makeSchedule("P", 0, "ハーモニーホール　練習室２３");
dayList[4][9]	= makeSchedule("P", 0, "東十郷公民館");
dayList[4][12]	= makeSchedule("P", 0, "ハーモニーホール　練習室２３");
dayList[4][20]	= makeSchedule("P", 0, "ハーモニーホール　練習室２３");
dayList[4][23]	= makeSchedule("P", 0, "東十郷公民館");
dayList[4][26]	= makeSchedule("P", 0, "ハーモニーホール　練習室２３");
dayList[4][29]	= makeSchedule("H", 0, null);
// ------------------------------------- 　５月
dayList[5] = new Array();
dayList[5][3]	= makeSchedule("H", 0, null);
dayList[5][4]	= makeSchedule("H", 0, null);
dayList[5][5]	= makeSchedule("H", 0, null);
dayList[5][10]	= makeSchedule("P", 0, "ハーモニーホール");
dayList[5][17]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[5][21]	= makeSchedule("P", 0, "東十郷公民館");
dayList[5][24]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[5][28]	= makeSchedule("P", 0, "東十郷公民館");
dayList[5][31]	= makeSchedule("P", 0, "ハーモニーホール　２３");
// ------------------------------------- 　６月
dayList[6] = new Array();
dayList[6][7]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[6][11]	= makeSchedule("P", 0, "東十郷公民館");
dayList[6][14]	= makeSchedule("P", 0, "ハーモニーホール　１");
dayList[6][21]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[6][25]	= makeSchedule("P", 0, "東十郷公民館");
dayList[6][28]	= makeSchedule("P", 0, "ハーモニーホール　１");
// ------------------------------------- 　７月　更新済み
dayList[7] = new Array();
dayList[7][5]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[7][9]	= makeSchedule("P", 0, "会場未定");
dayList[7][12]	= makeSchedule("P", 0, "ハーモニーホール　１");
dayList[7][13]	= makeSchedule("P", 0, "ハーモニーホール　１");
dayList[7][18]	= makeSchedule("H", 0, null);
dayList[7][19]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[7][20]	= makeSchedule("P", 0, "ハーモニーホール　１");
dayList[7][24]	= makeSchedule("E", 0, "全日コンクール　県大会");
dayList[7][26]	= makeSchedule("P", 0, "ハーモニーホール　２３");
// ------------------------------------- 　８月　更新済み
dayList[8] = new Array();
dayList[8][2]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[8][9]	= makeSchedule("P", 0, "ハーモニーホール　１");
dayList[8][16]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[8][23]	= makeSchedule("P", 0, "東十郷公民館");
dayList[8][30]	= makeSchedule("P", 0, "ハーモニーホール　２３");
// ------------------------------------- 　９月
dayList[9] = new Array();
dayList[9][6]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[9][13]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[9][19]	= makeSchedule("H", 0, null);
dayList[9][20]	= makeSchedule("P", 0, "ハーモニーホール　２３");
dayList[9][23]	= makeSchedule("H", 0, null);
dayList[9][27]	= makeSchedule("P", 0, "ハーモニーホール　１");
// ------------------------------------- 　１０月
dayList[10] = new Array();
dayList[10][5]	= makeSchedule("P", 0, "ハーモニー　２・３");
dayList[10][8]	= makeSchedule("P", 0, "東十郷公民館");
dayList[10][11]	= makeSchedule("H", 0, null);
dayList[10][12]	= makeSchedule("P", 0, "ハーモニー　１");
dayList[10][19]	= makeSchedule("P", 0, "ハーモニー　２・３");
dayList[10][22]	= makeSchedule("P", 0, "東十郷公民館");
dayList[10][26]	= makeSchedule("P", 0, "ハーモニー　１");
dayList[10][29]	= makeSchedule("P", 0, "東十郷公民館");
dayList[10][31]	= makeSchedule("P", 1, "坂井中学校");
// ------------------------------------- １１月
dayList[11] = new Array();
dayList[11][3]	= makeSchedule("H", 0, null);
dayList[11][23]	= makeSchedule("L", 0, "第２１回定期演奏会");
dayList[11][29]	= makeSchedule("P", 0, "丸岡公民館");
// ------------------------------------- １２月
dayList[12] = new Array();
dayList[12][6]	= makeSchedule("P", 0, "ハーモニー　２・３");
dayList[12][13]	= makeSchedule("P", 0, "ハーモニー　２・３");
dayList[12][23]	= makeSchedule("H", 0, null);


/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// ツール関数群

colNormal	= "#FFFFFF";	// 平　　　日
colSun		= "#FFEEEE";	// 日　祝　日
colSat		= "#DDEEFF";	// 土　曜　日
colPractice = "#FFFFDD";	// 練　習　日
colMeeting	= "#EEFFEE";	// 運営委員会

////////////////////////////////////////////////////////////
// func : writeCalendar
//		: 練習日程カレンダー作成
// args : mm	 表示月
//		: mode	 表示モード   0 - index ページ用
//		:					  1 - 練習日程ページ用
// ret	: -
function writeCalendar(mm, mode)
{
	width	 = (mode == 0) ? 21 : 30;
	fontsize = (mode == 0) ? "size=\"1\"" : "";
	
	html =	"<table border=\"0\" cellspacing=\"0\">\n";
	html +=		"<tr>\n";
	html +=			"<td bgcolor=\"#000099\">\n";
	html +=			"<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
	html +=				"<tr>\n";
	html +=					"<td background=\"image/bg_b.gif\" align=\"center\"><font color=\"#FFFFFF\"><b>" + month[mm - 1].name + "月の練習</B></font></td>\n";
	html +=				"</tr>\n";
	html +=			"</table>\n";
	html +=			"<table width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"0\">\n";
	html +=				"<tr>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFEEEE\"><font color=\"#FF7777\">日</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFFFFF\"><font color=\"#000000\">月</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFFFFF\"><font color=\"#000000\">火</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFFFFF\"><font color=\"#000000\">水</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFFFFF\"><font color=\"#000000\">木</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#FFFFFF\"><font color=\"#000000\">金</font></td>\n";
	html +=					"<td width=\"" + width + "\" align=\"center\" bgcolor=\"#DDEEFF\"><font color=\"#7777FF\">土</font></td>\n";
	html +=				"</tr>\n";
	html +=				"<tr>\n";
	//----------------------------------
	// Make calendar
	day = 1;
	i = month[mm - 1].startPos;
	for (;;) {
		for (; (i < 7) && (day <= month[mm - 1].totalDays); i++) {
			if ((day == 1) && (month[mm - 1].startPos > 0)) {
				html +=		"<td bgcolor=\"#FFFFFF\" colspan=\"" + month[mm - 1].startPos + "\">&nbsp;</td>\n";
			}
			
			//----------------------------------
			// Color & content setting
			colBack = (i == 0) ? colSun : (i == 6) ? colSat : colNormal;
			content = "&nbsp;";
			work = "";
			flga = 0;
			if (dayList[mm][day] != undefined) {
				work = dayList[mm][day].mode;
				flag = dayList[mm][day].newChange;
			}
			if (work == "H" || work == "L") {	// Sunday & Holiday
				colBack = colSun;
			}
			if (work == "P" || work == "N") {	// Practice
				if (flag != 3) {
					colBack = colPractice;
					content = "●";
				}
			}
			if (work == "M") {					// Meeting
				colBack = colMeeting;
				content = "▲";
			}
			if (work == "E" || work == "L") {	// Event
				content = "☆";
			}
			
			//----------------------------------
			// Calendar cell
			html +=		"<td align=\"center\" bgcolor=\"" + colBack + "\">" + day + "<br><font " + fontsize + " color=\"#000099\">" + content + "</font></td>\n";
			day++;
		}
		if (day > month[mm - 1].totalDays) {
			if (i != 7) {
				pos = 7 - i;
				html +=		"<td bgcolor=\"#FFFFFF\" colspan=\"" + pos + "\">&nbsp;</td>\n";
			}
			break;
		}
		else {
			html +=		"</tr>\n";
			html +=		"<tr>\n";
		}
		i = 0;
	}
	html +=				"</tr>\n";
	html +=			"</table>\n";
	html +=			"</td>\n";
	html +=		"</tr>\n";
	if (mode == 1) {
		html +=	"<tr>\n";
		html +=		"<td align=\"center\">\n";
		html +=			"<font color=\"#000099\">●：練習　▲：運委会　☆：イベント</font><br>\n";
		html +=		"</td>\n";
		html +=	"</tr>\n";
	}
	html +=	"</table>\n";
	document.write(html);
}


colSatFont	= "#7799CC";	// 土　曜　日
colSunFont	= "#FF7777";	// 日　祝　日
colInpotant	= "#FF7700";

////////////////////////////////////////////////////////////
// func : writeSchedule
//		: 練習日程スケジュール作成
// args : mm	 表示月
// ret	: -
function writeSchedule(mm)
{
	html = "";
	
	//----------------------------------
	// Make schedule
	day = 1;
	baseWeek = month[mm - 1].startPos;
	for (day = 1; day <= month[mm - 1].totalDays; day++) {
		
		if ((dayList[mm][day] != undefined) && dayList[mm][day].content != null) {
			
			html += "　";
			
			// calculate week
			calcWeek = (baseWeek + day - 1) % 7;
			
			// change color when Satraday & Sunday
			colFont = (calcWeek == 0) ? colSunFont : (calcWeek == 6) ? colSatFont : -1;
			if (dayList[mm][day].mode == "H" || dayList[mm][day].mode == "L" || dayList[mm][day].mode == "N"){
				colFont = colSunFont;
			}
			if (colFont != -1) {
				html += "<font color=\"" + colFont + "\">";
			}
			if (dayList[mm][day].newChange == 3) {
				html += "<strike>"
			}
			html += days[day];
			html += "（" + weeks[calcWeek] + "）　";
			if (dayList[mm][day].newChange == 3) {
				html += "</strike>"
			}
			if (colFont != -1) {
				html += "</font>";
			}
			
			// add content
			if (dayList[mm][day].newChange == 3) {
				html += "<strike>"
			}
			html += dayList[mm][day].content;
			if (dayList[mm][day].newChange == 3) {
				html += "</strike>"
			}
			
			// add "new" & "change"
			if (dayList[mm][day].newChange == 1) {
				html += "　<font size=\"2\" color=\"" + colInpotant + "\"><b>new</b></font>";
			}
			else if (dayList[mm][day].newChange == 2) {
				html += "　<font size=\"2\" color=\"" + colInpotant + "\"><b>change</b></font>";
			}
			
			html += "<br>\n";
		}
	}
	document.write(html);
}


// -->

