$(function(){$('input, textarea').keydown(function(e){if(e.keyCode==13){if(['country','zipCode'].includes($(this).attr('name'))){e.preventDefault();return false;}else{var $btnNextStep=$(this).closest('.js-step').find('.js-next-step');if($btnNextStep.length>0){$btnNextStep.eq(0).trigger('click');return false;}}}});$('.js-step .js-next-step').on('click',function(){var $curStep=$(this).closest('.js-step'),$nextStep=$curStep.next('.js-step');if($curStep.hasClass('js-validate-step')&&typeof Validator!=='undefined'){var validator=new Validator($curStep,{});if(validator.checkForm()===true){return false;}}
goToStep($nextStep,$curStep);});$('.js-step .js-prev-step').on('click',function(){var $curStep=$(this).closest('.js-step'),$nextStep=$curStep.prev('.js-step');goToStep($nextStep,$curStep);});});function goToStep($eleShown,$eleHidden){if(typeof handleBeforeGoNextStep=='function'){handleBeforeGoNextStep($eleShown,$eleHidden);}
var hiddenClass='hidden';if($eleShown.hasClass('step-hidden')){hiddenClass='step-hidden';}
$eleShown.removeClass('hidden step-hidden');$eleHidden.addClass(hiddenClass);$eleHidden.find('input').blur();activeProgressBar($eleShown);countdownToNextStep($eleShown);if(typeof handleAfterGoNextStep=='function'){handleAfterGoNextStep($eleShown,$eleHidden);}}
function countdownToNextStep($curStep){var timeout=$curStep.attr('data-timeout');if($curStep.hasClass('js-animation-step')&&typeof timeout!='undefined'){setTimeout(function(){var $nextStep=$curStep.next('.js-step');goToStep($nextStep,$curStep);},timeout);}}
function activeProgressBar($eleShown){var $progressBar=$eleShown.closest('.registration-form-builder').find('.js-progress-bar');if($progressBar.length>0){var indexCurStep=$eleShown.parent().find('.js-step').index($eleShown);$progressBar.find('li').removeClass('active').eq(indexCurStep).addClass('active visited');}}