+
+// event_edit
+
+// Load the html of the actual event and incect the output to the
+// event-edit section.
+function doEventPreview() {
+ $("#event-edit-preview").val(1);
+ $.post("calendar/api/create", $("#event-edit-form").serialize(), function (data) {
+ $("#event-preview").append(data);
+ });
+ $("#event-edit-preview").val(0);
+}
+
+// The following functions show/hide the specific event-edit content
+// in dependence of the selected nav.
+function eventAclActive() {
+ $("#event-edit-wrapper, #event-preview, #event-desc-wrapper").hide();
+ $("#event-acl-wrapper").show();
+}
+
+function eventPreviewActive() {
+ $("#event-acl-wrapper, #event-edit-wrapper, #event-desc-wrapper").hide();
+ $("#event-preview").show();
+ doEventPreview();
+}
+
+function eventEditActive() {
+ $("#event-acl-wrapper, #event-preview, #event-desc-wrapper").hide();
+ $("#event-edit-wrapper").show();
+
+ // Make sure jot text does have really the active class (we do this because there are some
+ // other events which trigger jot text.
+ toggleEventNav($("#event-edit-lnk"));
+}
+
+function eventDescActive() {
+ $("#event-edit-wrapper, #event-preview, #event-acl-wrapper").hide();
+ $("#event-desc-wrapper").show();
+}
+
+// Give the active "event-nav" list element the class "active".
+function toggleEventNav(elm) {
+ // Select all li of #event-nav and remove the active class.
+ $(elm).closest("#event-nav").children("li").removeClass("active");
+ // Add the active class to the parent of the link which was selected.
+ $(elm).parent("li").addClass("active");
+}
+
+// Disable the input for the finish date if it is not available.
+function enableDisableFinishDate() {
+ if ($("#id_nofinish").is(":checked")) $("#id_finish_text").prop("disabled", true);
+ else $("#id_finish_text").prop("disabled", false);
+}
+
+// @license-end