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

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

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

			// Colors

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

			// Site Identity

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

			// Top Header

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

			// General Setting

			if ( id === 'kids_online_store_preloader_hide' || id === 'kids_online_store_sticky_header' || id === 'kids_online_store_scroll_hide' || id === 'kids_online_store_woocommerce_shop_page_sidebar') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-kids_online_store_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Woocommerce product sale Setting

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

			// Social Icon

			if ( id === 'kids_online_store_facebook_icon' || id === 'kids_online_store_twitter_icon' || id === 'kids_online_store_instagram_icon'|| id === 'kids_online_store_linkedin_icon'|| id === 'kids_online_store_pinterest_icon' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-kids_online_store_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Slider

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

			// Header Image

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

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

			// Services

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

			// Footer

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

			// Single Post Setting

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

			// Single Post Comment Setting

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

			// Post Setting

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

			// Page Setting

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


	/*
	** Tabs
	*/

		// Colors
		kids_online_store_customizer_label( 'kids_online_store_theme_color_one', 'Theme Color' );
		kids_online_store_customizer_label( 'background_color', 'Colors' );
		kids_online_store_customizer_label( 'background_image', 'Image' );

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

		// Top Header
		kids_online_store_customizer_label( 'kids_online_store_phone_icon', 'Phone' );
		kids_online_store_customizer_label( 'kids_online_store_email_icon', 'Email' );

		// General Setting
		kids_online_store_customizer_label( 'kids_online_store_preloader_hide', 'Preloader' );
		kids_online_store_customizer_label( 'kids_online_store_sticky_header', 'Sticky Header' );
		kids_online_store_customizer_label( 'kids_online_store_scroll_hide', 'Scroll To Top' );
		kids_online_store_customizer_label( 'kids_online_store_woocommerce_shop_page_sidebar', 'Woocommerce Settings' );
		kids_online_store_customizer_label( 'kids_online_store_woocommerce_product_sale', 'Woocommerce Product Sale Positions' );
		kids_online_store_customizer_label( 'kids_online_store_woo_product_border_radius', 'Woocommerce Product Border Radius' );

		// Social Icon
		kids_online_store_customizer_label( 'kids_online_store_facebook_icon', 'Facebook' );
		kids_online_store_customizer_label( 'kids_online_store_twitter_icon', 'Twitter' );
		kids_online_store_customizer_label( 'kids_online_store_instagram_icon', 'Intagram' );
		kids_online_store_customizer_label( 'kids_online_store_linkedin_icon', 'Linkedin' );
		kids_online_store_customizer_label( 'kids_online_store_pinterest_icon', 'Pintrest' );

		//Slider
		kids_online_store_customizer_label( 'kids_online_store_slider_setting', 'Slider' );

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

		//Product Category
		kids_online_store_customizer_label( 'kids_online_store_product_setting', 'Product Category' );

		//Our Services
		kids_online_store_customizer_label( 'kids_gift_shop_services_setting', 'Our Services' );

		//Footer
		kids_online_store_customizer_label( 'kids_online_store_footer_background_color', 'Footer' );
		kids_online_store_customizer_label( 'kids_online_store_show_hide_copyright', 'Copyright' );

		//Single Post Setting
		kids_online_store_customizer_label( 'kids_online_store_single_post_thumb', 'Single Post Setting' );
		kids_online_store_customizer_label( 'kids_online_store_single_post_comment_title', 'Single Post Comment' );

		// Post Setting
		kids_online_store_customizer_label( 'kids_online_store_post_page_title', 'Post Setting' );

		// Page Setting
		kids_online_store_customizer_label( 'kids_online_store_single_page_title', 'Page Setting' );
	

	}); // wp.customize ready

})( jQuery );
