var getEditableEvents = function() {
	$.get('getevents.php', {}, function(response) {
		var events = "";
		var i = 0;
		for (i = 0; i < response.length; i++) {
			events += '<form method="post" action="saveevents.php?eventid='+response[i].eventid+'"><div><ul>';
			events += '<li class="event"><input type="text" name="title" value="' + response[i].title + '" /></li>';
			events += '<li class="event"><input type="text" name="date" value="' + response[i].startdate + '" /></li>';
			events += '<li class="event"><input type="text" name="time" value="' + response[i].starttime + '" /></li>';
			/*events += '<li class="event"><textarea name="description">' + response[i].description + '</textarea></li>';*/
			events += '<li class="event"><input type="text" name="location" value="' + response[i].location + '" /></li>';
			events += '<li class="event"><input type="submit" name="save" value="Save" /></li>';
			events += '<li class="event"><input type="submit" name="delete" value="Delete" /></li>';

			events += "</ul></div></form>";
		}
		$('#events').html(events);
	}, 'json');

};

var getEvents = function() {
	$.get('ajax/getevents.php', {}, function(response) {
		var events = "<tr><th>Date</th><th>Time</th><th>Event</th><th>Location</th></tr>";
		var i = 0;
		for (i = 0; i < response.length; i++) {
			events += '<tr class="'+response[i].month+'">';
			events += '<td>' + response[i].displaydate + '</td>';
			events += '<td>' + response[i].displaytime + '</td>';
			/*events += '<td>' + response[i].description + '</td>';*/
			events += '<td>' + response[i].title + '</td>';
			events += '<td>' + response[i].location + '</td>';
			events += '</tr>';
		}
		$('#events').html('<table>' + events + '</table>');
	}, 'json');



};
