function calendarSubmit() {
    $.ajax({
        type: "POST",
        url: "calendarsubmit.php",
        data: "month=" + $("input[name=month]").val() + "&day=" + $("input[name=day]").val() + "&EndMonth=" + $("select[name=EndMonth]").val() + "&EndDate=" + $("select[name=EndDate]").val() + "&startTime=" + $("select[name=startTime]").val() + "&endTime=" + $("select[name=endTime]").val() + "&event=" + $("input[name=event]").val() + "&location=" + $("input[name=location]").val() + "&details=" + $("textarea[name=details]").val(),
        success: function() {
            $("#calendarPopup").fadeOut();
            window.location.reload();
        }
    });           
}

function deleteEvent(id) {
    $.ajax({
        type: "POST",
        url: "calendardelete.php",
        data: "id=" + id,
        success: function() {
            $("#calendarPopup").fadeOut();
            window.location.reload();
        }
    });
}

function editEventSubmit(id) {
    $.ajax({
        type: "POST",
        url: "calendareditsubmit.php",
        data: "id=" + id + "&event=" + $("input[name=Event]").val() + "&location=" + $("input[name=Location]").val() + "&details=" + $("textarea[name=Details]").val(),
        success: function() {
            $("#calendarPopup").fadeOut();
            window.location.reload();
        }
    });
}

function editCalendarEvent(id) {
    $("#calendarPopup").fadeIn().load("calendaredit.php?id=" + id);
}
