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

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

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

			// Colors

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

			//  Topbar

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

			//  Header

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

			// General Setting

			if ( id === 'real_estate_management_preloader_hide' || id === 'real_estate_management_sticky_header' || id === 'real_estate_management_scroll_hide' || id === 'real_estate_management_products_per_row' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-real_estate_management_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Woocommerce product sale Setting

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

			// Latest Properties

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

			// Slider

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

			// Our Services

			if ( id === 'real_estate_escrow_projects_short_title' ) {
				$( '#customize-control-'+ id ).before('<li class="tab-title customize-control">'+ title  +'</li>');
			} else {
				$( '#customize-control-real_estate_management_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-real_estate_management_options-'+ id ).before('<li class="tab-title customize-control">'+ title +'</li>');
			}

			// Footer

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

			// Single Post Setting

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

			// Single Post Comment Setting

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

			// Post Setting

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

			// Page Setting

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


	/*
	** Tabs
	*/

		// Colors
		real_estate_management_customizer_label( 'real_estate_management_theme_color', 'Theme Color' );
		real_estate_management_customizer_label( 'background_color', 'Colors' );
		real_estate_management_customizer_label( 'background_image', 'Image' );

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

		//Topbar
		real_estate_management_customizer_label( 'real_estate_escrow_header_email_text', 'Email' );
		real_estate_management_customizer_label( 'real_estate_escrow_header_phone_text', 'Phone' );

		// Header
		real_estate_management_customizer_label( 'real_estate_management_topbar_btn_text', 'Button' );

		// General Setting
		real_estate_management_customizer_label( 'real_estate_management_preloader_hide', 'Preloader' );
		real_estate_management_customizer_label( 'real_estate_management_sticky_header', 'Sticky Header' );
		real_estate_management_customizer_label( 'real_estate_management_scroll_hide', 'Scroll To Top' );
		real_estate_management_customizer_label( 'real_estate_management_products_per_row', 'woocommerce Setting' );
		real_estate_management_customizer_label( 'real_estate_management_woocommerce_product_sale', 'Woocommerce Product Sale' );
		real_estate_management_customizer_label( 'real_estate_management_woocommerce_related_product_show_hide', 'Woocommerce Related Products' );

		// Latest Properties
		real_estate_management_customizer_label( 'real_estate_management_projects_short_title', 'Latest Properties' );

		//Slider
		real_estate_management_customizer_label( 'real_estate_management_top_slider_setting', 'Slider' );

		//Our Services
		real_estate_management_customizer_label( 'real_estate_escrow_projects_short_title', 'Our Services' );
		

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

		//Footer
		real_estate_management_customizer_label( 'real_estate_management_show_hide_footer', 'Footer' );
		real_estate_management_customizer_label( 'real_estate_management_show_hide_copyright', 'Copyright' );

		//Single Post Setting
		real_estate_management_customizer_label( 'real_estate_management_single_post_thumb', 'Single Post Setting' );
		real_estate_management_customizer_label( 'real_estate_management_single_post_comment_title', 'Single Post Comment' );

		// Post Setting
		real_estate_management_customizer_label( 'real_estate_management_post_page_title', 'Post Setting' );

		// Page Setting
		real_estate_management_customizer_label( 'real_estate_management_single_page_title', 'Page Setting' );
	

	}); // wp.customize ready

})( jQuery );
