/*
** Scripts within the customizer controls window.
*/

(function( $ ) {
	wp.customize.bind( 'ready', function() {

	/*
	** Reusable Functions
	*/
		var optPrefix = '#customize-control-motivational_life_coach_options-';
		
		// Label
		function motivational_life_coach_customizer_label( id, title ) {

			// Site Identity

			if ( id === 'custom_logo' || id === 'site_icon' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// General Setting

			if ( id === 'motivational_life_coach_scroll_hide' || id === 'motivational_life_coach_preloader_hide' || id === 'motivational_life_coach_sticky_header' || id === 'motivational_life_coach_products_per_row' || id === 'motivational_life_coach_products_per_row')  {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Woocommerce product sale Setting

			if ( id === 'motivational_life_coach_woocommerce_product_sale' || id === 'motivational_life_coach_woo_product_border_radius') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// About Us

			if ( id === 'motivational_life_coach_about_image' )  {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Colors

			if ( id === 'motivational_life_coach_global_color' || id === 'background_color' || id === 'background_image' || id === 'motivational_life_coach_heading_color' || id === 'motivational_life_coach_paragraph_color' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Header Image

			if ( id === 'header_image' || id === 'motivational_life_coach_post_layout' || id === 'motivational_life_coach_404_page_main_heading'  ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Social Icon

			if ( id === 'motivational_life_coach_facebook_icon' || id === 'motivational_life_coach_twitter_icon' || id === 'motivational_life_coach_intagram_icon' || id === 'motivational_life_coach_linkedin_icon' || id === 'motivational_life_coach_pintrest_icon') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			//  Header

			if ( id === 'motivational_life_coach_topbar_text' || id === 'motivational_life_coach_topbar_phone_text' || id === 'motivational_life_coach_topbar_email_text' || id === 'motivational_life_coach_header_button' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}


			// Slider

			if ( id === 'motivational_life_coach_slider_heading' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Services

			if ( id === 'motivational_life_coach_services_title'  ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Post Setting

			if ( id === 'motivational_life_coach_post_page_meta' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Single Post Setting

			if ( id === 'motivational_life_coach_single_post_page_image_border_radius' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Page Setting

			if ( id === 'motivational_life_coach_single_page_title' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Footer

			if ( id === 'motivational_life_coach_show_hide_footer' || id === 'motivational_life_coach_show_hide_copyright') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-motivational_life_coach_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}
			
		}


	/*
	** Tabs
	*/

		// General Setting
		motivational_life_coach_customizer_label( 'motivational_life_coach_preloader_hide', 'Preloader' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_scroll_hide', 'Scroll To Top' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_sticky_header', 'Sticky Header' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_products_per_row', 'Woocommerce Setting' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_woocommerce_product_sale', 'Woocommerce Product Sale' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_woo_product_border_radius', 'Woocommerce Product Border Radius' );

	    // Site Identity
		motivational_life_coach_customizer_label( 'custom_logo', 'Logo Setup' );
		motivational_life_coach_customizer_label( 'site_icon', 'Favicon' );

		// About Us
		motivational_life_coach_customizer_label( 'motivational_life_coach_about_image', 'About Us' );

		// Colors
		motivational_life_coach_customizer_label( 'motivational_life_coach_global_color', 'Theme Color' );
		motivational_life_coach_customizer_label( 'background_color', 'Colors' );
		motivational_life_coach_customizer_label( 'background_image', 'Image' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_heading_color', 'Heading Typography' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_paragraph_color', 'Paragraph Typography' );

		//Header Image
		motivational_life_coach_customizer_label( 'header_image', 'Header Image' );

		motivational_life_coach_customizer_label( 'motivational_life_coach_post_layout', 'Post Layouts Settings' );

		motivational_life_coach_customizer_label( 'motivational_life_coach_404_page_main_heading', '404 Page Settings' );

		// Social Icon 
		motivational_life_coach_customizer_label( 'motivational_life_coach_facebook_icon', 'Facebook' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_twitter_icon', 'Twitter' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_intagram_icon', 'Intagram' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_linkedin_icon', 'Linkedin' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_pintrest_icon', 'Pinterest' );

		// Header
		motivational_life_coach_customizer_label( 'motivational_life_coach_topbar_text', 'Topbar Text' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_topbar_phone_text', 'Phone Number' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_topbar_email_text', 'Email' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_header_button', 'Button' );

		//Slider
		motivational_life_coach_customizer_label( 'motivational_life_coach_slider_heading', 'Slider' );
		
		// Services
		motivational_life_coach_customizer_label( 'motivational_life_coach_services_title', 'Services' );

		// Post Setting
		motivational_life_coach_customizer_label( 'motivational_life_coach_post_page_meta', 'Post Setting' );

		//Single Post Setting
		motivational_life_coach_customizer_label( 'motivational_life_coach_single_post_page_image_border_radius', 'Single Post Setting' );

		// Page Setting
		motivational_life_coach_customizer_label( 'motivational_life_coach_single_page_title', 'Page Setting' );

		//Footer
		motivational_life_coach_customizer_label( 'motivational_life_coach_show_hide_footer', 'Footer' );
		motivational_life_coach_customizer_label( 'motivational_life_coach_show_hide_copyright', 'Copyright' );
	

	}); // wp.customize ready

})( jQuery );
