<%
/**
 * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */
%>

<%
int maxDayOfMonth = selCal.getActualMaximum(Calendar.DATE);

Set data = new HashSet();

for (int i = 1; i <= maxDayOfMonth; i++) {
	Calendar tempCal = (Calendar)curCal.clone();

	tempCal.set(Calendar.MONTH, curMonth);
	tempCal.set(Calendar.DATE, i);
	tempCal.set(Calendar.YEAR, curYear);

	boolean hasEvents = CalEventLocalServiceUtil.hasEvents(scopeGroupId, tempCal, eventType);

	if (hasEvents) {
		data.add(new Integer(i));
	}
}
%>

<table width="100%">
<tr>
	<c:if test='<%= summaryTabShowMiniMonth %>'>
		<td class="lfr-top" style="padding-right: 10px;" width="1%">
			<div class="calendar-container float-container">
				<div class="calendar-day">
					<h2 class="day-text"><%= DateUtil.getCurrentDate("EEEE", locale, timeZone) %></h2>
					<h3 class="day-number"><%= curDay %></h3>
				</div>

				<liferay-ui:calendar
					month="<%= curMonth %>"
					day="<%= curDay %>"
					year="<%= curYear %>"
					headerFormat="<%= dateFormatDate %>"
					data="<%= data %>"
				/>
			</div>
		</td>
	</c:if>

	<c:if test='<%= summaryTabOrientation.equals("vertical") %>'>
		</tr>
		<tr>
	</c:if>

	<c:if test='<%= summaryTabShowTodaysEvents %>'>
		<td class="lfr-top">
			<%@ include file="/html/portlet/calendar/event_iterator.jspf" %>
		</td>
	</c:if>
</tr>
</table>

<aui:script>
	function <portlet:namespace />updateCalendar(month, day, year) {
		location.href = '<portlet:renderURL><portlet:param name="tabs1" value="day" /><portlet:param name="eventType" value="<%= eventType %>" /></portlet:renderURL>&<portlet:namespace />month=' + month + '&<portlet:namespace />day=' + day + '&<portlet:namespace />year=' + year;
	}
</aui:script>