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

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

	/*
	** Reusable Functions
	*/
		var optPrefix = '#customize-control-curtains_fabric_options-';
		
		// Label
		function curtains_fabric_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-curtains_fabric_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Global Color Setting

			if ( id === 'curtains_fabric_global_color' || id === 'curtains_fabric_heading_color' || id === 'curtains_fabric_paragraph_color') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-curtains_fabric_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// General Setting

			if ( id === 'curtains_fabric_scroll_hide' || id === 'curtains_fabric_preloader_hide' || id === 'curtains_fabric_sticky_header' || id === 'curtains_fabric_products_per_row' || id === 'curtains_fabric_woo_product_border_radius' || id === 'curtains_fabric_width_option' )  {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-curtains_fabric_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Trending Product

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

			// Social Icon

			if ( id === 'curtains_fabric_facebook_icon' || id === 'curtains_fabric_twitter_icon' || id === 'curtains_fabric_intagram_icon' || id === 'curtains_fabric_linkedin_icon' || id === 'curtains_fabric_pintrest_icon') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-curtains_fabric_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Colors

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

			// Header Image

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

			//  Header

			if ( id === 'curtains_fabric_topbar_location_text' || id === 'curtains_fabric_topbar_phone_text' || id === 'curtains_fabric_topbar_mail_text' || id === 'curtains_fabric_topbar_timing_text' || id === 'curtains_fabric_header_wishlist_link' || id === 'curtains_fabric_search_setting') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-curtains_fabric_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}


			// Slider

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

			// Footer

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

			// Post Setting

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

			// Single Post Setting

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


	/*
	** Tabs
	*/

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

		// Global Color Setting
		curtains_fabric_customizer_label( 'curtains_fabric_global_color', 'Global Color' );
		curtains_fabric_customizer_label( 'curtains_fabric_heading_color', 'Heading Typography' );
		curtains_fabric_customizer_label( 'curtains_fabric_paragraph_color', 'Paragraph Typography' );

		// General Setting
		curtains_fabric_customizer_label( 'curtains_fabric_preloader_hide', 'Preloader' );
		curtains_fabric_customizer_label( 'curtains_fabric_sticky_header', 'Sticky Header' );
		curtains_fabric_customizer_label( 'curtains_fabric_scroll_hide', 'Scroll To Top' );
		curtains_fabric_customizer_label( 'curtains_fabric_products_per_row', 'woocommerce Setting' );
		curtains_fabric_customizer_label( 'curtains_fabric_woo_product_border_radius', 'Woocommerce Product Border Radius' );
		curtains_fabric_customizer_label( 'curtains_fabric_width_option', 'Site Width Layouts' );

		// Social Icon 
		curtains_fabric_customizer_label( 'curtains_fabric_facebook_icon', 'Facebook' );
		curtains_fabric_customizer_label( 'curtains_fabric_twitter_icon', 'Twitter' );
		curtains_fabric_customizer_label( 'curtains_fabric_intagram_icon', 'Intagram' );
		curtains_fabric_customizer_label( 'curtains_fabric_linkedin_icon', 'Linkedin' );
		curtains_fabric_customizer_label( 'curtains_fabric_pintrest_icon', 'Pinterest' );

		// Trending Product
		curtains_fabric_customizer_label( 'curtains_fabric_product_main_heading', 'Trending Product' );

		// Colors
		curtains_fabric_customizer_label( 'curtains_fabric_theme_color', 'Theme Color' );
		curtains_fabric_customizer_label( 'background_color', 'Colors' );
		curtains_fabric_customizer_label( 'background_image', 'Image' );

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

		curtains_fabric_customizer_label( 'curtains_fabric_post_layout', 'Post Layouts Settings' );

		curtains_fabric_customizer_label( 'curtains_fabric_404_page_main_heading', '404 Page Settings' );

		// Header
		curtains_fabric_customizer_label( 'curtains_fabric_topbar_location_text', 'Location' );
		curtains_fabric_customizer_label( 'curtains_fabric_topbar_phone_text', 'Phone Number' );
		curtains_fabric_customizer_label( 'curtains_fabric_topbar_mail_text', 'Email' );
		curtains_fabric_customizer_label( 'curtains_fabric_topbar_timing_text', 'Timing' );
		curtains_fabric_customizer_label( 'curtains_fabric_header_wishlist_link', 'Header Wishlist' );
		curtains_fabric_customizer_label( 'curtains_fabric_search_setting', 'Header Search' );

		//Slider
		curtains_fabric_customizer_label( 'curtains_fabric_slider_small_image', 'Slider' );

		//Footer
		curtains_fabric_customizer_label( 'curtains_fabric_footer_bg_image', 'Footer' );
		curtains_fabric_customizer_label( 'curtains_fabric_show_hide_copyright', 'Copyright' );

		// Post Setting
		curtains_fabric_customizer_label( 'curtains_fabric_post_page_title', 'Post Setting' );

		//Page setting
		curtains_fabric_customizer_label( 'curtains_fabric_single_page_sidebar_layout', 'Page Settings' );

		//Single Post Setting
		curtains_fabric_customizer_label( 'curtains_fabric_single_post_page_image_border_radius', 'Single Post Setting' );
	

	}); // wp.customize ready

})( jQuery );
