<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/taglib.jsp"%>
<table id="calendar">
	<fmt:formatDate var="month" value="${calendar.month}" pattern="yyyy-MM"/>
	<caption><a href="<c:url value="/articles.do?method=byArchive&date=${month}"/>" id="calendarmonth"><fmt:formatDate value="${calendar.month}" pattern="yyyy年M月"/></a></caption>

	<thead><tr><th scope="col" title="Sunday" abbr="Sunday">S</th><th scope="col" title="Monday" abbr="Monday">M</th><th scope="col" title="Tuesday" abbr="Tuesday">T</th><th scope="col" title="Wednesday" abbr="Wednesday">W</th><th scope="col" title="Thursday" abbr="Thursday">T</th><th scope="col" title="Friday" abbr="Friday">F</th><th scope="col" title="Saturday" abbr="Saturday">S</th></tr>
	</thead>

	<tfoot>
	<tr><td colspan="7">
	<c:if test="${calendar.prevMonth!=null}">
	<fmt:formatDate var="prevMonth_1" value="${calendar.prevMonth}" pattern="yyyy-MM"/>
	<fmt:formatDate var="prevMonth_2" value="${calendar.prevMonth}" pattern="yyyy年M月"/>
	<span id="prevmonth" class="left"><img src="<c:url value="/themes/${blog.options.theme_dir_name.value}/resources/images/prev.gif"/>" alt="" class="arrow-prev" height="8" width="9"><a href="<c:url value="/articles.do?method=byArchive&date=${prevMonth_1}"/>" title="<c:out value="${prevMonth_2}"/>"><c:out value="${prevMonth_2}"/></a></span>
	</c:if>
	<c:if test="${calendar.nextMonth!=null}">
	<fmt:formatDate var="nextMonth_1" value="${calendar.nextMonth}" pattern="yyyy-MM"/>
	<fmt:formatDate var="nextMonth_2" value="${calendar.nextMonth}" pattern="yyyy年M月"/>
	<span id="nextmonth" class="right"><a href="<c:url value="/articles.do?method=byArchive&date=${nextMonth_1}"/>" title="<c:out value="${nextMonth_2}"/>"><c:out value="${nextMonth_2}"/></a><img src="<c:url value="/themes/${blog.options.theme_dir_name.value}/resources/images/next.gif"/>" alt="" class="arrow-next" height="8" width="9"></span>
	</c:if>
	</td></tr>
	</tfoot>

	<tbody>
		<tr>
			<c:if test="${calendar.backOffsetDays>0}"><td colspan="<c:out value="${calendar.backOffsetDays}"/>">&nbsp;</td></c:if>
			<c:forEach var="day" begin="1" end="${calendar.days }">
			<c:choose>
				<c:when test="${calendar.map[day]!=null}">
					<td class="l"><a href="<c:url value="/articles.do?method=byArchive&date=${month}-${day}"/>"><c:out value="${day}"/></a></td>
				</c:when>
				<c:otherwise>
					<td><c:out value="${day}"/></td>
				</c:otherwise>
			</c:choose>
			<c:if test="${(day+calendar.backOffsetDays)%7==0&&day!=calendar.days}"></tr><tr></c:if>	
			</c:forEach>
			<c:if test="${calendar.forwardOffsetDays>0}"><td colspan="<c:out value="${calendar.forwardOffsetDays}"/>">&nbsp;</td></c:if>
		</tr>
	</tbody>
</table>