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

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

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

			// Global Color Setting

			if ( id === 'royal_jewellery_global_color' || id === 'royal_jewellery_heading_color' || id === 'royal_jewellery_paragraph_color'  || id === 'royal_jewellery_heading_color' || id === 'royal_jewellery_paragraph_color') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-royal_jewellery_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// General Setting

			if ( id === 'royal_jewellery_scroll_hide' || id === 'royal_jewellery_preloader_hide' || id === 'royal_jewellery_sticky_header' || id === 'royal_jewellery_products_per_row' || id === 'royal_jewellery_woo_product_border_radius')  {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-royal_jewellery_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Woocommerce product sale Setting

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

			// Trending Product

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

			// Colors

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

			// Header Image

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

			//  Header

			if ( id === 'royal_jewellery_topbar_text' || id === 'royal_jewellery_topbar_phone_text' || id === 'royal_jewellery_topbar_email_text' || id === 'royal_jewellery_search_setting' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-royal_jewellery_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}


			// Slider

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

			// Footer

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

			// Single Post Setting

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

			// Post Setting

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


	/*
	** Tabs
	*/

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

		// Global Color Setting
		royal_jewellery_customizer_label( 'royal_jewellery_global_color', 'Global Color' );

		// General Setting
		royal_jewellery_customizer_label( 'royal_jewellery_preloader_hide', 'Preloader' );
		royal_jewellery_customizer_label( 'royal_jewellery_scroll_hide', 'Scroll To Top' );
		royal_jewellery_customizer_label( 'royal_jewellery_sticky_header', 'Sticky Header' );
		royal_jewellery_customizer_label( 'royal_jewellery_products_per_row', 'woocommerce Setting' );
		royal_jewellery_customizer_label( 'royal_jewellery_woocommerce_product_sale', 'Woocommerce Product Sale' );
		royal_jewellery_customizer_label( 'royal_jewellery_woo_product_border_radius', 'Woocommerce Product Border Radius' );

		// Trending Product
		royal_jewellery_customizer_label( 'royal_jewellery_product_image', 'Trending Product' );

		// Colors
		royal_jewellery_customizer_label( 'royal_jewellery_theme_color', 'Theme Color' );
		royal_jewellery_customizer_label( 'background_color', 'Colors' );
		royal_jewellery_customizer_label( 'background_image', 'Image' );
		royal_jewellery_customizer_label( 'royal_jewellery_heading_color', 'Heading Typography' );
		royal_jewellery_customizer_label( 'royal_jewellery_paragraph_color', 'Paragraph Typography' );

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

		royal_jewellery_customizer_label( 'royal_jewellery_post_layout', 'Post Layouts Settings' );

		royal_jewellery_customizer_label( 'royal_jewellery_404_page_main_heading', '404 Page Settings' );

		// Header
		royal_jewellery_customizer_label( 'royal_jewellery_topbar_text', 'Topbar Text' );
		royal_jewellery_customizer_label( 'royal_jewellery_topbar_phone_text', 'Phone Number' );
		royal_jewellery_customizer_label( 'royal_jewellery_topbar_email_text', 'Email' );
		royal_jewellery_customizer_label( 'royal_jewellery_search_setting', 'Header Search' );

		//Slider
		royal_jewellery_customizer_label( 'royal_jewellery_top_slider_page1', 'Slider' );

		//Footer
		royal_jewellery_customizer_label( 'royal_jewellery_show_hide_footer', 'Footer' );
		royal_jewellery_customizer_label( 'royal_jewellery_show_hide_copyright', 'Copyright' );

		//Single Post Setting
		royal_jewellery_customizer_label( 'royal_jewellery_single_post_thumb', 'Single Post Setting' );

		// Post Setting
		royal_jewellery_customizer_label( 'royal_jewellery_post_page_title', 'Post Setting' );

	

	}); // wp.customize ready

})( jQuery );
