Secure Checkout :: USA Kickboxing – USA Kickboxing Curriculum
$( document ).ready( function() {
var stickyCounter = $(window).scrollTop();
$(window).scroll(function() { if ($(window).scrollTop() > stickyCounter) { $('.pk-countdown-timer-container').addClass('pk-countdown-timer-sticky'); } else { $('.pk-countdown-timer-container').removeClass('pk-countdown-timer-sticky'); } });
var $cdt_container = $( '.pk-countdown-timer-container' );
var cdt_interval = null; var countdown_timer_type = 'evergreen'; var countdown_timer_action = 'nothing'; var countdown_timer_url = ''; var countdown_timer_start_date = '1697653238000'; var countdown_timer_end_date = '1701454838000'; var countdown_timer_interval = '900000';
var START_DATE = new Date( (new Date()).getTime() + ((new Date()).getTimezoneOffset() * 60000) ); var END_DATE = null;
if( countdown_timer_type !== 'cookie' ) { setCookie( 'pk_cdt_distance', null, { expires: -1, path: window.location.pathname } ); }
switch( countdown_timer_type ) { case "evergreen": END_DATE = new Date( parseInt( countdown_timer_end_date ) + ((new Date()).getTimezoneOffset() * 60000) ); break;
case "cookie": var left_interval = countdown_timer_interval;
if( typeof getCookie( 'pk_cdt_start' ) !== "undefined" ) { var stared_at = new Date( parseInt( getCookie( 'pk_cdt_start' ) ) ); var planned_end_at = new Date( stared_at.getTime() + parseInt( left_interval ) );
left_interval = planned_end_at.getTime() - START_DATE.getTime(); } else if( typeof getCookie( 'pk_cdt_distance' ) === "string" || typeof getCookie( 'pk_cdt_distance' ) === "number" ) { left_interval = getCookie( 'pk_cdt_distance' ); } else { // timer hasn't started yet // set the start date to know when cookie timer was started setCookie( 'pk_cdt_start', START_DATE.getTime(), { path: window.location.pathname } ); }
if (typeof getCookie( 'pk_cdt_expired' ) !== "undefined") { left_interval = 0; }
END_DATE = new Date( START_DATE.getTime() + parseInt( left_interval ) ); break;
case "datetime": END_DATE = new Date( parseInt( countdown_timer_end_date ) + ((new Date()).getTimezoneOffset() * 60000) ); break; }
if( (END_DATE.getTime() - START_DATE.getTime()) < 0 && countdown_timer_action === 'redirect' ) { window.location.href = countdown_timer_url; } function runCountdownTimer() { return setInterval( function() { var now = new Date( (new Date()).getTime() + ((new Date()).getTimezoneOffset() * 60000) ); var distance = END_DATE.getTime() - now.getTime(); if( countdown_timer_type === 'cookie' ) { setCookie( 'pk_cdt_distance', distance, { path: window.location.pathname } ); } var days = Math.floor( distance / (1000 * 60 * 60 * 24) ) || 0; var hours = Math.floor( (distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60) ) || 0; var minutes = Math.floor( (distance % (1000 * 60 * 60)) / (1000 * 60) ) || 0; var seconds = (Math.floor( (distance % (1000 * 60)) / 1000 ) || 0) + 1; if( days > -1 ) { $( '.js-cdt-days' ).html( ("0" + days).substr( -2 ) ); }
if( hours > -1 ) { $( '.js-cdt-hours' ).html( ("0" + hours).substr( -2 ) ); }
if( minutes > -1 ) { $( '.js-cdt-minutes' ).html( ("0" + minutes).substr( -2 ) ); }
$( '.js-cdt-seconds' ).html( ("0" + seconds).substr( -2 ) );
if( distance < 0 ) { clearInterval( cdt_interval ); setCookie( 'pk_cdt_distance', null, { expires: -1, path: window.location.pathname } ); if( countdown_timer_type === "cookie" ) { setCookie( 'pk_cdt_expired', true, { path: window.location.pathname } ); } switch( countdown_timer_action ) { case "nothing": if( countdown_timer_type === "evergreen" ) { END_DATE = new Date( END_DATE.getTime() + parseInt( countdown_timer_interval ) ); cdt_interval = runCountdownTimer(); } break; case "hide": $cdt_container.hide().addClass( 'hidden d-none' ); break; case "redirect": window.location.href = countdown_timer_url; break; } } else { $cdt_container.show() } }, 1000 ); } cdt_interval = runCountdownTimer(); } );
(function() { // trim polyfill : https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/Trim if( !String.prototype.trim ) { (function() { // Make sure we trim BOM and NBSP var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; String.prototype.trim = function() { return this.replace( rtrim, '' ); }; })(); }
[].slice.call( document.querySelectorAll( 'input.input__field' ) ).forEach( function( inputEl ) { // in case the input is already filled.. if( inputEl.value.trim() !== '' ) { classie.add( inputEl.parentNode, 'input--filled' ); }
// events: inputEl.addEventListener( 'focus', onInputFocus ); inputEl.addEventListener( 'blur', onInputBlur ); } );
function onInputFocus( ev ) { classie.add( ev.target.parentNode, 'input--filled' ); }
function onInputBlur( ev ) { if( ev.target.value.trim() === '' ) { classie.remove( ev.target.parentNode, 'input--filled' ); } } })();