// お休み日マトリックス1 
//       行(曜日) 日 月 火 水 木 金 土
// 列( 週 ) 1週
// 列( 週 ) 2週     定休日を1に設定
// 列( 週 ) 3週     営業日を0に設定
// 列( 週 ) 4週
// 列( 週 ) 5週
arr_CLOSED_week1 = new Array(1,0,0,0,0,0,1);
arr_CLOSED_week2 = new Array(1,0,0,0,0,0,1);
arr_CLOSED_week3 = new Array(1,0,0,0,0,0,1);
arr_CLOSED_week4 = new Array(1,0,0,0,0,0,1);
arr_CLOSED_week5 = new Array(1,0,0,0,0,0,1);
arr_CLOSED_week = new Array(arr_CLOSED_week1,arr_CLOSED_week2,arr_CLOSED_week3,arr_CLOSED_week4,arr_CLOSED_week5);

// お休み日マトリックス2 月日指定
arr_CAL_SPECIAL_mon1 = new Array("1","2","3","11");		
arr_CAL_SPECIAL_mon2 = new Array("11");
arr_CAL_SPECIAL_mon3 = new Array("22");
arr_CAL_SPECIAL_mon4 = new Array("29");
arr_CAL_SPECIAL_mon5 = new Array("3","4","5");
arr_CAL_SPECIAL_mon6 = new Array();
arr_CAL_SPECIAL_mon7 = new Array("19");
arr_CAL_SPECIAL_mon8 = new Array("14");
arr_CAL_SPECIAL_mon9 = new Array("20","23");
arr_CAL_SPECIAL_mon10 = new Array("11");
arr_CAL_SPECIAL_mon11 = new Array("3","23");
arr_CAL_SPECIAL_mon12 = new Array("23","29","30","31");
arr_CAL_SPECIAL = new Array(arr_CAL_SPECIAL_mon1,arr_CAL_SPECIAL_mon2,arr_CAL_SPECIAL_mon3,arr_CAL_SPECIAL_mon4,arr_CAL_SPECIAL_mon5,arr_CAL_SPECIAL_mon6,
							arr_CAL_SPECIAL_mon7,arr_CAL_SPECIAL_mon8,arr_CAL_SPECIAL_mon9,arr_CAL_SPECIAL_mon10,arr_CAL_SPECIAL_mon11,arr_CAL_SPECIAL_mon12);

// 当日日付
curdate = new Date();
curyy = curdate.getYear();
curmm = curdate.getMonth() + 1;
curdd = curdate.getDate();
if (curyy < 2000) { curyy += 1900; }

function writePlaoCal(targetYYYY,targetMM,targetDD){

	targetMM = targetMM -1;
	arrDate = new Array('日','月','火','水','木','金','土');

	dateNow = new Date(targetYYYY,targetMM,targetDD);
	yy = dateNow.getYear();
	mm = dateNow.getMonth() + 1;
	dd = dateNow.getDate();
	if (yy < 2000) { yy += 1900; }

	fstdyThisMonth = new Date(yy,mm-1,1);
	fstDay = fstdyThisMonth.getDay();
	
	lstdyThisMonth = new Date(yy,mm,0);
	lstDate = lstdyThisMonth.getDate();
	
	document.write('<table width="100%" border="0" cellpadding="0" cellspacing="0">');
	document.write(' <tr><td style="line-height:10px ">&nbsp;</td></tr>');
	document.write(' <tr>');
	document.write('  <td class="cal_YYYY_MM">');
	document.write( yy + " 年 " + mm + " 月 ");
	document.write('  </td></tr>');
	document.write(' <tr>');
	document.write('  <td align="center">');
	document.write('   <table width="140" border="0" cellspacing="1" cellpadding="0" class="cal_LINE">');
	document.write('    <tr>');
	for(i = 0; i < 7; i++){
		document.write('<td width="20" class="cal_T'+i+' text1cm">'+arrDate[i]+'</td>');
	}
	document.write('</tr>');
	
	cellCnt = 0;
	weekCnt = 1;
	for(i = 0; i < fstDay; i++){
		if(cellCnt == 0){
			document.write('<tr>');
		}
		document.write('<td style="line-height:10px ">&nbsp;</td>');
		cellCnt++;
	}

	for(w_dd = 1; w_dd <= lstDate; w_dd++){
		wdow = cellCnt % 7;
		if( wdow == 0){
			document.write('<tr>');
		}
		
		if(arr_CLOSED_week[weekCnt-1][wdow] == 0){
			dayClass = "cal_OPEN";
		}else{
			dayClass = "cal_CLOSED";
		}
		
		for(w_special=0; w_special < arr_CAL_SPECIAL[mm-1].length; w_special++){
			if(arr_CAL_SPECIAL[mm-1][w_special] == w_dd) dayClass = "cal_CLOSED";
		}
		
		if( (curyy == yy) && (curmm == mm ) && (curdd == w_dd)){
			dayClass += " cal_BGCOLOR_TODAY";
		}else{
			dayClass += " cal_BGCOLOR";
		}
		
		document.write('<td width="20" class="'+dayClass+' text1cm">'+w_dd+'</td>');

		if( wdow == 6){
			document.write('</tr>');
		}
		cellCnt++;
	}
	
	totalCellCnt = (Math.floor( (cellCnt - 1) / 7 ) + 1) * 7;
	for(i = cellCnt; i < totalCellCnt; i++){
		document.write('<td style="line-height:10px ">&nbsp;</td>');
		if(i = totalCellCnt){
			document.write('</tr>');
		}
	}

	document.write('   </table>');
	document.write('  </td></tr>');
	document.write('</table>');

}
