[{if $oView->d3CheckForMobileTheme() == false}]
    [{assign var="checkedPaymentCount" value=$oView->getD3CheckedPaymentCount()}]
    [{oxscript add="
      var sActFormID = '`$checkedPaymentCount`';
      function SelectPayment( sCurrFormID)
      {
          sOldFormID = sActFormID;
          sActFormID = sCurrFormID;

          var oActForm = document.getElementById('payment' + sCurrFormID);
          if ( oActForm && sOldFormID != sActFormID)
          {
              oActForm.paymentid.checked = 'true';
              var oOldForm = document.getElementById('payment' + sOldFormID);
              if ( oOldForm) {
                  oOldForm.paymentid.checked = '';
              }
              oActForm.paymentid.click();
          }
      }

      function submitActiveForm()
      {   var oActForm = document.getElementById('payment' + sActFormID);

          if ( oActForm )
              oActForm.submit();
      }
    "}]

[{else}]

    [{oxscript add="
      function submitActiveForm()
      {
          sActFormID = $('#paymentMethods .selected a').data('selection-id');
          var oActForm = document.getElementById('payment-' + sActFormID);

          if ( oActForm ){
              // @link http://stackoverflow.com/questions/645555/should-jquerys-form-submit-not-trigger-onsubmit-within-the-form-tag
              var button = oActForm.ownerDocument.createElement('input');
              //make sure it can't be seen/disrupts layout (even momentarily)
              button.style.display = 'none';
              //make it such that it will invoke submit if clicked
              button.type = 'submit';
              //append it and click it
              oActForm.appendChild(button).click();
              //if it was prevented, make sure we don't get a build up of buttons
              oActForm.removeChild(button);

              /*oActForm.submit();*/
          }
      }
    "}]

    [{oxscript add="
        $('#paymentMethods').on('click', '.dropdown-option > a', function () {
            var sPaymentId   = $(this).data('selection-id');
            var oPaymentForm = $('#payment-' + sPaymentId);

            $('.payment-option.active-payment').removeClass('active-payment');
            $('#paymentOption_' + sPaymentId, oPaymentForm).addClass('active-payment');
            $('#payment_' + sPaymentId, oPaymentForm).prop('checked', true);
        });
    "}]

    [{oxscript add="
      function submitStoreUIdForm(sForm, blUseHpStore)
      {
            var oActUIdForm = document.getElementById(sForm);
            oActUIdForm.usehpstore.value = blUseHpStore;

          if ( oActUIdForm )
              oActUIdForm.submit();
      }
    "}]

[{/if}]
[{$smarty.block.parent}]