subscribe.wired.com Open in urlscan Pro
96.16.129.67  Public Scan

Submitted URL: https://link.wired.com/click/28233429.74166/aHR0cHM6Ly9zdWJzY3JpYmUud2lyZWQuY29tL3N1YnNjcmliZS9zcGxpdHMvd2lyZWQvV0lSX05...
Effective URL: https://subscribe.wired.com/subscribe/splits/wired/WIR_NEWSLETTER?utm_source=nl&utm_brand=wired&utm_mailing=WIR_Weekly%20202...
Submission: On June 30 via api from GB — Scanned from GB

Form analysis 1 forms found in the DOM

POST /subscribe/processSubscription

<form id="submission-form" action="/subscribe/processSubscription" method="post" target="result">
  <input type="hidden" name="offer_id" value="125558"> <input type="hidden" name="host_offer_id" value="125558">
  <input type="hidden" name="source_code" value="">
  <input type="hidden" name="parent_trans_id" value="">
  <input type="hidden" name="trans_id" value="">
  <input type="hidden" name="trans_key" value="">
  <input type="hidden" name="pos_name" value="">
  <input type="hidden" name="segment_name" value="">
  <input type="hidden" name="ignore_dav" value="1">
  <input type="hidden" id="chosen-offer" name="chosen_offer" value="1">
  <input type="hidden" id="submission-form-source" name="referral_source" value="EDT_WIR_NEWSLETTER_0_DAILY_OPT_DOWN_ZZ" data-source=""> <input type="hidden" name="pt_id" value=""> <input type="hidden" name="offer_term" id="offerterm"
    value="167056_0"> <input type="hidden" name="ship_cost" id="ship-cost" value="Free"> <input type="hidden" name="origin_price" id="originprice" value="$5.00"> <input type="hidden" name="cross_disp" id="crossdisp" data-ordertype="self"
    data-location="domestic" data-default="self-domestic gift-domestic" value="" maxlength="5" self-ordertype="self">
  <div id="header-background">
    <div role="banner" id="toplogo">
      <div class="wir-logo-container">
        <a class="wir-logo-a" href="https://www.wired.com/" border="0"><img id="toplogoimg" class="toplogoimgmb" src="https://subscribe.wired.com/circulation/wired/images/WIRED_Master_Logo_White_Transparent1.png" alt="Wired">
                        <img id="toplogoimg" class=" toplogoimgdt" src="https://subscribe.wired.com/circulation/wired/images/wired-logo-white-nextgen.png" alt="Wired">
                    </a>
      </div>
      <div class="wir-menu-container">
        <ul class="wir-mobile-menu1-next-gen">
          <li><span id="wir-menu-holder">More Options</span><span> <img class="toplogoimgmb" src="https://subscribe.wired.com/circulation/wired/images/white-arrow-down1.png" alt="Down Arrow" width="14px"><img class=" toplogoimgdta"
                src="https://subscribe.wired.com/circulation/wired/images/ng-nav-up-arrow-white-new.png" alt="Up arrow" width="14px"></span></li>
        </ul>
        <ul class="wir-DT-menu-next-gen">
          <li><a href="https://subscribe.wired.com/subscribe/wired/139271?source=HCL_WIR_TEXT_LINK_0_GIFT_NEXT_GEN_ZZ">Gift</a></li>
          <li><a href="https://w1.buysub.com/pubs/N3/WIR/Register.jsp?cds_page_id=175371&amp;cds_mag_code=WIR">Help</a></li>
        </ul>
      </div>
    </div>
    <div class="wir-menu-container wir-mobile-menu-next-gen">
      <ul>
        <li><a href="https://subscribe.wired.com/subscribe/wired/139271?source=HCL_WIR_TEXT_LINK_0_GIFT_NEXT_GEN_ZZ">Gift</a></li>
        <li><a href="https://w1.buysub.com/pubs/N3/WIR/Register.jsp?cds_page_id=175371&amp;cds_mag_code=WIR">Help</a></li>
      </ul>
    </div>
    <style>
      @font-face {
        font-family: 'WiredMono';
        src: url('https://subscribe.wired.com/circulation/wired/misc/WiredMono-Bold.woff2') format('woff2'), url('https://subscribe.wired.com/circulation/wired/misc/WiredMono-Bold.woff') format('woff')
      }

      @font-face {
        font-family: 'LabGrotesque-Black';
        src: url('/circulation/wired/misc/LabGrotesque-Black.woff');
      }

      #header-background {
        background-image: url('https://subscribe.wired.com/circulation/wired/images/ADA_Header_WIR_OPH_FourthOfJulySale_2022_DT.png');
        background-repeat: no-repeat;
        background-size: cover;
        background-position-y: center;
        overflow: hidden !important;
        background-color: #eaeaea;
        background-position-x: center;
      }

      .visually-hidden {
        display: none;
      }

      .strike {
        position: relative;
        display: inline-block;
      }

      .strike::before {
        content: '';
        border-bottom: 3px solid #FA0D13;
        width: 100%;
        position: absolute;
        right: 0;
        top: 45%;
      }

      #toplogo {
        background-color: transparent;
      }

      #wir-banner-ada {
        max-width: 1024px;
        min-height: 130px;
        /* background-color: #f5bf23; */
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        align-items: center;
      }

      #wir-banner-ada {
        height: 110px;
      }

      .wiredContainer {
        background-color: #fff;
        padding: 20px 20px 0px 20px;
        border-radius: 10px;
      }

      h1.wir-header-heading-ada {
        font-family: 'LabGrotesque-Black';
        font-style: normal;
        font-weight: 900;
        font-size: 32px;
        line-height: 24px;
        margin: 0;
        color: #0071CD;
        background-color: none;
        display: inline;
        padding: 2px 12px;
      }

      h2.wir-header-subheading-ada {
        font-family: 'LabGrotesque-Black';
        font-style: normal;
        font-weight: 900;
        font-size: 22px;
        line-height: 36px;
        margin: 0;
        background-color: none;
        color: #000;
        padding: 0 3px;
      }

      h3.wir-header-subheading2-ada {
        font-family: 'WiredMono';
        font-style: normal;
        font-weight: bold;
        font-size: 12px;
        line-height: 24px;
        margin: 0;
        background-color: none;
        color: #000;
        display: inline;
        padding: 0px;
      }

      .wir-menu-container ul li a {
        display: inline-block;
        color: #ffffff;
        text-decoration-line: none;
      }

      #wir-menu-holder {
        color: white;
      }

      #wir-banner-ada .wir-header-heading-ada {
        /* margin-bottom: 15px; */
      }

      .wir-menu-container.wir-mobile-menu-next-gen {
        height: 150px;
      }

      #wir-menu-holder {
        color: #ffffff;
      }

      .wiredContainer {
        margin-top: -5px;
      }

      @media screen and (max-width: 720px) {
        #header-background {
          background-image: url('https://subscribe.wired.com/circulation/wired/images/ADA_Header_WIR_OPH_FourthOfJulySale_2022_MOB.png');
          background-repeat: no-repeat;
          background-size: cover;
          background-position-y: center;
          overflow: hidden !important;
          background-color: #eaeaea;
          background-position-x: center;
          height: 170px;
        }

        #wir-banner-ada {
          height: 110px;
        }

        #wir-banner-ada .wir-header-heading-ada {
          width: 320px;
          /* margin: 0 auto; */
        }

        h1.wir-header-heading-ada {}

        h2.wir-header-subheading-ada {
          font-size: 26px;
          line-height: 32px;
          margin: 0 auto;
        }

        h3.wir-header-subheading1-ada {
          font-size: 18px;
          line-height: 22px;
        }

        h3.wir-header-subheading2-ada {
          font-size: 12px;
          line-height: 0px;
          margin: 0;
          margin-top: 0;
        }

        .wiredContainer {
          margin-top: 0px;
        }

        @media screen and (max-width: 540px) {
          h1.wir-header-heading-ada {
            font-size: 22px;
          }

          h2.wir-header-subheading-ada {
            font-size: 16px;
            line-height: 32px;
            margin: 0 auto;
          }

          h3.wir-header-subheading1-ada {
            font-size: 18px;
            line-height: 22px;
          }

          h3.wir-header-subheading2-ada {
            font-size: 12px;
            line-height: 0px;
            margin: 0;
            margin-top: 0;
          }

          .wiredContainer {
            margin-top: 0px;
            background-color: #fff;
            padding: 5px 5px 5px 5px;
            border-radius: 10px;
          }
        }
      }
    </style>
    <div id="wir-banner-ada">
      <div class="wiredContainer" style="text-align: center; color: #fff">
        <div>
          <h1 class="wir-header-heading-ada">FOURTH OF JULY SALE</h1>
          <h2 class="wir-header-subheading-ada">Get a year of WIRED for <span class="strike">$29.99</span> <span style="color: #FA0D13;">$5</span></h2>
          <h3 class="wir-header-subheading2-ada">Cancel anytime. </h3>
        </div>
      </div>
    </div><!--JS-->
    <script type="text/javascript">
      let arrowImg = document.querySelector('.wir-mobile-menu1-next-gen').querySelector('.toplogoimgmb');
      arrowImg.src = 'https://subscribe.wired.com/circulation/wired/images/white-arrow-down1.png'
    </script><!--end of: JS-->
  </div>
  <div id="page-holder" role="main">
    <div id="pagesection">
      <div id="order-progress-bar">
        <div class="nextgen-progress-bar">
          <ol>
            <li><a href="#nextgen-step-1">Location</a></li>
            <li><a href="#chooseoffer">Plan</a></li>
            <li><a href="#nextgen-step-3">Payment</a></li>
            <li class="ng-disabled"><a href="#nextgen-step-4">Address</a></li>
            <li class="ng-disabled"><a href="#ordersummary">Submit</a></li>
          </ol>
          <div class="nextgen-progress-container">
            <div class="nextgen-progress"></div>
          </div>
        </div>
      </div>
      <div class="giftcheckon" id="nextgen-step-1">
        <div id="isgiftholder-container">
          <style>
            .prechecked {
              background-color: #fff;
              text-align: center;
              font-size: 16px;
            }
          </style>
          <div id="isgiftholder" style="">
            <div id="isGiftCheck" aria-labelledby="isGiftCheckText" data-isgift="false" role="button" tabindex="0"><img id="nextgen-gift-check" src="https://subscribe.wired.com/circulation/wired/images/ng-radio-check-new.png" alt=""></div>
            <div id="isGiftCheckText">This is a gift</div>
            <div class="nextgen-gift-icon"></div>
            <div id="isGiftCheckinfocopy" class="gift-on">
            </div>
          </div>
        </div>
      </div>
      <div class="nextgen-greyborder usonlyhide"></div>
      <div id="wherego" class="sectionbox">
        <div id="wheregoing" class="sectionheadfont" tabindex="-1">
          <h2>Step 1. Location</h2>
        </div>
        <div class="space15"></div>
        <div id="wheregoselect">
          <script>
            jQuery.fn.filterByText = function(textbox) {
              return this.each(function() {
                var select = this;
                var options = [];
                $(select).find('option').each(function() {
                  options.push({
                    value: $(this).val(),
                    text: $(this).text()
                  });
                });
                $(select).data('options', options);
                $(textbox).bind('change keyup', function(e) {
                  if (e.keyCode == '40') {
                    $("#ship-country-selector").focus();
                  }
                  $(select).css("display", "inherit");
                  var options = $(select).empty().data('options');
                  var search = $.trim($(this).val());
                  var regex = new RegExp(search, "gi");
                  $.each(options, function(i) {
                    var option = options[i];
                    if (option.text.toUpperCase().startsWith(search.toUpperCase()) == true) {
                      $(select).append($('<option>').text(option.text).val(option.value));
                    }
                  });
                  $(select).attr("size", $(select).find('option').length);
                  if ($(select).find('option').length > 5) {
                    var size = (5 * 37) + 'px';
                    $(select).css("height", size);
                  } else {
                    var size = ($(select).find('option').length * 37) + 'px';
                    $(select).css("height", size);
                    $(select).css("padding", "0px");
                  }
                  if ($(select).find('option').length == 1) {
                    $(select).attr("size", 2);
                  }
                  if ($(select).find('option').length == 0) {
                    // $("#ship-country-selector").hide();
                  }
                  if (e.keyCode != '32' && e.keyCode != '8' && e.keyCode != '13' && e.keyCode != '9') {
                    if ($(select).find('option').length == 1) {
                      $(select).attr("size", 2);
                      $("#ship-country-selector-input").val($("#ship-country-selector > option:first").text());
                    }
                    if ($("#ship-country-selector").val() == '' || $("#ship-country-selector").val() == null) {
                      $("#ship-country-selector-error").addClass("error");
                      $("#ship-country-selector-input").addClass("errorinput");
                      $("#ship-country-selector-input").focus();
                    } else {
                      $("#ship-country-selector-error").removeClass("error");
                      $("#ship-country-selector-input").removeClass("errorinput");
                    }
                  }
                });
              });
            };
          </script>
          <style>
            #nextgen-international-selector {
              display: none;
              width: 100%;
            }
          </style>
          <input id="ship-country-selector-input" type="hidden" value="United States" autocomplete="FF9PE-34GF">
          <div id="nextgen-country-selector">
            <div id="nextgen-domestic" class="nextgen-country-buttons nextgen-country-selected" role="button" tabindex="0">U.S.</div>
            <div id="nextgen-international" class="nextgen-country-buttons" role="button" tabindex="0">International</div>
          </div>
          <div id="nextgen-international-selector">
            <label for="ship-country-selector">
              <div id="deliverto" class="subtext"> Deliver To </div>
              <span id="ship-country-selector-error" class="output-message">Select a location.</span>
            </label>
            <select id="ship-country-selector" name="country_code" data-location="domestic" data-shipname="ship_country_code" data-billname="country_code" class="ui search selection dropdown" autocomplete="country-name">
              <option value="" style="color: #979797">Choose Location</option>
              <option value="AF" style="color: rgb(151, 151, 151);">Afghanistan</option>
              <option value="AL" style="color: rgb(151, 151, 151);">Albania</option>
              <option value="DZ" style="color: rgb(151, 151, 151);">Algeria</option>
              <option value="AD" style="color: rgb(151, 151, 151);">Andorra</option>
              <option value="AO" style="color: rgb(151, 151, 151);">Angola</option>
              <option value="AI" style="color: rgb(151, 151, 151);">Anguilla</option>
              <option value="AQ" style="color: rgb(151, 151, 151);">Antarctica</option>
              <option value="AG" style="color: rgb(151, 151, 151);">Antigua and Barbuda</option>
              <option value="AR" style="color: rgb(151, 151, 151);">Argentina</option>
              <option value="AM" style="color: rgb(151, 151, 151);">Armenia</option>
              <option value="AW" style="color: rgb(151, 151, 151);">Aruba</option>
              <option value="AU" style="color: rgb(151, 151, 151);">Australia</option>
              <option value="AT" style="color: rgb(151, 151, 151);">Austria</option>
              <option value="AZ" style="color: rgb(151, 151, 151);">Azerbaijan</option>
              <option value="BS" style="color: rgb(151, 151, 151);">Bahamas</option>
              <option value="BH" style="color: rgb(151, 151, 151);">Bahrain</option>
              <option value="BD" style="color: rgb(151, 151, 151);">Bangladesh</option>
              <option value="BB" style="color: rgb(151, 151, 151);">Barbados</option>
              <option value="BE" style="color: rgb(151, 151, 151);">Belgium</option>
              <option value="BZ" style="color: rgb(151, 151, 151);">Belize</option>
              <option value="BJ" style="color: rgb(151, 151, 151);">Benin</option>
              <option value="BM" style="color: rgb(151, 151, 151);">Bermuda</option>
              <option value="BT" style="color: rgb(151, 151, 151);">Bhutan</option>
              <option value="BO" style="color: rgb(151, 151, 151);">Bolivia</option>
              <option value="BA" style="color: rgb(151, 151, 151);">Bosnia-Herzegovina</option>
              <option value="BW" style="color: rgb(151, 151, 151);">Botswana</option>
              <option value="BR" style="color: rgb(151, 151, 151);">Brazil</option>
              <option value="VG" style="color: rgb(151, 151, 151);">British Virgin Islands</option>
              <option value="BN" style="color: rgb(151, 151, 151);">Brunei Darussalam</option>
              <option value="BG" style="color: rgb(151, 151, 151);">Bulgaria</option>
              <option value="BF" style="color: rgb(151, 151, 151);">Burkina Faso</option>
              <option value="BI" style="color: rgb(151, 151, 151);">Burundi</option>
              <option value="KH" style="color: rgb(151, 151, 151);">Cambodia</option>
              <option value="CM" style="color: rgb(151, 151, 151);">Cameroon</option>
              <option value="CA" style="color: rgb(151, 151, 151);">Canada</option>
              <option value="C3" style="color: rgb(151, 151, 151);">Canary Islands</option>
              <option value="CV" style="color: rgb(151, 151, 151);">Cape Verde</option>
              <option value="KY" style="color: rgb(151, 151, 151);">Cayman Islands</option>
              <option value="CF" style="color: rgb(151, 151, 151);">Central African Rep</option>
              <option value="TD" style="color: rgb(151, 151, 151);">Chad</option>
              <option value="CL" style="color: rgb(151, 151, 151);">Chile</option>
              <option value="CN" style="color: rgb(151, 151, 151);">China Peoples Republic</option>
              <option value="CO" style="color: rgb(151, 151, 151);">Colombia</option>
              <option value="KM" style="color: rgb(151, 151, 151);">Comoros</option>
              <option value="CG" style="color: rgb(151, 151, 151);">Congo</option>
              <option value="CD" style="color: rgb(151, 151, 151);">Congo, The Democratic Republic of the</option>
              <option value="CK" style="color: rgb(151, 151, 151);">Cook Islands</option>
              <option value="CR" style="color: rgb(151, 151, 151);">Costa Rica</option>
              <option value="CI" style="color: rgb(151, 151, 151);">Cote d’Ivoire</option>
              <option value="HR" style="color: rgb(151, 151, 151);">Croatia</option>
              <option value="CY" style="color: rgb(151, 151, 151);">Cyprus</option>
              <option value="CZ" style="color: rgb(151, 151, 151);">Czech Republic</option>
              <option value="DK" style="color: rgb(151, 151, 151);">Denmark</option>
              <option value="DJ" style="color: rgb(151, 151, 151);">Djibouti</option>
              <option value="DM" style="color: rgb(151, 151, 151);">Dominica</option>
              <option value="DO" style="color: rgb(151, 151, 151);">Dominican Republic</option>
              <option value="EA" style="color: rgb(151, 151, 151);">Easter Island</option>
              <option value="EC" style="color: rgb(151, 151, 151);">Ecuador</option>
              <option value="EG" style="color: rgb(151, 151, 151);">Egypt</option>
              <option value="SV" style="color: rgb(151, 151, 151);">El Salvador</option>
              <option value="GQ" style="color: rgb(151, 151, 151);">Equatorial Guinea</option>
              <option value="ER" style="color: rgb(151, 151, 151);">Eritrea</option>
              <option value="EE" style="color: rgb(151, 151, 151);">Estonia</option>
              <option value="ET" style="color: rgb(151, 151, 151);">Ethiopia</option>
              <option value="FO" style="color: rgb(151, 151, 151);">Faeroe Islands</option>
              <option value="FK" style="color: rgb(151, 151, 151);">Falkland Islands</option>
              <option value="FJ" style="color: rgb(151, 151, 151);">Fiji</option>
              <option value="FI" style="color: rgb(151, 151, 151);">Finland</option>
              <option value="FR" style="color: rgb(151, 151, 151);">France</option>
              <option value="PF" style="color: rgb(151, 151, 151);">French Polynesia</option>
              <option value="GA" style="color: rgb(151, 151, 151);">Gabon</option>
              <option value="GM" style="color: rgb(151, 151, 151);">Gambia</option>
              <option value="GE" style="color: rgb(151, 151, 151);">Georgia</option>
              <option value="DE" style="color: rgb(151, 151, 151);">Germany</option>
              <option value="GI" style="color: rgb(151, 151, 151);">Gibraltar</option>
              <option value="GR" style="color: rgb(151, 151, 151);">Greece</option>
              <option value="GL" style="color: rgb(151, 151, 151);">Greenland</option>
              <option value="GD" style="color: rgb(151, 151, 151);">Grenada</option>
              <option value="GT" style="color: rgb(151, 151, 151);">Guatemala</option>
              <option value="GN" style="color: rgb(151, 151, 151);">Guinea</option>
              <option value="GW" style="color: rgb(151, 151, 151);">Guinea-Bissau</option>
              <option value="GY" style="color: rgb(151, 151, 151);">Guyana</option>
              <option value="HT" style="color: rgb(151, 151, 151);">Haiti</option>
              <option value="HN" style="color: rgb(151, 151, 151);">Honduras</option>
              <option value="HK" style="color: rgb(151, 151, 151);">Hong Kong</option>
              <option value="HU" style="color: rgb(151, 151, 151);">Hungary</option>
              <option value="IS" style="color: rgb(151, 151, 151);">Iceland</option>
              <option value="IN" style="color: rgb(151, 151, 151);">India</option>
              <option value="IE" style="color: rgb(151, 151, 151);">Ireland</option>
              <option value="IM" style="color: rgb(151, 151, 151);">Isle of Man</option>
              <option value="IL" style="color: rgb(151, 151, 151);">Israel</option>
              <option value="IT" style="color: rgb(151, 151, 151);">Italy</option>
              <option value="JM" style="color: rgb(151, 151, 151);">Jamaica</option>
              <option value="JP" style="color: rgb(151, 151, 151);">Japan</option>
              <option value="JO" style="color: rgb(151, 151, 151);">Jordan</option>
              <option value="KZ" style="color: rgb(151, 151, 151);">Kazakhstan</option>
              <option value="KE" style="color: rgb(151, 151, 151);">Kenya</option>
              <option value="KI" style="color: rgb(151, 151, 151);">Kiribati</option>
              <option value="KW" style="color: rgb(151, 151, 151);">Kuwait</option>
              <option value="KG" style="color: rgb(151, 151, 151);">Kyrgyzstan</option>
              <option value="LA" style="color: rgb(151, 151, 151);">Laos</option>
              <option value="LV" style="color: rgb(151, 151, 151);">Latvia</option>
              <option value="LB" style="color: rgb(151, 151, 151);">Lebanon</option>
              <option value="LS" style="color: rgb(151, 151, 151);">Lesotho</option>
              <option value="LR" style="color: rgb(151, 151, 151);">Liberia</option>
              <option value="LI" style="color: rgb(151, 151, 151);">Liechtenstein</option>
              <option value="LT" style="color: rgb(151, 151, 151);">Lithuania</option>
              <option value="LU" style="color: rgb(151, 151, 151);">Luxembourg</option>
              <option value="MO" style="color: rgb(151, 151, 151);">Macao</option>
              <option value="MK" style="color: rgb(151, 151, 151);">Macedonia</option>
              <option value="MG" style="color: rgb(151, 151, 151);">Madagascar</option>
              <option value="MW" style="color: rgb(151, 151, 151);">Malawi</option>
              <option value="MY" style="color: rgb(151, 151, 151);">Malaysia</option>
              <option value="MV" style="color: rgb(151, 151, 151);">Maldives</option>
              <option value="ML" style="color: rgb(151, 151, 151);">Mali</option>
              <option value="MT" style="color: rgb(151, 151, 151);">Malta</option>
              <option value="MH" style="color: rgb(151, 151, 151);">Marshall Islands</option>
              <option value="MR" style="color: rgb(151, 151, 151);">Mauritania</option>
              <option value="MU" style="color: rgb(151, 151, 151);">Mauritius</option>
              <option value="MX" style="color: rgb(151, 151, 151);">Mexico</option>
              <option value="FM" style="color: rgb(151, 151, 151);">Micronesia</option>
              <option value="MD" style="color: rgb(151, 151, 151);">Moldova, Republic of</option>
              <option value="MC" style="color: rgb(151, 151, 151);">Monaco</option>
              <option value="MN" style="color: rgb(151, 151, 151);">Mongolia</option>
              <option value="MS" style="color: rgb(151, 151, 151);">Monserrat</option>
              <option value="ME" style="color: rgb(151, 151, 151);">Montenegro</option>
              <option value="MA" style="color: rgb(151, 151, 151);">Morocco</option>
              <option value="MZ" style="color: rgb(151, 151, 151);">Mozambique</option>
              <option value="MM" style="color: rgb(151, 151, 151);">Myanmar</option>
              <option value="NA" style="color: rgb(151, 151, 151);">Namibia</option>
              <option value="NR" style="color: rgb(151, 151, 151);">Nauru</option>
              <option value="NP" style="color: rgb(151, 151, 151);">Nepal</option>
              <option value="NL" style="color: rgb(151, 151, 151);">Netherlands</option>
              <option value="AN" style="color: rgb(151, 151, 151);">Netherlands Antilles</option>
              <option value="NC" style="color: rgb(151, 151, 151);">New Caledonia</option>
              <option value="NZ" style="color: rgb(151, 151, 151);">New Zealand</option>
              <option value="NI" style="color: rgb(151, 151, 151);">Nicaragua</option>
              <option value="NE" style="color: rgb(151, 151, 151);">Niger</option>
              <option value="NF" style="color: rgb(151, 151, 151);">Norfolk Island</option>
              <option value="NO" style="color: rgb(151, 151, 151);">Norway</option>
              <option value="OM" style="color: rgb(151, 151, 151);">Oman</option>
              <option value="PK" style="color: rgb(151, 151, 151);">Pakistan</option>
              <option value="PA" style="color: rgb(151, 151, 151);">Panama</option>
              <option value="PG" style="color: rgb(151, 151, 151);">Papua New Guinea</option>
              <option value="PY" style="color: rgb(151, 151, 151);">Paraguay</option>
              <option value="PE" style="color: rgb(151, 151, 151);">Peru</option>
              <option value="PH" style="color: rgb(151, 151, 151);">Philippines</option>
              <option value="PN" style="color: rgb(151, 151, 151);">Pitcairn Islands</option>
              <option value="PL" style="color: rgb(151, 151, 151);">Poland</option>
              <option value="PT" style="color: rgb(151, 151, 151);">Portugal</option>
              <option value="QA" style="color: rgb(151, 151, 151);">Qatar</option>
              <option value="KR" style="color: rgb(151, 151, 151);">Repl of Korea</option>
              <option value="RE" style="color: rgb(151, 151, 151);">Reunion</option>
              <option value="RO" style="color: rgb(151, 151, 151);">Romania</option>
              <option value="RW" style="color: rgb(151, 151, 151);">Rwanda</option>
              <option value="SM" style="color: rgb(151, 151, 151);">San Marino</option>
              <option value="ST" style="color: rgb(151, 151, 151);">Sao Tome and Principe</option>
              <option value="SA" style="color: rgb(151, 151, 151);">Saudi Arabia</option>
              <option value="SN" style="color: rgb(151, 151, 151);">Senegal</option>
              <option value="RS" style="color: rgb(151, 151, 151);">Serbia</option>
              <option value="SC" style="color: rgb(151, 151, 151);">Seychelles</option>
              <option value="SL" style="color: rgb(151, 151, 151);">Sierra Leone</option>
              <option value="SG" style="color: rgb(151, 151, 151);">Singapore</option>
              <option value="SK" style="color: rgb(151, 151, 151);">Slovak Republic</option>
              <option value="SI" style="color: rgb(151, 151, 151);">Slovenia</option>
              <option value="SB" style="color: rgb(151, 151, 151);">Solomon Islands</option>
              <option value="SO" style="color: rgb(151, 151, 151);">Somalia</option>
              <option value="ZA" style="color: rgb(151, 151, 151);">South Africa</option>
              <option value="ES" style="color: rgb(151, 151, 151);">Spain</option>
              <option value="LK" style="color: rgb(151, 151, 151);">Sri Lanka</option>
              <option value="SH" style="color: rgb(151, 151, 151);">St Helena</option>
              <option value="KN" style="color: rgb(151, 151, 151);">St Kitts-Nevis</option>
              <option value="LC" style="color: rgb(151, 151, 151);">St Lucia</option>
              <option value="PM" style="color: rgb(151, 151, 151);">St Pierre &amp; Miquelon</option>
              <option value="VC" style="color: rgb(151, 151, 151);">St Vincent &amp; Grenadines</option>
              <option value="SR" style="color: rgb(151, 151, 151);">Suriname</option>
              <option value="SZ" style="color: rgb(151, 151, 151);">Swaziland</option>
              <option value="SE" style="color: rgb(151, 151, 151);">Sweden</option>
              <option value="CH" style="color: rgb(151, 151, 151);">Switzerland</option>
              <option value="TW" style="color: rgb(151, 151, 151);">Taiwan</option>
              <option value="TJ" style="color: rgb(151, 151, 151);">Tajikistan</option>
              <option value="TZ" style="color: rgb(151, 151, 151);">Tanzania</option>
              <option value="TH" style="color: rgb(151, 151, 151);">Thailand</option>
              <option value="TG" style="color: rgb(151, 151, 151);">Togo</option>
              <option value="TO" style="color: rgb(151, 151, 151);">Tonga</option>
              <option value="TT" style="color: rgb(151, 151, 151);">Trinidad and Tobago</option>
              <option value="TN" style="color: rgb(151, 151, 151);">Tunisia</option>
              <option value="TR" style="color: rgb(151, 151, 151);">Turkey</option>
              <option value="TM" style="color: rgb(151, 151, 151);">Turkmenistan</option>
              <option value="TC" style="color: rgb(151, 151, 151);">Turks-Caicos Islands</option>
              <option value="TV" style="color: rgb(151, 151, 151);">Tuvalu</option>
              <option value="UG" style="color: rgb(151, 151, 151);">Uganda</option>
              <option value="AE" style="color: rgb(151, 151, 151);">United Arab Emirates</option>
              <option value="GB" style="color: rgb(151, 151, 151);">United Kingdom</option>
              <option value="US" style="display: none; color: rgb(151, 151, 151);">United States</option>
              <option value="UY" style="color: rgb(151, 151, 151);">Uruguay</option>
              <option value="UZ" style="color: rgb(151, 151, 151);">Uzbekistan</option>
              <option value="VU" style="color: rgb(151, 151, 151);">Vanuatu</option>
              <option value="VA" style="color: rgb(151, 151, 151);">Vatican City</option>
              <option value="VE" style="color: rgb(151, 151, 151);">Venezuela</option>
              <option value="VI" style="color: rgb(151, 151, 151);">Virgin Islands</option>
              <option value="WF" style="color: rgb(151, 151, 151);">Wallis Futuna Islands</option>
              <option value="EH" style="color: rgb(151, 151, 151);">Western Sahara</option>
              <option value="WS" style="color: rgb(151, 151, 151);">Western Samoa</option>
              <option value="YE" style="color: rgb(151, 151, 151);">Yemen</option>
              <option value="ZM" style="color: rgb(151, 151, 151);">Zambia</option>
              <option value="ZW" style="color: rgb(151, 151, 151);">Zimbabwe</option>
            </select>
          </div>
        </div>
      </div>
      <div class="nextgen-greyborder usonlyhide"></div>
      <div id="chooseoffer" class="sectionbox sectionbox-full">
        <div id="chooseofferheadtext"><span class="sectionheadfont">
            <h2>STEP 2. Choose Your Plan</h2>
          </span></div>
        <div class="space10 ng-hide-on-dt"></div>
        <div class="space15 ng-hide-on-mobile"></div>
        <div id="nextgen-offer-container">
          <span id="chooseoffermessage" class="output-message">Select an offer</span>
          <div class="panel offer on" data-format="bundle" data-chosenoffer="1" data-issues="12" data-self-issues="12" data-gift-issues="12" id="offer1" data-patermnew="one year" data-papricenew="$29.99" tabindex="0" role="button">
            <div class="panel-popular panel-default">MOST POPULAR</div>
            <div class="panel-inner">
              <div class="offerheader heading02">Print + Digital Access</div>
              <div class="heading03"><span class="gift-on">Give </span>1 year for <span class="visually-hidden">Regular price </span><strike>$29.99</strike><span class="visually-hidden"> Sale price:</span> $5</div>
              <div class="ng-dt-int-order"><span>+ international shipping</span></div>
              <div class="ng_arcopy">After one year, renews automatically at one year for $29.99</div>
              <div class="panel-selector-container">
                <div class="panel-selector">Selected</div>
              </div>
              <div class="space5"></div>
              <div style="width:100%">
                <ul class="body01 nosudo" style="height: 63px;">
                  <li><span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>
                    <p>Unlimited access to WIRED.com</p>
                  </li>
                  <li><span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>
                    <p>Print subscription</p>
                  </li>
                  <li><span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>
                    <p>Digital edition of the magazine</p>
                  </li>
                </ul>
              </div>
              <div class="panel-arrow-down"><img src="https://subscribe.wired.com/circulation/wired/images/wir-triangle-down-nextgen.png" alt=""></div>
              <div class="panel-image">
                <div class="auto-cover"><img class="update-cover" src="https://www.wired.com/wp-content/uploads/2014/08/cover_wired_190.jpg" alt="Wired Cover" width="75"></div>
                <img class="panel-shot" src="https://subscribe.wired.com/circulation/wired/images/WIR_600X305_DIG-CONTROL.png" alt="Print + Digital Access"><img class="panel-shot-selected"
                  src="https://subscribe.wired.com/circulation/wired/images/WIR_600X305_DIG-CONTROL-Selected.png" alt="Print + Digital Access">
              </div>
              <div class="panel-arrow-up"><img src="https://subscribe.wired.com/circulation/wired/images/wir-triangle-up-nextgen.png" alt=""></div>
            </div>
            <div class="panel-image-spacer"></div>
          </div>
          <div class="panel offer off" data-format="digital" data-chosenoffer="2" data-issues="12" data-self-issues="12" data-gift-issues="12" id="offer2" data-patermnew="one year" data-papricenew="$29.99" tabindex="0" role="button">
            <div class="panel-popular"></div>
            <div class="panel-inner">
              <div class="offerheader heading02"> Digital Only Access </div>
              <div class="heading03">
                <span class="gift-on">Give </span>1 year for <span class="visually-hidden">Regular price </span><strike>$29.99</strike><span class="visually-hidden"> Sale price:</span> $5
              </div>
              <div class="ng-dt-int-order1"><span>&nbsp;</span></div>
              <div class="panel-sales-tax"></div>
              <div class="ng_arcopy">After one year, renews automatically at one year for $29.99</div>
              <div class="panel-selector-container">
                <div class="panel-selector">Select</div>
              </div>
              <div class="space5"></div>
              <div style="width:100%">
                <ul class="body01 nosudo" style="height: 63px;">
                  <li><span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>
                    <p>Unlimited access to WIRED.com</p>
                  </li>
                  <li><span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>
                    <p>Digital edition of the magazine</p>
                  </li>
                </ul>
              </div>
              <div class="panel-arrow-down"><img src="https://subscribe.wired.com/circulation/wired/images/wir-triangle-down-nextgen.png" alt=""></div>
              <div class="panel-image"><img class="panel-shot" style="margin-left:0px;" src="https://subscribe.wired.com/circulation/wired/images/WIR_600X305_DIG-CONTROL.png" alt="Print + Digital Access"><img class="panel-shot-selected"
                  style="margin-left:0px;" src="https://subscribe.wired.com/circulation/wired/images/WIR_600X305_DIG-CONTROL-Selected.png" alt="Print + Digital Access"></div>
              <div class="panel-arrow-up"><img src="https://subscribe.wired.com/circulation/wired/images/wir-triangle-up-nextgen.png" alt=""></div>
            </div>
            <div class="panel-image-spacer"></div>
          </div>
        </div>
        <div class="space25"></div>
        <div class="nextgen-greyborder"></div>
      </div>
      <div class="giftrecipientshow" style="display: none;"></div>
      <fieldset id="giftrecipient" class="sectionbox" disabled="" style="display: none;">
        <div id="giftaddresstext" class="sectionheadfont">
          <h2>STEP 3. GIFT RECIPIENT</h2>
        </div>
        <div id="nextgen-gift-recipient">
          <h2>Enter Recipient Information</h2>
        </div>
        <div class="flex">
          <div class="ng_required">
            <label for="ship-first-name">First Name<input type="text" class="req" id="ship-first-name" name="ship_first_name" aria-required="true" autocomplete="given-name"></label>
            <div class="errorcontainer"><span id="ship-first-name-error" class="output-message">Please enter first name</span></div>
          </div>
          <div class="ng_required ng-flex-last">
            <label for="ship-last-name">Last Name<input type="text" class="req" id="ship-last-name" name="ship_last_name" aria-required="true" autocomplete="family-name"></label>
            <div class="errorcontainer"><span id="ship-last-name-error" class="output-message">Please enter last name</span></div>
          </div>
        </div>
        <div id="nextgen-gift-shipping"></div>
        <div class="ng_required">
          <label for="ship-email">Recipient Email<input type="text" class="req" id="ship-email" name="ship_email" aria-required="true" autocomplete="email"></label>
          <div class="errorcontainer"><span id="ship-email-error" class="output-message">Email cannot be empty</span> <span id="ship-email-invaliderror" class="output-message">Please enter a valid email</span></div>
          <div id="giftprivacytext">Will be used in accordance with our <a href="https://www.condenast.com/user-agreement" target="_blank">User Agreement</a> and <a href="https://www.condenast.com/privacy-policy" target="_blank">Privacy Policy</a>.
          </div>
        </div>
      </fieldset>
      <div id="nextgen-gift-border" class="nextgen-greyborder" style="display: none;"></div>
      <div id="expressPayment"></div>
      <script>
        var hasapplepay = false;
        var appdisp = ['apple', 'amazon'];
        var noappdisp = ['amazon', 'paypal'];
        var amazonflag = true;
        var paypalflag = true;
        var applepayflag = false;

        function hasapplepaydisplay() {
          if (hasapplepay == true || hasapplepay == false) {
            if (hasapplepay == true) {
              var i;
              for (i = 0; i <= appdisp.length; i++) {
                if (appdisp[i] == "apple") {
                  $("#applepay_checkout_section").append($("#applePay"));
                  applepayflag = true;
                }
                if (appdisp[i] == "amazon") {
                  $("#nextgen-tab-2").append($("#amazonpay-container"));
                  amazonflag = true;
                  $("#applePayform").addClass("hasamz");
                }
                if (appdisp[i] == "paypal") {
                  $("#nextgen-tab-3").append($("#ppcheckoutexpbutton"));
                  paypalflag = true;
                }
              }
            } else {
              var i;
              for (i = 0; i <= noappdisp.length; i++) {
                if (noappdisp[i] == "apple") {
                  $("#applepay_checkout_section").append($("#applePay"));
                  applepayflag = true;
                }
                if (noappdisp[i] == "amazon") {
                  $("#nextgen-tab-2").append($("#amazonpay-container"));
                  amazonflag = true;
                  $("#applePayform").addClass("hasamz");
                }
                if (noappdisp[i] == "paypal") {
                  $("#nextgen-tab-3").append($("#ppcheckoutexpbutton"));
                  paypalflag = true;
                }
              }
            }
            if (applepayflag == false) {
              // $("#applePay").hide();
              $("#nextgen-tab-4").remove();
              $("[data-ngtab='4']").remove();
            }
            if (amazonflag == false) {
              // $("#amazonpay-container").remove();
              $("#nextgen-tab-2").remove();
              $("[data-ngtab='2']").remove();
            }
            if (paypalflag == false) {
              // $("#ppcheckoutexpbutton").remove();
              $("#nextgen-tab-3").remove();
              $("[data-ngtab='3']").remove();
            }
            if (paypalflag == false && applepayflag == false) {
              $(".autoRenew").hide();
            }
          }
        }
      </script>
      <div class="nextgen-payment-container" id="nextgen-step-3">
        <div id="paymentdettext" class="sectionheadfont">
          <h2><span id="nextgen-gift-payno">STEP 3.</span> PAYMENT DETAILS</h2>
        </div>
        <div class="nextgen-cancel-text">
          <p>You may cancel at any time.</p>
        </div>
        <div class="nextgen-payment-links">
          <div class="nextgen-payment-buttons nextgen-payment-buttons-selected" data-ngtab="1" role="button" tabindex="0">Credit Card</div>
          <div class="nextgen-payment-buttons" data-ngtab="2" role="button" tabindex="0"><img src="https://subscribe.wired.com/circulation/wired/images/Nextgen-Amazon-Pay.png" alt="Amazon pay" width="66px" height="13px" style="margin-top:5px;"></div>
          <div class="nextgen-payment-buttons" data-ngtab="3" role="button" tabindex="0"><img src="https://subscribe.wired.com/circulation/wired/images/Nextgen-Paypal-Pay.png" alt="Paypal pay" width="58px" height="15px"></div>
        </div>
        <div class="nextgen-payment-tab nextgen-payment-selected" id="nextgen-tab-1">
          <!-- Start of Credit Card Info -->
          <div id="paymentdetails" class="sectionbox">
            <div class="flex">
              <div class="ng_required">
                <label for="creditcard"> Credit/Debit Card # <input type="number" id="creditcard" name="credit_card_number" maxlength="16" pattern="[0-9]*" min="0" max="9999999999999999" oninput="maxLengthCheck(this)" aria-required="true"
                    autocomplete="cc-number">
                  <div id="cctext">This transaction is secured with SSL encryption.</div>
                  <div class="errorcontainer"> <span id="creditcard-error" class="output-message">Please enter a valid credit card</span> <span id="creditcard-invalid-error" class="output-message">Please enter a valid credit card</span> </div>
                </label>
              </div>
              <div class="ng_required">
                <fieldset style="border:none;-webkit-appearance:none;padding:0px;margin:0;">
                  <label for="month" id="monthlabel">Exp. Month</label>
                  <select id="month" class="req ui search selection dropdown optionplace1" name="credit_card_exp_month" auto-complete="PUD-VFCD" autocomplete="cc-exp-month" style="color: rgb(204, 204, 204);">
                    <option value="" selected="" style="color: rgb(51, 51, 51);"></option>
                    <option value="01" style="color: rgb(0, 0, 0);">Jan</option>
                    <option value="02" style="color: rgb(0, 0, 0);">Feb</option>
                    <option value="03" style="color: rgb(0, 0, 0);">Mar</option>
                    <option value="04" style="color: rgb(0, 0, 0);">Apr</option>
                    <option value="05" style="color: rgb(0, 0, 0);">May</option>
                    <option value="06" style="color: rgb(0, 0, 0);">Jun</option>
                    <option value="07" style="color: rgb(0, 0, 0);">Jul</option>
                    <option value="08" style="color: rgb(0, 0, 0);">Aug</option>
                    <option value="09" style="color: rgb(0, 0, 0);">Sep</option>
                    <option value="10" style="color: rgb(0, 0, 0);">Oct</option>
                    <option value="11" style="color: rgb(0, 0, 0);">Nov</option>
                    <option value="12" style="color: rgb(0, 0, 0);">Dec</option>
                  </select>
                  <div class="errorcontainer"> <span id="month-error" class="output-message">Select month</span> </div>
                </fieldset>
              </div>
              <div class="ng_required">
                <label for="year" id="yearlabel">Exp. Year</label>
                <select id="year" name="credit_card_exp_year" aria-required="true" class="req ui search selection dropdown optionplace1" autocomplete="cc-exp-year" style="color: rgb(204, 204, 204);">
                  <option value="" selected="" style="color: rgb(51, 51, 51);"></option>
                  <option value="22" style="color: rgb(0, 0, 0);">2022</option>
                  <option value="23" style="color: rgb(0, 0, 0);">2023</option>
                  <option value="24" style="color: rgb(0, 0, 0);">2024</option>
                  <option value="25" style="color: rgb(0, 0, 0);">2025</option>
                  <option value="26" style="color: rgb(0, 0, 0);">2026</option>
                  <option value="27" style="color: rgb(0, 0, 0);">2027</option>
                  <option value="28" style="color: rgb(0, 0, 0);">2028</option>
                  <option value="29" style="color: rgb(0, 0, 0);">2029</option>
                  <option value="30" style="color: rgb(0, 0, 0);">2030</option>
                  <option value="31" style="color: rgb(0, 0, 0);">2031</option>
                  <option value="32" style="color: rgb(0, 0, 0);">2032</option>
                </select>
                <div class="errorcontainer"> <span id="year-error" class="output-message">Select year</span> </div>
              </div>
              <div class="ng_required">
                <label for="cvv">CVV <input type="number" id="cvv" class="req" name="credit_card_cvv" pattern="[0-9]*" maxlength="4" min="0" max="9999" oninput="maxLengthCheck(this)" aria-required="true" autocomplete="cc-csc">
                </label>
                <div class="errorcontainer"><span id="cvv-error" class="output-message">Enter valid CVV</span></div>
              </div>
            </div>
          </div>
          <!-- End of Credit Card Info -->
        </div>
        <div class="nextgen-payment-tab" id="nextgen-tab-2">
          <style type="text/css">
            #addressBookWidgetDiv {
              max-width: 620px;
              height: 228px;
              width: 100%;
              display: none;
            }

            #walletWidgetDiv {
              max-width: 620px;
              height: 228px;
              width: 100%;
              display: none;
            }

            #consentWidgetDiv {
              max-width: 620px;
              height: 140px;
              width: 100%;
              display: none;
              margin-bottom: 20px;
            }

            #amazon_processing {
              margin: 20px auto;
              text-align: center;
              display: none;
            }

            #AmzPayRenew {
              margin-top: 25px;
              display: none;
            }

            #amazonpay-container {
              max-width: 620px;
              margin: auto;
              display: block;
              box-sizing: border-box;
            }

            #AmazonPayButton {
              text-align: center;
              margin-top: 10px;
              display: none;
            }

            .amazonpay-button-inner-image {
              max-width: 280px;
              margin-left: auto;
              margin-right: auto;
              max-height: 65px;
              width: 100%;
              cursor: pointer;
            }

            #amazon_submit {
              display: none;
            }

            .amazonautoRenew a {
              color: #000000;
            }

            .amazonautoRenew a:hover {
              color: #000000;
            }

            @media only screen and (min-width: 767px) {
              .amazonappleno {
                display: none;
              }
            }
          </style>
          <script>
            var theOrderObjtest = "";
            var amazonState = "";
            $(document).ready(function() {
              $.getScript('https://code.jquery.com/jquery-3.5.1.min.js');
              $.getScript('https://static-na.payments-amazon.com/OffAmazonPayments/us/js/Widgets.js');
              try {
                var urlParams = new URLSearchParams(window.location.search);
                if (urlParams.get('SOURCE') !== null && urlParams.get('SOURCE') !== '') {
                  document.cookie = "cnsource=" + urlParams.get('SOURCE') + ";domain=" + window.location.hostname + ";path=/";
                } else {
                  deleteCookie('cnsource');
                }
                if (urlParams.get('source') !== null && urlParams.get('source') !== '') {
                  document.cookie = "cnsource=" + urlParams.get('source') + ";domain=" + window.location.hostname + ";path=/";
                } else {
                  deleteCookie('cnsource');
                }
                if (urlParams.get('POS_NAME') !== null && urlParams.get('POS_NAME') !== '') {
                  document.cookie = "cnposname=" + urlParams.get('POS_NAME') + ";domain=" + window.location.hostname + ";path=/";
                } else {
                  deleteCookie('cnposname');
                }
                if (urlParams.get('pos_name') !== null && urlParams.get('pos_name') !== '') {
                  document.cookie = "cnposname=" + urlParams.get('pos_name') + ";domain=" + window.location.hostname + ";path=/";
                } else {
                  deleteCookie('cnposname');
                }
              } catch (err) {}
              var $j = jQuery.noConflict(true);
              var $jOrig = jQuery || $j;
              window.jQuery = window.$ = $j;
              window.onAmazonLoginReady = function() {
                amazon.Login.setClientId('amzn1.application-oa2-client.87be8392a3e547f0861f97a70ef90487');
                amazon.Login.setUseCookie(true);
              };
              window.onAmazonPaymentsReady = function() {
                var urlParams = new URLSearchParams(window.location.search);
                var access_token = urlParams.get('access_token');
                console.log(access_token);
                var billingAgreementId = '';
                console.log(billingAgreementId);
                var redirectUrl = "/subscribe/amazonreturn";
                console.log(redirectUrl);
                if (!access_token && !billingAgreementId) {
                  document.cookie = "origpath=" + window.location.pathname + ";path=/";
                  $j('#AmazonPayButton').show();
                  var authRequest;
                  //	render the button here
                  OffAmazonPayments.Button('AmazonPayButton', 'A3AADXX5DBORYZ', {
                    type: 'PwA',
                    color: 'DarkGray',
                    size: 'x-large',
                    authorization: function() {
                      loginOptions = {
                        scope: "profile payments:widget payments:shipping_address",
                        popup: false
                      };
                      authRequest = amazon.Login.authorize(loginOptions, redirectUrl);
                    },
                    onError: function(error) {
                      // your error handling code
                      alert("The following error occurred in login: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
                    }
                  });
                  try {
                    if (document.getElementById("AmazonPayButton") != null) {
                      document.getElementById("AmazonPayButton").addEventListener("keydown", function(event) {
                        //event.preventDefault();
                        console.log("keypress on amazon version23");
                        console.log(event);
                        if (event.key === 'Enter' || event.keyCode === '32' || event.code === 'Space') {
                          OffAmazonPayments.jQuery("#OffAmazonPaymentsWidgets0").click();
                        }
                      });
                    }
                  } catch (err) {}
                }
                if (access_token || billingAgreementId) {
                  $j('#addressBookWidgetDiv, #walletWidgetDiv, #consentWidgetDiv, #logoutDiv, #AmzPayRenew, #amazon_submit').show();
                  $j('.amazon-hide-content').hide();
                  $j('[name=pt_id]').val(['12']);
                  // logout
                  /*
                  	document.getElementById('Logout').onclick = function() {
                  		console.log('logout');
                  		amazon.Login.logout();
                  	};
                  */
                  //address book widget
                  var ba_promise = new Promise(function(resolve, reject) {
                    var addressWidget = new OffAmazonPayments.Widgets.AddressBook({
                      sellerId: 'A3AADXX5DBORYZ',
                      agreementType: 'BillingAgreement',
                      onReady: function(billingAgreement) {
                        console.log("on ready inside address book widget");
                        billingAgreementId = billingAgreement.getAmazonBillingAgreementId();
                        console.log(billingAgreementId);
                        $j('input[name=billing_agreement_id]').val(billingAgreementId);
                        resolve(billingAgreementId);
                      },
                      onAddressSelect: function(billingAgreement) {
                        // Replace the following code with the action that you want to perform
                        // after the address is selected.
                        // The amazonBillingAgreementId can be used to retrieve
                        // the address details by calling the GetBillingAgreementDetails operation.
                        // If rendering the AddressBook and Wallet widgets on the same page, you
                        // should wait for this event before you render the Wallet widget for
                        // the first time.
                        // The Wallet widget will re-render itself on all subsequent
                        // onAddressSelect events without any action from you. We don't
                        // recommend that you explicitly refresh it.
                        $j.ajax({
                          method: "POST",
                          url: "/subscribe/amazonpayapi",
                          dataType: 'xml',
                          data: {
                            billing_agreement_id: billingAgreementId,
                            address_consent_token: access_token
                          }
                        }).done(function(response) {
                          //console.log(response);
                          var addressObj = $(response).find('PhysicalDestination');
                          //console.log(addressObj);
                          $('input[name=address]').val(addressObj.find('AddressLine1').text());
                          $('input[name=address2]').val(addressObj.find('AddressLine2').text());
                          $('input[name=city]').val(addressObj.find('City').text());
                          amazonState = addressObj.find('StateOrRegion').text();
                          $('input[name=postal_code]').val(addressObj.find('PostalCode').text());
                          $('[name=country_code]').val(addressObj.find('CountryCode').text());
                          $('#ship-country-selector').trigger("change");
                          if ($('#ship-country-selector').val() == "US") {
                            $('#ship-country-selector').attr("data-location", "domestic");
                            $("#nextgen-domestic").addClass("nextgen-country-selected");
                            $("#nextgen-international").removeClass("nextgen-country-selected");
                          } else if ($('#ship-country-selector').val() == "CA") {
                            $('#ship-country-selector').attr("data-location", "canada");
                            $("#nextgen-domestic").removeClass("nextgen-country-selected");
                            $("#nextgen-international").addClass("nextgen-country-selected");
                          } else {
                            $('#ship-country-selector').attr("data-location", "international");
                            $("#nextgen-domestic").removeClass("nextgen-country-selected");
                            $("#nextgen-international").addClass("nextgen-country-selected");
                          }
                          setofferterm();
                          paArautoupdate();
                          paArCopyUpdate();
                          console.log("currentamzcountry-" + $('[name=country_code]').val());
                          $('input[name=email]').val($(response).find('Email').text());
                          var full_name = addressObj.find('Name').text();
                          var first_name = full_name.split(' ').slice(0, -1).join(' ');
                          var last_name = full_name.split(' ').slice(-1).join(' ');
                          $('input[name=first_name]').val(first_name);
                          $('input[name=last_name]').val(last_name);
                        });
                      },
                      design: {
                        designMode: 'responsive'
                      },
                      onError: function(error) {
                        // your error handling code
                        alert("The following error occurred in address: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
                      }
                    }).bind("addressBookWidgetDiv");
                    //wallet widget
                    var walletWidget = new OffAmazonPayments.Widgets.Wallet({
                      sellerId: 'A3AADXX5DBORYZ',
                      // amazonBillingAgreementId obtained from the AddressBook widget
                      amazonBillingAgreementId: billingAgreementId,
                      onPaymentSelect: function(billingAgreement) {
                        // Replace this code with the action that you want to perform
                        // after the payment method is selected.
                      },
                      design: {
                        designMode: 'responsive'
                      },
                      onError: function(error) {
                        // your error handling code
                        alert("The following error occurred in wallet: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
                      }
                    }).bind("walletWidgetDiv");
                  });
                  //consent widget
                  ba_promise.then(function(data) {
                    console.log(data);
                    console.log(billingAgreementId);
                    var consentWidget = new OffAmazonPayments.Widgets.Consent({
                      sellerId: 'A3AADXX5DBORYZ',
                      // amazonBillingAgreementId obtained from the Amazon Address Book widget.
                      amazonBillingAgreementId: billingAgreementId,
                      design: {
                        designMode: 'responsive'
                      },
                      onReady: function(billingAgreementConsentStatus) {
                        // Called after widget renders
                        if (billingAgreementConsentStatus.type == "Consent") {
                          console.log(billingAgreementConsentStatus);
                          console.log(arguments);
                          buyerBillingAgreementConsentStatus = billingAgreementConsentStatus.getConsentStatus();
                          // getConsentStatus returns true or false
                          // true checkbox is selected
                          // false checkbox is unselected - default
                        }
                      },
                      onConsent: function(billingAgreementConsentStatus) {
                        buyerBillingAgreementConsentStatus = billingAgreementConsentStatus.getConsentStatus();
                        // getConsentStatus returns true or false
                        // true checkbox is selected buyer has consented
                        // false checkbox is unselected  buyer has not consented
                        // Replace this code with the action that you want to perform
                        // after the consent checkbox is selected/unselected.
                      },
                      onError: function(error) {
                        // your error handling code
                        console.log("The following error occurred in consent: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
                      }
                    }).bind("consentWidgetDiv");
                  }).catch(function(err) {
                    alert('error:' + err);
                  });
                }
              };
              window.jQuery = window.$ = $jOrig;
              $('#amazon_submit').on("click.amazonsubmit, keypress.amazonsubmit", function(e) {
                localStorage.setItem("chosenoffer", $(".panel.offer.on").attr("data-chosenoffer"));
                console.log("chosenoffer=" + jQuery(".panel.offer.on").attr("data-chosenoffer"));
                $(".nextgen-progress").animate({
                  width: "100%"
                });
                $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
                var paneleventfilter = false;
                console.log(e.handleObj.origType);
                if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
                  paneleventfilter = true;
                }
                if (e.keyCode == '32' || e.keyCode == '13') {
                  $(this).click();
                }
                if (paneleventfilter == true) {
                  $('#amazon_submit').hide();
                  $('#amazon_processing').show();
                  if (buyerBillingAgreementConsentStatus == "false") {
                    alert("Please agree to use your selected payment method to submit your order.");
                    $('html, body').animate({
                      scrollTop: $("#amazonpay-container").offset().top
                    }, 1000);
                    $('#amazon_submit').show();
                    $('#amazon_processing').hide();
                    return false;
                  }
                  var offerTerm = document.getElementsByName('offer_term')[0].value;
                  var offerId = document.getElementsByName('offer_id')[0].value;
                  var amzpayBillId = document.getElementsByName('billing_agreement_id')[0].value;
                  var hostOfferId = document.getElementsByName('host_offer_id')[0].value;
                  var parentTransId = document.getElementsByName('parent_trans_id')[0].value;
                  var transId = document.getElementsByName('trans_id')[0].value;
                  var transKey = document.getElementsByName('trans_key')[0].value;
                  var sourceCode = document.getElementsByName('source_code')[0].value;
                  try {
                    var refSource = document.getElementsByName('referral_source')[0].value;
                    var refSource = getCookieCN("cnsource");
                  } catch (err) {}
                  var nlsourceCode = "";
                  try {
                    var posName = document.getElementsByName('pos_name')[0].value;
                    var posName = getCookieCN("cnposname");
                  } catch (err) {}
                  var firstName = document.getElementsByName('first_name')[0].value;
                  var lastName = document.getElementsByName('last_name')[0].value;
                  var donAdd = document.getElementsByName('address')[0].value;
                  var donAdd2 = document.getElementsByName('address2')[0].value;
                  var donCity = document.getElementsByName('city')[0].value;
                  var donState = amazonState;
                  var donZip = document.getElementsByName('postal_code')[0].value;
                  var donCountry = document.getElementsByName('country_code')[0].value;
                  var donEmail = document.getElementsByName('email')[0].value;
                  var ptId = document.getElementsByName('pt_id')[0].value;
                  var theOrderObj = {
                    "offer_term": offerTerm,
                    "pos_name": posName,
                    "offer_id": offerId,
                    "host_offer_id": hostOfferId,
                    "parent_trans_id": parentTransId,
                    "trans_id": transId,
                    "trans_key": transKey,
                    "source_code": sourceCode,
                    "referral_source": refSource,
                    "newsletter_source_code": nlsourceCode,
                    "first_name": firstName,
                    "last_name": lastName,
                    "address": donAdd,
                    "address2": donAdd2,
                    "city": donCity,
                    "state": donState,
                    "postal_code": donZip,
                    "country_code": donCountry,
                    "email": donEmail,
                    "pt_id": ptId,
                    "billing_agreement_id": amzpayBillId
                  };
                  theOrderObjtest = theOrderObj;
                  if (donCountry !== null) {
                    $.ajax({
                      type: "POST",
                      url: "/api/circ/js/Transaction",
                      data: theOrderObj,
                      dataType: "json",
                      error: function(jqXHR, error, errorThrown) {},
                      success: function(data) {
                        var orderStatObj = data;
                        if (orderStatObj.order_success == '') {
                          var orderFailed =
                            "We're sorry. The address you entered does not appear to be valid. Please review and try again. If the problem persists, consider checking the address at the <a href=\"http://zip4.usps.com/zip4/welcome.jsp\" target=\"_blank\">US Postal Service website.</a> <!-- We're sorry.  We are unable to process your transaction at this time.  Please try again. --> ";
                          var orderFailedError = "";
                          if (typeof orderStatObj.order_failed[0] !== 'undefined' && typeof orderStatObj.order_failed[0].error !== 'undefined') {
                            orderFailedError = orderStatObj.order_failed[0].error;
                            $('#amazon_submit').show();
                            $('#btn_processing').hide();
                          } else {
                            orderFailedError = orderStatObj.order_failed[0];
                            $('#amazon_submit').show();
                            $('#btn_processing').hide();
                          }
                          console.log(orderFailedError);
                          if (orderStatObj.order_failed[0] !== 'undefined' && typeof orderStatObj.order_failed[0].error !== 'undefined') {
                            orderFailed = orderStatObj.order_failed[0].error;
                            $('#amazon_submit').show();
                            $('#btn_processing').hide();
                          } else {
                            alert(orderStatObj.order_failed); // change this to display order failure message
                            orderFailed = orderStatObj.order_failed[0];
                            $('#amazon_submit').show();
                            $('#btn_processing').hide();
                          }
                        } else {
                          window.location = orderStatObj.order_success[0].next_offer_url;
                        }
                      }
                    });
                  } else {
                    alert("Please enter a valid country shipping address");
                    reject("Please enter a valid country shipping address");
                  }
                }
              });
            });
          </script>
          <!-- test update 1 -->
          <div id="amazonpay-container" class="container">
            <input type="hidden" name="billing_agreement_id" value="">
            <div id="addressBookWidgetDiv"></div>
            <div id="walletWidgetDiv"></div>
            <div id="consentWidgetDiv"></div>
            <div id="ng_amazon_review"></div>
            <div id="AmazonPayButton" role="button" tabindex="0" style="display: block;" data-treatment="{&quot;treatment&quot;:&quot;T6&quot;,&quot;abtestName&quot;:&quot;BUTTON_REBRANDING&quot;}"><img class=" amazonpay-button-inner-image"
                style="cursor:pointer; max-height:90px;" alt="AmazonPay" id="OffAmazonPaymentsWidgets0" tabindex="0" src="https://d2ldlvi1yef00y.cloudfront.net/us/live/en_us/amazonpay/darkgray/x-large/button_T6.png"></div>
            <div id="AmzPayRenew">
              <!-- START OF CONTINUOUS SERVICE -->
              <div class="amazonautoRenew">
                <div class="autoRenewText"><a name="autoRenew"></a>
                  <div class="paArWrap">
                    <h2>Automatic Renewal:</h2>
                    <p id="arcompliancecopy"> After your initial <span class="paTermNew">one year </span> term, your subscription will <strong>automatically renew</strong> for one year at <span class="paPriceNew">$29.99</span>. Your subscription will
                      continue until you cancel, and after your first renewal the term and rate may change. Before each renewal, we will send a reminder with the term and rate then in effect. If you do nothing, we will charge the payment method you
                      selected. You can cancel at any time to get a refund for the portion remaining on your subscription by <a href="https://www.wired.com/customerservice" target="_blank">contacting customer service</a> or calling 1-800-769-4733.
                    </p>
                  </div>
                  <br>
                  <p class="arUaLink">By subscribing, you agree to automatic renewal as described above, our <a href="https://www.condenast.com/user-agreement" target="_blank">user agreement</a> (including the
                    <a href="https://www.condenast.com/user-agreement#section-viii-g" target="_blank">class action waiver and arbitration provisions</a>), our
                    <a href="https://www.condenast.com/privacy-policy" target="_blank">privacy policy and cookie statement</a><span class="arlink_us_only" style=""> and to receive marketing and account-related emails from <span
                        style="text-transform: uppercase;">Wired</span>. You can unsubscribe at any time</span>.</p>
                </div>
              </div>
              <!-- END OF CONTINUOUS SERVICE -->
            </div>
            <div id="amazon_submit" class="sectionbox" role="button" tabindex="0">
              <div id="amazon_submit_mob">Subscribe</div>
              <div id="ssl">
                <p><img id="sslimage" src="https://subscribe.wired.com/circulation/wired/images/NextGen-ssl-icon.png" alt="Padlock"> This transaction is secured with SSL encryption</p>
              </div>
            </div>
            <div id="amazon_processing"><img src="/circulation/shared/images/omn_processing.gif" alt="processing"></div>
          </div>
        </div>
        <div class="nextgen-payment-tab" id="nextgen-tab-3">
          <div class="nextgen-pp-gift-payment">
            <p>Please enter your billing information below before continuing your purchase with PayPal.</p>
          </div>
          <div id="nextgen-paypal-billing-address"></div>
          <!--EC Preview-->
          <div class="autoRenew">
            <div class="autoRenewText">
              <div class="paArWrap">
                <div>
                  <h3>Automatic Renewal:</h3>
                </div>
                <p>After your initial <span class="paTermNew">one year </span> term, your subscription will <strong>automatically renew</strong> for one year at <span class="paPriceNew">$29.99</span>. Your subscription will continue until you cancel,
                  and after your first renewal the term and rate may change. Before each renewal, we will send a reminder with the term and rate then in effect. If you do nothing, we will charge the payment method you selected. You can cancel at any
                  time to get a refund for the portion remaining on your subscription by <a href="https://www.wired.com/customerservice" target="_blank">contacting customer service</a> or calling 1-800-769-4733.</p>
              </div>
              <br>
              <p class="arUaLink">By subscribing, you agree to Automatic Renewal as described above, our <a href="https://www.condenast.com/user-agreement" target="_blank">User Agreement</a> (including the
                <a href="https://www.condenast.com/user-agreement#section-viii-g" target="_blank">class action waiver and arbitration provisions</a>) and
                <a href="https://www.condenast.com/privacy-policy" target="_blank">Privacy Policy and Cookie Statement</a><span class="arlink_us_only" style=""> and to receive marketing and account-related emails from Wired. You can unsubscribe at
                  any time</span>.</p>
            </div>
          </div>
          <!-- test update 1 -->
          <script async="" src="//www.paypalobjects.com/api/checkout.js"></script>
          <script>
            function getParameterByName(name, url) {
              if (!url) url = window.location.href;
              url = url.replace(/&amp;/g, "&");
              name = name.replace(/[\[\]]/g, "\\$&");
              var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                results = regex.exec(url);
              if (!results) return null;
              if (!results[2]) return '';
              return decodeURIComponent(results[2].replace(/\+/g, " "));
            }
            jQuery("#ppcheckoutexpbutton").on("click.ppcheck, keypressppcheck, keydown.ppcheck", function(e) {
              var paneleventfilter = false;
              console.log(e.handleObj.origType);
              if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
                paneleventfilter = true;
              }
              if (paneleventfilter == true) {
                var offerTerm = document.getElementsByName('offer_term')[0].value;
                var offerId = document.getElementsByName('offer_id')[0].value;
                var hostOfferId = document.getElementsByName('host_offer_id')[0].value;
                var parentTransId = document.getElementsByName('parent_trans_id')[0].value;
                var transId = document.getElementsByName('trans_id')[0].value;
                var transKey = document.getElementsByName('trans_key')[0].value;
                var sourceCode = document.getElementsByName('source_code')[0].value;
                var refSource = document.getElementsByName('referral_source')[0].value;
                var posName = document.getElementsByName('pos_name')[0].value;
                var ignoredav = "1";
                var firstName = document.getElementsByName('first_name')[0].value;
                var lastName = document.getElementsByName('last_name')[0].value;
                var donAdd = document.getElementsByName('address')[0].value;
                var donAdd2 = document.getElementsByName('address2')[0].value;
                var donCity = document.getElementsByName('city')[0].value;
                var donCountry = document.getElementsByName('country_code')[0].value;
                if (donCountry == "CA") {
                  var donState = document.getElementsByName('state')[1].value;
                } else if (donCountry == "US") {
                  var donState = document.getElementsByName('state')[0].value;
                } else {
                  var donState = document.getElementsByName('state')[2].value;
                }
                var donZip = document.getElementsByName('postal_code')[0].value;
                var donEmail = document.getElementsByName('email')[0].value;
                var ptId = "9";
                var chargeOnShip = "0";
                var chosenOffer = jQuery('#chosenOffer').attr("value");
                //updating paypal functionality
                if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
                  var doneefirstName = document.getElementsByName('ship_first_name')[0].value;
                  var doneelastName = document.getElementsByName('ship_last_name')[0].value;
                  var doneeAdd = document.getElementsByName('ship_address')[0].value;
                  var doneeAdd2 = document.getElementsByName('ship_address2')[0].value;
                  var doneeCity = document.getElementsByName('ship_city')[0].value;
                  var doneeZip = document.getElementsByName('ship_postal_code')[0].value;
                  var doneeCountry = document.getElementsByName('ship_country_code')[0].value;
                  var doneeEmail = document.getElementsByName('ship_email')[0].value;
                  if (doneeCountry == "CA") {
                    var doneeState = document.getElementsByName('ship_state')[1].value;
                  } else {
                    var doneeState = document.getElementsByName('ship_state')[0].value;
                  }
                  var theOrderObj = {
                    "offer_term": offerTerm,
                    "pos_name": posName,
                    "offer_id": offerId,
                    "host_offer_id": hostOfferId,
                    "parent_trans_id": parentTransId,
                    "trans_id": transId,
                    "trans_key": transKey,
                    "source_code": sourceCode,
                    "referral_source": refSource,
                    "ignore_dav": ignoredav,
                    "first_name": firstName,
                    "last_name": lastName,
                    "address": donAdd,
                    "address2": donAdd2,
                    "city": donCity,
                    "state": donState,
                    "postal_code": donZip,
                    "country_code": donCountry,
                    "email": donEmail,
                    "ship_first_name": doneefirstName,
                    "ship_last_name": doneelastName,
                    "ship_address": doneeAdd,
                    "ship_address2": doneeAdd2,
                    "ship_city": doneeCity,
                    "ship_state": doneeState,
                    "ship_postal_code": doneeZip,
                    "ship_country_code": doneeCountry,
                    "ship_email": doneeEmail,
                    "pt_id": ptId,
                    "charge_on_ship": chargeOnShip,
                    "chosen_offer": chosenOffer
                  }
                } else {
                  var theOrderObj = {
                    "offer_term": offerTerm,
                    "pos_name": posName,
                    "offer_id": offerId,
                    "host_offer_id": hostOfferId,
                    "parent_trans_id": parentTransId,
                    "trans_id": transId,
                    "trans_key": transKey,
                    "source_code": sourceCode,
                    "referral_source": refSource,
                    "pos_name": posName,
                    "ignore_dav": ignoredav,
                    "first_name": firstName,
                    "last_name": lastName,
                    "address": donAdd,
                    "address2": donAdd2,
                    "city": donCity,
                    "state": donState,
                    "postal_code": donZip,
                    "country_code": donCountry,
                    "email": donEmail,
                    "pt_id": ptId,
                    "charge_on_ship": chargeOnShip,
                    "chosen_offer": chosenOffer
                  }
                }
                var addressError;
                if (donCountry === 'US') {
                  addressError = "We're sorry. Our system does not recognize the address you entered. Please review and try again. If you continue to receive this message, please contact Customer Service for assistance at 1-800-769-4733.";
                } else {
                  addressError = "We're sorry. Our system does not recognize the address you entered. Please review and try again. If you continue to receive this message, please contact Customer Service for assistance at 1-515-243-3273.";
                }
                paypal.checkout.initXO();
                $.support.cors = true;
                $.ajax({
                  type: "POST",
                  url: "/api/circ/js/Transaction",
                  data: theOrderObj,
                  dataType: "json",
                  error: function(e) {
                    $("#btn_submit").show();
                    $("#btn_processing").hide();
                    alert("Error in ajax post" + e.statusText);
                    paypal.checkout.closeFlow();
                  },
                  success: function(data) {
                    $("#btn_submit").show();
                    $("#btn_processing").hide();
                    var orderStatObj = data;
                    console.log(orderStatObj);
                    if (orderStatObj.order_failed[0].url) {
                      var ppUrl = orderStatObj.order_failed[0].url;
                      var ppToken = getParameterByName('token', ppUrl);
                      paypal.checkout.startFlow(ppToken);
                    } else {
                      var orderFailedError = "";
                      if (typeof orderStatObj.order_failed[0] !== 'undefined' && typeof orderStatObj.order_failed[0].error !== 'undefined') {
                        orderFailedError = orderStatObj.order_failed[0].error;
                      } else {
                        orderFailedError = orderStatObj.order_failed[0];
                      }
                      alert("Your payment was declined. Please update your PayPal payment details or enter your address and credit card information below");
                      if (orderFailedError.substr(0, 66) == 'We are sorry. The address you entered does not appear to be valid.') {
                        alert(addressError);
                      } else {
                        alert(orderFailedError);
                      }
                      paypal.checkout.closeFlow();
                      $('#btn_submit').show();
                      $('#btn_processing').hide();
                    }
                  }
                });
              }
            });
            window.paypalCheckoutReady = function() {
              function getParameterByName(name, url) {
                if (!url) url = window.location.href;
                url = url.replace(/&amp;/g, "&");
                name = name.replace(/[\[\]]/g, "\\$&");
                var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                  results = regex.exec(url);
                if (!results) return null;
                if (!results[2]) return '';
                return decodeURIComponent(results[2].replace(/\+/g, " "));
              }
              paypal.checkout.setup("5BZ399HNM9RUC", {
                environment: 'production',
                click: function(event) {
                  // if (!($('.nextgen-payment-buttons[data-ngtab="3"]').hasClass("nextgen-payment-buttons-selected"))) {
                  // 	$('#btnSubmit').show(); 
                  // 		$('#processing').hide();
                  // 		return false;
                  // 	if ($(".panel.impulse").hasClass("on")) {
                  // 		var addofferTerm = document.getElementsByName('offer_term_donee')[0].value;
                  // 	}					
                  // }
                  var offerTerm = document.getElementsByName('offer_term')[0].value;
                  var offerId = document.getElementsByName('offer_id')[0].value;
                  var hostOfferId = document.getElementsByName('host_offer_id')[0].value;
                  var parentTransId = document.getElementsByName('parent_trans_id')[0].value;
                  var transId = document.getElementsByName('trans_id')[0].value;
                  var transKey = document.getElementsByName('trans_key')[0].value;
                  var sourceCode = document.getElementsByName('source_code')[0].value;
                  // var nlsourceCode = document.getElementsByName('newsletter_source_code')[0].value;
                  var refSource = document.getElementsByName('referral_source')[0].value;
                  var posName = document.getElementsByName('pos_name')[0].value;
                  if (!($('.nextgen-payment-buttons[data-ngtab="3"]').hasClass("nextgen-payment-buttons-selected"))) {
                    var ignoredav = document.getElementsByName('ignore_dav')[0].value;
                  }
                  var firstName = document.getElementsByName('first_name')[0].value;
                  var lastName = document.getElementsByName('last_name')[0].value;
                  var donAdd = document.getElementsByName('address')[0].value;
                  var donAdd2 = document.getElementsByName('address2')[0].value;
                  var donCity = document.getElementsByName('city')[0].value;
                  var donCountry = document.getElementsByName('country_code')[0].value;
                  if (donCountry == "CA") {
                    var donState = document.getElementsByName('state')[1].value;
                  } else if (donCountry == "US") {
                    var donState = document.getElementsByName('state')[0].value;
                  } else {
                    var donState = document.getElementsByName('state')[2].value;
                  }
                  var donZip = document.getElementsByName('postal_code')[0].value;
                  var donEmail = document.getElementsByName('email')[0].value;
                  var ptId = document.getElementsByName('pt_id')[0].value;
                  // var chargeOnShip = document.getElementsByName('charge_on_ship')[0].value;
                  var chosenOffer = jQuery('#chosenOffer').attr("value");
                  if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
                    var doneefirstName = document.getElementsByName('ship_first_name')[0].value;
                    var doneelastName = document.getElementsByName('ship_last_name')[0].value;
                    var doneeAdd = document.getElementsByName('ship_address')[0].value;
                    var doneeAdd2 = document.getElementsByName('ship_address2')[0].value;
                    var doneeCity = document.getElementsByName('ship_city')[0].value;
                    var doneeZip = document.getElementsByName('ship_postal_code')[0].value;
                    var doneeCountry = document.getElementsByName('ship_country_code')[0].value;
                    var doneeEmail = document.getElementsByName('ship_email')[0].value;
                    if (doneeCountry == "CA") {
                      var doneeState = document.getElementsByName('ship_state')[1].value;
                    } else {
                      var doneeState = document.getElementsByName('ship_state')[0].value;
                    }
                    var theOrderObj = {
                      "offer_term": offerTerm,
                      "pos_name": posName,
                      "offer_id": offerId,
                      "host_offer_id": hostOfferId,
                      "parent_trans_id": parentTransId,
                      "trans_id": transId,
                      "trans_key": transKey,
                      "source_code": sourceCode,
                      "referral_source": refSource,
                      "pos_name": posName,
                      "first_name": firstName,
                      "last_name": lastName,
                      "address": donAdd,
                      "address2": donAdd2,
                      "city": donCity,
                      "state": donState,
                      "postal_code": donZip,
                      "country_code": donCountry,
                      "email": donEmail,
                      "ship_first_name": doneefirstName,
                      "ship_last_name": doneelastName,
                      "ship_address": doneeAdd,
                      "ship_address2": doneeAdd2,
                      "ship_city": doneeCity,
                      "ship_state": doneeState,
                      "ship_postal_code": doneeZip,
                      "ship_country_code": doneeCountry,
                      "ship_email": doneeEmail,
                      "pt_id": ptId,
                      "chosen_offer": chosenOffer
                    }
                  } else {
                    var theOrderObj = {
                      "offer_term": offerTerm,
                      "pos_name": posName,
                      "offer_id": offerId,
                      "host_offer_id": hostOfferId,
                      "parent_trans_id": parentTransId,
                      "trans_id": transId,
                      "trans_key": transKey,
                      "source_code": sourceCode,
                      "referral_source": refSource,
                      "pos_name": posName,
                      "first_name": firstName,
                      "last_name": lastName,
                      "address": donAdd,
                      "address2": donAdd2,
                      "city": donCity,
                      "state": donState,
                      "postal_code": donZip,
                      "country_code": donCountry,
                      "email": donEmail,
                      "pt_id": ptId,
                      "chosen_offer": chosenOffer
                    };
                  }
                  if ($('.nextgen-payment-buttons[data-ngtab="3"]').hasClass("nextgen-payment-buttons-selected")) {
                    // theOrderObj["add_offer_term"] = document.getElementsByName('offer_term_donee')[0].value;
                  }
                  $("[name^='email_pref']:checked").each(function() {
                    var name = jQuery(this).attr("name");
                    theOrderObj[name] = 'Y';
                  });
                  if (!($('.nextgen-payment-buttons[data-ngtab="3"]').hasClass("nextgen-payment-buttons-selected"))) {
                    theOrderObj["ignore_dav"] = ignoredav;
                  };
                  paypal.checkout.initXO();
                  $.support.cors = true;
                  $.ajax({
                    type: "POST",
                    url: "/api/circ/js/Transaction",
                    data: theOrderObj,
                    dataType: "json",
                    error: function(e) {
                      $("#btnSubmit").show();
                      $("#processing").hide();
                      alert("Error in ajax post" + e.statusText);
                      paypal.checkout.closeFlow();
                    },
                    success: function(data) {
                      $("#btnSubmit").show();
                      $("#processing").hide();
                      var orderStatObj = data;
                      console.log(orderStatObj);
                      if (orderStatObj.order_failed[0].url) {
                        var ppUrl = orderStatObj.order_failed[0].url;
                        var ppToken = getParameterByName('token', ppUrl);
                        paypal.checkout.startFlow(ppToken);
                      } else {
                        alert("Your payment was declined. Please update your PayPal payment details or enter your address and credit card information below");
                        if (typeof orderStatObj.order_failed[0] !== 'undefined' && typeof orderStatObj.order_failed[0].error !== 'undefined') {
                          alert(orderStatObj.order_failed[0].error);
                        } else {
                          alert(orderStatObj.order_failed[0]);
                        }
                        paypal.checkout.closeFlow();
                        $("#btnSubmit").show();
                        $("#processing").hide();
                      }
                    }
                  });
                },
                condition: function() {
                  return !!(document.getElementsByName('pt_id')[0].value == '9');
                },
                button: "ppSubmit"
              });
            }
          </script>
          <div id="ppcheckoutexpbutton" role="button" tabindex="0" class="haspaypalon"><span id="paypaldecription">Check out with</span><img src="/circulation/architecturaldigest/images/paypal-checkout_ADA_Style.png" alt="paypal"
              aria-describedby="paypaldecription"></div>
        </div>
      </div>
      <script>
        jQuery(document).ready(function() {
          if (amazonflag == false) {
            $("#amazonpay-container").remove();
          }
          if (paypalflag == false) {
            $("#ppcheckoutexpbutton").remove();
          }
          if (paypalflag == false && applepayflag == false) {
            $(".autoRenew").hide();
          }
        });
      </script>
      <div class="space15 ng-amazon-hide"></div>
      <div class="nextgen-greyborder nextgen-epc-hide"></div>
      <div id="nextgen-step-4">
        <div class="sectionheadfont">
          <h2>STEP 4. <span>SHIPPING ADDRESS</span></h2>
        </div>
      </div>
      <!-- Gift Impulse Start-->
      <!-- FMC Donation Impulse beginning unless -->
      <!-- FMC Donation Impulse End unless -->
      <!-- Gift Impulse End-->
      <div id="yourinformation" class="sectionbox">
        <div id="yourinformationtext">
          <h2>Enter Your Information</h2>
        </div>
        <div class="flex">
          <div class="ng_required">
            <label for="bill-first-name">First Name<input type="text" class="req" id="bill-first-name" name="first_name" aria-required="true" autocomplete="given-name"></label>
            <div class="errorcontainer"><span id="bill-first-name-error" class="output-message">Please enter first name</span></div>
          </div>
          <div class="ng_required ng-flex-last">
            <label for="bill-last-name">Last Name<input type="text" class="req" id="bill-last-name" name="last_name" aria-required="true" autocomplete="family-name"></label>
            <div class="errorcontainer"><span id="bill-last-name-error" class="output-message">Please enter last name</span></div>
          </div>
        </div>
        <div id="nextgen-self-shipping">
          <div id="shippingaddress" class="sectionbox">
            <div id="ng-addressbox" class="addressbox">
              <div id="shipcountrycontainer" style="display: none;">
                <label for="ship-country">Location<input type="text" id="ship-country" class="req" readonly="" value="United States" autocomplete="off"></label>
                <div class="ng-change-ship-country">Change</div>
              </div>
              <div class="ng_required">
                <label for="ship-address">Street Address<input type="text" class="req" id="ship-address" name="address" data-shipname="ship_address" data-billname="address" aria-required="true" autocomplete="address-line1"></label>
                <div class="errorcontainer"><span id="ship-address-error" class="output-message">Please enter a valid address</span></div>
              </div>
              <div>
                <label for="ship-address2">Apt, Floor, Unit, etc. (optional) <input type="text" id="ship-address2" name="address2" data-shipname="ship_address2" data-billname="address2" aria-required="true" autocomplete="address-line2"></label>
              </div>
              <div class="flex flex-nowrap">
                <div class="ng_required">
                  <label for="ship-city">City<input type="text" class="req" id="ship-city" name="city" data-shipname="ship_city" data-billname="city" aria-required="true" autocomplete="address-level2"></label>
                  <div class="errorcontainer"> <span id="ship-city-error" class="output-message">Please enter city</span></div>
                </div>
                <div class="ng_required">
                  <div style="">
                    <label for="ship-state-domestic" id="ship-state-domestic-label" style=""><span class="shipstatelabel">State</span></label>
                    <select type="text" class="req ui search selection dropdown" id="ship-state-domestic" name="state" data-shipname="ship_state" data-billname="state" autocomplete="address-level1" style="">
                      <option value="">
                      </option>
                      <option value="AL">AL</option>
                      <option value="AK">AK</option>
                      <option value="AZ">AZ</option>
                      <option value="AR">AR</option>
                      <option value="CA">CA</option>
                      <option value="CO">CO</option>
                      <option value="CT">CT</option>
                      <option value="DE">DE</option>
                      <option value="DC">DC</option>
                      <option value="FL">FL</option>
                      <option value="GA">GA</option>
                      <option value="HI">HI</option>
                      <option value="ID">ID</option>
                      <option value="IL">IL</option>
                      <option value="IN">IN</option>
                      <option value="IA">IA</option>
                      <option value="KS">KS</option>
                      <option value="KY">KY</option>
                      <option value="LA">LA</option>
                      <option value="ME">ME</option>
                      <option value="MD">MD</option>
                      <option value="MA">MA</option>
                      <option value="MI">MI</option>
                      <option value="MN">MN</option>
                      <option value="MS">MS</option>
                      <option value="MO">MO</option>
                      <option value="MT">MT</option>
                      <option value="NE">NE</option>
                      <option value="NV">NV</option>
                      <option value="NH">NH</option>
                      <option value="NJ">NJ</option>
                      <option value="NM">NM</option>
                      <option value="NY">NY</option>
                      <option value="NC">NC</option>
                      <option value="ND">ND</option>
                      <option value="OH">OH</option>
                      <option value="OK">OK</option>
                      <option value="OR">OR</option>
                      <option value="PA">PA</option>
                      <option value="RI">RI</option>
                      <option value="SC">SC</option>
                      <option value="SD">SD</option>
                      <option value="TN">TN</option>
                      <option value="TX">TX</option>
                      <option value="UT">UT</option>
                      <option value="VT">VT</option>
                      <option value="VA">VA</option>
                      <option value="WA">WA</option>
                      <option value="WV">WV</option>
                      <option value="WI">WI</option>
                      <option value="WY">WY</option>
                      <option value="AA">AA</option>
                      <option value="AE">AE</option>
                      <option value="AP">AP</option>
                      <option value="PR">PR</option>
                    </select>
                  </div>
                  <div style="display: none;">
                    <label for="ship-state-canada" id="ship-state-canada-label" style="display:none;"><span class="shipstatelabel">State</span></label>
                    <select type="text" class="req ui search selection dropdown" id="ship-state-canada" name="state" disabled="" data-shipname="ship_state" data-billname="state" style="display:none !important;" autocomplete="address-level1">
                      <option value=""></option>
                      <option value="AB">AB</option>
                      <option value="BC">BC</option>
                      <option value="MB">MB</option>
                      <option value="NB">NB</option>
                      <option value="NL">NL</option>
                      <option value="NS">NS</option>
                      <option value="ON">ON</option>
                      <option value="PE">PE</option>
                      <option value="QC">QC</option>
                      <option value="SK">SK</option>
                      <option value="NT">NT</option>
                      <option value="NU">NU</option>
                      <option value="YT">YT</option>
                    </select>
                  </div>
                  <div>
                    <label for="ship-state-international" id="ship-state-international-label" style="display:none;"> <span class="shipstatelabel">State</span></label>
                    <input type="text" id="ship-state-international" class="countryform" name="state" disabled="" data-shipname="ship_state" data-billname="state" style="display:none;" autocomplete="address-level1">
                  </div>
                  <div class="errorcontainer"> <span id="ship-state-error" class="output-message">Please select state</span></div>
                </div>
                <div class="ng_required">
                  <label for="ship-postal-code" id="ship-zip-domestic">Zip</label>
                  <label for="ship-postal-code" id="ship-zip-canada" style="display:none;">Postal Code</label>
                  <label for="ship-postal-code" id="ship-zip-international" style="display:none;">Postal Code</label>
                  <input type="text" class="req" id="ship-postal-code" name="postal_code" data-shipname="ship_postal_code" data-billname="postal_code" value="" autocomplete="postal-code" maxlength="5">
                  <div class="errorcontainer"> <span id="ship-postal-code-error" class="output-message">Please enter code</span></div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="ng_required">
          <label for="bill-email"><span id="nextgen-bill-email">Email</span><input type="text" class="req" id="bill-email" name="email" aria-required="true" autocomplete="email"> </label>
          <div class="errorcontainer"><span id="bill-email-error" class="output-message">Email cannot be empty</span> <span id="bill-email-invaliderror" class="output-message">Please enter a valid email</span> </div>
          <div id="privacytext">Will be used in accordance with our <a href="https://www.condenast.com/user-agreement" target="_blank">User Agreement</a> and <a href="https://www.condenast.com/privacy-policy" target="_blank">Privacy Policy</a>.</div>
        </div>
        <fieldset id="billingaddress" disabled="" style="display: none;">
          <div class="addressbox">
            <div class="ship-country-dropdown ng_required">
              <label for="bill-country">Location</label>
              <select id="bill-country" class="ui search selection dropdown" name="country_code" autocomplete="country-name">
                <option>Select Location</option>
                <option value="AF">Afghanistan</option>
                <option value="AL">Albania</option>
                <option value="DZ">Algeria</option>
                <option value="AD">Andorra</option>
                <option value="AO">Angola</option>
                <option value="AI">Anguilla</option>
                <option value="AQ">Antarctica</option>
                <option value="AG">Antigua and Barbuda</option>
                <option value="AR">Argentina</option>
                <option value="AM">Armenia</option>
                <option value="AW">Aruba</option>
                <option value="AU">Australia</option>
                <option value="AT">Austria</option>
                <option value="AZ">Azerbaijan</option>
                <option value="BS">Bahamas</option>
                <option value="BH">Bahrain</option>
                <option value="BD">Bangladesh</option>
                <option value="BB">Barbados</option>
                <option value="BE">Belgium</option>
                <option value="BZ">Belize</option>
                <option value="BJ">Benin</option>
                <option value="BM">Bermuda</option>
                <option value="BT">Bhutan</option>
                <option value="BO">Bolivia</option>
                <option value="BA">Bosnia-Herzegovina</option>
                <option value="BW">Botswana</option>
                <option value="BR">Brazil</option>
                <option value="VG">British Virgin Islands</option>
                <option value="BN">Brunei Darussalam</option>
                <option value="BG">Bulgaria</option>
                <option value="BF">Burkina Faso</option>
                <option value="BI">Burundi</option>
                <option value="KH">Cambodia</option>
                <option value="CM">Cameroon</option>
                <option value="CA">Canada</option>
                <option value="C3">Canary Islands</option>
                <option value="CV">Cape Verde</option>
                <option value="KY">Cayman Islands</option>
                <option value="CF">Central African Rep</option>
                <option value="TD">Chad</option>
                <option value="CL">Chile</option>
                <option value="CN">China Peoples Republic</option>
                <option value="CO">Colombia</option>
                <option value="KM">Comoros</option>
                <option value="CG">Congo</option>
                <option value="CD">Congo, The Democratic Republic of the</option>
                <option value="CK">Cook Islands</option>
                <option value="CR">Costa Rica</option>
                <option value="CI">Cote d’Ivoire</option>
                <option value="HR">Croatia</option>
                <option value="CY">Cyprus</option>
                <option value="CZ">Czech Republic</option>
                <option value="DK">Denmark</option>
                <option value="DJ">Djibouti</option>
                <option value="DM">Dominica</option>
                <option value="DO">Dominican Republic</option>
                <option value="EA">Easter Island</option>
                <option value="EC">Ecuador</option>
                <option value="EG">Egypt</option>
                <option value="SV">El Salvador</option>
                <option value="GQ">Equatorial Guinea</option>
                <option value="ER">Eritrea</option>
                <option value="EE">Estonia</option>
                <option value="ET">Ethiopia</option>
                <option value="FO">Faeroe Islands</option>
                <option value="FK">Falkland Islands</option>
                <option value="FJ">Fiji</option>
                <option value="FI">Finland</option>
                <option value="FR">France</option>
                <option value="PF">French Polynesia</option>
                <option value="GA">Gabon</option>
                <option value="GM">Gambia</option>
                <option value="GE">Georgia</option>
                <option value="DE">Germany</option>
                <option value="GI">Gibraltar</option>
                <option value="GR">Greece</option>
                <option value="GL">Greenland</option>
                <option value="GD">Grenada</option>
                <option value="GT">Guatemala</option>
                <option value="GN">Guinea</option>
                <option value="GW">Guinea-Bissau</option>
                <option value="GY">Guyana</option>
                <option value="HT">Haiti</option>
                <option value="HN">Honduras</option>
                <option value="HK">Hong Kong</option>
                <option value="HU">Hungary</option>
                <option value="IS">Iceland</option>
                <option value="IN">India</option>
                <option value="IE">Ireland</option>
                <option value="IM">Isle of Man</option>
                <option value="IL">Israel</option>
                <option value="IT">Italy</option>
                <option value="JM">Jamaica</option>
                <option value="JP">Japan</option>
                <option value="JO">Jordan</option>
                <option value="KZ">Kazakhstan</option>
                <option value="KE">Kenya</option>
                <option value="KI">Kiribati</option>
                <option value="KW">Kuwait</option>
                <option value="KG">Kyrgyzstan</option>
                <option value="LA">Laos</option>
                <option value="LV">Latvia</option>
                <option value="LB">Lebanon</option>
                <option value="LS">Lesotho</option>
                <option value="LR">Liberia</option>
                <option value="LI">Liechtenstein</option>
                <option value="LT">Lithuania</option>
                <option value="LU">Luxembourg</option>
                <option value="MO">Macao</option>
                <option value="MK">Macedonia</option>
                <option value="MG">Madagascar</option>
                <option value="MW">Malawi</option>
                <option value="MY">Malaysia</option>
                <option value="MV">Maldives</option>
                <option value="ML">Mali</option>
                <option value="MT">Malta</option>
                <option value="MH">Marshall Islands</option>
                <option value="MR">Mauritania</option>
                <option value="MU">Mauritius</option>
                <option value="MX">Mexico</option>
                <option value="FM">Micronesia</option>
                <option value="MD">Moldova, Republic of</option>
                <option value="MC">Monaco</option>
                <option value="MN">Mongolia</option>
                <option value="MS">Monserrat</option>
                <option value="ME">Montenegro</option>
                <option value="MA">Morocco</option>
                <option value="MZ">Mozambique</option>
                <option value="MM">Myanmar</option>
                <option value="NA">Namibia</option>
                <option value="NR">Nauru</option>
                <option value="NP">Nepal</option>
                <option value="NL">Netherlands</option>
                <option value="AN">Netherlands Antilles</option>
                <option value="NC">New Caledonia</option>
                <option value="NZ">New Zealand</option>
                <option value="NI">Nicaragua</option>
                <option value="NE">Niger</option>
                <option value="NF">Norfolk Island</option>
                <option value="NO">Norway</option>
                <option value="OM">Oman</option>
                <option value="PK">Pakistan</option>
                <option value="PA">Panama</option>
                <option value="PG">Papua New Guinea</option>
                <option value="PY">Paraguay</option>
                <option value="PE">Peru</option>
                <option value="PH">Philippines</option>
                <option value="PN">Pitcairn Islands</option>
                <option value="PL">Poland</option>
                <option value="PT">Portugal</option>
                <option value="QA">Qatar</option>
                <option value="KR">Repl of Korea</option>
                <option value="RE">Reunion</option>
                <option value="RO">Romania</option>
                <option value="RW">Rwanda</option>
                <option value="SM">San Marino</option>
                <option value="ST">Sao Tome and Principe</option>
                <option value="SA">Saudi Arabia</option>
                <option value="SN">Senegal</option>
                <option value="RS">Serbia</option>
                <option value="SC">Seychelles</option>
                <option value="SL">Sierra Leone</option>
                <option value="SG">Singapore</option>
                <option value="SK">Slovak Republic</option>
                <option value="SI">Slovenia</option>
                <option value="SB">Solomon Islands</option>
                <option value="SO">Somalia</option>
                <option value="ZA">South Africa</option>
                <option value="ES">Spain</option>
                <option value="LK">Sri Lanka</option>
                <option value="SH">St Helena</option>
                <option value="KN">St Kitts-Nevis</option>
                <option value="LC">St Lucia</option>
                <option value="PM">St Pierre &amp; Miquelon</option>
                <option value="VC">St Vincent &amp; Grenadines</option>
                <option value="SR">Suriname</option>
                <option value="SZ">Swaziland</option>
                <option value="SE">Sweden</option>
                <option value="CH">Switzerland</option>
                <option value="TW">Taiwan</option>
                <option value="TJ">Tajikistan</option>
                <option value="TZ">Tanzania</option>
                <option value="TH">Thailand</option>
                <option value="TG">Togo</option>
                <option value="TO">Tonga</option>
                <option value="TT">Trinidad and Tobago</option>
                <option value="TN">Tunisia</option>
                <option value="TR">Turkey</option>
                <option value="TM">Turkmenistan</option>
                <option value="TC">Turks-Caicos Islands</option>
                <option value="TV">Tuvalu</option>
                <option value="UG">Uganda</option>
                <option value="AE">United Arab Emirates</option>
                <option value="GB">United Kingdom</option>
                <option value="US" selected="">United States</option>
                <option value="UY">Uruguay</option>
                <option value="UZ">Uzbekistan</option>
                <option value="VU">Vanuatu</option>
                <option value="VA">Vatican City</option>
                <option value="VE">Venezuela</option>
                <option value="VI">Virgin Islands</option>
                <option value="WF">Wallis Futuna Islands</option>
                <option value="EH">Western Sahara</option>
                <option value="WS">Western Samoa</option>
                <option value="YE">Yemen</option>
                <option value="ZM">Zambia</option>
                <option value="ZW">Zimbabwe</option>
              </select>
              <div class="errorcontainer"><span id="bill-country-error" class="output-message">Please select a location</span></div>
            </div>
            <div class="ng_required">
              <label for="bill-address">Street Address<input type="text" class="req" id="bill-address" name="address" aria-required="true" autocomplete="address-line1"></label>
              <div class="errorcontainer"> <span id="bill-address-error" class="output-message">Please enter a valid address</span> </div>
            </div>
            <div>
              <label for="bill-address2">Apt, Floor, Unit, etc. (optional)<input type="text" id="bill-address2" name="address2" autocomplete="address-line2"></label>
            </div>
            <div class="flex nextgen-yourinfo-flex">
              <div class="ng_required">
                <label for="bill-city">City<input type="text" class="req" id="bill-city" name="city" aria-required="true" autocomplete="address-level2"></label>
                <div class="errorcontainer"><span id="bill-city-error" class="output-message">Please enter city</span></div>
              </div>
              <div class="ng_required">
                <div>
                  <label for="bill-state-domestic" id="bill-state-domestic-label" style=""><span class="billstatelabel">State</span> </label>
                  <select type="text" class="req ui search selection dropdown" id="bill-state-domestic" name="state" data-billname="bill_state" aria-required="true" autocomplete="address-level1" style="">
                    <option value="">
                    </option>
                    <option value="AL">AL</option>
                    <option value="AK">AK</option>
                    <option value="AZ">AZ</option>
                    <option value="AR">AR</option>
                    <option value="CA">CA</option>
                    <option value="CO">CO</option>
                    <option value="CT">CT</option>
                    <option value="DE">DE</option>
                    <option value="DC">DC</option>
                    <option value="FL">FL</option>
                    <option value="GA">GA</option>
                    <option value="HI">HI</option>
                    <option value="ID">ID</option>
                    <option value="IL">IL</option>
                    <option value="IN">IN</option>
                    <option value="IA">IA</option>
                    <option value="KS">KS</option>
                    <option value="KY">KY</option>
                    <option value="LA">LA</option>
                    <option value="ME">ME</option>
                    <option value="MD">MD</option>
                    <option value="MA">MA</option>
                    <option value="MI">MI</option>
                    <option value="MN">MN</option>
                    <option value="MS">MS</option>
                    <option value="MO">MO</option>
                    <option value="MT">MT</option>
                    <option value="NE">NE</option>
                    <option value="NV">NV</option>
                    <option value="NH">NH</option>
                    <option value="NJ">NJ</option>
                    <option value="NM">NM</option>
                    <option value="NY">NY</option>
                    <option value="NC">NC</option>
                    <option value="ND">ND</option>
                    <option value="OH">OH</option>
                    <option value="OK">OK</option>
                    <option value="OR">OR</option>
                    <option value="PA">PA</option>
                    <option value="RI">RI</option>
                    <option value="SC">SC</option>
                    <option value="SD">SD</option>
                    <option value="TN">TN</option>
                    <option value="TX">TX</option>
                    <option value="UT">UT</option>
                    <option value="VT">VT</option>
                    <option value="VA">VA</option>
                    <option value="WA">WA</option>
                    <option value="WV">WV</option>
                    <option value="WI">WI</option>
                    <option value="WY">WY</option>
                    <option value="AA">AA</option>
                    <option value="AE">AE</option>
                    <option value="AP">AP</option>
                    <option value="PR">PR</option>
                  </select>
                </div>
                <div>
                  <label for="bill-state-canada" id="bill-state-canada-label" style="display: none;"> <span class="billstatelabel">State</span> </label>
                  <select type="text" class="req ui search selection dropdown" id="bill-state-canada" name="state" disabled="" style="display:none !important;" autocomplete="address-level1">
                    <option value=""></option>
                    <option value="AB">AB</option>
                    <option value="BC">BC</option>
                    <option value="MB">MB</option>
                    <option value="NB">NB</option>
                    <option value="NL">NL</option>
                    <option value="NS">NS</option>
                    <option value="ON">ON</option>
                    <option value="PE">PE</option>
                    <option value="QC">QC</option>
                    <option value="SK">SK</option>
                    <option value="NT">NT</option>
                    <option value="NU">NU</option>
                    <option value="YT">YT</option>
                  </select>
                </div>
                <div>
                  <label for="bill-state-international" id="bill-state-international-label" style="display:none;"> <span class="billstatelabel">State</span> </label>
                  <input type="text" id="bill-state-international" class="countryform req" name="state" disabled="" style="display:none;" autocomplete="address-level1">
                </div>
                <div class="errorcontainer"><span id="bill-state-error" class="output-message" style="display: none;">Please select state</span></div>
              </div>
              <div class="ng_required">
                <label for="bill-postal-code" id="bill-zip-domestic">Zip</label>
                <label for="bill-postal-code" id="bill-zip-canada" style="display:none;">Postal Code</label>
                <label for="bill-postal-code" id="bill-zip-international" style="display:none;">Postal Code</label>
                <input type="text" class="req" id="bill-postal-code" name="postal_code" autocomplete="postal-code" maxlength="5">
                <div class="errorcontainer"><span id="bill-postal-code-error" class="output-message" style="display: none;">Please enter zip</span></div>
              </div>
            </div>
          </div>
        </fieldset>
      </div>
      <div class="nextgen-greyborder nextgen-epc-hide2 ng-mobile-hide"></div>
      <div id="ordersummary" class="sectionbox">
        <div id="ordersumtext" class="sectionheadfont">
          <h2>STEP 5. Review and Submit</h2>
          <div class="nextgen-cancel-text-1">
            <p id="ngArCopy">After one year, renews automatically at one year for $29.99.</p>
            <p>You may cancel at any time.</p>
          </div>
        </div>
        <div class="flex-container">
          <div class="column" id="itemsummarydesc">1 Year – Print + Digital Access</div>
          <div class="column" id="itemprice">$5.00</div>
        </div>
        <div id="impulsesummary" class="flex-container impulseOff">
          <div class="column" id="impulseummarydesc"></div>
          <div class="column" id="impulseprice"></div>
        </div>
        <div class="flex-container">
          <div id="shiphandtext" class="column">
            <p>Shipping &amp; Handling</p>
          </div>
          <div class="column" id="shipcost">Free</div>
        </div>
        <div id="estimatetotalborder"></div>
        <div class="flex-container">
          <div id="estimatetotalcol" class="column">
            <p><strong>Total Billed</strong></p>
          </div>
          <div id="totalalign" class="column">
            <div id="total">$5.00</div>
            <div id="mousetax">+sales tax where applicable</div>
          </div>
        </div>
      </div>
      <div class="space10 ng-amazon-hide ng-mobile-hide"></div>
      <div id="autorenewal" class="sectionbox gift-off" style="">
        <!--AR-VT-1.1 outside-->
        <!--AR-VT-1.2-inside-->
        <!--NextGen Order Forms-->
        <style>
          #renewallaw {
            font-size: 12px;
            line-height: 1.58;
            text-align: left;
            color: #666;
            font-weight: 500;
            margin-bottom: 25px;
          }

          #aragreement {
            -webkit-appearance: checkbox;
            -moz-appearance: checkbox;
            appearance: checkbox;
            width: 15px;
            height: 15px;
            padding: 0px;
            margin-top: 0px;
            margin-right: 5px;
            margin-bottom: 0px;
            margin-left: 0px;
          }
        </style>
        <div id="renewallaw" style="display:none;">
          <input id="aragreement" name="ar-agreement" type="checkbox" aria-required="true" value="" disabled="">
          <span>Please confirm that you agree with our Subscriber Auto Renewal Feature below.</span>
          <div class="errorcontainer" style="display:none;"> <span id="aragreement-error" class="output-message">Please confirm the Subscriber Auto Renewal Feature below.</span> </div>
        </div>
        <script>
          jQuery(document).ready(function($) {
            jQuery("#aragreement").prop('disabled', true);
            jQuery("[name='state']").change(function() {
              if (jQuery("#aragreement").is(':checked')) {
                $("#aragreement").trigger("click");
              }
              if (jQuery(this).val() == 'VT') {
                jQuery("#renewallaw").addClass("autoRenew");
                jQuery("#aragreement").addClass("req");
                jQuery("#renewallaw").show();
                jQuery("#aragreement").prop('disabled', false);
                jQuery("#aragreement").on("click.validaterenew, keypress.validaterenew", function(e) {
                  if (jQuery("#aragreement").is(':checked')) {
                    jQuery(".errorcontainer").hide(); // checked
                    jQuery("#aragreement").removeClass("errorinput errorInput");
                    jQuery("#aragreement-error").removeClass("error");
                    jQuery("#aragreement-error").hide();
                    jQuery("#aragreement").removeClass("req");
                  } else {
                    jQuery(".errorcontainer").show(); // unchecked
                    jQuery("#aragreement-error").addClass("error");
                    jQuery("#aragreement-error").show();
                    jQuery("#aragreement").addClass("req");
                    jQuery("#aragreement").addClass("errorinput errorInput");
                  }
                });
              } else {
                jQuery("#renewallaw").hide();
                jQuery("#aragreement").removeClass("req");
                jQuery("#aragreement").prop('disabled', true);
                jQuery("#aragreement").removeClass("errorinput errorInput");
                jQuery("#aragreement-error").removeClass("error");
                // jQuery("#aragreement-error").hide();
              }
            });
            jQuery("#placeorder.button").on("click.validatestate, keypress.validatestate", function(e) {
              if (jQuery("[name='state']").val() == 'VT') {
                jQuery("#renewallaw").addClass("autoRenew");
                jQuery("#aragreement").addClass("req");
                jQuery("#renewallaw").show();
                jQuery("#aragreement").prop('disabled', false);
                if (jQuery("#aragreement").is(':checked')) {
                  jQuery(".errorcontainer").hide(); // checked
                  jQuery("#aragreement").removeClass("errorinput errorInput");
                  jQuery("#aragreement-error").removeClass("error");
                  jQuery("#aragreement-error").hide();
                  jQuery("#aragreement").removeClass("req");
                } else {
                  jQuery(".errorcontainer").show(); // unchecked
                  jQuery("#aragreement-error").addClass("error");
                  jQuery("#aragreement-error").show();
                  jQuery("#aragreement").addClass("req");
                  jQuery("#aragreement").addClass("errorinput errorInput");
                }
              }
            });
          });
        </script>
        <div class="paArWrap">
          <div id="autoheader"> Automatic Renewal: </div>
          <div id="autotext">
            <p id="arcompliancecopy"> After your initial <span class="paTermNew">one year </span> term, your subscription will <strong>automatically renew</strong> for one year at <span class="paPriceNew">$29.99</span>. Your subscription will
              continue until you cancel, and after your first renewal the term and rate may change. Before each renewal, we will send a reminder with the term and rate then in effect. If you do nothing, we will charge the payment method you selected.
              You can cancel at any time to get a refund for the portion remaining on your subscription by <a href="https://www.wired.com/customerservice" target="_blank">contacting customer service</a> or calling 1-800-769-4733.</p>
          </div>
        </div>
        <br>
        <p class="arUaLink">By subscribing, you agree to automatic renewal as described above, our <a href="https://www.condenast.com/user-agreement" target="_blank">user agreement</a> (including the
          <a href="https://www.condenast.com/user-agreement#section-viii-g" target="_blank">class action waiver and arbitration provisions</a>)<span class="arlink_us_only" style="">, our
            <a href="https://www.condenast.com/privacy-policy" target="_blank">privacy policy and cookie statement</a> and to receive marketing and account-related emails from <span style="text-transform: uppercase;">Wired</span>. You can unsubscribe
            at any time</span><span class="arlink_int_only" style="display: none;"> and <a href="https://www.condenast.com/privacy-policy" target="_blank">privacy policy and cookie statement</a></span>.</p>
      </div>
      <!---AR link US Only--->
      <script>
        $(document).ready(function() {
          if ($("[name='country_code']").val() == 'US') {
            $(".arlink_us_only").show();
            $(".arlink_int_only").hide();
            console.log("US btn");
          } else {
            $(".arlink_us_only").hide();
            $(".arlink_int_only").show();
            console.log("INT btn");
          }
          $("#ship-country-selector").change(function() {
            if ($("#ship-country-selector").val() == "US") {
              $(".arlink_us_only").show();
              $(".arlink_int_only").hide();
              console.log("US btn onchange");
            } else {
              $(".arlink_us_only").hide();
              $(".arlink_int_only").show();
              console.log("INT btn onchange");
            }
          });
        });
      </script>
      <!-- test update 1 -->
      <p class="ng-paypal-as-payment" style="display: none;">By subscribing you agree to our <a href="https://www.condenast.com/user-agreement" target="_blank">User Agreement</a> (including the
        <a href="https://www.condenast.com/user-agreement#section-viii-g" target="_blank">class action waiver and arbitration provisions</a>) and
        <a href="https://www.condenast.com/privacy-policy" target="_blank">Privacy Policy &amp; Cookie Statement</a>.</p>
      <div id="orderobject-response">
      </div>
      <div id="ppSubmit" data-paypal-click-listener=""></div>
      <div id="placeorder" class="sectionbox">
        <div class="button" role="button" tabindex="0"> Subscribe </div>
        <div class="paNewSalesTax">+sales tax where applicable</div>
        <div class="pbutton" role="button" tabindex="0" style="display: none;"> Subscribe </div>
        <div class="abutton" role="button" tabindex="0" style="display: none;"> Subscribe </div>
        <div class="space5"></div>
        <div id="ssl">
          <p><img id="sslimage" src="https://subscribe.wired.com/circulation/wired/images/ng-ssl-lock-new.png" alt="Padlock"> This transaction is secured with SSL encryption</p>
        </div>
      </div>
      <img id="btn_processing" style="display:none;" src="/circulation/shared/images/omn_processing.gif" alt="One moment please.">
      <div class="space10"></div>
    </div>
    <style type="text/css">
      #foot1passtext {
        font-family: LabGrotesque-Regular;
        font-size: 14px;
        line-height: 18px;
        text-align: left;
        color: #ffffff;
        margin-bottom: 15px;
      }

      #foot1passtext a {
        text-decoration: underline;
        color: #ffffff;
      }
    </style>
    <div id="footersection">
      <div id="customerservice">
        <div id="customercare">
          <p><strong><span>Customer Service can be reached at <a href="https://www.wired.com/customerservice">wired.com/customerservice</a>,</span>
              <span><span id="phone-change">1-800-769-4733</span>, or by <a href="mailto:WIRcustserv@cdsfulfillment.com">email</a>.</span></strong></p>
        </div>
      </div>
      <div class="footer">
        <p id="secondfootterm"><strong>The current annual rates are: </strong>In the US, a bundle subscription is $49.99. In Canada, a bundle subscription is $59.99. In all other destinations, a bundle subscription is $70. A digital-only subscription
          is $29.99 in all destinations.</p>
        <p id="footterm">WIRED publishes monthly, except the combined July/August and December/January issues and other combined issues that count as two, as indicated on the issue's cover.</p>
        <p id="footmailtime">First issue mails within 6 weeks. Plus sales tax where applicable.</p>
        <p id="footpost">This offer is only available to customers who have not been subscribed to WIRED within the last 180 days. All orders subject to approval. Limit one free gift per address, as applicable. By ordering, you agree not to resell
          any subscriptions purchased from this site.</p>
        <p id="footpost1" class="subfoottext">Subscribers: If the Post Office alerts us that your magazine is undeliverable, we have no further obligation unless we receive a corrected address within one year. </p>
        <!-- OneTrust Cookies Settings button start --><button id="ot-sdk-btn" class="ot-sdk-show-settings ot-sdk-btn--visible" type="button" style="display: block; margin-right: auto; margin-left: auto; margin-bottom: 20px;">Manage
          Preferences</button><!-- OneTrust Cookies Settings button end -->
      </div>
      <div class="footer footer1">
        <p id="footprivacy"> <a href="https://www.condenast.com/user-agreement" target="_blank">USER AGREEMENT</a> | <a href="https://www.condenast.com/privacy-policy" target="_blank">PRIVACY POLICY</a>
          <a href="https://www.condenast.com/privacy-policy#notice-to-california-customers" target="_blank">(your CA Privacy Rights).</a> </p>
        <p id="footcopyright"> Copyright © 2022 Condé Nast Digital. All rights reserved.<br>
        </p>
      </div>
    </div>
    <style type="text/css">
      .new_footer_br {
        display: none !important;
      }

      #footintcurrency,
      .footintcurrency {
        display: none !important;
      }

      #footterm,
      #footservweb {
        font-weight: bold !important;
      }

      #footprivacy,
      #footcopyright {
        text-align: center !important;
      }

      #footprivacy a {
        text-decoration: underline !important;
        text-transform: uppercase !important;
      }

      #footprivacy a:last-child {
        text-transform: none !important;
      }

      #footservweb a {
        text-decoration: underline !important
      }

      #footservweb,
      #footterm,
      #footmailtime,
      #secondfootterm,
      #footpostintro,
      #footpost,
      #footintcurrency,
      #footcovidcopy {
        text-align: left !important;
      }
    </style>
    <div id="googleauto" class="vis-hide-google" aria-live="polite" role="status"></div>
    <!--finder file starts here -->
    <!--end finder file section -->
    <script type="text/javascript">
      <!---option-placeholder functionality starts-
      -->
      jQuery(function($)
      {
      /*function
      for
      placeholder
      select * /
      function
      selectPlaceholdermonth(selectID) {
      var
      selected
      =
      $(selectID
      +
      '
      option: selected ');
      var
      val
      =
      selected.val();
      $(selectID
      +
      '
      option '
      ).css('color',
      '#000');
      selected.css('color',
      '#333');
      if
      (val
      ==
      "")
      {
      $(selectID).css('color',
      '#ccc');
      };
      $(selectID).change(function() {
      var
      val
      =
      $(selectID
      +
      '
      option: selected '
      ).val();
      if
      (val
      ==
      "")
      {
      $(selectID).css('color',
      '#ccc');
      } else {
      $(selectID).css('color',
      '#000');
      };
      });
      };
      selectPlaceholdermonth('.optionplace2');
      selectPlaceholdermonth('.optionplace1');
      });
    <!---option-placeholder functionality End--->
    <!--BILL COUNTRY ZIP CODE FUNCTIONALITY STARTS--> $("#bill-country").change(function () { console.log($("#bill-country").val()); if ($("#bill-country").val() !== "US" && $("#bill-country").val() !== "CDN") { console.log("otherstate");
    $("#bill-zip-domestic").prop("disabled", true).hide(); $("#bill-zip-canada").prop("disabled", true).hide(); $("#bill-zip-international").prop("disabled", true).show(); } else { if ($("#bill-country").val() == "CDN") { console.log("canadastate");
    $("#bill-zip-domestic").prop("disabled", true).hide(); $("#bill-zip-canada").prop("disabled", true).show(); $("#bill-zip-international").prop("disabled", true).hide(); } if ($("#bill-country").val() == "US") { console.log("USZIP");
    $("#bill-zip-domestic").prop("disabled", true).show(); $("#bill-zip-canada").prop("disabled", true).hide(); $("#bill-zip-international").prop("disabled", true).hide(); } } }); <!--BILL COUNTRY ZIP CODE FUNCTIONALITY ENDS-->
    <!--SHIP COUNTRY ZIP CODE FUNCTIONALITY STARTS--> $("#ship-country-selector").change(function () { console.log($("#ship-country-selector").val()); if ($("#ship-country-selector").val() !== "US" && $("#ship-country-selector").val() !== "CDN") {
    console.log("otherstate"); $("#ship-zip-domestic").prop("disabled", true).hide(); $("#ship-zip-canada").prop("disabled", true).hide(); $("#ship-zip-international").prop("disabled", true).show(); } else { if ($("ship-country-selector").val() ==
    "CDN") { console.log("canadastate"); $("#ship-zip-domestic").prop("disabled", true).hide(); $("#ship-zip-canada").prop("disabled", true).show(); $("#ship-zip-international").prop("disabled", true).hide(); } if ($("#ship-country-selector").val()
    == "US") { console.log("USZIP"); $("#ship-zip-domestic").prop("disabled", true).show(); $("#ship-zip-canada").prop("disabled", true).hide(); $("#ship-zip-international").prop("disabled", true).hide(); } } });
    <!--SHIP COUNTRY  ZIP CODE FUNCTIONALITY ENDS-->
    </script>
    <!--SCROLL-TOP FUNCTIONALITY IF PUT ON PREVIEW MODE WHILE IS UPDATED TO BE ADA COMPLIANT-->
    <!---- Scroll top Testing Starts-->
    <!---- Scroll top Testing Ends-->
    <script>
      function getCookieCN(cname) {
        var name = cname + "=";
        var ca = document.cookie.split(';');
        for (var i = 0; i < ca.length; i++) {
          var c = ca[i];
          while (c.charAt(0) == ' ') {
            c = c.substring(1);
          }
          if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
          }
        }
        return "";
      }

      function ngcreateCookie(cookieName, cookieValue, daysToExpire) {
        var date = new Date();
        date.setTime(date.getTime() + (daysToExpire * 24 * 60 * 60 * 1000));
        document.cookie = cookieName + "=" + cookieValue + "; expires=" + date.toUTCString() + "; path=/";
      }
      var ngIdArray, ng_split_offers, ngArrNew = [];
      jQuery(window).on("load", function() {
        $("#googleauto").insertAfter($(".pac-container.pac-logo"));
        $('.pac-container.pac-logo').bind('DOMSubtreeModified', function(e) {
          if (e.target.innerHTML.length > 0) {
            if ($(".pac-item").length > 0) {
              $("#googleauto").html('<p> A list of <span id="sugnum">' + $(".pac-item").length + '</span> address suggestions is available. Use the up and down arrow keys to navigate the list</span></p>');
            }
          }
        });
        $("#address").on("keyup.sugno", function() {
          if ($(".pac-item").length > 0) {
            $("#googleauto").html('<p> A list of <span id="sugnum">' + $(".pac-item").length + '</span> address suggestions is available. Use the up and down arrow keys to navigate the list </p>');
          }
          if ($(".pac-item").length == 0) {
            $("#googleauto").html('<p>  There are no matches for your search </p>');
          }
        });
      });
      var impulsePrice = "0.00";
      var setautobyoffer = function() {
        var offeridsel = jQuery(".panel.offer.on").attr("id");
        // console.log("updatingauto");
        if (jQuery('.auto.' + offeridsel).length > 0) {
          console.log("updatingautocomplete");
          jQuery(".auto, #autorenewal").hide();
          jQuery('.auto.' + offeridsel).show();
          jQuery("#autorenewal").show();
        }
      }
      var hasImpulse = false;
      var CONSTANTS = (function() {
        return {
          OFFERS: {
            167056: {
              offerterm: '167056',
              source_code: '99ZGAAD04',
              isGift: 'false',
              format: 'bundle',
              formatval: 'B',
              offertype: '1',
              transtype: '12',
              issues: '12',
              price: '5.00',
              domestic_postage: '0.00',
              canadian_postage: '10.00',
              foreign_postage: '30.00',
              domestic_total: '5',
              canadian_total: '15',
              foreign_total: '35'
            },
            167200: {
              offerterm: '167200',
              source_code: '89ZHAAD08',
              isGift: 'true',
              format: 'bundle',
              formatval: 'B',
              offertype: '1',
              transtype: '11',
              issues: '12',
              price: '5.00',
              domestic_postage: '0.00',
              canadian_postage: '10.00',
              foreign_postage: '30.00',
              domestic_total: '5',
              canadian_total: '15',
              foreign_total: '35'
            },
            167060: {
              offerterm: '167060',
              source_code: '99ZDAAD02',
              isGift: 'false',
              format: 'digital',
              formatval: 'D',
              offertype: '1',
              transtype: '12',
              issues: '12',
              price: '5.00',
              domestic_postage: '0.00',
              canadian_postage: '0.00',
              foreign_postage: '0.00',
              domestic_total: '5',
              canadian_total: '5',
              foreign_total: '5'
            },
            167201: {
              offerterm: '167201',
              source_code: '89ZEAAD03',
              isGift: 'true',
              format: 'digital',
              formatval: 'D',
              offertype: '1',
              transtype: '11',
              issues: '12',
              price: '5.00',
              domestic_postage: '0.00',
              canadian_postage: '0.00',
              foreign_postage: '0.00',
              domestic_total: '5',
              canadian_total: '5',
              foreign_total: '5'
            }
          }
        }
      })();
      var total;
      var setofferterm = function() {
        for (var product in CONSTANTS.OFFERS) {
          var offer = CONSTANTS.OFFERS[product];
          setautobyoffer();
          if ((offer.isGift === $("#isGiftCheck").attr("data-isGift")) && (offer.format === $(".panel.offer.on").attr("data-format")) && (offer.offertype == "1") && (offer.issues === $(".panel.offer.on").attr("data-issues"))) {
            var summary;
            var location = $("#ship-country-selector").attr("data-location");
            var shipping;
            $(".auto, #autorenewal, .gift-off").hide();
            if ($("#isGiftCheck").attr("data-isGift") == "true") {
              $('input[name=offer_term]').attr("value", offer.offerterm + '_1');
              $('#crossdisp').attr("self-ordertype", "gift");
            } else {
              $('input[name=offer_term]').attr("value", offer.offerterm + '_0');
              $('.auto.' + location).show();
              setautobyoffer();
              $(".gift-off").show();
              if ($('.nextgen-payment-buttons[data-ngtab="1"]').hasClass("nextgen-payment-buttons-selected")) {
                $("#autorenewal").show();
              } else {
                $("#autorenewal").hide();
              }
              $('#crossdisp').attr("self-ordertype", "self");
            }
            $('input[name=chosen_offer]').attr("value", $(".panel.offer.on").attr("data-chosenoffer"));
            var ng_offer_format, ng_offer_issues;
            if (offer.format == 'bundle') {
              ng_offer_format = "Print + Digital";
            } else if (offer.format == 'digital') {
              ng_offer_format = "Digital";
            } else {
              ng_offer_format = "Print";
            };
            if ((offer.issues == '12') || (offer.issues == '11')) {
              ng_offer_issues = "1 Year";
            } else if ((offer.issues == '24') || (offer.issues == '23') || (offer.issues == '22')) {
              ng_offer_issues = "2 Years";
            } else {
              ng_offer_issues = offer.issues + "  Months";
            }
            if ($("#isGiftCheck").attr("data-isGift") == "true") {
              summary = ng_offer_issues + ' &ndash; ' + ng_offer_format + ' <span class=\"boldgift\">Gift<\/span> Access';
            } else {
              summary = ng_offer_issues + ' &ndash; ' + ng_offer_format + ' Access';
            }
            $('#itemsummarydesc').html(summary);
            $('#itemprice').html("$" + offer.price);
            $('#originprice').attr("value", "$" + offer.price);
            if (location == 'canada') {
              shipping = ((offer.canadian_postage == '0.00') ? 'Free' : "$" + offer.canadian_postage);
              total = "$" + parseFloat((parseFloat(offer.price) + parseFloat(offer.canadian_postage))).toFixed(2);
              offer_term_json[$('input[name=offer_term]').val()].internet_price = parseFloat((parseFloat(offer.price) + parseFloat(offer.canadian_postage))).toFixed(2);
            } else if (location == 'international') {
              shipping = ((offer.foreign_postage == '0.00') ? 'Free' : "$" + offer.foreign_postage);
              total = "$" + parseFloat((parseFloat(offer.price) + parseFloat(offer.foreign_postage))).toFixed(2);
              offer_term_json[$('input[name=offer_term]').val()].internet_price = parseFloat((parseFloat(offer.price) + parseFloat(offer.foreign_postage))).toFixed(2);
            } else {
              shipping = "Free";
              total = "$" + offer.price;
              offer_term_json[$('input[name=offer_term]').val()].internet_price = offer.price;
            }
            $('input[name="ship_cost"]').attr("value", shipping);
            $('#shipcost').html(shipping);
            $('#total, #arpricing').html(total);
            var location = $('#ship-country-selector').val();
            switch (location) {
              case 'US':
                if ($("#applePayform").hasClass("hasApple") == false) {
                  if ($("#isGiftCheck").attr("data-isGift") == "false") {
                    $("#applePayform").show();
                  }
                }
                break;
              case 'CA':
                if ($("#applePayform").hasClass("hasApple") == false) {
                  $(".autoRenew").hide();
                }
                break;
              default:
                if ($("#applePayform").hasClass("hasApple") == false) {
                  $(".autoRenew").hide();
                }
                break;
            }
            break;
          }
        }
      };
      var setsubmissionform = function() {
        if ($("#isGiftCheck").attr("data-isGift") == "true") {
          $("#billingaddress").prop("false");
          $("[data-shipname]").each(function() {
            $(this).attr("name", $(this).attr("data-shipname"));
          });
        } else {
          $("#billingaddress").prop("disabled", true);
          $("[data-shipname]").each(function() {
            $(this).attr("name", $(this).attr("data-billname"));
          });
        }
      }
      setsubmissionform();
      $(".panel.offer").each(function() {
        if ($(this).hasClass("on") == true) {
          $(this).find("[aria-pressed]").attr("aria-pressed", "true");
        } else {
          $(this).find("[aria-pressed]").attr("aria-pressed", "false");
        }
      });
      if ($(document).innerWidth() > 768) {
        $(".panel.offer").on("click.panel, keypress.panel, keydown.panel", function(e) {
          var paneleventfilter = false;
          if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
            paneleventfilter = true;
          }
          if (paneleventfilter == true) {
            $(".panel.offer").removeClass("on").addClass("off");
            $(".circlecheck").attr("aria-pressed", "false");
            $(this).find("[aria-pressed]").attr("aria-pressed", "true");
            $(this).addClass("on").removeClass("off");
            $(".panel-selector").text("Select");
            $(this).find('.panel-selector').text("Selected");
            // Change Shipping address to billing address for digital only order
            if ($(".panel.offer[data-format='digital']").hasClass("on")) {
              $("#nextgen-step-4 h2 span").text("BILLING ADDRESS");
            } else {
              $("#nextgen-step-4 h2 span").text("SHIPPING ADDRESS");
            }
            paArCopyUpdate();
            try {
              localStorage.setItem("chosenoffer", $(".panel.offer.on").attr("data-chosenoffer"));
            } catch (err) {
              console.log(err);
            }
            setofferterm();
            if ($(this).attr("data-format") == "digital") {
              $("#shiphandtext").parents(".flex-container").hide();
            } else {
              $("#shiphandtext").parents(".flex-container").show().css("display", "flex");
            }
            if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
              $('html, body').animate({
                scrollTop: $(".giftrecipientshow").offset().top - 60
              }, 1000);
            } else {
              $('html, body').animate({
                scrollTop: $("#nextgen-step-3").offset().top - 60
              }, 1000);
            }
          }
        });
      } else {
        $("#nextgen-offer-container").on("click keypress keydown", ".panel.offer .panel-selector", function(e) {
          var paneleventfilter = false;
          if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
            paneleventfilter = true;
          }
          if (paneleventfilter == true) {
            if ($(".panel.offer").hasClass("on")) {
              $(".panel.offer .panel-shot-selected").hide();
              $(this).parents(".panel.offer").find(".panel-shot-selected").show();
              $(".panel.offer .panel-shot").show();
              $(this).parents(".panel.offer").find(".panel-shot").hide();
              if ($(this).parents(".panel.offer").find('.panel-image').is(":hidden")) {
                $(this).parents(".panel.offer").find('.panel-image').slideDown();
              }
              $(this).parents(".panel.offer").find('.panel-arrow-down').hide();
              $(this).parents(".panel.offer").find('.panel-arrow-up').show();
              $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "flex");
            } else {
              $(this).parents(".panel.offer").find(".panel-shot-selected").show();
              $(this).parents(".panel.offer").find(".panel-shot").hide();
              if ($(this).parents(".panel.offer").find('.panel-image').is(":hidden")) {
                $(this).parents(".panel.offer").find('.panel-image').slideDown();
              }
              $(this).parents(".panel.offer").find('.panel-arrow-down').hide();
              $(this).parents(".panel.offer").find('.panel-arrow-up').show();
              $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "flex");
            }
            $(".panel.offer").removeClass("on").addClass("off");
            $(".circlecheck").attr("aria-pressed", "false");
            $(".panel.offer").find("[aria-pressed]").attr("aria-pressed", "true");
            $(this).parents(".panel.offer").addClass("on").removeClass("off");
            $(".panel-selector").text("Select");
            $(this).text("Selected");
            // Change Shipping address to billing address for digital only order
            if ($(".panel.offer[data-format='digital']").hasClass("on")) {
              $("#nextgen-step-4 h2 span").text("BILLING ADDRESS");
            } else {
              $("#nextgen-step-4 h2 span").text("SHIPPING ADDRESS");
            }
            paArCopyUpdate();
            try {
              localStorage.setItem("chosenoffer", $(".panel.offer.on").attr("data-chosenoffer"));
            } catch (err) {
              console.log(err);
            }
            setofferterm();
            if ($(this).attr("data-format") == "digital") {
              $("#shiphandtext").parents(".flex-container").hide();
            } else {
              $("#shiphandtext").parents(".flex-container").show().css("display", "flex");
            }
            if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
              $('html, body').animate({
                scrollTop: $(".giftrecipientshow").offset().top - 60
              }, 1000);
            } else {
              $('html, body').animate({
                scrollTop: $("#nextgen-step-3").offset().top - 60
              }, 1000);
            }
          }
        })
      }
      $("#ship-state-international,#ship-state-domestic,#ship-state-canada, #billingaddress, #giftrecipient, .giftrecipientshow").prop("disabled", true).hide();
      console.log("hidingcanada3?");
      $("#isgiftholder").on("click.isgift, keypress.paneloffer", function(e) {
        var paneleventfilter = false;
        console.log(e);
        if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
          paneleventfilter = true;
        }
        if (paneleventfilter == true) {
          if ($("#isGiftCheck").attr("data-isGift") == "false") {
            $("#isGiftCheck").attr("data-isGift", true);
            $("#isGiftCheck").attr("aria-pressed", true);
            $("#billingaddress, #giftrecipient, .giftrecipientshow").prop("disabled", false).show();
            $("#autorenewal, .gift-off").hide();
            $("#crossdisp").attr("data-ordertype", "gift");
            $(".panel.offer").each(function() {
              $("#isGiftCheck").attr("data-issues", $("#isGiftCheck").attr("data-gift-issues"));
            });
            if ($("#isImpulseholder").hasClass("isImpulseholder-active")) {
              $("#isImpulseholder").trigger("click");
            }
            $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code, #impulseofferterm")
              .prop("disabled", true).hide();
            $(".nextgen-epc-hide, #nextgen-step-4").hide();
            $("#nextgen-gift-check, #nextgen-gift-border").show();
            $("#isgiftholder").addClass("isgiftholder-selected");
            $("#nextgen-gift-payno").text("STEP 4.");
            if ($(document).innerWidth() > 768) {
              $("#order-progress-bar > div > ol > li:nth-child(3)").html('<a href="#giftrecipient">Gift Recipient</a>');
            } else {
              $("#order-progress-bar > div > ol > li:nth-child(3)").html('<a href="#giftrecipient">Gift</a>');
            }
            $("#order-progress-bar > div > ol > li:nth-child(4)").addClass("ng-disabled").html('<a href="#nextgen-step-3">Payment</a>');
            $("#yourinformationtext h2").text("Enter Your Billing Information");
            $("#yourinformation").css("margin-top", "15px");
            $("#shippingaddress").appendTo("#nextgen-gift-shipping");
            $("#billingaddress").appendTo("#nextgen-self-shipping");
            $('.nextgen-payment-buttons[data-ngtab="1"]').show().click();
            $('.nextgen-payment-buttons[data-ngtab="3"]').show();
            $('.ng-paypal-as-payment').show();
            $('.nextgen-payment-buttons[data-ngtab="2"], .nextgen-payment-buttons[data-ngtab="4"], .autoRenew , #ppcheckoutexpbutton').hide();
            ngIdArray = ngFindId();
            if ($("#nextgen-international").hasClass("nextgen-country-selected")) {
              $('.nextgen-payment-buttons[data-ngtab], .domestic-off, .ng-canada-on').hide();
              $('.nextgen-payment-buttons[data-ngtab="1"]').click();
              $('#shippingaddressimpulse').hide();
              $(".nextgen-payment-links").css("min-height", "25px");
            }
            $("#ngArCopy, .ng_arcopy").hide();
          } else {
            $("#isGiftCheck").attr("data-isgift", false);
            $("#isGiftCheck").attr("aria-pressed", false);
            $("#billingaddress, #giftrecipient, .giftrecipientshow").prop("disabled", true).hide();
            $("#autorenewal, .gift-off").show();
            $("#crossdisp").attr("data-ordertype", "self");
            $(".panel.offer").each(function() {
              $("#isGiftCheck").attr("data-issues", $("#isGiftCheck").attr("data-self-issues"));
            });
            $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code, #impulseofferterm")
              .prop("disabled", true).hide();
            $(".nextgen-epc-hide, #nextgen-step-4, #amazonpay-container, .nextgen-payment-buttons[data-ngtab], .autoRenew , #ppcheckoutexpbutton, .ng-amazon-hide").show();
            $("#nextgen-gift-border, #nextgen-gift-check, .ng-paypal-as-payment").hide();
            $("#isgiftholder").removeClass("isgiftholder-selected");
            $("#nextgen-gift-payno").text("STEP 3.");
            $("#order-progress-bar > div > ol > li:nth-child(3)").html('<a href="#nextgen-step-3">Payment</a>');
            $("#order-progress-bar > div > ol > li:nth-child(4)").addClass("ng-disabled").html('<a href="#nextgen-step-4">Address</a>');
            $("#shippingaddress").appendTo("#nextgen-self-shipping");
            $('.nextgen-payment-buttons[data-ngtab="1"]').click();
            $("#yourinformationtext h2").text("Enter Your Information");
            $("#yourinformation").css("margin-top", "0");
            $("#shippingaddressimpulse").show();
            if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
              $("#shippingaddressimpulse,  #impulseFields").show();
              $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code, #impulseofferterm")
                .prop("disabled", false).show();
            }
            if ($("#nextgen-international").hasClass("nextgen-country-selected")) {
              $('.nextgen-payment-buttons[data-ngtab], .domestic-off, .ng-canada-on').hide();
              $('.nextgen-payment-buttons[data-ngtab="1"]').click().delay(50);
              $("#shippingaddressimpulse").show();
              $(".nextgen-payment-links").css("min-height", "25px");
            }
            $("#ngArCopy, .ng_arcopy").show();
          }
          setsubmissionform();
          setofferterm();
        }
        //initAutocomplete();
        ngIdArray = ngFindId();
      });
      $("#bill-state-international,#bill-state-canada, #bill-state-international-label, #bill-state-canada-label").prop("disabled", true).hide();
      $("#ship-state-domestic").prop("disabled", false).show();
      localStorage.setItem("ngCountry", $("#ship-country-selector").val());

      function ng_country_change() {
        $(".search.selection.dropdown").removeClass("disabled");
        if ($("#ship-country-selector").attr("id") == "ship-country-selector") {
          $("#ship-country, #ship-country-selector-input").val($("#ship-country-selector").find("option:selected").text());
        }
        $('#ship-postal-code').removeAttr("maxlength");
        $("#ship-state-international,#ship-state-domestic,#ship-state-canada, #ship-state-international-label, #ship-state-domestic-label, #ship-state-canada-label").prop("disabled", true).hide();
        $("#ship-state-domestic").parent().hide();
        $("#ship-state-canada").parent().hide();
        console.log("hidingcanada?");
        $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code, #impulseofferterm").prop(
          "disabled", true).hide();
        if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
          $("#isImpulseCheck").click();
        }
        if ($("#ship-country-selector").val() !== "US" && $("#ship-country-selector").val() !== "CA") {
          console.log("applepayfrom1");
          if ($("#applePayform").hasClass("hasApple") == false) {
            $("#applePay").hide();
            $(".autoRenew").hide();
          }
          $("#amazonpay-container").hide();
          $("#applePayform").hide();
          $("#ppcheckoutexpbutton").addClass("haspaypaloff");
          $("#ppcheckoutexpbutton").removeClass("haspaypalon");
          $("#shippingaddress .addressbox").addClass("international");
          $("#ship-state-international, #ship-state-international-label").prop("disabled", false).show();
          $('#ship-country-selector, #crossdisp').attr("data-location", "international");
          if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
            $("#isImpulseCheck").click();
          }
        } else {
          $("#shippingaddress .addressbox").removeClass("international");
          if ($("#ship-country-selector").val() == "CA") {
            console.log("applepayfrom2");
            if ($("#applePayform").hasClass("hasApple") == false) {
              $("#applePay").hide();
              $(".autoRenew").hide();
            }
            $("#amazonpay-container").hide();
            $("#applePayform").hide();
            $("#enterfields").hide();
            $("#ppcheckoutexpbutton").addClass("haspaypaloff");
            $("#ppcheckoutexpbutton").removeClass("haspaypalon");
            $("#ship-state-canada, #ship-state-canada-label").prop("disabled", false).show();
            $("#ship-state-canada").parent().parent().show();
            $("#ship-state-canada").parent().show();
            $('#ship-country-selector, #crossdisp').attr("data-location", "canada");
            if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
              $("#isImpulseCheck").click();
            }
          }
          if ($("#ship-country-selector").val() == "US") {
            if ($("#applePayform").hasClass("hasApple") == false) {
              $("#applePayform").show();
              $(".autoRenew").show();
            }
            $("#amazonpay-container").show();
            $("#enterfields").show();
            $("#ppcheckoutexpbutton").addClass("haspaypalon");
            $("#ppcheckoutexpbutton").removeClass("haspaypaloff");
            if ($("#applePayform").hasClass("hasApple") == true && $("#applepay_checkout_section").hasClass("paypal-off") == true) {
              $("#applePayform").show();
              $("#applepay_checkout_section").show();
            }
            $("#ship-state-domestic, #ship-state-domestic-label").prop("disabled", false).show();
            $("#ship-state-domestic").parent().parent().show();
            $("#ship-state-domestic").parent().show();
            $('#ship-country-selector, #crossdisp').attr("data-location", "domestic");
            $('#ship-postal-code, #crossdisp').attr("maxlength", "5");
            if ($(".impulseOn").length == 1) {
              $("#impulse-state-domestic").parent().show();
              $("#impulse-state-domestic").parent().removeClass("disabled");
              $(".impulseOn").show();
            }
            if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
              $("#isImpulseCheck").click();
            }
          }
        }
        $("#impulse-ship-country").val($("#ship-country-selector").val());
        $("#bill-country").val($("#ship-country-selector").val());
        selecboxdisp($("#bill-country").val());
        setofferterm();
        ngcreateCookie("ngCountry", ($("#ship-country-selector").val()), 0.1);
      }
      $('#nextgen-international-selector').on("change", "#ship-country-selector", function() {
        ng_country_change();
        ngIdArray = ngFindId();
      });

      function selecboxdisp(countryval) {
        $('#bill-postal-code').removeAttr("maxlength");
        $("#bill-state-international,#bill-state-domestic,#bill-state-canada, #bill-state-international-label, #bill-state-domestic-label, #bill-state-canada-label ").prop("disabled", true).hide();
        if ($("#isImpulseCheck").attr("data-isImpulse") == "true") {
          $("#isImpulseCheck").click();
        }
        $("#bill-state-error, #bill-postal-code-error").hide();
        $("#bill-state-international, #bill-state-canada, #bill-state-domestic, #bill-postal-code").removeClass("errorinput");
        if (countryval !== "US" && countryval !== "CA") {
          $("#billingaddress .addressbox").addClass("international");
          $("#bill-state-international").prop("disabled", false).show();
          $("#bill-state-international-label").show();
          $("#bill-state-domestic, #bill-state-canada").prop("disabled", true).hide();
          $("#bill-state-canada-label, #bill-state-domestic-label").hide();
          $("#bill-zip-international").show();
          $("#bill-zip-canada, #bill-zip-domestic").hide();
          $(".billstatelabel").html("Province");
          $("#bill-state-error").text('Please enter province');
          $("#bill-postal-code-error").text('Please enter code');
        } else {
          $("#billingaddress .addressbox").removeClass("international");
          if (countryval == "CA") {
            $("#bill-state-canada").prop("disabled", false).show();
            $("#bill-state-canada-label").show();
            $("#bill-state-domestic, #bill-state-international").prop("disabled", true).hide();
            $("#bill-state-domestic-label, #bill-state-international-label").hide();
            $("#bill-zip-canada").show();
            $("#bill-zip-domestic, #bill-zip-international").hide();
            $(".billstatelabel").html("Province");
            $("#bill-state-error").text('Please select province');
            $("#bill-postal-code-error").text('Please enter code');
          }
          if (countryval == "US") {
            $("#bill-state-domestic").prop("disabled", false).show();
            $("#bill-state-domestic-label").show();
            $("#bill-state-international, #bill-state-canada").prop("disabled", true).hide();
            $("#bill-state-canada-label, #bill-state-international-label").hide();
            $("#bill-zip-domestic").show();
            $("#bill-zip-canada, #bill-zip-international").hide();
            $(".billstatelabel").html("State");
            $('#bill-postal-code').attr("maxlength", "5");
            $("#bill-state-error").text('Please select state');
            $("#bill-postal-code-error").text('Please enter zip');
          }
        }
      }
      $('#bill-country').on("change.billcountry", function() {
        selecboxdisp($(this).val());
        setofferterm();
        ngIdArray = ngFindId();
      });
      $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code, #impulseofferterm").prop(
        "disabled", true).hide();
      $("#impulseFields").hide();
      var submitorder = function() {
        var imptypes = $("#crossdisp").attr("data-default").split(" ");
        var implocflag = 0;
        var impordflag = 0;
        for (i = 0; i < imptypes.length; i++) {
          var imptype = imptypes[i].split("-");
          if (imptype[0] == $("#crossdisp").attr("data-ordertype")) {
            impordflag = 1;
          }
          if (imptype[1] == $("#crossdisp").attr("data-location")) {
            implocflag = 1;
          }
        }
        if (implocflag == 1 && impordflag == 1) {
          $("#crossdisp").attr("value", "1");
        } else {
          $("#crossdisp").attr("value", "0");
        }
        if ($('input[name="credit_card_number"]').val().match(/^4/)) {
          $('input[name="pt_id"]').attr('value', '2');
          $("[data-cctype='visa']").addClass("on");
        } else if ($('input[name="credit_card_number"]').val().match(/^5/) || $('input[name="credit_card_number"]').val().match(/^2/)) {
          $('input[name="pt_id"]').attr('value', '1');
          $("[data-cctype=mastercard]").addClass("on");
        } else if ($('input[name="credit_card_number"]').val().match(/^3/)) {
          $('input[name="pt_id"]').attr('value', '3');
          $("[data-cctype=amex]").addClass("on");
        } else if ($('input[name="credit_card_number"]').val().match(/^6/)) {
          $('input[name="pt_id"]').attr('value', '5');
          $("[data-cctype=discover]").addClass("on");
        }
        var myForm = document.getElementById('submission-form');
        var addressError;
        if ($("[name='country_code']").val() === 'US') {
          addressError = "We're sorry. Our system does not recognize the address you entered. Please review and try again. If you continue to receive this message, please contact Customer Service for assistance at 1-800-769-4733.";
        } else {
          addressError = "We're sorry. Our system does not recognize the address you entered. Please review and try again. If you continue to receive this message, please contact Customer Service for assistance at 1-515-243-3273.";
        }
        formData = new FormData(myForm);
        jQuery.ajax({
          type: "POST",
          url: "/api/circ/js/Transaction",
          data: formData,
          processData: false,
          contentType: false,
          dataType: "json",
          error: function(jqXHR, error, errorThrown) {},
          success: function(data) {
            var orderStatObj = data;
            if (orderStatObj.order_success == '') {
              var orderFailedError = "";
              if (typeof orderStatObj.order_failed[0] !== 'undefined' && typeof orderStatObj.order_failed[0].error !== 'undefined') {
                orderFailedError = orderStatObj.order_failed[0].error;
              } else {
                orderFailedError = orderStatObj.order_failed[0];
              }
              console.log(orderFailedError);
              $('#formatSelection').addClass("error");
              if (orderFailedError.substr(0, 66) == 'We are sorry. The address you entered does not appear to be valid.') {
                $('#orderobject-response').html(addressError);
              } else {
                $('#orderobject-response').html(orderFailedError);
              }
              $('#orderobject-response').show();
              $('#btn_processing, .button').hide();
              if (orderFailedError.substr(0, 29) != 'This is an introductory offer') {
                $('.button').show();
              }
              // alert(orderStatObj.order_failed[0].error);  change this to display order failure message
              $('#placeorder').show();
              $('#btn_processing').hide();
              if (orderFailedError == 'Failed Credit Card Number Verification.') {
                $("#creditcard-invalid-error").addClass("error");
                $(".errorcontainer").each(function() {
                  if ($(this).find(".error").length == 0) {
                    $(this).hide();
                  } else {
                    $(this).show();
                  }
                });
                $("#creditcard").addClass("errorinput");
                // $('html,body').animate({
                // 	scrollTop: $("#creditcard").offset().top
                // });
                // $(".errorinput:first").focus();
              }
            } else {
              $("#creditcard").attr("value", "");
              $("#cvv").attr("value", "");
              window.location = orderStatObj.order_success[0].next_offer_url;
              console.log(orderStatObj.order_success[0].next_offer_url);
            }
          }
        });
      };
      $("#placeorder .button").on("click.placeorder, keypress.placeorder", function(e) {
        var paneleventfilter = false;
        console.log(e.handleObj.origType);
        if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
          paneleventfilter = true;
        }
        if (paneleventfilter == true) {
          $(".errorinput").each(function() {
            $(this).removeAttr("aria-describedby");
          });
          $("#bill-email").attr("aria-describedby", "privacytext");
          $("#ship-email").attr("aria-describedby", "giftprivacytext");
          $("#creditcard").attr("aria-describedby", "cctext");
          $('.req').each(function() {
            if ($(this).is(':visible') == true) {
              if ($(this).attr("id") == "month") {
                if ($("#month").val() == '' || $("#month").val() == 'sel') {
                  $("#month").addClass("errorinput");
                  $("#month-error").addClass("error");
                  console.log("addingmontherror");
                } else {
                  $("#month").removeClass("errorinput");
                  $("#month-error").removeClass("error");
                }
              }
              if ($(this).attr("id") == "year" || $(this).attr("id") == "sel") {
                if ($("#year+.dropdown+input").next().text() == '') {
                  $("#year+.dropdown+input").addClass("errorinput");
                  $("#year-error").addClass("error");
                } else {
                  $("#year+.dropdown+input").removeClass("errorinput");
                  $("#year-error").removeClass("error");
                }
              }
              if ($(this).attr("id") == "ship-state-domestic") {
                if ($("#ship-state-domestic").val() == 'Select' || $("#ship-state-domestic").val() == '') {
                  $("#ship-state-domestic").addClass("errorinput");
                  $("#ship-state-error").addClass("error");
                } else {
                  $("#ship-state-domestic").removeClass("errorinput");
                  $("#ship-state-error").removeClass("error");
                }
              }
              if ($(this).attr("id") == "bill-state-domestic") {
                if ($("#isGiftCheck").attr("data-isGift") == "true") {
                  if ($("#bill-state-domestic").val() == 'Select' || $("#bill-state-domestic").val() == '') {
                    $("#bill-state-domestic").addClass("errorinput");
                    $("#bill-state-error").addClass("error");
                  } else {
                    $("#bill-state-domestic").removeClass("errorinput");
                    $("#bill-state-error").removeClass("error");
                  }
                }
              }
              if ($(this).attr("id") == "ship-state-canada") {
                if ($("#ship-state-canada").val() == 'Select' || $("#ship-state-canada").val() == '') {
                  $("#ship-state-canada").addClass("errorinput");
                  $("#ship-state-error").addClass("error");
                } else {
                  $("#ship-state-canada").removeClass("errorinput");
                  $("#ship-state-error").removeClass("error");
                }
              }
              if ($(this).attr("id") == "bill-state-canada") {
                if ($("#isGiftCheck").attr("data-isGift") == "true") {
                  if ($("#bill-state-canada").val() == 'Select' || $("#bill-state-canada").val() == '') {
                    $("#bill-state-canada").addClass("errorinput");
                    $("#ship-state-error").addClass("error");
                  } else {
                    $("#bill-state-canada").removeClass("errorinput");
                    $("#bill-state-error").removeClass("error");
                  }
                }
              }
            }
            if ($(this).val() == "" && $(this).prop("disabled") == false && $(this).is(':visible') == true) {
              $('#' + $(this).attr("id") + '-error').addClass("error");
              $(this).addClass("errorinput");
            } else {
              $('#' + $(this).attr("id") + '-error').removeClass("error");
              $(this).removeClass("errorinput");
            }
            $(".errorcontainer").each(function() {
              if ($(this).find(".error").length == 0) {
                $(this).hide();
              } else {
                $(this).show();
              }
            });
          });
          if ($(".panel.offer.on").length == 0) {
            $("#chooseoffermessage").addClass("error");
          } else {
            $("#chooseoffermessage").removeClass("error");
          }
          if ($(".error:first").length > 0) {
            $('html,body').animate({
              scrollTop: $(".error:first").offset().top - 90
            })
            jQuery(".errorinput:first").focus();
          }
          if ($(".panel.offer.on").length == 0) {
            $("#chooseoffermessage").addClass("error");
          } else {
            $("#chooseoffermessage").removeClass("error");
          }
          parseInt($("#creditcard").val().trim())
          if ($('input[name="pt_id"]').val() != "9") {
            if ((parseInt($("#creditcard").val().trim()).toString().length < 15 && parseInt($("#creditcard").val().trim()).toString().length > 0) && parseInt($("#creditcard").val().trim()).toString() != "NaN") {
              $('#creditcard-invalid-error').addClass("error");
              $('#creditcard').addClass("errorinput");
              $('#creditcard-error').removeClass("error");
            } else {
              $('#creditcard-invalid-error').removeClass("error");
              if (parseInt($("#creditcard").val().trim()).toString().length == 0 || parseInt($("#creditcard").val().trim()).toString() == "NaN") {
                $('#creditcard-error').addClass("error");
                $("#creditcard").addClass("errorinput");
              } else {
                $('#creditcard-invalid-error').removeClass("error");
                $('#creditcard-error').removeClass("error");
                $("#creditcard").removeClass("errorinput");
              }
            }
          };
          if ($(".error").length > 0) {
            var $target = $(".errorinput:first");
            $('html, body').animate({
              scrollTop: $target.offset().top
            }, {
              duration: 800,
              step: function(now, fx) {
                var newOffset = $target.offset().top - 120;
                if (fx.end !== newOffset) fx.end = newOffset;
              }
            });
            $(".errorinput:first").focus();
          }
          if ($(".error").length == 0) {
            $(".nextgen-progress").animate({
              width: "100%"
            });
            $("#placeorder").hide();
            $("#btn_processing").show();
            console.log("do order submission after error latest");
            if ($('input[name="pt_id"]').val() == "9") {
              $("#ppSubmit").trigger("click");
            } else {
              submitorder();
            }
          }
        }
        $("[aria-describedby]").each(function() {
          $(this).removeAttr("aria-describedby");
        });
        $(".errorinput").each(function() {
          $(this).attr("aria-describedby", jQuery(this).attr("id") + "-error");
        });
        $("#bill-email").attr("aria-describedby", " privacytext ");
        $("#ship-email").attr("aria-describedby", " giftprivacytext ");
        $("#creditcard").attr("aria-describedby", " cctext ");
        $("#bill-email.errorinput").attr("aria-describedby", jQuery("#bill-email").attr("aria-describedby") + " bill-email-error");
        $("#ship-email.errorinput").attr("aria-describedby", jQuery("#ship-email").attr("aria-describedby") + " ship-email-error");
        $("#creditcard.errorinput").attr("aria-describedby", jQuery("#creditcard").attr("aria-describedby") + " creditcard-error");
        $(".errorcontainer").each(function() {
          if ($(this).find(".error").length == 0) {
            $(this).hide();
          } else {
            $(this).show();
          }
        });
      });
      $(".ng-change-ship-country").on("click", function() {
        $('html,body').animate({
          scrollTop: $("#wherego").offset().top - 120
        })
        $("#ship-country-selector").focus();
      });
    </script>
    <div id="googleautoship" class="vis-hide-google" aria-live="polite" role="status"></div>
    <div id="googleautobill" class="vis-hide-google" aria-live="polite" role="status"></div>
    <script>
      $("#bill-email").on('focusout.email', function() {
        if ($(this).val() != '') {
          var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
          $(this).parents(".ng_required").find("#bill-email-error").removeClass("error").hide();
          if (re.test($("#bill-email").val()) == false) {
            $("#bill-email-invaliderror").addClass("error").show();
            $(this).addClass("errorinput");
            $(this).attr("aria-describedby", "privacytext bill-email-invaliderror");
            $(this).parents(".ng_required").find(".errorcontainer").show();
          } else {
            $("#bill-email-invaliderror").removeClass("error").hide();
            $(this).removeClass("errorinput");
            $(this).attr("aria-describedby", "privacytext");
            $(this).parents(".ng_required").find(".errorcontainer").hide();
          }
        } else {
          $(this).addClass("errorinput");
          $(this).attr("aria-describedby", "privacytext bill-email-invaliderror");
          $(this).parents(".ng_required").find(".errorcontainer").show();
          $(this).parents(".ng_required").find("#bill-email-error").show();
          $("#bill-email-invaliderror").removeClass("error").hide();
        }
      });
      $("#ship-email").on('focusout.email', function() {
        if ($(this).val() != '') {
          var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
          $(this).parents(".ng_required").find("#ship-email-error").removeClass("error").hide();
          if (re.test($("#ship-email").val()) == false) {
            $("#ship-email-invaliderror").addClass("error").show();
            $(this).attr("aria-describedby", " giftprivacytext ship-email-invaliderror");
            $(this).addClass("errorinput");
            $(this).parents(".ng_required").find(".errorcontainer").show();
          } else {
            $("#ship-email-invaliderror").removeClass("error").hide();
            $(this).attr("aria-describedby", " giftprivacytext");
            $(this).removeClass("errorinput");
            $(this).parents(".ng_required").find(".errorcontainer").hide();
          }
        } else {
          $(this).attr("aria-describedby", " giftprivacytext ship-email-invaliderror");
          $(this).addClass("errorinput");
          $(this).parents(".ng_required").find(".errorcontainer").show();
          $(this).parents(".ng_required").find("#ship-email-error").show();
          $("#ship-email-invaliderror").removeClass("error").hide();
        }
      });
      $("#impulse-ship-email").on('focusout.email', function() {
        if ($(this).val() != '') {
          var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
          $(this).parents(".ng_required").find("#impulse-ship-email-error").removeClass("error").hide();
          if (re.test($("#impulse-ship-email").val()) == false) {
            $("#impulse-ship-email-invaliderror").addClass("error").show();
            $(this).attr("aria-describedby", " giftprivacytext impulse-ship-email-invaliderror");
            $(this).addClass("errorinput");
            $(this).parents(".ng_required").find(".errorcontainer").show();
          } else {
            $("#impulse-ship-email-invaliderror").removeClass("error").hide();
            $(this).attr("aria-describedby", " giftprivacytext");
            $(this).removeClass("errorinput");
            $(this).parents(".ng_required").find(".errorcontainer").hide();
          }
        } else {
          $(this).attr("aria-describedby", " giftprivacytext impulse-ship-email-invaliderror");
          $(this).addClass("errorinput");
          $(this).parents(".ng_required").find(".errorcontainer").show();
          $(this).parents(".ng_required").find("#impulse-ship-email-error").show();
          $("#impulse-ship-email-invaliderror").removeClass("error").hide();
        }
      });
      $("#ship-country-selector").on("change.shipautocomplete", function() {
        $("#ship-country-selector-input").attr("autocomplete", "FF9PE-34GF");
        // $(".search").attr("autocomplete", "6PMF-89EG");
        if ($(this).val() != "CA") {
          $("#ship-state-canada").attr("style", "display:none !important;");
          console.log("shipcandashowinga?");
        }
        $(".req.ui.search.selection.dropdown.disabled").hide();
        // $('#ship-country-selector').dropdown("hide");
        console.log("ship-country-selectorchangedb");
      });
      $(".req.ui.search.selection.dropdown.disabled").hide();
      $(".req.ui.search.selection.dropdown.disabled").on("change.shipautocompletehide", function() {
        $(".req.ui.search.selection.dropdown.disabled").hide();
      });
      $("#ship-state-domestic+.dropdown+input").on("focusout.errorship3, blur.errorship3", function() {
        if ($(this).next().text() == '') {
          $(this).addClass("errorinput");
          $("#bill-state-error").addClass("error");
        } else {
          $(this).removeClass("errorinput");
          $("#bill-state-error").removeClass("error");
        }
      });
      $("#ship-state-canada+.dropdown+input").on("focusout.errorship4, blur.errorship4", function() {
        if ($(this).next().text() == '') {
          $(this).addClass("errorinput");
          $("#bill-state-error").addClass("error");
        } else {
          $(this).removeClass("errorinput");
          $("#bill-state-error").removeClass("error");
        }
      });
      $("#bill-state-domestic+.dropdown+input").on("focusout.errorship5, blur.errorship5", function() {
        if ($("#isGiftCheck").attr("data-isGift") == "true") {
          if ($(this).next().text() == '') {
            $(this).addClass("errorinput");
            $("#bill-state-error").addClass("error");
          } else {
            $(this).removeClass("errorinput");
            $("#bill-state-error").removeClass("error");
          }
        }
      });
      $("#bill-state-canada+.dropdown+input").on("focusout.errorship6, blur.errorship6", function() {
        if ($(this).next().text() == '') {
          $(this).addClass("errorinput");
          $("#bill-state-error").addClass("error");
        } else {
          $(this).removeClass("errorinput");
          $("#bill-state-error").removeClass("error");
        }
      });
      jQuery(document).ready(function() {
        $("#footersection").find("p").each(function() {
          if ($(this).text().trim().length == 0) {
            $(this).remove();
          }
        });
        $('ul.nosudo li').each(function() {
          $(this).prepend('<span><img class="list-tick-icon" src="https://subscribe.wired.com/circulation/wired/images/ng-bullet-new.png" alt="tick"></span>')
        });
      });
      $("input.search").each(function(index) {
        $(this).attr("id", "search-" + index);
        $(this).parent().prev("label").attr("for", "search-" + index);
      });
      $(".panel.offer").each(function() {
        $(this).attr("data-self-issues", $(this).attr("data-issues"));
        $(this).attr("data-gift-issues", parseInt($(this).attr("data-issues")));
      });
      var selfterms = 0;
      selfterms = 1;
      selfterms = 1;
      if (selfterms == 0) {
        console.log("selfterms" + selfterms);
        if ($("#isGiftCheck").attr("data-isGift") == "false") {
          $("#isGiftCheck").click();
          $(".prechecked").removeClass("prechecked");
          $("div#isGiftCheck").off("click");
          $("div#isGiftCheck").off("keypress");
          $("div#isGiftCheck").removeAttr("role");
          $("div#isGiftCheck").removeAttr("tabindex");
          $("div#isGiftCheck").removeAttr("aria-pressed");
          $("div#isGiftCheck").css("cursor", "auto");
        }
      } else {
        for (var product in CONSTANTS.OFFERS) {
          var offer = CONSTANTS.OFFERS[product];
          $("#isgiftholder").hide();
          if ((offer.offertype != '3') && (offer.transtype == '11' || offer.transtype == '10')) {
            console.log("giftofferfound");
            $("#isgiftholder").show();
            break;
          }
        }
      }
      jQuery('[data-chosenoffer]').each(function() {
        jQuery(this).attr("id", "offer" + jQuery(this).attr("data-chosenoffer"));
        jQuery(this).find(".circlecheck").attr("aria-labelledby", "offer" + jQuery(this).attr("data-chosenoffer"));
      });
      console.log("version1242019444");
      // Remove AMZPay & ApplePay for INTL/CA - TJ 9052019
      $('#ship-country-selector').on("change.country", function() {
        if ($(this).val() !== "US") {
          $("#amazonpay-container").hide();
          $("#applePayform").hide();
        }
      });
    </script>
    <script>
      var ngistrue = false;
      var ngpistrue = false;
      var ngselfptrue = false;
      var ngselfatrue = false;
      $(".wir-mobile-menu1-next-gen").click(function() {
        $("#toplogo").toggleClass("wir-bg-onclick");
        $(".toplogoimgmb").toggleClass("wir-hide-onclick");
        $(".toplogoimgdt").toggleClass("wir-display-onclick");
        $("#wir-menu-holder").text(($("#wir-menu-holder").text() == 'More Options') ? 'Fewer Options' : 'More Options');
        $(".toplogoimgdta").toggleClass("toplogoimgdtaa");
        $(".wir-menu-container.wir-mobile-menu-next-gen").slideToggle(function() {
          $(this).toggleClass("wir-display-onclick")
        });
      });
      $("#impulseofferterm").prop("disabled", true);
      $("#ship-country-selector").val("US").trigger("change");
      $("#ship-country-selector option[value='US']").hide();
      $("#shipcountrycontainer").hide();
      var ngurl = new URLSearchParams(window.location.search);
      var ng_at = ngurl.get('access_token');
      if (ng_at == "" || ng_at == null) {
        //Country Selector Button Function
        $("#nextgen-domestic").on("click keydown keypress", function(e) {
          var paneleventfilter = false;
          if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
            paneleventfilter = true;
          }
          if (paneleventfilter == true) {
            $('.nextgen-country-buttons').removeClass('nextgen-country-selected');
            $("#ship-state-domestic").show();
            $("#ship-state-international").hide();
            $(this).toggleClass('nextgen-country-selected');
            $("#ship-country-selector-input").attr("value", "United States");
            $("#ship-country-selector").attr("data-location", "domestic");
            $("#nextgen-international-selector").slideUp(function() {
              $(this).hide();
            });
            $("#ship-country-selector").val("US").trigger("change");
            $(".arlink_us_only").show();
            $(".arlink_int_only").hide();
            console.log("US btn");
            ng_country_change();
            $(".nextgen-payment-links").css("min-height", "80px").show();
            $("#ship-state-error").text("Please select state");
            $("#nextgen-step-4").css("margin-bottom", "10px");
            $("#phone-change").text("1-800-769-4733");
            $("#shipcountrycontainer, .domestic-off, .ng-canada-on, .canadian-price, .international-price, .ng-dt-int-order span, .ng-dt-int-order1 span").hide();
            $(".domestic-price").show();
            $("#ship-zip-domestic").show();
            $(".int-digital-only, #ship-zip-canada, #ship-zip-international").hide();
            $("#ship-country").val($('#ship-country-selector').find(":selected").text());
            $(".shipstatelabel").text("State");
            $('.ng-sales-hide').show();
            $(".ngIntOrder").hide();
            $('#ppcheckoutexpbutton').hide();
            if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
              $('.nextgen-payment-buttons[data-ngtab], .autoRenew, #ppcheckoutexpbutton, #amazonpay-container, #applePay').hide();
              $('.nextgen-payment-buttons[data-ngtab="1"], .nextgen-payment-buttons[data-ngtab="3"]').show();
              $("#placeorder .button").text("Subscribe");
              $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code").prop(
                "disabled", true).attr("aria-required", false).hide();
            } else {
              $('.nextgen-payment-buttons[data-ngtab], .autoRenew, #amazonpay-container, #applePay').show();
              $("#placeorder .button").text("Subscribe");
            }
            if ($("#isImpulseholder").hasClass("isImpulseholder-active")) {
              $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code").prop(
                "disabled", false).attr("aria-required", true).show();
            } else {
              $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code").prop(
                "disabled", true).attr("aria-required", false).hide();
            }
            $('.nextgen-payment-buttons[data-ngtab="1"]').trigger('click');
            $("#impulseofferterm").attr("data-ngimptype", "bundle");
            $("#placeorder .pbutton, #placeorder .abutton, #applePay").hide();
            $("#placeorder .button").show();
            $("#impulse-country-container").hide();
            paArautoupdate();
            paArCopyUpdate();
            ngIdArray = ngFindId();
          }
        });
        $("#nextgen-international").on("click keydown keypress", function(e) {
          var paneleventfilter = false;
          if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
            paneleventfilter = true;
          }
          if (paneleventfilter == true) {
            $('.nextgen-country-buttons').removeClass('nextgen-country-selected');
            $(this).toggleClass('nextgen-country-selected');
            $("#nextgen-international-selector").slideDown(function() {
              $(this).show()
            });
            $("#shipcountrycontainer, .ng-sales-hide, .ng-dt-int-order span, .ng-dt-int-order1 span").show();
            $("#ship-country-selector").val("").trigger("change");
            $(".arlink_us_only").hide();
            $(".arlink_int_only").show();
            console.log("INT btn");
            $("#ship-country").val($('#ship-country-selector').find(":selected").text());
            $('.domestic-off, .ng-canada-on').hide();
            $('.canadian-price, .international-price').hide();
            $('.nextgen-payment-buttons[data-ngtab="1"]').click();
            $("#ship-zip-canada, #ship-zip-domestic").hide();
            $("#ship-zip-international, .int-digital-only").show();
            $(".ngIntOrder, .ngInt").show();
            $(".ngCan").hide();
            //removing the gift impulse if gift is selected
            if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
              // $('.nextgen-payment-buttons[data-ngtab], .autoRenew, #ppcheckoutexpbutton, #amazonpay-container, #applePay').hide();
              $("#shippingaddressimpulse").hide();
              $('.nextgen-payment-buttons[data-ngtab]').hide();
              $(".nextgen-payment-links").css("min-height", "25px").show();
            } else {
              $("#shippingaddressimpulse").show();
              $('.nextgen-payment-buttons[data-ngtab]:nth-child(n+3)').hide();
              $(".nextgen-payment-links").css("min-height", "80px").show();
            }
            $("#nextgen-step-4").css("margin-bottom", "20px");
            $(".ng-dt-int-order span").text("+ international shipping");
            $(".shipstatelabel").text("Province");
            $("#placeorder .button").text("Subscribe");
            ngIdArray = ngFindId();
            $('#ppcheckoutexpbutton').hide();
            $("#placeorder .pbutton, #placeorder .abutton, #applePay").hide();
            $("#placeorder .button").show();
          }
        });
        $("#nextgen-international-selector").on("change", function() {
          $("#ship-country-selector").trigger("change");
        })
        $("#shippingaddress").appendTo("#nextgen-self-shipping");
        //Payment Button Function
        $('.nextgen-payment-buttons').on("click keydown keypress", function(e) {
          var paneleventfilter = false;
          if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
            paneleventfilter = true;
          }
          if (paneleventfilter == true) {
            var tab_id = $(this).attr('data-ngtab');
            $('.nextgen-payment-buttons').removeClass('nextgen-payment-buttons-selected');
            $('.nextgen-payment-tab').removeClass('nextgen-payment-selected');
            $(this).addClass('nextgen-payment-buttons-selected');
            $("#nextgen-tab-" + tab_id).addClass('nextgen-payment-selected');
            $("#ppcheckoutexpbutton, .paNewSalesTax").hide();
            if (tab_id == "1") {
              if ($('input[name="pt_id"]').val() == "9") {
                $('input[name="pt_id"]').val("");
              }
              $("#creditcard, #month, #year, #cvv").prop("disabled", false);
              $("#placeorder .button").text("Subscribe");
              $("#order-progress-bar ol > li:nth-child(4), #order-progress-bar ol > li:nth-child(5)").show();
              if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
                $("#impulseofferterm").prop("disabled", true);
                $("#nextgen-step-4, #impulseFields, #autorenewal, .ng-amazon-hide, .nextgen-epc-hide").hide();
                $("#yourinformation, #shippingaddress, #paymentdetails, #placeorder, #ordersummary, .nextgen-epc-hide2, .nextgen-pp-gift-payment").show();
                if (ngistrue == true) {
                  $(".nextgen-progress").animate({
                    width: "75%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
                } else {
                  $(".nextgen-progress").animate({
                    width: "50%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
                }
                ngIdArray = ngFindId();
              } else {
                $("#yourinformation, #shippingaddress, #paymentdetails, #autorenewal, #placeorder, #autorenewal, .nextgen-epc-hide, #ordersummary, #nextgen-step-4, .ng-amazon-hide").show();
                if ($("#nextgen-international").hasClass("nextgen-country-selected")) {
                  $('#shippingaddressimpulse').hide();
                } else {
                  $('#shippingaddressimpulse').show();
                }
                $("#impulseFields").hide();
                $("#order-progress-bar ol > li:nth-child(4)").html('<a href="#nextgen-step-4">Address</a>');
                if (!$("#isgiftholder").hasClass("isgiftholder-selected")) {
                  $(".nextgen-epc-hide, .nextgen-epc-hide2").show();
                };
                if (ngselfptrue == true && ngselfatrue == true) {
                  $(".nextgen-progress").animate({
                    width: "95%"
                  });
                  $("#order-progress-bar ol li:nth-child(4), #order-progress-bar ol li:nth-child(5)").removeClass("ng-disabled");
                } else if (ngselfptrue == true) {
                  $(".nextgen-progress").animate({
                    width: "75%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
                } else {
                  $(".nextgen-progress").animate({
                    width: "50%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
                }
                $("#placeorder .pbutton, #placeorder .abutton, #applePay").hide();
                $("#placeorder .button").show();
                //testing if statement
                if ($("#nextgen-international").hasClass("nextgen-country-selected")) {
                  $("#impulseofferterm").attr("data-ngimptype", "digital");
                  $("#impulse-country-container").show();
                }
                ngIdArray = ngFindId();
              }
            } else if (tab_id == "2") {
              $("#order-progress-bar ol > li:nth-child(4)").html('<a href="#ordersummary">Submit</a>').show();
              $("#order-progress-bar ol > li:nth-child(5)").hide();
              $(".nextgen-progress").animate({
                width: "65%"
              });
              $("#yourinformation, #shippingaddress, #shippingaddressimpulse, #paymentdetails, #autorenewal, #placeorder, #ordersummary, .nextgen-epc-hide, .nextgen-epc-hide2, #nextgen-step-4,  #impulseFields,.ng-amazon-hide").hide();
              $("#amazonpay-container, #AmazonPayButton").show();
            } else if (tab_id == "3") {
              $("#creditcard, #month, #year, #cvv").prop("disabled", true);
              $("#creditcard, #month, #year, #cvv").removeClass("errorinput");
              $("#creditcard-invalid-error").removeClass("error");
              if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
                $('input[name="pt_id"]').val("9");
                $("#impulseofferterm").prop("disabled", true);
                $("#paymentdetails, #nextgen-step-4, #impulseFields, #autorenewal, .ng-amazon-hide, .nextgen-epc-hide").hide();
                $("#yourinformation, #shippingaddress, #placeorder, #ordersummary, .nextgen-epc-hide2, .nextgen-pp-gift-payment").show();
                $("#placeorder .button").text("Subscribe");
                $(".ng-paypal-as-payment").show();
                $("#order-progress-bar ol > li:nth-child(4), #order-progress-bar ol > li:nth-child(5)").show();
                if (ngistrue == true || ngselfptrue == true) {
                  $(".nextgen-progress").animate({
                    width: "75%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
                } else if (ngpistrue == true) {
                  $(".nextgen-progress").animate({
                    width: "95%"
                  });
                  $("#order-progress-bar ol li:nth-child(5)").removeClass("ng-disabled");
                } else {
                  $(".nextgen-progress").animate({
                    width: "50%"
                  });
                  $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
                }
                $("#placeorder .pbutton, #placeorder .abutton, #applePay").hide();
                $("#placeorder .button").show();
                ngIdArray = ngFindId();
              } else {
                $('input[name="pt_id"]').val("");
                $("#yourinformation, #shippingaddress, #shippingaddressimpulse, #paymentdetails, #autorenewal, #placeorder, #ordersummary, .nextgen-epc-hide, .nextgen-epc-hide2,#nextgen-step-4, #impulseFields, .nextgen-pp-gift-payment").hide();
                $("#placeorder .button").text("Subscribe");
                $("#impulseofferterm").prop("disabled", true);
                $("#order-progress-bar ol > li:nth-child(4)").html('<a href="#nextgen-step-4">Address</a>').hide();
                $("#order-progress-bar ol > li:nth-child(5)").hide();
                $(".paNewSalesTax").show();
                $("#placeorder, #placeorder .button, #placeorder .abutton, #applePay, .ng-amazon-hide").hide();
                $("#placeorder, #placeorder .pbutton").show();
                $(".nextgen-progress").animate({
                  width: "95%"
                });
              }
            } else {
              $("#yourinformation, #shippingaddress, #shippingaddressimpulse, #paymentdetails, #autorenewal, #placeorder, #ordersummary, .nextgen-epc-hide, .nextgen-epc-hide2, #nextgen-step-4, #impulseFields").hide();
              $("#impulseofferterm").prop("disabled", true);
              $("#order-progress-bar ol > li:nth-child(4)").html('<a href="#nextgen-step-4">Address</a>').hide();
              $("#order-progress-bar ol > li:nth-child(5)").hide();
              $(".nextgen-progress").animate({
                width: "95%"
              });
              $(".paNewSalesTax").show();
              $("#placeorder, #placeorder .button, #placeorder .pbutton, #applePay, .ng-amazon-hide").hide();
              $("#placeorder, #placeorder .abutton").show();
            }
          }
        });
      } else {
        $('html, body').animate({
          scrollTop: $(".nextgen-payment-container").offset().top - 90
        }, 1500);
        // Make Amazon tab default
        $('.nextgen-payment-buttons').removeClass('nextgen-payment-buttons-selected');
        $('.nextgen-payment-tab').removeClass('nextgen-payment-selected');
        $('.nextgen-payment-buttons[data-ngtab="2"]').addClass('nextgen-payment-buttons-selected');
        $("#nextgen-tab-2").addClass('nextgen-payment-selected');
        // Change payment option to other buttons buttons
        $('.nextgen-payment-buttons').each(function() {
          if ($(this).attr('data-ngtab') != "2") {
            $(this).addClass("changePayment");
          }
        });
        $("#isGiftCheck").addClass("changePayment");
        $("#isgiftholder").css("pointerEvents", "none");
        $("#nextgen-country-selector").css("pointerEvents", "none");
        $("#yourinformation, #shippingaddress, #shippingaddressimpulse, #paymentdetails, #placeorder, .nextgen-epc-hide, .nextgen-epc-hide2, #nextgen-step-4, .ng-amazon-hide").hide();
        $("#autorenewal").remove();
        $("#ordersumtext h2").text("STEP 4. Review and Submit")
        $("#ordersummary").appendTo("#ng_amazon_review");
        $("#ordersummary").show();
        $("#ordersummary").css("padding", "20px 0");
        $("#order-progress-bar ol > li:nth-child(4)").html('<a href="#ordersummary">Submit</a>');
        $("#order-progress-bar ol > li:nth-child(5)").hide();
        var ngcountryselected = localStorage.getItem("ngCountry");
        if (ngcountryselected == "US") {
          $("#nextgen-domestic").addClass("nextgen-country-selected");
          $("#nextgen-international").removeClass("nextgen-country-selected");
        } else {
          $("#nextgen-domestic").removeClass("nextgen-country-selected");
          $("#nextgen-international").addClass("nextgen-country-selected");
        }
      }
      // Sticky Progress bar
      var $progressBar_top = $("#order-progress-bar").position().top;
      $(window).on("scroll", function() {
        if (($(document).scrollTop()) > $progressBar_top) {
          $("#order-progress-bar").css({
            "position": "fixed",
            "top": "0",
            "max-width": "1024px",
            "z-index": "50"
          });
          $(".giftcheckon").css({
            "margin-top": "70px"
          });
        } else {
          $("#order-progress-bar").css({
            "position": "static"
          });
          $(".giftcheckon").css({
            "margin-top": "0"
          });
        }
      });
      // Smooth Scroll
      $('#order-progress-bar').on('click', 'a[href*="#"]', function(e) {
        $('html,body').animate({
          scrollTop: $($(this).attr('href')).offset().top - $("#order-progress-bar").outerHeight() + 2
        }, 900);
        return false;
      });
      // remove Order summary on mobile
      // Ship Country Phone number and Shipping charges change
      $("#ship-country-selector").on("change", function() {
        if ($('#ship-country-selector').val() == "US" || $('#ship-country-selector').val() == "") {
          $("#phone-change").text("1-800-769-4733");
          $(".domestic-off, .ng-canada-on").hide();
          $(".international-price, .canadian-price").hide();
          $(".domestic-price").show();
          $(".ng-sales-hide").show();
          $(".ng-dt-int-order span").hide();
          $(".ng-dt-int-order1 span").hide();
          $(".int-digital-only").hide();
          $(".ngIntOrder").hide();
          ngIdArray = ngFindId();
          $("#ship-state-error").text("Please select state");
        } else if ($('#ship-country-selector').val() == "CA") {
          $("#phone-change").text("1-800-769-4733");
          $(".domestic-off, .ng-sales-hide").hide();
          $(".ng-canada-on").show();
          $(".domestic-price, .international-price").hide();
          $(".canadian-price").show();
          $(".int-digital-only").show();
          $(".ng-dt-int-order span").show();
          $(".ng-dt-int-order1 span").show();
          $(".ng-dt-int-order span").text("+ Canada shipping");
          $(".ngIntOrder, .ngCan").show();
          $(".ngInt").hide();
          ngIdArray = ngFindId();
          $("#ship-state-error").text("Please select province");
        } else {
          $("#phone-change").text("515-243-3273");
          $(".ng-canada-on, .ng-sales-hide").hide();
          $(".domestic-off").show();
          $(".canadian-price, .domestic-price").hide();
          $(".international-price").show();
          $(".int-digital-only").show();
          $(".ng-dt-int-order span").show();
          $(".ng-dt-int-order1 span").show();
          $(".ng-dt-int-order span").text("+ international shipping");
          $(".ngIntOrder, .ngInt").show();
          $(".ngCan").hide();
          ngIdArray = ngFindId();
          $("#ship-state-error").text("Please select province");
          $("#ship-state-error").hide();
        }
        paArautoupdate();
        paArCopyUpdate();
      });
      //dynamic AR copy, update for constants in statement v6
      var price = {
        us_bundle: "$29.99",
        ca_bundle: "$40",
        int_bundle: "$70",
        digital: "$29.99"
      }

      function paArautoupdate() {
        $(".panel.offer").each(function() {
          var paIssues = $(this).attr("data-issues");
          var paFormat = $(this).attr("data-format");
          var paLocation = $('#ship-country-selector').val();
          if ((paIssues == '14') || (paIssues == '12') || (paIssues == '11')) {
            paArIssue = "one year";
          } else if ((paIssues == '26') || (paIssues == '24') || (paIssues == '23')) {
            paArIssue = "two years";
          } else if (paIssues == '3') {
            paArIssue = "three months";
          } else if ((paIssues == '6') || (paIssues == '8')) {
            paArIssue = "six months";
          } else {
            paArIssue = paIssues + " months";
          }
          if (paFormat == 'digital') {
            paArPrice = price.digital;
          } else {
            if ((paLocation == 'US') || (paLocation == '')) {
              paArPrice = price.us_bundle;
            } else if (paLocation == 'CA') {
              paArPrice = price.ca_bundle;
            } else {
              paArPrice = price.int_bundle;
            }
          }
          var paArString = 'After ' + paArIssue + ', renews automatically at one year for ' + paArPrice;
          $(this).find(".ng_arcopy").text(paArString);
          $(this).attr("data-patermnew", paArIssue.replace("years", "year").replace("months", "month"));
          $(this).attr("data-papricenew", paArPrice);
        });
      }
      paArautoupdate();

      function paArCopyUpdate() {
        if ($(".panel.offer.on .ng_arcopy").length != 0) {
          $("#ngArCopy").text($(".panel.offer.on .ng_arcopy").text() + ".");
          localStorage.setItem("ngArCopyupdate", $(".panel.offer.on .ng_arcopy").text() + ".");
        } else {
          localStorage.setItem("ngArCopyupdate", "");
          $("#ngArCopy").hide();
        }
        $(".paTermNew").text($(".panel.offer.on").attr("data-patermnew") + ' ');
        $(".paPriceNew").text($(".panel.offer.on").attr("data-papricenew"));
        localStorage.setItem("paTermNew", $(".panel.offer.on").attr("data-patermnew"));
        localStorage.setItem("paPriceNew", $(".panel.offer.on").attr("data-papricenew"));
      }
      paArCopyUpdate();
      // Change color of the first child on Select
      $('#ship-country-selector option').slice(1).css('color', '#979797');
      $('#ship-country-selector').on('change', function() {
        $('#ship-country-selector').css('color', '#000');
        $('#ship-country-selector option').first().css('color', '#979797');
      });
      // Panel image toggle on mobile
      $(".panel-arrow-down").on("click", function() {
        if ($(this).parents(".panel.offer").hasClass("on")) {
          $(this).parents(".panel.offer").find(".panel-shot-selected").show();
          $(this).parents(".panel.offer").find(".panel-shot").hide();
          $(this).parents(".panel.offer").find('.panel-image').slideDown();
          $(this).hide();
          $(this).parents(".panel.offer").find('.panel-arrow-up').show();
          $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "flex");
        } else {
          $(this).parents(".panel.offer").find(".panel-shot-selected").hide();
          $(this).parents(".panel.offer").find(".panel-shot").show();
          $(this).parents(".panel.offer").find('.panel-image').slideDown();
          $(this).hide();
          $(this).parents(".panel.offer").find('.panel-arrow-up').show();
          $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "flex");
        }
      });
      $(".panel-arrow-up").on("click", function() {
        if ($(this).parents(".panel.offer").hasClass("on")) {
          $(this).parents(".panel.offer").find('.panel-image').slideUp(function() {
            $(this).parents(".panel.offer").find(".panel-shot-selected").hide();
            $(this).parents(".panel.offer").find(".panel-shot").show();
            $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "none");
            $(this).parents(".panel.offer").find('.panel-arrow-down').show();
          });
          $(this).hide();
        } else {
          $(this).parents(".panel.offer").find('.panel-image').slideUp(function() {
            $(this).parents(".panel.offer").find(".panel-shot-selected").show();
            $(this).parents(".panel.offer").find(".panel-shot").hide();
            $(this).parents(".panel.offer").find(".panel-inner ul li:nth-child(n+3)").css("display", "none");
            $(this).parents(".panel.offer").find('.panel-arrow-down').show();
          });
          $(this).hide();
        }
      });
      // CC Validation
      $('#creditcard:enabled').on("focusout", function() {
        if ($('#creditcard').val().length < 15) {
          $('#creditcard-invalid-error').addClass("error").show();
          $('#creditcard').addClass("errorinput");
          $(this).parents(".ng_required").find(".errorcontainer").show();
          $('#creditcard-error').removeClass("error").hide();
          $(this).attr("aria-describedby", "creditcard-invalid-error");
        } else {
          $(this).parents(".ng_required").find(".errorcontainer").hide();
          $('#creditcard-invalid-error').removeClass("error").hide();
          $('#creditcard').removeClass("errorinput");
          $('#creditcard-error').removeClass("error").hide();
          $(this).removeAttr("aria-describedby");
        }
      });

      function maxLengthCheck(object) {
        if (object.value.length > object.maxLength) object.value = object.value.slice(0, object.maxLength)
      };
      // Disable Impulse Gift by default
      $("#impulse-ship-first-name, #impulse-ship-last-name, #impulse-ship-email, #impulse-ship-country, #impulse-ship-address, #impulse-ship-address2, #impulse-ship-city, #impulse-state-domestic, #impulse-ship-postal-code").prop("disabled", true);
      // Input fields isEmpty Validation + Progress Bar
      function ngFindId() {
        ngNewArr = $(".ng_required input:enabled, .ng_required select:enabled").not("#ship-state-international, #impulse-state-international, #bill-state-international")
        var ngIdArray = [];
        for (var i = 0; i < ngNewArr.length; i++) {
          ngIdArray[i] = ngNewArr[i].id;
        }
        return ngIdArray
      }
      ngIdArray = ngFindId();
      $(".ng_required input, .ng_required select").on('keydown keypress click paste change focusin', function() {
        var ng_narr_length;
        var ng_item = $(this).attr("id");
        for (var i = 1; i < ngIdArray.length; i++) {
          if (ng_item == ngIdArray[i]) {
            ng_narr_length = i;
          }
        }
        for (var i = 0; i < ng_narr_length; i++) {
          $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").hide();
          $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span").hide();
          if ($("#" + ngIdArray[i]).val() == "") {
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").show();
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:first-child").show();
            $("#" + ngIdArray[i]).addClass('errorinput');
            $("#" + ngIdArray[i]).attr("aria-describedby", ngIdArray[i] + '-error');
          } else if ($("#" + ngIdArray[i]).val() != "" && ($("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span").hasClass("error"))) {
            if ((ngIdArray[i] == "creditcard" || ngIdArray[i] == "bill-email" || ngIdArray[i] == "ship-email" || ngIdArray[i] == "impulse-ship-email" || ngIdArray[i] == "ship-state-international" || ngIdArray[i] == "bill-state-international" ||
                ngIdArray[i] == "impulse-state-international")) {
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").show();
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(2)").show();
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(1)").hide();
              $("#" + ngIdArray[i]).addClass('errorinput');
              $("#" + ngIdArray[i]).attr("aria-describedby", ngIdArray[i] + '-error');
            } else {
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").hide();
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(2)").removeClass('error').hide();
              $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(1)").removeClass('error').hide();
              $("#" + ngIdArray[i]).removeClass('errorinput');
              $("#" + ngIdArray[i]).removeAttr("aria-describedby");
            }
          } else if ($("#" + ngIdArray[i]).val() != "" && (!$("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span").hasClass("error"))) {
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").hide();
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(2)").hide();
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(1)").hide();
            $("#" + ngIdArray[i]).removeClass('errorinput');
            $("#" + ngIdArray[i]).removeAttr("aria-describedby");
          } else {
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer").hide();
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:first-child").removeClass('error').hide();
            $("#" + ngIdArray[i]).parents(".ng_required").find(".errorcontainer span:nth-child(2)").removeClass('error').hide();
            $("#" + ngIdArray[i]).removeClass('errorinput');
            $("#" + ngIdArray[i]).removeAttr("aria-describedby");
          }
        }
      });
      $(".ng_required input, .ng_required select").not("#creditcard, #bill-email, #ship-email, #impulse-ship-email, #bill-state-international, #ship-state-international, #impulse-state-international").on('focusout', function() {
        if ($(this).val() != "") {
          $(this).parents(".ng_required").find(".errorcontainer").hide();
          $(this).parents(".ng_required").find(".errorcontainer span:first-child").hide();
          $(this).removeClass('errorinput');
          $(this).removeAttr("aria-describedby");
        } else {
          $(this).parents(".ng_required").find(".errorcontainer").show();
          $(this).parents(".ng_required").find(".errorcontainer span:first-child").show();
          $(this).addClass('errorinput');
          $(this).attr("aria-describedby", $(this).attr("id") + '-error');
        }
      });
      //Progress Bar
      $("#giftrecipient").on("change paste focusout", function() {
        if ($("#isgiftholder").hasClass("isgiftholder-selected")) {
          ngGiftArray = ngIdArray.slice(0, 7);
          var ngi = 0;
          $.each(ngGiftArray, function(ngi) {
            if ($("#" + ngGiftArray[ngi]).val() != "") {
              ngistrue = true;
            } else {
              ngistrue = false;
              return false;
            }
            ngi++
          })
          if (ngistrue == true) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
          } else if (ngistrue == true && ngpistrue == false) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
          } else if (ngistrue == false && ngpistrue == true) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
          } else {
            $(".nextgen-progress").animate({
              width: "50%"
            });
            $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
          }
        }
      });
      $(".nextgen-payment-container, #yourinformation").on("change paste focusout", function() {
        if ($("#isgiftholder").hasClass("isgiftholder-selected") && ngistrue == true) {
          ngPayArray = ngIdArray.slice(7, ngIdArray.length);
          var ngp = 0;
          $.each(ngPayArray, function(ngp) {
            if ($("#" + ngPayArray[ngp]).val() != "") {
              ngpistrue = true;
            } else {
              ngpistrue = false;
              return false;
            }
            ngp++
          })
          if (ngpistrue == true) {
            $(".nextgen-progress").animate({
              width: "95%"
            });
            $("#order-progress-bar ol li:nth-child(5)").removeClass("ng-disabled");
          } else {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(5)").addClass("ng-disabled");
          }
        }
      });
      $("#nextgen-step-3").on("change paste focusout", function() {
        if (!($("#isgiftholder").hasClass("isgiftholder-selected"))) {
          ngSelfArray = ngIdArray.slice(0, 4);
          var ngs = 0;
          $.each(ngSelfArray, function(ngs) {
            if ($("#" + ngSelfArray[ngs]).val() != "") {
              ngselfptrue = true;
            } else {
              ngselfptrue = false;
              return false;
            }
            ngs++
            console.log(ngselfptrue)
          })
          if (ngselfptrue == true) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
          } else if (ngselfptrue == true && ngselfatrue == false) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
          } else if (ngselfptrue == false && ngselfatrue == true) {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
          } else {
            $(".nextgen-progress").animate({
              width: "50%"
            });
            $("#order-progress-bar ol li:nth-child(4)").addClass("ng-disabled");
          }
        }
      });
      $("#impulseFields, #yourinformation").on("change paste focusout", function() {
        if (!($("#isgiftholder").hasClass("isgiftholder-selected")) && ngselfptrue == true) {
          ngsPayArray = ngIdArray.slice(4, ngIdArray.length);
          var ngsp = 0;
          $.each(ngsPayArray, function(ngsp) {
            if ($("#" + ngsPayArray[ngsp]).val() != "") {
              ngselfatrue = true;
            } else {
              ngselfatrue = false;
              return false;
            }
            ngsp++
          })
          if (ngselfatrue == true) {
            $(".nextgen-progress").animate({
              width: "95%"
            });
            $("#order-progress-bar ol li:nth-child(5)").removeClass("ng-disabled");
          } else {
            $(".nextgen-progress").animate({
              width: "75%"
            });
            $("#order-progress-bar ol li:nth-child(5)").addClass("ng-disabled");
          }
        }
      });
      // Paypal Domestic International Payment
      $("#placeorder .pbutton").on("click keydown keypress", function(e) {
        var paneleventfilter = false;
        if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
          paneleventfilter = true;
        }
        if (paneleventfilter == true) {
          $("#ppcheckoutexpbutton").trigger("click");
          $(".nextgen-progress").animate({
            width: "100%"
          });
          $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
        }
      })
      $("#placeorder .abutton").on("click keydown keypress", function(e) {
        var paneleventfilter = false;
        if (e.keyCode == '32' || e.handleObj.origType == "click" || e.keyCode == '13') {
          paneleventfilter = true;
        }
        if (paneleventfilter == true) {
          $("#applePay").trigger("click");
          $(".nextgen-progress").animate({
            width: "100%"
          });
          $("#order-progress-bar ol li:nth-child(4)").removeClass("ng-disabled");
        }
      });
      var isSafari = navigator.vendor && navigator.vendor.indexOf('Apple') > -1 && navigator.userAgent && navigator.userAgent.indexOf('CriOS') == -1 && navigator.userAgent.indexOf('FxiOS') == -1;
      if (isSafari == true) {
        $('.nextgen-progress-bar ol li').css("text-indent", "-9px");
      }
      $(function() {
        $(".circlecheck").remove();
        $(".panel.offer").attr("tabindex", "0").attr("role", "button");
      })
      $(window).on("load", function() {
        //  Equal height panel List
        if ($(document).innerWidth() > 768) {
          var nextgen_maxHeight = 0;
          $(".body01.nosudo").each(function() {
            if ($(this).height() > nextgen_maxHeight) {
              nextgen_maxHeight = $(this).height();
            }
          });
          $(".body01.nosudo").height(nextgen_maxHeight);
        }
      });
      $(document).ready(function() {
        if ($("[name='country_code']").val() == 'US') {
          $(".arlink_us_only").show();
          $(".arlink_int_only").hide();
          console.log("US btn");
        } else {
          $(".arlink_us_only").hide();
          $(".arlink_int_only").show();
          console.log("INT btn");
        }
        $("#ship-country-selector").change(function() {
          if ($("#ship-country-selector").val() == "US") {
            $(".arlink_us_only").show();
            $(".arlink_int_only").hide();
            console.log("US btn onchange");
          } else {
            $(".arlink_us_only").hide();
            $(".arlink_int_only").show();
            console.log("INT btn onchange");
          }
        });
      });
    </script>
    <!-- <style> 
#footterm{font-weight:bold; } 
#footmailtime{clear: both; margin-top: 10px;display: block;margin-bottom: 10px; } 
#secondfootterm {
    clear: both;
    margin-top: 10px;
    display: block;
    margin-bottom: 10px;
}
</style> 

<script> 
jQuery( "#secondfootterm" ).css(":after", ""); 
jQuery( "#secondfootterm" ).ready().html( "In the U.S., the current annual rate for a bundle subscription is $49.99; digital-only subscriptions are $29.99. In Canada, the current annual rate for a bundle subscription is $59.99. In all other countries, the current annual rate for a bundle subscription is $70. The current annual rate for a digital-only subscription is $29.99 in all countries." ); 

jQuery( "#footterm" ).css(":after", ""); 
jQuery( "#footterm" ).ready().html( "WIRED publishes monthly, except the combined July/August issue and other combined issues that count as two, as indicated on the issue's cover." ); 

jQuery( "#footmailtime" ).ready().html( "First issue mails within 6 weeks." ); 
jQuery( "#footmailtime" ).css(":after", ""); 

jQuery( "#footcanceltime" ).ready().html( "You may cancel at any time during your subscription and receive a full refund for unmailed issues." ); 
jQuery( "#footcanceltime" ).css(":after", ""); 

</script> -->
    <!-- DNU <script type="text/javascript"> _linkedin_partner_id = "434737"; window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || []; window._linkedin_data_partner_ids.push(_linkedin_partner_id); </script><script type="text/javascript"> (function(){var s = document.getElementsByTagName("script")[0]; var b = document.createElement("script"); b.type = "text/javascript";b.async = true; b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js"; s.parentNode.insertBefore(b, s);})(); </script> <noscript> <img height="1" width="1" style="display:none;" alt="" src="https://dc.ads.linkedin.com/collect/?pid=434737&fmt=gif" /> </noscript> -->
    <div id="statsHolder">
      <script type="text/javascript">
        HEARST.circ.contentType = 'eCommerce';
        HEARST.circ.commerceProps = {
          keycode: HEARST.circ.keycode,
          campaignId: HEARST.circ.campaignId,
          campaignName: HEARST.circ.campaignName
        };
        HEARST.circ.status = 200;
      </script>
      <script type="text/javascript">
        _satellite.pageBottom();
      </script>
      <script type="text/javascript">
        <!--
        if (navigator.appVersion.indexOf('MSIE') >= 0) document.write(unescape('%3C') + '\!-' + '-')
        //
        -->
      </script>
    </div>
    <script type="text/javascript">
      var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
      document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    </script>
    <script src="https://ssl.google-analytics.com/ga.js" type="text/javascript"></script>
    <img height="1" width="1" src="https://condenast.g.delivery.net/g/ue/?e=3&amp;v=13610&amp;l=10986&amp;ps=125558" alt="">
    <!--ROTATION_ID: WIR_NEWSLETTER-->
    <script>
      (function() {
        jQuery(function() {
          function getURLParam(name, url) {
            if (!url) url = window.location.href;
            name = name.replace(/[\[\]]/g, "\\$&");
            var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
              results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, " "));
          }
          var uSource = getURLParam('source');
          if (uSource != "") {
            jQuery("input[name=referral_source]").val(uSource);
          }
        });
      })(jQuery);
    </script>
    <!--ROTATION_ID: closing-->
    <div style="display:none;"> Wired </div>
    <!-- EXIT POP FUNCTIONALITY -->
    <!-- Comment out the VOG exit pop requested on 1/28/20 -->
    <!-- end of VOG comment Exit-pop -->
  </div>
</form>

Text Content

 * More Options

 * Gift
 * Help

 * Gift
 * Help


FOURTH OF JULY SALE


GET A YEAR OF WIRED FOR $29.99 $5


CANCEL ANYTIME.

 1. Location
 2. Plan
 3. Payment
 4. Address
 5. Submit


This is a gift





STEP 1. LOCATION


U.S.
International
Deliver To
Select a location. Choose LocationAfghanistan Albania Algeria Andorra Angola
Anguilla Antarctica Antigua and Barbuda Argentina Armenia Aruba Australia
Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belgium Belize Benin
Bermuda Bhutan Bolivia Bosnia-Herzegovina Botswana Brazil British Virgin Islands
Brunei Darussalam Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Canary
Islands Cape Verde Cayman Islands Central African Rep Chad Chile China Peoples
Republic Colombia Comoros Congo Congo, The Democratic Republic of the Cook
Islands Costa Rica Cote d’Ivoire Croatia Cyprus Czech Republic Denmark Djibouti
Dominica Dominican Republic Easter Island Ecuador Egypt El Salvador Equatorial
Guinea Eritrea Estonia Ethiopia Faeroe Islands Falkland Islands Fiji Finland
France French Polynesia Gabon Gambia Georgia Germany Gibraltar Greece Greenland
Grenada Guatemala Guinea Guinea-Bissau Guyana Haiti Honduras Hong Kong Hungary
Iceland India Ireland Isle of Man Israel Italy Jamaica Japan Jordan Kazakhstan
Kenya Kiribati Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho Liberia
Liechtenstein Lithuania Luxembourg Macao Macedonia Madagascar Malawi Malaysia
Maldives Mali Malta Marshall Islands Mauritania Mauritius Mexico Micronesia
Moldova, Republic of Monaco Mongolia Monserrat Montenegro Morocco Mozambique
Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New
Zealand Nicaragua Niger Norfolk Island Norway Oman Pakistan Panama Papua New
Guinea Paraguay Peru Philippines Pitcairn Islands Poland Portugal Qatar Repl of
Korea Reunion Romania Rwanda San Marino Sao Tome and Principe Saudi Arabia
Senegal Serbia Seychelles Sierra Leone Singapore Slovak Republic Slovenia
Solomon Islands Somalia South Africa Spain Sri Lanka St Helena St Kitts-Nevis St
Lucia St Pierre & Miquelon St Vincent & Grenadines Suriname Swaziland Sweden
Switzerland Taiwan Tajikistan Tanzania Thailand Togo Tonga Trinidad and Tobago
Tunisia Turkey Turkmenistan Turks-Caicos Islands Tuvalu Uganda United Arab
Emirates United Kingdom United States Uruguay Uzbekistan Vanuatu Vatican City
Venezuela Virgin Islands Wallis Futuna Islands Western Sahara Western Samoa
Yemen Zambia Zimbabwe



STEP 2. CHOOSE YOUR PLAN



Select an offer
MOST POPULAR
Print + Digital Access
Give 1 year for Regular price $29.99 Sale price: $5
+ international shipping
After one year, renews automatically at one year for $29.99
Selected


 * Unlimited access to WIRED.com

 * Print subscription

 * Digital edition of the magazine





Digital Only Access
Give 1 year for Regular price $29.99 Sale price: $5
 

After one year, renews automatically at one year for $29.99
Select


 * Unlimited access to WIRED.com

 * Digital edition of the magazine










STEP 3. GIFT RECIPIENT


ENTER RECIPIENT INFORMATION

First Name
Please enter first name
Last Name
Please enter last name

Recipient Email
Email cannot be empty Please enter a valid email
Will be used in accordance with our User Agreement and Privacy Policy.




STEP 3. PAYMENT DETAILS

You may cancel at any time.

Credit Card


Credit/Debit Card #
This transaction is secured with SSL encryption.
Please enter a valid credit card Please enter a valid credit card
Exp. Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Select month
Exp. Year 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032
Select year
CVV
Enter valid CVV


AUTOMATIC RENEWAL:

After your initial one year term, your subscription will automatically renew for
one year at $29.99. Your subscription will continue until you cancel, and after
your first renewal the term and rate may change. Before each renewal, we will
send a reminder with the term and rate then in effect. If you do nothing, we
will charge the payment method you selected. You can cancel at any time to get a
refund for the portion remaining on your subscription by contacting customer
service or calling 1-800-769-4733.


By subscribing, you agree to automatic renewal as described above, our user
agreement (including the class action waiver and arbitration provisions), our
privacy policy and cookie statement and to receive marketing and account-related
emails from Wired. You can unsubscribe at any time.

Subscribe

This transaction is secured with SSL encryption



Please enter your billing information below before continuing your purchase with
PayPal.




AUTOMATIC RENEWAL:

After your initial one year term, your subscription will automatically renew for
one year at $29.99. Your subscription will continue until you cancel, and after
your first renewal the term and rate may change. Before each renewal, we will
send a reminder with the term and rate then in effect. If you do nothing, we
will charge the payment method you selected. You can cancel at any time to get a
refund for the portion remaining on your subscription by contacting customer
service or calling 1-800-769-4733.


By subscribing, you agree to Automatic Renewal as described above, our User
Agreement (including the class action waiver and arbitration provisions) and
Privacy Policy and Cookie Statement and to receive marketing and account-related
emails from Wired. You can unsubscribe at any time.

Check out with




STEP 4. SHIPPING ADDRESS


ENTER YOUR INFORMATION

First Name
Please enter first name
Last Name
Please enter last name
Location
Change
Street Address
Please enter a valid address
Apt, Floor, Unit, etc. (optional)
City
Please enter city
State AL AK AZ AR CA CO CT DE DC FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS
MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY AA
AE AP PR
State AB BC MB NB NL NS ON PE QC SK NT NU YT
State
Please select state
Zip Postal Code Postal Code
Please enter code
Email
Email cannot be empty Please enter a valid email
Will be used in accordance with our User Agreement and Privacy Policy.
Location Select Location Afghanistan Albania Algeria Andorra Angola Anguilla
Antarctica Antigua and Barbuda Argentina Armenia Aruba Australia Austria
Azerbaijan Bahamas Bahrain Bangladesh Barbados Belgium Belize Benin Bermuda
Bhutan Bolivia Bosnia-Herzegovina Botswana Brazil British Virgin Islands Brunei
Darussalam Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Canary Islands
Cape Verde Cayman Islands Central African Rep Chad Chile China Peoples Republic
Colombia Comoros Congo Congo, The Democratic Republic of the Cook Islands Costa
Rica Cote d’Ivoire Croatia Cyprus Czech Republic Denmark Djibouti Dominica
Dominican Republic Easter Island Ecuador Egypt El Salvador Equatorial Guinea
Eritrea Estonia Ethiopia Faeroe Islands Falkland Islands Fiji Finland France
French Polynesia Gabon Gambia Georgia Germany Gibraltar Greece Greenland Grenada
Guatemala Guinea Guinea-Bissau Guyana Haiti Honduras Hong Kong Hungary Iceland
India Ireland Isle of Man Israel Italy Jamaica Japan Jordan Kazakhstan Kenya
Kiribati Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho Liberia Liechtenstein
Lithuania Luxembourg Macao Macedonia Madagascar Malawi Malaysia Maldives Mali
Malta Marshall Islands Mauritania Mauritius Mexico Micronesia Moldova, Republic
of Monaco Mongolia Monserrat Montenegro Morocco Mozambique Myanmar Namibia Nauru
Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niger
Norfolk Island Norway Oman Pakistan Panama Papua New Guinea Paraguay Peru
Philippines Pitcairn Islands Poland Portugal Qatar Repl of Korea Reunion Romania
Rwanda San Marino Sao Tome and Principe Saudi Arabia Senegal Serbia Seychelles
Sierra Leone Singapore Slovak Republic Slovenia Solomon Islands Somalia South
Africa Spain Sri Lanka St Helena St Kitts-Nevis St Lucia St Pierre & Miquelon St
Vincent & Grenadines Suriname Swaziland Sweden Switzerland Taiwan Tajikistan
Tanzania Thailand Togo Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan
Turks-Caicos Islands Tuvalu Uganda United Arab Emirates United Kingdom United
States Uruguay Uzbekistan Vanuatu Vatican City Venezuela Virgin Islands Wallis
Futuna Islands Western Sahara Western Samoa Yemen Zambia Zimbabwe
Please select a location
Street Address
Please enter a valid address
Apt, Floor, Unit, etc. (optional)
City
Please enter city
State AL AK AZ AR CA CO CT DE DC FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS
MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY AA
AE AP PR
State AB BC MB NB NL NS ON PE QC SK NT NU YT
State
Please select state
Zip Postal Code Postal Code
Please enter zip



STEP 5. REVIEW AND SUBMIT

After one year, renews automatically at one year for $29.99.

You may cancel at any time.

1 Year – Print + Digital Access
$5.00


Shipping & Handling

Free


Total Billed

$5.00
+sales tax where applicable

Please confirm that you agree with our Subscriber Auto Renewal Feature below.
Please confirm the Subscriber Auto Renewal Feature below.
Automatic Renewal:

After your initial one year term, your subscription will automatically renew for
one year at $29.99. Your subscription will continue until you cancel, and after
your first renewal the term and rate may change. Before each renewal, we will
send a reminder with the term and rate then in effect. If you do nothing, we
will charge the payment method you selected. You can cancel at any time to get a
refund for the portion remaining on your subscription by contacting customer
service or calling 1-800-769-4733.


By subscribing, you agree to automatic renewal as described above, our user
agreement (including the class action waiver and arbitration provisions), our
privacy policy and cookie statement and to receive marketing and account-related
emails from Wired. You can unsubscribe at any time and privacy policy and cookie
statement.

By subscribing you agree to our User Agreement (including the class action
waiver and arbitration provisions) and Privacy Policy & Cookie Statement.



Subscribe
+sales tax where applicable
Subscribe
Subscribe


This transaction is secured with SSL encryption



Customer Service can be reached at wired.com/customerservice, 1-800-769-4733, or
by email.

The current annual rates are: In the US, a bundle subscription is $49.99. In
Canada, a bundle subscription is $59.99. In all other destinations, a bundle
subscription is $70. A digital-only subscription is $29.99 in all destinations.

WIRED publishes monthly, except the combined July/August and December/January
issues and other combined issues that count as two, as indicated on the issue's
cover.

First issue mails within 6 weeks. Plus sales tax where applicable.

This offer is only available to customers who have not been subscribed to WIRED
within the last 180 days. All orders subject to approval. Limit one free gift
per address, as applicable. By ordering, you agree not to resell any
subscriptions purchased from this site.

Subscribers: If the Post Office alerts us that your magazine is undeliverable,
we have no further obligation unless we receive a corrected address within one
year.

Manage Preferences

USER AGREEMENT | PRIVACY POLICY (your CA Privacy Rights).

Copyright © 2022 Condé Nast Digital. All rights reserved.






Wired



WE CARE ABOUT YOUR PRIVACY

We and our partners store and/or access information on a device, such as unique
IDs in cookies to process personal data. You may accept or manage your choices
by clicking below or at any time in the privacy policy page. These choices will
be signaled to our partners and will not affect browsing data.


WE AND OUR PARTNERS PROCESS DATA TO PROVIDE:

Use precise geolocation data. Actively scan device characteristics for
identification. Store and/or access information on a device. Personalised ads
and content, ad and content measurement, audience insights and product
development. List of Partners (vendors)

I Accept
Show Purposes