( function( api ) {

	// Extends our custom "sports-league" section.
	api.sectionConstructor['sports-league'] = 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: 'sports_league_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("sports_league_first_color").set("#fe5900");
            wp.customize.instance("sports_league_second_color").set("#F6551C");
        }
    }

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