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

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

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

			// Global Color Setting

			if ( id === 'interior_decor_studio_global_color' || id === 'interior_decor_studio_heading_color' || id === 'interior_decor_studio_paragraph_color') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-interior_decor_studio_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// General Setting

			if ( id === 'interior_decor_studio_scroll_hide' || id === 'interior_decor_studio_preloader_hide' || id === 'interior_decor_studio_sticky_header' || id === 'interior_decor_studio_products_per_row' || id === 'interior_decor_studio_woo_product_border_radius' || id === 'interior_decor_studio_width_option')  {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-interior_decor_studio_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Colors

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

			// Header Image

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

			//  Header

			if ( id === 'interior_decor_studio_header_button' || id === 'interior_decor_studio_topbar_phone_text' || id === 'interior_decor_studio_topbar_mail_text' || id === 'interior_decor_studio_topbar_timing_text' || id === 'interior_decor_studio_header_wishlist_link' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-interior_decor_studio_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}


			// Slider

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

			// Project

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

			// Footer

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

			// Post Setting

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

			// Single Post Setting

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


	/*
	** Tabs
	*/

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

		// Global Color Setting
		interior_decor_studio_customizer_label( 'interior_decor_studio_global_color', 'Global Color' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_heading_color', 'Heading Typography' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_paragraph_color', 'Paragraph Typography' );

		// General Setting
		interior_decor_studio_customizer_label( 'interior_decor_studio_preloader_hide', 'Preloader' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_sticky_header', 'Sticky Header' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_scroll_hide', 'Scroll To Top' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_scroll_top_position', 'Scroll to top Position' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_products_per_row', 'woocommerce Setting' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_woo_product_border_radius', 'Woocommerce Product Border Radius' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_width_option', 'Site Width Layouts' );

		// Colors
		interior_decor_studio_customizer_label( 'interior_decor_studio_theme_color', 'Theme Color' );
		interior_decor_studio_customizer_label( 'background_color', 'Colors' );
		interior_decor_studio_customizer_label( 'background_image', 'Image' );

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

		interior_decor_studio_customizer_label( 'interior_decor_studio_post_layout', 'Post Layouts Settings' );

		interior_decor_studio_customizer_label( 'interior_decor_studio_404_page_main_heading', '404 Page Settings' );

		// Header
		interior_decor_studio_customizer_label( 'interior_decor_studio_header_button', 'Header Button' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_topbar_phone_text', 'Phone Number' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_topbar_mail_text', 'Email Address' );

		//Slider
		interior_decor_studio_customizer_label( 'interior_decor_studio_slider_short_heading', 'Slider' );

		//Slider
		interior_decor_studio_customizer_label( 'interior_decor_studio_services_title', 'Our Project' );

		//Footer
		interior_decor_studio_customizer_label( 'interior_decor_studio_footer_bg_image', 'Footer' );
		interior_decor_studio_customizer_label( 'interior_decor_studio_show_hide_copyright', 'Copyright' );

		// Post Setting
		interior_decor_studio_customizer_label( 'interior_decor_studio_post_page_title', 'Post Setting' );

		// Page Setting
		interior_decor_studio_customizer_label( 'interior_decor_studio_single_page_sidebar_layout', 'Page Setting' );

		//Single Post Setting
		interior_decor_studio_customizer_label( 'interior_decor_studio_single_post_thumb', 'Single Post Setting' );

	}); // wp.customize ready

})( jQuery );
