jQuery(document).ready(function($){
	/* Do slide function when click main button-------------- */
	$(".wcc-switcher-style-02").find(".wcc-crnt-currency").on("click", function () {
		// Define which theme is clicked
		let $this;
		$this     = $(this).parent();
		$thisCrnt = $this.find(".wcc-crnt-currency");
		$thisList = $this.find(".wcc-list");               

		$thisList.slideToggle();
		
		function toggleClass() {
			if ($thisCrnt.hasClass("wcc-list-opened")) {
				$thisCrnt.removeClass("wcc-list-opened");                
			} else {
				$thisCrnt.addClass("wcc-list-opened");                
			}            
		}        

		toggleClass()

		/* Do slide function when select item
		  and add 'crnt' class to selected item ---------------- */
		$thisList.find("li").on("click", function () {
			var selectedItemHTML = $(this).html();
			$thisList.find(".crnt").removeClass("crnt");
			$(this).addClass("crnt");            
			$thisList.slideUp();            
			$thisCrnt.html(selectedItemHTML);
			$thisCrnt.removeClass("wcc-list-opened")
		});
	});

});

jQuery(document).ready(function($){
	$(document).on('click', '#wcc-switcher-style-02 ul li', function(){
		var code = $(this).data('code');
		$('.wccs_switcher_form_02 .wccs_switcher').val(code);
		setTimeout(function(){ $('form.wccs_switcher_form_02').submit(); }, 500);
	});
});
