@using OurUmbraco.Events.Api
@using OurUmbraco.Events.Models
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
    var events = new List<Event>();
    List<Event> getEvents = EventsController.UpcomingEvents(Model.Id);
    events.AddRange(getEvents);
}

		<div id="googlemap" style="width:978px;height:350px;">Loading map, please wait...</div>
		<div class="box">
			<p>
				<table class="list" id="eventList" style="width: 100%;">
					<thead>
						<tr>
							<th>Name</th>
							<th>Location</th>
							<th>Time</th>
						</tr>
					</thead>
					<tbody>
					@foreach(var ev in events.OrderBy(x => x.StartDateTime)) {
						<tr id="@ev.Id" rel="@ev.VenueLatitude,@ev.VenueLongitude">
							<td class="name">
								<a href="@ev.Link">@ev.Name</a>
							</td>
							<td class="location">
								@ev.Venue
							</td>
							<td class="date">
								@ev.StartDateTime.ToLongDateString() @ev.StartDateTime.ToLongTimeString()
							</td>
						</tr>							
					}
					</tbody>
				</table>
			</p>
		</div>