(function ($) {

    jQuery('#fooevents-overwrite-confirm').on('change', function () {

        jQuery('#fooevents-overwrite-notice').toggle();

    });

    jQuery('form[name="fooevents-theme-viewer-upload-form"]').on('submit', function (e) {

        var isOverwriteChecked = jQuery('#fooevents-overwrite-confirm').is(':checked');

        if (isOverwriteChecked) {

            if (!confirm(FooEventsThemesObj.overrideConfirm)) {
                e.preventDefault();
                return false;
            }
        }
    });

})(jQuery);