<?php
	///////////// Schedule Code ///////////////////////////////////////////
	// EB Content Management System
	// Copyright EB Dynamics, Inc., Edward Lemmers, P.E.
	// Last revised: 6/15/2007
        // Revised: 8/1/2009  ELL
        // Added class hooks for styling.
	//
	$query = "SELECT * FROM schedule WHERE `Active` = 1 ORDER BY `EventDateSort`";
	$result = mysql_query($query);
	$num_results = mysql_num_rows($result);
	echo "<div align='center' class='events_div'>\n";
	echo "<table class='events_table'>\n";
	echo "<tr bgcolor='#CCCCCC' class='events_tr_head'>\n";
	echo "<td class='events_td_head'><b>Description</b></td>\n";
	echo "<td class='events_td_head'><b>Date</b></td>\n";
	echo "<td class='events_td_head'><b>Start Time</b></td>\n";
	echo "<td class='events_td_head'><b>End Time</b></td>\n";
	echo "<td class='events_td_head'><b>Hebrew Date</b></td>\n";
	echo "</tr>\n";
	for ($i = 0; $i < $num_results; $i++)
	{
		$row = mysql_fetch_array($result);
	
		$Description = $row["Description"];
		$EventDate = $row["EventDate"];
		$StartTime = $row["StartTime"];
		$EndTime = $row["EndTime"];
		$HebrewDate = $row["HebrewDate"];
		$URL = $row["URL"];
		$Description = stripslashes($Description);
		$EventDate = stripslashes($EventDate);
		$StartTime = stripslashes($StartTime);
		$EndTime = stripslashes($EndTime);
		$HebrewDate = stripslashes($HebrewDate);
		$URL = stripslashes($URL);
		
		if ($bgclr == "#DDDDDD")
			$bgclr = "#EEEEEE";
		else
			$bgclr = "#DDDDDD";
		
		echo "<tr bgcolor='$bgclr' class='events_tr'>\n";
		if ($URL)
			echo "<td valign='top' class='events_td'><a href='$URL'>$Description</a></td>\n";
		else
			echo "<td valign='top' class='events_td'>$Description</td>\n";
			
		echo "<td valign='top' class='events_td'>$EventDate</td>\n";
		echo "<td valign='top' class='events_td'>$StartTime</td>\n";
		echo "<td valign='top' class='events_td'>$EndTime</td>\n";
		echo "<td valign='top' class='events_td'>$HebrewDate</td>\n";
		echo "</tr>\n";
	}
	echo "</table>\n";
	echo "</div>\n";
	/////////////////////////////////////////////////////////////////////////
?>