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

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

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

			// Colors

			if ( id === 'gardener_lite_theme_color' || id === 'background_color' || id === 'background_image' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-gardener_lite_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-gardener_lite_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Global Color Setting

			if ( id === 'gardener_lite_global_color' || id === 'gardener_lite_heading_color' || id === 'gardener_lite_paragraph_color') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-gardener_lite_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Top Header

			if ( id === 'gardener_lite_mail_icon' || id === 'gardener_lite_phone_icon' || id === 'gardener_lite_location_icon' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-gardener_lite_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// General Setting

			if ( id === 'gardener_lite_preloader_hide' || id === 'gardener_lite_sticky_header' || id === 'gardener_lite_scroll_hide' || id === 'gardener_lite_products_per_row' || id === 'gardener_lite_woocommerce_related_product_show_hide') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-gardener_lite_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Social Icon

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

			// Slider

			if ( id === 'gardener_lite_top_slider_setting' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-gardener_lite_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-gardener_lite_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}
			
			// Featured Product

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

			// Footer

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

			// Single Post Setting

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

			// Post Setting

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

			// Page Setting

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


	/*
	** Tabs
	*/

		// Colors
		gardener_lite_customizer_label( 'gardener_lite_theme_color', 'Theme Color' );
		gardener_lite_customizer_label( 'background_color', 'Colors' );
		gardener_lite_customizer_label( 'background_image', 'Image' );

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

		// Top Header
		gardener_lite_customizer_label( 'gardener_lite_mail_icon', 'Email' );
		gardener_lite_customizer_label( 'gardener_lite_phone_icon', 'Phone' );
		gardener_lite_customizer_label( 'gardener_lite_location_icon', 'Location' );

		// Global Color Setting
		gardener_lite_customizer_label( 'gardener_lite_global_color', 'Global Color' );
		gardener_lite_customizer_label( 'gardener_lite_heading_color', 'Heading Typography' );
		gardener_lite_customizer_label( 'gardener_lite_paragraph_color', 'Paragraph Typography' );

		// General Setting
		gardener_lite_customizer_label( 'gardener_lite_preloader_hide', 'Preloader' );
		gardener_lite_customizer_label( 'gardener_lite_sticky_header', 'Sticky Header' );
		gardener_lite_customizer_label( 'gardener_lite_scroll_hide', 'Scroll To Top' );
		gardener_lite_customizer_label( 'gardener_lite_products_per_row', 'Woocommerce Setting' );
		gardener_lite_customizer_label( 'gardener_lite_woocommerce_related_product_show_hide', 'Woocommerce Related Products' );

		// Social Icon
		gardener_lite_customizer_label( 'gardener_lite_facebook_url', 'Social Links' );

		//Slider
		gardener_lite_customizer_label( 'gardener_lite_top_slider_setting', 'Slider' );

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

		//Featured Product
		gardener_lite_customizer_label( 'gardener_lite_new_product_setting', 'Featured Product' );

		//Footer
		gardener_lite_customizer_label( 'gardener_lite_footer_background_color', 'Footer' );
		gardener_lite_customizer_label( 'gardener_lite_show_hide_copyright', 'Copyright' );

		//Single Post Setting
		gardener_lite_customizer_label( 'gardener_lite_single_post_thumb', 'Single Post Setting' );

		// Post Setting
		gardener_lite_customizer_label( 'gardener_lite_post_page_title', 'Post Setting' );

		// Page Setting
		gardener_lite_customizer_label( 'gardener_lite_single_page_title', 'Page Setting' );
	

	}); // wp.customize ready

})( jQuery );
