{include file="$gentemplates/$header_tpl"}
<h2>{$section.calendar}</h2>

<h3 class="p-b5" style="padding-bottom: 35px;">{$lang.events.events_calendar}
	<div style="margin:-25px 0 0">
		<a href="{$add_event_link}" class="add-icon float_right" title="{$lang.events.add}" alt="{$lang.events.add}">&nbsp;</a>
	</div>
</h3>

<!-- Calendar menu -->
<div id="tooltip" onclick="hideToolTip()" style="background-color: #FFFFFF; border: 1px dotted; width:150px; text-align: {$default_left}; position:absolute; display:none; padding:5px;left:533px;top:373px"></div>
<div class="title_big_calendar">
	<a class="small-left-arr" href="{$page_path}?show_period=month&month={$selected_month.mon}&year={$selected_month.year}&move=back_month" title="{$lang.button.prev_mounth}">&nbsp;</A>
	{$selected_month.month}
	<a class="small-right-arr" href="{$page_path}?show_period=month&month={$selected_month.mon}&year={$selected_month.year}&move=next_month" title="{$lang.button.next_mounth}">&nbsp;</A>
</div>
<!-- /Calendar menu -->
<table class="big_calendar">
	<tr class="white">
		<td>{$st.monday}</td>
		<td>{$st.tuesday}</td>
		<td>{$st.wednesday}</td>
		<td>{$st.thursday}</td>
		<td>{$st.friday}</td>
		<td>{$st.saturday}</td>
		<td>{$st.sunday}</td>
	</tr>
	{foreach from=$current_month item=week}
		<tr>
			<td {if $week.1.current_day == 'true'}class="current_day"{/if}>
				{if $week.1 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.1.mday}">{$week.1.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.1.mday},'{section loop=$week.1.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.1.event[e].id_event} class=calendar_url>{$week.1.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.1.event_count}{$lang.events.events}&nbsp;{$week.1.event_count}{/if}
					</a>
				{/if}
			</td>

			<td {if $week.2.current_day == 'true'}class="current_day"{/if}>
				{if $week.2 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.2.mday}">{$week.2.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.2.mday},'{section loop=$week.2.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.2.event[e].id_event} class=calendar_url>{$week.2.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.2.event_count}{$lang.events.events}&nbsp;{$week.2.event_count}{/if}
					</a>
				{/if}
			</td>
			<td {if $week.3.current_day == 'true'}class="current_day"{/if}>
				{if $week.3 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.3.mday}">{$week.3.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.3.mday},'{section loop=$week.3.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.3.event[e].id_event} class=calendar_url>{$week.3.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.3.event_count}{$lang.events.events}&nbsp;{$week.3.event_count}{/if}
					</a>
				{/if}
			</td>
			<td {if $week.4.current_day == 'true'}class="current_day"{/if}>
				{if $week.4 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.4.mday}">{$week.4.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.4.mday},'{section loop=$week.4.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.4.event[e].id_event} class=calendar_url>{$week.4.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.4.event_count}{$lang.events.events}&nbsp;{$week.4.event_count}{/if}
					</a>
				{/if}
			</td>
			<td {if $week.5.current_day == 'true'}class="current_day"{/if}>
				{if $week.5 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.5.mday}">{$week.5.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.5.mday},'{section loop=$week.5.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.5.event[e].id_event} class=calendar_url>{$week.5.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.5.event_count}{$lang.events.events}&nbsp;{$week.5.event_count}{/if}
					</a>
				{/if}
			</td>
			<td {if $week.6.current_day == 'true'}class="current_day"{/if}>
				{if $week.6 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.6.mday}">{$week.6.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.6.mday},'{section loop=$week.6.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.6.event[e].id_event} class=calendar_url>{$week.6.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.6.event_count}{$lang.events.events}&nbsp;{$week.6.event_count}{/if}
					</a>
				{/if}
			</td>
			<td {if $week.0.current_day == 'true'}class="current_day"{/if}>
				{if $week.0 == "false"}
					&nbsp;
				{else}
					<span id="top_{$week.0.mday}">{$week.0.mday}</span><div style="padding-top:8px;"></div>
					<a href="#" onmouseover="javascript: showToolTip({$week.0.mday},'{section loop=$week.0.event name=e}{$smarty.section.e.iteration}. <A href={$event_path}?sel=event&id_event={$week.0.event[e].id_event} class=calendar_url>{$week.0.event[e].full_name}</A><BR>{/section}');return false">
						{if $week.0.event_count}{$lang.events.events}&nbsp;{$week.0.event_count}{/if}
					</a>
				{/if}
			</td>
		</tr>
	{/foreach}
</table>


{*
<p>
	<h2>{$section.calendar} <a href="{$add_event_link}" class="add-icon float_right" title="{$lang.events.add}" alt="{$lang.events.add}">&nbsp;</a></h2>
	
</p>
<!-- Calendar menu -->

<p style="text-align:center">
	<a class="small-left-arr" href="{$page_path}?show_period=month&month={$selected_month.mon}&year={$selected_month.year}&move=back_month" title="{$lang.button.prev_mounth}">&nbsp;</A>
	{$selected_month.month},&nbsp;{$selected_month.year}
	<a class="small-right-arr" href="{$page_path}?show_period=month&month={$selected_month.mon}&year={$selected_month.year}&move=next_month" title="{$lang.button.next_mounth}">&nbsp;</A>
</p>
<!-- /Calendar menu -->
<table class="big_calendar">
	<tr>
		<td>{$st.monday}</td>
		<td>{$st.tuesday}</td>
		<td>{$st.wednesday}</td>
		<td>{$st.thursday}</td>
		<td>{$st.friday}</td>
		<td>{$st.saturday}</td>
		<td>{$st.sunday}</td>
	</tr>
	{foreach from=$current_month item=week}
		<tr>
			<td {if $week.1.current_day == 'true'}class="current_day"{/if}>
				{if $week.1 == "false"}
					&nbsp;
				{else}
					{$week.1.mday}<br />
					{section loop=$week.1.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.1.event[e].id_event}">
							{$week.1.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>

			<td {if $week.2.current_day == 'true'}class="current_day"{/if}>
				{if $week.2 == "false"}
					&nbsp;
				{else}
					{$week.2.mday}<br />
					{section loop=$week.2.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.2.event[e].id_event}">
							{$week.2.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
			<td {if $week.3.current_day == 'true'}class="current_day"{/if}>
				{if $week.3 == "false"}
					&nbsp;
				{else}
					{$week.3.mday}<br />
					{section loop=$week.3.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.3.event[e].id_event}">
							{$week.3.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
			<td {if $week.4.current_day == 'true'}class="current_day"{/if}>
				{if $week.4 == "false"}
					&nbsp;
				{else}
					{$week.4.mday}<br />
					{section loop=$week.4.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.4.event[e].id_event}">
							{$week.4.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
			<td {if $week.5.current_day == 'true'}class="current_day"{/if}>
				{if $week.5 == "false"}
					&nbsp;
				{else}
					{$week.5.mday}<br />
					{section loop=$week.5.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.5.event[e].id_event}">
							{$week.5.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
			<td {if $week.6.current_day == 'true'}class="current_day"{/if}>
				{if $week.6 == "false"}
					&nbsp;
				{else}
					{$week.6.mday}<br />
					{section loop=$week.6.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.6.event[e].id_event}">
							{$week.6.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
			<td {if $week.0.current_day == 'true'}class="current_day"{/if}>
				{if $week.0 == "false"}
					&nbsp;
				{else}
					{$week.0.mday}<br />
					{section loop=$week.0.event name=e}
						<a href="{$event_path}?sel=event&id_event={$week.0.event[e].id_event}">
							{$week.0.event[e].name}
						</a><br />
					{/section}
				{/if}
			</td>
		</tr>
	{/foreach}
</table>*}{literal}
	<script type="text/javascript">		
		function showToolTip(par,text){
			var obj = document.getElementById('tooltip');
			obj.innerHTML = text;
			obj.style.display = 'block';
			if($('#top_'+par).position().left > 850)
				obj.style.left = ($('#top_'+par).position().left-55) + 'px';
			else 
				obj.style.left = $('#top_'+par).position().left + 'px';
			obj.style.top = $('#top_'+par).position().top+'px';
		}
		function hideToolTip(){
			document.getElementById('tooltip').style.display = 'none';
		}

		function LoadCalendar(destination, param) {
			InitXMLHttpRequest();
			// Load the result from the response page
			if (req) {
				req.onreadystatechange = function() {
					if (req.readyState == 4) {
						destination.innerHTML = req.responseText;
					} else {
						destination.innerHTML = "Loading data...";
					}
				}
				req.open("GET", "{/literal}{$site_root}/{$seo.events_calendar}{literal}?act=ajax" + param, true);
				req.send(null);
			} else {
				destination.innerHTML = 'Browser unable to create XMLHttp Object';
			}
		}
	</script>
	{/literal}
{include file="$gentemplates/$footer_tpl"}