( function( api ) {

	// Extends our custom "election-campaign" section.
	api.sectionConstructor['election-campaign'] = api.Section.extend( {

		// No events for this type of section.
		attachEvents: function () {},

		// Always make the section active.
		isContextuallyActive: function () {
			return true;
		}
	} );

} )( wp.customize );

(function ($) {
    function ResetDemoSettings() {
        if (!confirm("Are you sure you want to reset demo import settings?")) return;

        $.post(ajaxurl, { action: 'election_campaign_reset_demo_import_settings' }, function () {
            location.reload();
        });
    }

    window.ResetDemoSettings = ResetDemoSettings;
})(jQuery);

(function ($, wp) {
    function ResetGlobalColor() {
        if (confirm("Are you sure you want to reset global color settings?")) {
            wp.customize.instance("election_campaign_first_color").set("#163D80");
			wp.customize.instance("election_campaign_second_color").set("#CF2E2E");
        }
    }

    window.ResetGlobalColor = ResetGlobalColor;
})(jQuery, wp);