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

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

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

			// Colors

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

			// Global Color Setting

			if ( id === 'architect_engineer_global_color' || id === 'architect_engineer_heading_color' || id === 'architect_engineer_paragraph_color') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-architect_engineer_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Header

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

			// General Setting

			if ( id === 'architect_engineer_preloader_hide' || id === 'architect_engineer_sticky_header' || id === 'architect_engineer_scroll_hide' || id === 'architect_engineer_products_per_row' || id === 'architect_engineer_woo_product_border_radius') {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-architect_engineer_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Woocommerce product sale Setting

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

			// Social Icon

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

			// Slider

			if ( id === 'architect_engineer_top_slider_setting' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-architect_engineer_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-architect_engineer_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}
			
			// Latest Projects

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

			// Footer

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

			// Single Post Setting

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

			// Single Post Comment Setting

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

			// Post Setting

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

			// Page Setting

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


	/*
	** Tabs
	*/

		// Colors
		architect_engineer_customizer_label( 'architect_engineer_theme_color', 'Theme Color' );
		architect_engineer_customizer_label( 'background_color', 'Colors' );
		architect_engineer_customizer_label( 'background_image', 'Image' );

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

		// Global Color Setting
		architect_engineer_customizer_label( 'architect_engineer_global_color', 'Global Color' );
		architect_engineer_customizer_label( 'architect_engineer_heading_color', 'Heading Typography' );
		architect_engineer_customizer_label( 'architect_engineer_paragraph_color', 'Paragraph Typography' );

		// Top Header
		architect_engineer_customizer_label( 'architect_engineer_phone_number', 'Phone' );

		// General Setting
		architect_engineer_customizer_label( 'architect_engineer_preloader_hide', 'Preloader' );
		architect_engineer_customizer_label( 'architect_engineer_sticky_header', 'Sticky Header' );
		architect_engineer_customizer_label( 'architect_engineer_scroll_hide', 'Scroll To Top' );
		architect_engineer_customizer_label( 'architect_engineer_products_per_row', 'Woocommerce Setting' );
		architect_engineer_customizer_label( 'architect_engineer_woocommerce_product_sale', 'Woocommerce Product Sale' );
		architect_engineer_customizer_label( 'architect_engineer_woo_product_border_radius', 'Woocommerce Product Border Radius' );
		architect_engineer_customizer_label( 'architect_engineer_woocommerce_related_product_show_hide', 'Woocommerce Related Products' );

		// Social Icon
		architect_engineer_customizer_label( 'architect_engineer_facebook_url', 'Social Links' );

		//Slider
		architect_engineer_customizer_label( 'architect_engineer_top_slider_setting', 'Slider' );

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

		//Latest Projects
		architect_engineer_customizer_label( 'architect_engineer_projects_short_title', 'Latest Projects' );

		//Footer
		architect_engineer_customizer_label( 'architect_engineer_show_hide_footer', 'Footer' );
		architect_engineer_customizer_label( 'architect_engineer_show_hide_copyright', 'Copyright' );

		//Single Post Setting
		architect_engineer_customizer_label( 'architect_engineer_single_post_thumb', 'Single Post Setting' );
		architect_engineer_customizer_label( 'architect_engineer_single_post_comment_title', 'Single Post Comment' );

		// Post Setting
		architect_engineer_customizer_label( 'architect_engineer_post_page_title', 'Post Setting' );

		// Page Setting
		architect_engineer_customizer_label( 'architect_engineer_single_page_title', 'Page Setting' );
	

	}); // wp.customize ready

})( jQuery );
