(function () {
	'use strict';

	(function () {
	  wp.customize.bind('ready', function () {
	    jQuery('#nishiki-radio-image-container li img').click(function () {
	      jQuery('#nishiki-radio-image-container li').each(function () {
	        jQuery(this).find('img').removeClass('nishiki-radio-image-selected');
	      });
	      jQuery(this).addClass('nishiki-radio-image-selected');
	    });
	    var section = jQuery("[id^='customize-control-ctrl_front_page_section']");
	    var sectionCount = section.length;
	    section.find('.customize-control-title').css({
	      'font-weight': 'normal',
	      color: '#fff',
	      background: '#313a6f',
	      padding: '0.2rem 0.6rem'
	    });
	    var featuredItem = jQuery("[id^='customize-control-ctrl_front_page_featured_items']");
	    var featuredItemCount = featuredItem.length;
	    featuredItem.find('.customize-control-title').css({
	      'font-weight': 'normal',
	      color: '#fff',
	      background: '#555',
	      padding: '0.2rem 0.6rem'
	    });
	    jQuery("[id^='customize-control-ctrl_front_page_featured_item_header']").find('.customize-control-title').css({
	      'font-weight': 'normal',
	      color: '#fff',
	      background: '#888',
	      padding: '0.2rem 0.6rem'
	    });
	    jQuery("[id^='customize-control-ctrl_nishiki_pro_campaign']").find('.item-header').css({
	      'font-weight': 'normal',
	      color: '#fff',
	      background: '#313a6f',
	      padding: '0.2rem 0.6rem',
	      display: 'block'
	    });

	    for (var i = 1; i <= sectionCount; i++) {
	      wp.customize('setting_front_page_section' + i, function (setting) {
	        wp.customize.control('setting_front_page_image' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_image_placeholder_display' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_image_placeholder_grayscale' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_background_color' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_background_opacity' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_main_text' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_sub_text' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_text_align' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_text_color' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_button_text' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_button_text_color' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_button_link' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_button_link_color' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_button_link_target' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_front_page_featured_items' + i, function (control) {
	          var visibility = function visibility() {
	            if ('custom' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize('setting_front_page_featured_items' + i, function (setting_item) {
	          j = 1;

	          while (j < featuredItemCount) {
	            wp.customize('setting_front_page_featured_item_type' + i + '_' + j, function (setting_item_type) {
	              wp.customize.control('ctrl_front_page_featured_item_icon' + i + '_' + j, function (control) {
	                var visibility = function visibility() {
	                  if ('icon' === setting_item_type.get() && 'enabled' === setting_item.get() && 'custom' === setting.get()) {
	                    control.container.slideDown(300);
	                  } else {
	                    control.container.slideUp(300);
	                  }
	                };

	                visibility();
	                setting.bind(visibility);
	                setting_item.bind(visibility);
	                setting_item_type.bind(visibility);
	              });
	              wp.customize.control('ctrl_front_page_featured_item_icon_color' + i + '_' + j, function (control) {
	                var visibility = function visibility() {
	                  if ('icon' === setting_item_type.get() && 'enabled' === setting_item.get() && 'custom' === setting.get()) {
	                    control.container.slideDown(180);
	                  } else {
	                    control.container.slideUp(180);
	                  }
	                };

	                visibility();
	                setting.bind(visibility);
	                setting_item.bind(visibility);
	                setting_item_type.bind(visibility);
	              });
	              wp.customize.control('ctrl_front_page_featured_item_image' + i + '_' + j, function (control) {
	                var visibility = function visibility() {
	                  if ('image' === setting_item_type.get() && 'enabled' === setting_item.get() && 'custom' === setting.get()) {
	                    control.container.slideDown(300);
	                  } else {
	                    control.container.slideUp(300);
	                  }
	                };

	                visibility();
	                setting.bind(visibility);
	                setting_item.bind(visibility);
	                setting_item_type.bind(visibility);
	              });
	            });
	            wp.customize.control('ctrl_front_page_featured_item_header' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_column' + i, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_type' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_title' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_title_color' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_text' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_text_color' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_button_text' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_button_link' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_button_text_color' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_button_link_color' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            wp.customize.control('ctrl_front_page_featured_item_button_link_target' + i + '_' + j, function (control) {
	              var visibility = function visibility() {
	                if ('enabled' === setting_item.get() && 'custom' === setting.get()) {
	                  control.container.slideDown(180);
	                } else {
	                  control.container.slideUp(180);
	                }
	              };

	              visibility();
	              setting.bind(visibility);
	              setting_item.bind(visibility);
	            });
	            j++;
	          }
	        });
	      });
	    }

	    wp.customize('setting_nishiki_pro_design_btn_type', function (setting) {
	      wp.customize.control('ctrl_nishiki_pro_design_btn_radius', function (control) {
	        var visibility = function visibility() {
	          if ('custom' === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_header_layout', function (setting) {
	      wp.customize.control('ctrl_header_fixed', function (control) {
	        var visibility = function visibility() {
	          if ('default' === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	      wp.customize.control('ctrl_header_fixed_mobile', function (control) {
	        var visibility = function visibility() {
	          if ('center' === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_header_overlay', function (setting) {
	      wp.customize.control('ctrl_header_overlay_text_color', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	      wp.customize.control('ctrl_header_overlay_background_color', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	      wp.customize.control('ctrl_header_overlay_background_color_opacity', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_header_menu_collapse', function (setting) {
	      wp.customize.control('ctrl_header_drawer_menu_width', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_post_eye_catch', function (setting) {
	      wp.customize.control('ctrl_post_eye_catch_layout', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_page_eye_catch', function (setting) {
	      wp.customize.control('ctrl_page_eye_catch_layout', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_archive_eye_catch', function (setting) {
	      wp.customize.control('ctrl_archive_eye_catch_layout', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_archive_article_layout', function (setting) {
	      wp.customize.control('ctrl_archive_article_design', function (control) {
	        var visibility = function visibility() {
	          if ('card' === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });

	    for (var i = 2; i <= 6; i++) {
	      wp.customize('setting_nishiki_pro_design_heading_type_h' + i, function (setting) {
	        wp.customize.control('ctrl_nishiki_pro_design_heading_color_h' + i + '_01', function (control) {
	          var visibility = function visibility() {
	            if ('none' === setting.get()) {
	              control.container.slideUp(180);
	            } else {
	              control.container.slideDown(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_nishiki_pro_design_heading_color_h' + i + '_02', function (control) {
	          var visibility = function visibility() {
	            if ('none' === setting.get()) {
	              control.container.slideUp(180);
	            } else {
	              control.container.slideDown(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_nishiki_pro_design_heading_color_h' + i + '_03', function (control) {
	          var visibility = function visibility() {
	            if ('sailor-anchor-box' === setting.get() || 'brick-wall-box' === setting.get() || 'graph-paper-box' === setting.get() || 'jigsaw-puzzle-box' === setting.get() || 'houndstooth-box' === setting.get() || 'stripe-box' === setting.get()) {
	              control.container.slideDown(180);
	            } else {
	              control.container.slideUp(180);
	            }

	            if ('none' === setting.get()) {
	              control.container.slideUp(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	        wp.customize.control('ctrl_nishiki_pro_design_heading_radius_h' + i, function (control) {
	          var visibility = function visibility() {
	            if ('none' === setting.get()) {
	              control.container.slideUp(180);
	            } else {
	              control.container.slideDown(180);
	            }
	          };

	          visibility();
	          setting.bind(visibility);
	        });
	      });
	    }

	    wp.customize('setting_nishiki_pro_share_button_css', function (setting) {
	      wp.customize.control('ctrl_nishiki_pro_share_design_pattern', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	    wp.customize('setting_nishiki_pro_footer_scroll_page_top_button_enable', function (setting) {
	      wp.customize.control('ctrl_nishiki_pro_footer_scroll_page_top_button_desktop', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	      wp.customize.control('ctrl_nishiki_pro_footer_scroll_page_top_button_tablet', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	      wp.customize.control('ctrl_nishiki_pro_footer_scroll_page_top_button_smartphone', function (control) {
	        var visibility = function visibility() {
	          if (true === setting.get()) {
	            control.container.slideDown(180);
	          } else {
	            control.container.slideUp(180);
	          }
	        };

	        visibility();
	        setting.bind(visibility);
	      });
	    });
	  });
	})(jQuery);

}());
