HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/castironradiatorcentre/changes prev/2024-03-01/prev/inc-template-checkout.asp
<%
' === COMMON TEMPLATE (SAME FOR ALL SHOPPING SITES USING BOOTSTRAP) ===

' (SS,7/9/07) replaced CC_SWITCH with CC_MAESTRO
' (SS,14/9/07) added Hear about us and subscribe
' (SS,14/11/07) added Delivery Allow Collection
' (SS,13/2/08) removed bold from Postcode, no longer a required field
' (SS,22/10/08) corrected bug in ShowCheckoutGetAccountType, noticed while checking code ShowCheckoutErrorMessage call was in HTML not ASP, and parameter was missing
' (SS,10/11/08) added Sub ShowCheckoutPaymentButton, works with any image, now called for Google, PayPal, DirectPay
' (SS,12/11/08) added bold for Postcode back in
' (SS,18/03/09) changed output references from "Invoice" to "Billing"
' (SS,19/03/09) changed heading in ShowCheckoutPersonalDetailsEntryForm to just Address (not Delivery Address anymore)
' (SS,17/04/09) added conditional Mobile and DeliveryDate fields
' (SS,23/04/09) added Discount to Sub ShowCheckoutOrderDetailsSubtotal
' (SS,08/05/09) voucher code now only show if this feature is enabled
' (SS,19/05/09) adding of bgcolor="#FFFFFF" to ShowCheckoutOrderDetailsMaster and removing several <br>'s after header
' (SS,28/05/09) removed Retype Email, added login (for Optional Accounts) and password to save details
' (SS,29/05/09) added Sub ShowChequeConfirmationForm for cheque payments and Sub ShowBankTransferConfirmationForm for bank transfers
' (SS,01/06/09) changed GetOrderConfirmationURL to GetOrderDetailsURL
' (SS,03/06/09) added more parameters to Sub ShowCheckoutOrderDetailsMaster
' (SS,04/06/09) added AMessageToCustomer parameter to ShowCheckoutOrderDetailsFooter
' (SS,15/06/09) replaced bgcolor="#FFFFFF" with class="checkout_bkd"
' (SS,18/06/09) slight change to text, from "Click the button" to "Click one of the buttons"
' (SS,23/06/09) minor change to ShowCheckoutPersonalDetailsEntryForm to only show password box for optional accounts
' (SS,30/09/09) change to ShowCheckoutPersonalDetailsEntryForm to make Voucher Code field more prominent, i.e. change colour from black to red
' (SS,19/03/10) added language translation using calls to tr function
' (SS,07/05/10) added calls to new button routines, changed colspan in ShowCheckoutPersonalDetailsEntryForm from "2" to "3"
' (SS,23/07/10) change to ShowCheckoutSecurePaymentMessage and ShowOrderThankYou
' (SS,20/01/11) changed to Sub ShowCheckoutOrderDetailsFooter to show printer friendly link as button
' (SS,16/05/11) changed to ShowCheckoutOrderDetailsItem to allow replacement products to be ordered
' (SS,14/06/11) improvements to work correctly with new "div" templates. Also table tags to lowercase
' (SS,20/06/11) removed all class="form" from form controls, all checkboxes now use class="form-checkbox" to remove border from IE and vertically align the caption
' (SS,06/07/11) added AOptionsList to ShowCheckoutOrderDetailsItem
' (SS,06/10/11) added VATNumberValidated hidden field if IsVATZeroForIntraCommunity, via AddVATNumberValidationHTML
' (SS,17/02/12) bugfix to ShowChequeConfirmationForm and ShowBankTransferConfirmationForm to show correct currency value, for EUR & GBP it was applying exchange rate twice
' (SS,18/04/12) change to ShowCheckoutPersonalDetailsEntryForm to allow disabling of "Don't charge postage, I will collect" checkbox when collection only item in basket
' (SS,27/04/12) change to ShowOrderThankYou, adding break and make cheque info bold
' (SS,22/05/12) change to ShowOrderThankYou, to fixed total amount shown, had forgotten to change it here when fixing bug on 17/2/12
' (SS,23/05/12) minor change to ShowCheckoutAccountsMessage
' (SS,21/08/12) changes to ShowCheckoutPersonalDetailsEntryForm to restrict message size to 600 chars
' (SS,12/12/12) added entry (SS,06/10/11) which had gone missing, from old template/framework
' (SS,12/03/13) added "Back to My Account" button to ShowCheckoutOrderDetailsFooter
' (SS,22/03/13) added Sub ShowCheckoutTermsAndConditionsCheckBox
' (SS,02/07/13) change to Sub ShowCheckoutPersonalDetailsEntryForm, to add "Billing" in front of "Address"
' (SS,20/12/13) added added GetVATNumberHelpMessage to VAT field and changed size of field from 30 to 20
' (SS,09/09/14) changes to work with Bootstrap 3 framework
' (SS,09/10/14) added GetDeliveryInfo to ShowCheckoutOrderDetailsSubtotal
' (SS,23/10/14) added GetListCombo to Sub ShowFormControl for "select"
' (SS,19/12/14) changes to Sub ShowOrderThankYou for bank transfer details
' (SS,19/01/15) changes to Sub ShowCheckoutSecurePaymentMessage and ACaption parameter added to Sub ShowCheckoutPaymentButton
' (SS,05/02/15) changes to Sub ShowCheckoutSecurePaymentMessage to improve the wording, removed li tag from Sub ShowCheckoutMessage
' (SS,06/02/15) added Sub ShowCheckoutMakePayPalPaymentText
' (SS,09/09/15) correction to ShowFormControl LMaxLength was not being set result in error when somebody try to post a review with too long a title
' (SS,26/01/16) change to Sub ShowCheckoutTermsAndConditionsCheckBox, change to text and link
' (SS,20/04/16) added GetMessage("Voucher") to voucher code, i.e. hint message
' (SS,05/10/16) New subs ShowCheckoutLocalModeFeatures and ShowCheckoutLocalModePayment, added ClearVoucherCodeForLocalMode to ShowCheckoutPersonalDetailsEntryForm
' (SS,04/04/17) Changes to local mode fields, delivery checkboxes and VAT number field visibility, also change to Sub ShowOrderThankYou to show print invoice button in local mode
' (SS,18/07/17) Added autocomplete off to Sub ShowFormControl
' (SS,03/08/17) Change to ShowCheckoutLocalModePayment, improved to get values stored in settingsSub ShowCheckoutLocalModePayment
' (SS/19/01/18) Change to Sub ShowOrderThankYou to improve junk folder message
' (SS,13/03/18) Change to Sub ShowOrderThankYou to remove two preceding breaks i.e. <br><br> from before GetOrderConfirmationExtraMessage
' (SS,06/04/18) Added Sub ShowPaymentFailureAlert, used by Payzone
' (SS,18/04/18) Removed redundant Sub ShowCreditCardTypeForm, Sub ShowCreditCardDetailsForm, Sub ShowCardType, Sub ShowCustomerInfoDirectCardTypes, Sub ShowCheckoutPayNowWithCreditCardButton and change to ShowCustomerInfoCardTypes
' (SS,19/04/18) Replaced ShowCheckoutMakePayPalPaymentText with ShowCheckoutMakePayPalPaymentButton
' (SS,19/04/18) In Sub ShowOrderThankYou, changed Important Notice alert from alert-info to alert-danger, also word changed and table replaced with div
' (SS,20/04/18) Caption change and sentence removal in Sub ShowCheckoutMakePayPalPaymentButton, text change to ShowCheckoutSecurePaymentMessage
' (SS,20/04/18) Change to Sub ShowCheckoutPaymentButton to increase button size and colour, and added ShowCheckoutPaymentButtonHeader and ShowCheckoutPaymentButtonFooter (empty currently)
' (SS,22/05/18) Removed HearAboutUs and SubscribeSub from ShowCheckoutPersonalDetailsEntryForm
' (SS,28/11/18) Wording changes to Sub ShowCheckoutLoginSection to reduce confusion about logging in.
' (SS,13/12/18) Change to Sub ShowOrderThankYou to add cancel order link to end of cheque / bank transfer payment method
' (SS,09/12/19) Change to Sub ShowCheckoutTermsAndConditionsCheckBox modified text to "By leaving this ticked I confirm I have read and agree to the terms and conditions"
' (SS,11/12/19) Change to Sub ShowCheckoutTermsAndConditionsCheckBox to show same text as before for sites that don't default with checkbox ticked
' (SS,23/04/20) Change to Sub ShowCheckoutPersonalDetailsEntryForm (for HF) to remove DeliveryAddToExistingOrder checkbox, probably temporarily to allow catch up of orders
'               Also need to check functionality in local mode, perhaps always allow in local mode.
' (SS,20/09/19) Changes for Bootstrap 4
' (SS,10/05/20) Modified Sub ShowCheckoutTermsAndConditionsCheckBox for Bootstrap 4
' (SS,23/09/20) Change to Sub ShowPaymentFailureAlert replaced window.history.back() with LRetryURL for NetPay which uses Server Post
' (SS,24/09/20) Combined Bootstrap 3 and Bootstrap 4 version into this one common version
' (SS,25/09/20) Added setting to conditionally remove ShowDeliveryAddToExistingOrder
' (SS,29/09/20) Further improvements to combine Bootstrap 3 and 4 version
' (SS,15/02/21) Added Sub ShowEORINoScript for EOR number showing/hiding where applicable
' (SS,22/02/21) Moved jQuery/JavaScript code to separate (subs) section to ensure it will run when jquery.js appear further down the page
'               It will be called just before end body tag in inc-template-main.asp
' (SS,22/04/21) Changes to Sub ShowFormControl, also added DespatchByDate to Sub ShowCheckoutLocalModeFeatures for CIRC
' (SS,22/04/21) Change to Sub ShowCheckoutOrderDetailsSubtotal, replaced tr("Delivery") with GetDeliveryOptionLabel, to show Expedited or Tracked Delivery for HF
' (SS,23/04/21) Added default date to call to CustomGetDespatchByDateList
' (SS,11/06/21) Change to Sub ShowCheckoutPersonalDetailsEntryForm, call to ShowHearAboutUsFormControls replaced LEnabled with True to always show HearAboutUs,
'               due to existing customer not being able to set this unless they go into account settings 
' (SS,15/06/21) Correction to Sub ShowCheckoutLoginSection to remove Session("Password"), it's redundant and not necessary
' (SS,19/05/22) Change to Sub ShowCheckoutPersonalDetailsEntryForm and Sub ShowCheckoutDeliveryAddressEntryForm to show postcode before company name if AddressLookupEnabled
' (SS,20/06/22) Change to Sub ShowCheckoutPaymentButton to reduce max-height for logo
' (SS,21/06/22) New Sub ScriptPageReloadOnBackButton, to cause payment form page to reload, applicable to Clover
'               Change to Sub ShowPaymentFailureAlert for Clover
' (SS,23/06/22) Modified Sub ShowPaymentFailureAlert for Clover multiple payment methods 
' (SS,29/07/22) Modified Sub Sub ShowCheckoutPersonalDetailsEntryForm and ShowCheckoutDeliveryAddressEntryForm to show different county label and placeholder for UK and RW (added for HF)
' (SS,28/07/23) CHanged to Sub ShowCheckoutOrderDetailsSubtotal to show discount info for voucher

' (SS,5/9/14) globals to hold form label column width to use in next rendering of form control, and whether controls is shown enabled or not
Dim FFormControlsLabelWidth
SetFormControlsLabelWidth 2 ' default to 2

' --- START OF CHECKOUT TEMPLATES --- '

' (SS,15/6/11) removed table, added div
Sub ShowCheckoutHeader
%>
<div id="checkout">
<%
End Sub

' (SS,2/9/05)
Sub ShowCheckoutErrorMessage(AErrorMessage)
  If AErrorMessage <> "" Then
%>
<font color="red"><%=AErrorMessage%></font>
<%
  End If
End Sub

Sub ShowCheckoutGetAccountType(AErrorMessage)
%>
<table width="100%" border="0" cellPadding="3" cellSpacing="0">
<tr>
<td colspan="2" width="100%" class="headingsmall">
If you're an account holder then login here, otherwise leave blank and press "proceed to next stage".
<br><br>
</td>
</tr>
<%
If AErrorMessage <> "" Then
%>
<tr>
<td width="100%" colspan="2" class="errormessage">
<%=ShowCheckoutErrorMessage(AErrorMessage)%>
</td>
</tr>
<%
End If
%>
</table>

<table width="100%" border="0" cellPadding="3" cellSpacing="0">
<tr>
<td width="80" nowrap>Account ID:</td>
<td><input type="text" name="AccountID" value="<%=Request.Form("AccountID")%>" size="30" maxlength="50"></td>
</tr>
<tr>
<td nowrap>Password:</td>
<td><input type="password" name="Password" value="<%=HTMLEncode(Request.Form("Password"))%>" size="30" maxlength="50"></td>
</tr>
</table>
<%
End Sub

' (SS,27/5/09) tidied to work better with new div designs, added class="checkout"
' (SS,28/11/18) added " (optional)" to "Returning Customer Login" and to "Enter email address" and to "Enter password"
' Replaced "Returning" with "Existing Customer"
' Also replaced tr("If you are a returning customer please enter your email address and password below then press Log in. Otherwise leave these two fields blank and enter your full details below.")
' with new text:
' If you already have an account with us then you can optionally enter your email and password below to retreive your details. Otherwise leave these two fields blank and enter your full details below. 
' (SS,27/9/19) for Bootstrap 4 replaced "col-lg-8 col-md-8 col-sm-10 col-xs-12" with "col-lg-8"
' (SS,4/10/19) removed class="col-sm-offset-2 col-sm-10" from GetButtonLoginInCheckout and class="form-group" from outside div, also remove the inner div
' (SS,25/9/20) added "If IsBootstrap4" and separate HTML for both Bootstrap 3 and 4 versions
' (SS,15/6/21) correction to remove Session("Password"), it's redundant and not necessary
Sub ShowCheckoutLoginSection(AErrorMessage)
%>

<div class="row">

<%If IsBootstrap4 Then%>
<div class="col-lg-8">

<div class="card mb-3">
  <h5 class="card-header">Existing Customer Login (optional)</h4>
  <div class="card-body">
<%Else%>
<div class="col-lg-8 col-md-8 col-sm-10 col-xs-12">  

<div class="panel panel-default">
  <div class="panel-heading">Existing Customer Login (optional)</div>
  <div class="panel-body">
<%End If%>
    <p>
If you already have an account with us then you can optionally enter your email and password below to retrieve your details. Otherwise leave these two fields blank and enter your full details below.
    </p>
<%
If AErrorMessage <> "" Then
  ShowAlertMesssage "danger", AErrorMessage
End If
%>

<%
  ' (SS,4/10/19) added required to both fields (Bootstrap 4) (now a separate form for validation)
  SetFormControlsLabelWidth 2 ' default to 2 for following controls
  ShowFormControl "email", "LoginEmail", "Email", Session("LoginEmail"), "Enter email address (optional)", "100", True, "", "required"
  ' (SS,15/6/21) corrected Session("Password") to Session("LoginPassword"), then removed it because there's no need to default this
  ShowFormControl "password", "LoginPassword", "Password", "", "Enter password (optional)", "20", True, "", "required"
%>

<%If IsBootstrap4 Then%>
    <div>
<%Else%>
    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-10">
<%End If%>
      <%=GetButtonLoginInCheckout%>
      &nbsp;&nbsp;<a href="products.asp?page=account&cmd=forgotpassword"><%=tr("Forgot Password")%>?</a>
<%If IsBootstrap4 Then%>           
    </div>        
<%Else%>
      </div>
    </div>
<%End If%>
  
  </div> <!--panel or card-->
</div> <!--panel-body or card-body-->

</div> <!--col-->

</div> <!--row-->

<%
End Sub

' (SS,5/9/14) call this to set the next col width for control rendering
Sub SetFormControlsLabelWidth(AWidth)
  FFormControlsLabelWidth = AWidth
End Sub

' (SS,5/9/14)
Function GetFormControlsLabelWidth
  GetFormControlsLabelWidth = FFormControlsLabelWidth
End Function

' (SS,5/9/14) called from ShowFormControl
' (SS,27/9/19) modified for Bootstrap 4, added AControlName to add ID for accessibility
' (SS,25/9/20) now handles both Bootstrap 3 and 4
Sub ShowFormControlHelpText(AControlName, AHelpText)
  If AHelpText <> "" Then
If IsBootstrap4 Then%>
  <small id="<%=AControlName%>HelpBlock" class="form-text text-muted"><%=tr(AHelpText)%></small>
<%Else%>
  <span class="help-block"><%=tr(AHelpText)%></span>
<%End If
  End If
End Sub

' (SS,5/9/14) to help build a form easier
' translation using tr() is attempted on ALabel and APlaceHolder
' ALabelWidth is width in grid columns, defaults to 2
' AAOptions not currently used
' (SS,23/10/14) added list= to AOptions, for select added GetListCombo
' (SS,18/7/17) added Autocomplete to turn it off via AAOptions
' (SS,27/9/19) changes for Bootstrap 4, added row to class after "form-group"
' replaced class "control-label" with "col-form-label", removed "control-label" from label itself seemed superfluous because it's also set in LLabelWidthClass
' also added " pr-0" to label class to reduce right padding to prevent word wrap of label
' added AName parameter to ShowFormControlHelpText
' For checkbox new classes form-check, form-check-input, form-check-label used, and input no longer embedded inside label
' Added aria-describedby for checkbox if help text supplied
' (SS,10/10/19) added LRowClass
' (SS,25/9/20) changed to handle both Bootstrap 3 and 4
' (SS,22/4/21) added "list" to else i.e. for date type to allow a list of dates
Sub ShowFormControl(AType, AName, ALabel, AValue, APlaceHolder, AMaxLength, AEnabled, AHelpText, AAOptions)
  Dim LLabel, LMaxLength, LLabelWidthClass, LControlWidthClass, LLabelWidthOffsetClass, LEnabledHTML, LRowClass, LList
  LLabel = ALabel
  If LLabel = "" Then LLabel = AName
  ' (SS,9/9/15) corrected AMaxLength = LMaxLength to LMaxLength = AMaxLength 
  LMaxLength = AMaxLength
  If LMaxLength <> "" Then LMaxLength = " maxlength=""" & AMaxLength & """"
  If GetFormControlsLabelWidth > 0 Then
    If IsBootstrap4 Then
      ' (SS,27/9/19) replaced "control-label" with "col-form-label", added " pr-0" to reduce right padding and prevent word wrap at certain widths
      LLabelWidthClass = "col-form-label col-sm-" & GetFormControlsLabelWidth & " pr-0"
      LControlWidthClass = "col-sm-" & 12 - GetFormControlsLabelWidth
      ' (SS,27/9/19) For Bootstrap 4 replaced "col-sm-offset-" with "offset-sm-"
      LLabelWidthOffsetClass = "offset-sm-" & GetFormControlsLabelWidth
      LRowClass = " row"  ' (SS,10/10/19) required for Bootstrap 4
    Else ' Bootstrap 3
      LLabelWidthClass = "control-label col-sm-" & GetFormControlsLabelWidth
      LControlWidthClass = "col-sm-" & 12 - GetFormControlsLabelWidth
      LLabelWidthOffsetClass = "col-sm-offset-" & GetFormControlsLabelWidth
      LRowClass = "" ' (SS,25/9/20)
    End If
  Else ' i.e. 0, assume non horizontal form controls
    LLabelWidthClass = ""
    LControlWidthClass = ""
    LLabelWidthOffsetClass = ""
    LRowClass = ""      ' (SS,10/10/19)
  End If
  
  If AEnabled Then
    LEnabledHTML = ""
  Else
    LEnabledHTML = " disabled"
  End If
  
  ' if in options add onKeyPress
  Dim LOnKeyPress
  LOnKeyPress = GetOptionEquals(AAOptions, "onKeyPress")
  If LOnKeyPress <> "" Then LOnKeyPress = " onKeyPress=" & LOnKeyPress
  
  ' (SS,18/7/17) added following to allow autocomplete off if in options
  Dim LAutocomplete
  LAutocomplete = GetOptionEquals(AAOptions, "autocomplete")
  If LAutocomplete <> "" Then LAutocomplete = " autocomplete=" & LAutocomplete
  
  ' (SS,30/9/19) added following to allow validation if field is required
  ' (SS,25/9/20) added IsBootstrap4 to not do this for Bootstrap 3
  Dim LRequired
  If IsBootstrap4 And IsOption(AAOptions, "required") Then
    LRequired = " required"
  Else
    LRequired = ""
  End If
  
%>
  <div class="form-group<%=LRowClass%>"><%
  If AType = "checkbox" Then%>
    <div class="<%=LLabelWidthOffsetClass & " " & LControlWidthClass%>">
<%If IsBootstrap4 Then%>
      <div class="form-check">
        <input class="form-check-input" type="checkbox" name="<%=AName%>" id="<%=AName%>" value="checked"<%=Iif(AValue, " checked", "")%><%=Iif(AHelpText = "", "", " aria-describedby=""" + AName + "HelpBlock""")%><%=LEnabledHTML%>> 
        <label class="form-check-label" for="<%=AName%>">
        <%=ALabel%>
        </label>
        <%ShowFormControlHelpText AName, AHelpText%>
      </div>
<%Else%>
      <div class="checkbox">
        <label>
          <input type="checkbox" name="<%=AName%>" id="<%=AName%>" value="checked" <%=Iif(AValue, "checked", "")%><%=LEnabledHTML%>> <%=ALabel%>
        </label>
        <%ShowFormControlHelpText AName, AHelpText%>        
      </div>
<%End If%>
    </div><%
  Else%>
    <label for="<%=AName%>" class="<%=LLabelWidthClass%>"><%=HTMLEncode(tr(LLabel))%></label>
    <div class="<%=LControlWidthClass%>"><%
    If AType = "textarea" Then%>
      <textarea name="<%=AName%>" id="<%=AName%>" class="form-control" rows="3"<%=LMaxLength%> placeholder="<%=HTMLEncode(tr(APlaceHolder))%>"><%=HTMLEncode(AValue)%></textarea><%
    ElseIf AType = "select" Then
      Dim LExtras
      ' (SS,1/3/15) added id for "label for" to work for combos
      LExtras = "class=""form-control"" id=""" & AName & ">""" & LEnabledHTML
      If AName = "Title" Then
        Response.Write GetTitleCombo(LExtras)
      ElseIf AName = "Country" Or AName = "DeliveryCountry" Then
        Response.Write GetCountryCombo(AName, LExtras)
      ElseIf AName = "HearAboutUs" Then
        Response.Write GetHearAboutUsCombo
      Else ' (SS,23/10/14) assume list combo
        ' (SS,22/4/21) moved Dim LList to the top to prevent "Name redefined" error in Else below
        ' get list from options
        LList = GetOptionEquals(AAOptions, "list")
        Response.Write GetListCombo(AName, LList, AValue, False)
      End If%>  
  <%Else
      ' (SS,22/4/21) get list from options (used by new "date" type) i.e. list of allowed dates, just the name of the defined list
      LList = GetOptionEquals(AAOptions, "list")
      If LList <> "" Then LList = " list=" & LList
      ' (SS,22/4/21) also added min and max values (used for date currently)      
      Dim LMin, LMax
      LMin = GetOptionEquals(AAOptions, "min")
      If LMin <> "" Then LMin = " min=" & LMin
      LMax = GetOptionEquals(AAOptions, "max")
      If LMax <> "" Then LMax = " max=" & LMax
      %>
      <input type="<%=AType%>" name="<%=AName%>" id="<%=AName%>" class="form-control" placeholder="<%=HTMLEncode(tr(APlaceHolder))%>" value="<%=HTMLEncode(AValue)%>"<%=LMaxLength%><%=LEnabledHTML%><%=LOnKeyPress%><%=LAutocomplete%><%=LList%><%=LMin%><%=LMax%><%=LRequired%>><%
    End If
    ShowFormControlHelpText AName, AHelpText
    ' (SS,30/9/19) added following for invalidation feedback info
    If LRequired <> "" Then%>
      <div class="invalid-feedback">
        Please enter <%=ALabel%>
      </div>
   <%End If%>
    </div><%
  End If%>
  </div>  
<%  
End Sub


' (SS,15/6/11) tidied up for new div version and improved styles, added class="checkout-form" to table
' removed "Stage 1 of 3"
' (SS,6/10/11) added VATNumberValidated hidden field if IsVATZeroForIntraCommunity, via AddVATNumberValidationHTML
' (SS,18/4/12) added Iif(CollectionOnlyOrder, " disabled", "") to disable "Don't charge postage, I will collect" checkbox
' (SS,21/8/12) added maxlength=..GetMaxMessageLength to restrict size to 600 chars
' (SS,2/7/13) change "Enter Personal Details & Address" to "Enter Personal Details & Billing Address" to prevent confusion
' (SS,20/12/13) added GetVATNumberHelpMessage to VAT field
' (SS,30/3/17) added javascript to only show VAT number field for UK
' (SS,22/5/18) removed HearAboutUs and Subscribe
' (SS,27/9/19) for Bootstrap 4 replaced "col-lg-8 col-md-8 col-sm-10 col-xs-12" with "col-lg-8", and replaced "Company Name" with "Company"
' (SS,30/9/19) added improved validation for required fields, validates before posting. Hints shown next to each field and field is highlit and made active
' (SS,3/10/19) removed the Title field, decided it's not necessary
' (SS,4/10/19) log in section including call to ShowCheckoutLoginSection removed from here to apputils due to separate form now used
' (SS,19/5/22) change to show postcode before CompanyName if AddressLookupEnabled
' (SS,29/7/22) change to show different county label and placeholder for UK and RW (added for HF)
Sub ShowCheckoutPersonalDetailsEntryForm(AErrorMessage, AAllowDifferentDeliveryAddress)
	' (SS,27/5/09)
	Dim LErrorMessage
	LErrorMessage = AErrorMessage
  
  ' (SS,4/10/19) call to ShowCheckoutLoginSection removed from here to new ShowCheckoutLoginForm in apputils.asp
 
  Dim LEnabled, LEnabledHTML ' used to make certain controls readonly if on account '
  LEnabled = Not AccountLoggedIn
  If Not LEnabled Then
    LEnabledHTML = ""
  Else
    LEnabledHTML = "disabled"
  End If

%>

<div class="row">

<div class="col-lg-8<%=Bootstrap3Only(" col-md-8 col-sm-10 col-xs-12")%>">  

<div class="<%=GetPanelCardClass("")%>">
  <<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%> class="<%=GetPanelCardClass("H")%>"><%=tr("Enter Personal Details & Billing Address")%></<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%>>
  <div class="<%=GetPanelCardClass("B")%>">
<%
  If LErrorMessage <> "" Then
    ShowAlertMesssage "danger", LErrorMessage
  End If

  SetFormControlsLabelWidth 3 ' default to 3 for following controls
  
  ' (SS,30/9/19) added required to required fields to show valid feedback info before form is actually submitted
  ' (SS,3/10/19) removed Title (decided not necessary)
  ' ShowFormControl "select", "Title", "", "", "", "", LEnabled, "", "required"
  ShowFormControl "text", "FirstName", "First Name", Session("FirstName"), "Enter first name", "50", LEnabled, "", "required"
  ShowFormControl "text", "Surname", "Surname", Session("Surname"), "Enter surname name", "50", LEnabled, "", "required"
  
  ' (SS,19/5/22) added postcode before CompanyName "If AddressLookupEnabled "to allow postcode to appear first when address lookup is enabled
  If AddressLookupEnabled Then ShowFormControl "text", "Postcode", "Postcode / ZIP", Session("Postcode"), "Enter postcode or ZIP", "20", LEnabled, "", Bootstrap4Only("required")
   
  ShowFormControl "text", "CompanyName", "Company", Session("CompanyName"), "Enter company name (optional)", "50", LEnabled, "", "" ' (SS,27/9/19) replaced label text "Company Name" with "Company" to prevent word wrap at small widths
  ShowFormControl "text", "Address1", "Address Line 1", Session("Address1"), "Enter first line of address", "50", LEnabled, "", Bootstrap4Only("required")
  ShowFormControl "text", "Address2", "Address Line 2", Session("Address2"), "Enter second line of address (optional)", "50", LEnabled, "", "" ' (SS,30/9/10) added "(optional)"
  ShowFormControl "text", "Town", "Town / City", Session("Town"), "Enter town or city", "50", LEnabled, "", Bootstrap4Only("required")
  ShowFormControl "text", "County", "County / State", Session("County"), "Enter county, state or region", "50", LEnabled, "", ""
  
  ' (SS,19/5/22) added If Not AddressLookupEnabled to allow postcode to appear first when address lookup is enabled
  If Not AddressLookupEnabled Then ShowFormControl "text", "Postcode", "Postcode / ZIP", Session("Postcode"), "Enter postcode or ZIP", "20", LEnabled, "", Bootstrap4Only("required")
  
  ShowFormControl "select", "Country", "", "", "", "", LEnabled, "", Bootstrap4Only("required")
  
  'If IsVATZeroForIntraCommunity Then
  '  ShowFormControl "text", "VATNumber", "VAT Number", Session("VATNumber"), "Enter VAT Number (optional)", "50", LEnabled, GetVATNumberHelpMessage, ""
  '  AddVATNumberValidationHTML
  'End If
  
  ' (SS,11/2/21) replaced above VATNumber with following EORINumber and XIEORINumber
  ShowFormControl "text", "EORINumber", "EORI Number", Session("EORINumber"), "Enter EORI Number (companies only)", "50", LEnabled, "", ""
  ShowFormControl "text", "XIEORINumber", "XI EORI Number", Session("XIEORINumber"), "Enter XI EORI Number (Northern Ireland only)", "50", LEnabled, "", ""    

  If AllowCollection Then
    ' (SS,3/4/17) replaced "postage" with "delivery"
    ShowFormControl "checkbox", "DeliveryWillCollect", "Don't charge delivery, I will collect", Session("DeliveryWillCollect"), "", "", Not CollectionOnlyOrder, "", ""
  End If
  
  ' (SS,30/3/17) *** to be continued
  ' (SS,3/4/17) replaced "Only to be used with authority.<br>Enter previous order no in message box below."
  ' with "confirm existing order number in message box below"
  ' (SS,23/4/20) followed removed, temporarily for HyperFlight, requested by Neil
  ' (SS,25/9/20) added setting to remove conditionally
  If ShowDeliveryAddToExistingOrder Then
    ShowFormControl "checkbox", "DeliveryAddToExistingOrder", "Don't charge delivery, add to existing order", Session("DeliveryAddToExistingOrder"), "", "", Not CollectionOnlyOrder, "(confirm existing order number in message box below)", ""
  End If
  
  If AAllowDifferentDeliveryAddress Then  
    ' (SS,3/4/17) added help text "(if not, untick this box and complete delivery address on next page)"
    ShowFormControl "checkbox", "DeliveryAddressSameAsInvoice", "Delivery address is the same as the billing address", Session("DeliveryAddressSameAsInvoice"), "", "", True, "(if not, untick this box and complete delivery address on next page)", ""
  End If
  
  
  ' ShowFormControl "text", "Telephone", "Telephone", Session("Telephone"), "Enter telephone number", "50", LEnabled, "", ""  
  ' (SS,30/3/17) replaced above with following to ensure mobile no is entered instead of landline
  ShowFormControl "text", "Telephone", "Mobile", Session("Telephone"), "Enter mobile number", "50", LEnabled, "", Bootstrap4Only("required")
  
  'If MobileEnabled Then
  '  ShowFormControl "text", "Mobile", "Mobile", Session("Mobile"), "Enter mobile number", "50", LEnabled, "", ""
  'End If
  ' (SS,18/5/21) replaced above with following (for CIRC), text to say "(required)" but we're not forcing entry
  If AlternativePhoneEnabled Then
    ShowFormControl "text", "AlternativePhone", "Alternative Phone", Session("AlternativePhone"), "Enter alternative phone number (required)", "50", LEnabled, "", "" 
  End If
  
  ShowFormControl "email", "Email", "Email", Session("Email"), "Enter email address", "100", LEnabled, "", Bootstrap4Only("required")

  If Not AccountLoggedIn And AccountsOptional Then
    ShowFormControl "password", "Password", "Password", Session("Password"), "Enter password (optional)", "20", LEnabled, "Optional, to save your details for next time", ""
  End If
%>

<%If ChooseDeliveryDate Then%>
<tr>
<td nowrap><b><%=tr("Delivery Date")%>:</b></td>
<td>
<%=GetDeliveryDateCombo("DeliveryDate", Session("DeliveryDate"), MaxDeliveryDays)%>
</td>
</tr>
<%End If%>

<%If VouchersEnabled Then
    ' (SS,20/4/16) added GetMessage("Voucher")
    ' (SS,10/10/16) replaced Session("VoucherCode") with GetVoucherCode and added ClearVoucherCodeForLocalMode
    ClearVoucherCodeForLocalMode
    ShowFormControl "text", "VoucherCode", "Voucher Code", GetVoucherCode, "Enter a voucher code to receive a discount", "20", True, GetMessage("Voucher"), ""
  End If

  ' (SS,22/5/18) removed HearAboutUs completed, Subscribe moved to end of checkout, i.e. thank you page (return from payment) (to ShowCustomerSubscription)
  'If Not AccountsEnabled Or Not AccountLoggedIn Then
  '  ShowFormControl "select", "HearAboutUs", "Hear about us", "", "", "", True, "", ""
  '  ShowFormControl "checkbox", "Subscribe", "Please subscribe me to your newsletter and offers", Session("Subscribe"), "", "", True, "", ""
  'End If    

  If AccountLoggedIn And Not AccountsOptional Then
    ShowFormControl "text", "PurchaseOrderNo", "Purchase Order No", Session("PurchaseOrderNo"), "Please enter a purchase order number (optional)", "50", True, "", ""
  End If

  ShowFormControl "textarea", "Message", "Message", Session("Message"), "Enter special instructions", GetMaxMessageLength, True, "", ""
  
  ' (SS,17/5/21) added following HearAboutUs but with custom label, also shows other text box if other chosen
  ' (SS,19/5/21) made into separate routine
  ' (SS,11/6/21) replaced LEnabled with True to always show, due to existing customer not being able to set this unless they go into account settings
  ShowHearAboutUsFormControls True 
  
  ' (SS,22/2/21)
  AddScript("ScriptDelivery")
  
  ' (SS,19/2/21) add the EORI script, added at the end of the body due to jQuery being loaded later, this will call ScriptEORINo
  AddScript("ScriptEORINo")
  
  ' (SS,29/7/22) to show a different label in county field if not UK (for HF)
  AddScript("ScriptCountyLabel")
  
%>

  </div> <!--panel-body-->
</div> <!--panel-->

</div> <!--col-->

</div> <!--row-->
  
<% 
End Sub

' (SS,19/5/21) made into this routine to avoid repetition, called from here and also inc-template-account.asp
Sub ShowHearAboutUsFormControls(AVisible)
  ' (SS,18/5/21) made HearAboutUs optional and added custom label, also shows other text box if other chosen
  ' reason for using AVisible instead of AEnabled us because GetHearAboutUsCombo doesn't support extras like disable
  ' also no point in showing this because AVisible will only be True when not logged in, logged into account and they would already have set this
  If HearAboutUsEnabled And AVisible Then
    ShowFormControl "select", "HearAboutUs", GetHearAboutUsLabel, "", "", "", True, "", ""  
    ShowFormControl "text", "HearAboutUsOther", "Other", Session("HearAboutUsOther"), "Please enter " & LCase(GetHearAboutUsLabel), "50", True, "", ""
    AddScript("ScriptHearAboutUs") ' to show.hide Other text box if "Other" selected in combo box
  End If
End Sub

' (SS,3/10/16) called when local mode enable for extra feature only available for store
' (SS,27/9/19) for Bootstrap 4 replaced "col-lg-8 col-md-8 col-sm-10 col-xs-12" with "col-lg-8"
' (SS,28/9/20) changed to work for both Bootstrap 3 and 4 using new functions GetPanelCardClass, Bootstrap3Only, Bootstrap4Only
' (SS,22/4/21) added LocalModeDespatchByDate (uses HTML 5 date control, may not work in all browsers)
Sub ShowCheckoutLocalModeFeatures
  Dim i, LList
%>
<div class="row">

<div class="col-lg-8<%=Bootstrap3Only(" col-md-8 col-sm-10 col-xs-12")%>">

<div class="<%=GetPanelCardClass("")%>">
  <<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%> class="<%=GetPanelCardClass("H")%>"><%=tr("Local Mode Extra Features (not to be used without authority)")%></<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%>>
  <div class="<%=GetPanelCardClass("B")%>">
<%
  ' ShowFormControl "text", "DeliveryCostOverride", "Delivery Override", Session("DeliveryCostOverride"), "", "10", True, "", ""
  
  ' (SS,24/3/17) replaced above with following 
  ShowFormControl "select", "DeliveryCostOverride", "Delivery Override", Session("DeliveryCostOverride"), "", "", True, "", "list=" & COMBO_PLEASE_SELECT & NL & "FOC" & NL & "Standard delivery" & NL & "Standard delivery and collection" & NL & "Collection only" & NL & "Other"
  ShowFormControl "text", "DeliveryCostOverrideAmount", "Delivery Override Amount", Session("DeliveryCostOverrideAmount"), "", "10", True, "Enter delivery amount above", ""

  ' ShowFormControl "text", "DiscountOverride", "Discount Override", Session("DiscountOverride"), "", "10", True, "", ""
  ' (SS,22/3/17) replaced above free form with fixed %
  LList = ""
  For i = 0 To 100 Step 5
    LList = LList & NL & i & "%"
  Next  
  ShowFormControl "select", "DiscountOverride", "Discount Override", Session("DiscountOverride"), "", "", True, "", "list=" & COMBO_PLEASE_SELECT & LList  
  
  LList = ""
  For i = 9 To 1 Step -1
    LList = LList & NL & i
  Next
  If Session("Priority") = "" Then Session("Priority") = "5" ' default to 5 if blank
  ShowFormControl "select", "Priority", "Priority", Session("Priority"), "", "", True, "", "list=" & TrimAll(LList)
  
  ' (SS,22/4/21) added despatch by date if despatch deates enabled
  If DespatchDatesEnabled Then
    If FunctionExists("CustomGetDespatchByDateList") Then
      Dim LDateList, LDefaultDate, LMinDate, LMaxDate
      ' following outputs a HTML datalist with id="despatchbydates"
      LDateList = CustomGetDespatchByDateList(LDefaultDate, LMinDate, LMaxDate)     
      ShowFormControl "date", "LocalModeDespatchByDate", "Despatch By Date", LDefaultDate, "", "", True, "Above date only applied for priority 9", "list=""despatchbydates"",min=""" & LMinDate & """,max=""" & LMaxDate & """"
      Response.Write LDateList      
    End If    
  End If
  
  ShowFormControl "checkbox", "Exchange", "Exchange", Session("Exchange"), "", "", True, "", ""
  
  'ShowFormControl "select", "ExchangeReason", "Exchange Reason", Session("ExchangeReason"), "", "", True, "", "list=" & "Please select..." & NL & "Damaged in transit" & NL & "Leaking" & NL & "Warranty" & NL & "Other"
  ' (SS,28/3/17) replaced above with following
  'ShowFormControl "select", "ExchangeReason", "Exchange Reason", Session("ExchangeReason"), "", "", True, "", "list=" & COMBO_PLEASE_SELECT & NL & "Warranty (FOC)" & NL & "Warranty (Charged)" & NL & "Damaged in transit" & NL & "Leaking" & NL & "Other"  
  ' (SS,3/8/17) replaced above with following to get value from settings, "Leaking" was removed from the default
  ShowFormControl "select", "ExchangeReason", "Exchange Reason", Session("ExchangeReason"), "", "", True, "", "list=" & COMBO_PLEASE_SELECT & NL & ReplaceStr(GetLocalModeExchangeReasons, ",", NL)   

  ShowFormControl "textarea", "Notes", "Internal Notes", Session("Notes"), "", GetMaxMessageLength, True, "", "" 
  
  ' (SS,22/2/21)
  AddScript("ScriptLocalMode")
%>  

  </div> <!--panel-body-->
</div> <!--panel-->

</div> <!--col-->

</div> <!--row-->

<%
End Sub  

' (SS,15/6/11) tidied up for new div version and improved styles, added class="checkout-form" to table
' removed "Stage 1 of 3"
' (SS,8/9/14) new version for Bootstrap
' (SS,27/9/19) for Bootstrap 4 replaced "col-lg-8 col-md-8 col-sm-10 col-xs-12" with "col-lg-8" and "Company Name" with "Company"
' (SS,28/9/20) modified to work for Bootstrap 3 too
' (SS,19/5/22) change to show postcode before company name if AddressLookupEnabled
' (SS,29/7/22) change to show different county label and placeholder for UK and RW (added for HF)
Sub ShowCheckoutDeliveryAddressEntryForm(AErrorMessage)
%>
<div class="row">

<div class="col-lg-8<%=Bootstrap3Only(" col-md-8 col-sm-10 col-xs-12")%>">  

<div class="<%=GetPanelCardClass("")%>">
  <<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%> class="<%=GetPanelCardClass("H")%>"><%=tr("Enter Delivery Address")%></<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%>>
  <div class="<%=GetPanelCardClass("B")%>">

<%
  If AErrorMessage <> "" Then
    ShowAlertMesssage "danger", AErrorMessage
  End If
  
  SetFormControlsLabelWidth 3 ' default to 3 for following controls

  ShowFormControl "text", "DeliveryName", "Name", Session("DeliveryName"), "Enter full name", "50", True, "", ""
  
  ' (SS,19/5/22) added postcode before DeliveryCompanyName "If AddressLookupEnabled "to allow postcode to appear first when address lookup is enabled
  If AddressLookupEnabled Then ShowFormControl "text", "DeliveryPostcode", "Postcode / ZIP", Session("DeliveryPostcode"), "Enter postcode or ZIP", "20", True, "", ""  
  
  ShowFormControl "text", "DeliveryCompanyName", "Company", Session("DeliveryCompanyName"), "Enter company name (optional)", "50", True, "", "" ' (SS,27/9/19) replaced label text "Company Name" with "Company" to prevent word wrap at small widths   
  ShowFormControl "text", "DeliveryAddress1", "Address Line 1", Session("DeliveryAddress1"), "Enter first line of address", "50", True, "", ""
  ShowFormControl "text", "DeliveryAddress2", "Address Line 2", Session("DeliveryAddress2"), "Enter second line of address", "50", True, "", ""
  ShowFormControl "text", "DeliveryTown", "Town / City", Session("DeliveryTown"), "Enter town or city", "50", True, "", ""
  ShowFormControl "text", "DeliveryCounty", "County / State", Session("DeliveryCounty"), "Enter county, state or region", "50", True, "", ""
 
  ' (SS,19/5/22) added If Not AddressLookupEnabled to allow postcode to appear first when address lookup is enabled 
  If Not AddressLookupEnabled Then ShowFormControl "text", "DeliveryPostcode", "Postcode / ZIP", Session("DeliveryPostcode"), "Enter postcode or ZIP", "20", True, "", ""
  
  ShowFormControl "select", "DeliveryCountry", "Country", "", "", "", True, GetImportantCountryMessage, ""
  
  ' (SS,29/7/22) to show a different label in county field if not UK (for HF)
  AddScript("ScriptCountyLabel")  
%>  
  </div> <!--panel-body-->
</div> <!--panel-->

</div> <!--col-->

</div> <!--row-->
<%
End Sub

' (SS,14/8/05) added this because it's now called from two areas, replaces ShowCheckoutPersonalDetailsConfirmation
' (SS,3/6/09) added APaymentMethod, APaymentReference, ACourier, ATrackingNo, AMessageToCustomer
' (SS,14/6/11) removed tr("Stage 2 of 3"), removed class="checkout_bkd" from table tag
' (SS,20/9/19) modified for Bootstrap 4, "panel" changed to "card", added card-body for checkout ending div added to end of ShowCheckoutOrderDetailsFooter
' (SS,28/9/20) modified to also work with Bootstrap 3
' (SS,19/5/21) replaced If MobileEnabled And GetMobile and Mobile, with AlternativePhoneEnabled and GetAlternativePhone and AlternativePhone
Sub ShowCheckoutOrderDetailsMaster(AInCheckout, AOrderNo, ADateOrdered, AStatus, AAccountID, ADeliveryAddressSameAsInvoice, ABillingAddress, ADeliveryAddress, ATelephone, AEmailAddress, APurchaseOrderNo, AMessage, APaymentMethod, APaymentReference, ACourier, ATrackingNo, AMessageToCustomer)
%>
<%If AInCheckout Then%>
<div class="<%=GetPanelCardClass("")%>">
  <<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%> class="<%=GetPanelCardClass("H")%>"><%=tr("Check Order and Select Payment Method")%></<%=Bootstrap3Only("div")%><%=Bootstrap4Only("h5")%>>
  <div class="<%=GetPanelCardClass("B")%>">
<%End If%>
<table class="table-order-master table table-responsive">
<%If AAccountID <> "" Then%>
<tr>
<th nowrap><%=tr("Account ID")%></th>
<td><%=AAccountID%></td>
</tr>
<%End If%>
<%If Not AInCheckout And AStatus <> "" Then%>
<tr>
<th><%=tr("Order Status")%></th>
<td><%=tr(AStatus)%></td>
</tr>
<%End If%>
<tr>
<th><%=tr("Order Ref")%></th>
<td><%=AOrderNo%></td>
</tr>
<%If ADateOrdered <> "" Then%>
<tr>
<th nowrap><%=tr("Date of Order")%></th>
<td><%=ADateOrdered%></td>
</tr>
<%End If%>
<tr>
<th><%=tr("Billing Address")%></th>
<td>
<%Response.Write(ABillingAddress)%>
</td>
</tr>
<tr>
<th><%=tr("Delivery Address")%></th>
<td>
<%
If ADeliveryAddressSameAsInvoice Then
  Response.Write(tr("Same as Billing address"))
Else
  Response.Write(ADeliveryAddress)
End If%>
</td>
<%If ChooseDeliveryDate Then%>
<tr>
<th><%=tr("Delivery Date")%></th>
<td><%=GetDeliveryDate%></td>
</tr>
<%End If%>
<%If ATelephone <> "" Then%>
<tr>
<th><%=tr("Telephone")%></th>
<td><%=ATelephone%></td>
</tr>
<%End If%>
<%If AlternativePhoneEnabled And GetAlternativePhone <> "" Then%>
<tr>
<th><%=tr("Alternative Phone")%>:</th>
<td><%=GetAlternativePhone%></td>
</tr>
<%End If%>
<tr>
<th><%=tr("Email")%></th>
<td><%=AEmailAddress%></td>
</tr>
<%If APurchaseOrderNo <> "" Then%>
<tr>
<th><%=tr("Purchase Order No")%></th>
<td><%=APurchaseOrderNo%></td>
</tr>
<%End If%>
<%If AMessage <> "" Then%>
<tr>
<th><%=tr("Message")%></th>
<td><%=AMessage%></td>
</tr>
<%End If%>
<%If Not AInCheckout Then%>
	<tr>
	<th><%=tr("Payment Method")%></th>
	<td><%=APaymentMethod%></td>
	</tr>
	<tr>
	<th nowrap><%=tr("Payment Reference")%></th>
	<td><%=APaymentReference%></td>
	</tr>
	<%If ACourier <> "" Then%>
	<tr>
	<th><%=tr("Courier")%></th>
	<td><%=ACourier%></td>
	</tr>
	<%End If%>
	<%If ATrackingNo <> "" Then%>
	<tr>
	<th><%=tr("Tracking " + Iif(IsURL(ATrackingNo), "URL", "No"))%></th>
	<td>
		<%If IsURL(ATrackingNo) Then%>
			<a href="<%=ATrackingNo%>">
		<%End If%>
		<%=ATrackingNo%>
		<%If IsURL(ATrackingNo) Then%>
		 </a>
		<%End If%>
	</td>
	</tr>
	<%End If%>
	<%If AMessageToCustomer <> "" Then%>
	<tr>
	<th><%=tr("Message to Customer")%></th>
	<td><%=AMessageToCustomer%></td>
	</tr>
	<%End If%>
<%End If%>
</table>
<%
End Sub

' (SS,14/6/11) replaced class="checkout_bkd" with "checkout-order-detail"
' removed all bgcolor="#CAE8FF", replaced td with th, removed <b>, added nowrap to 
Sub ShowCheckoutOrderDetailsHeader(AInCheckout)
%>
<p></p>
<table class="table-order-detail table table-responsive<%=Bootstrap4Only(" mb-0")%>" style="<%=Bootstrap3Only("margin-bottom: 0px")%>">
<tr>
<th><%=tr("Code")%></th>
<th><%=tr("Product Name")%></th>
<th style="text-align:center"><%=tr("Qty")%></th>
<th style="text-align:right"><%=tr("Price")%></th>
<th style="text-align:right"><%=tr("Total")%></th>
<%If Not AInCheckout Then%>
<th style="text-align:center"><%=tr("Buy")%></th>
<%End If%>
</tr>
<%
End Sub

' (SS,16/5/11) replaced GetBuyLink with GetBuyLinkPreviousOrders, to allow replacement product to be ordered
' (SS,14/6/11) removed all bgcolor="#F0F4F7", added nowrap to product code, replaced button image with class="button"
' (SS,6/7/11) added OptionsList
' (SS,9/9/14) for Bootstrap replaced "button" class with Bootstrap extra small button with glyphicon
Sub ShowCheckoutOrderDetailsItem(AInCheckout, AProductCode, AProductName, AOptionsList, AQty, APrice, AProductTotal)
%>
<!-- START OF ORDER ITEM DATA -->
<tr>
<td nowrap><a href="<%=GetProductLink(AProductCode)%>"><%=AProductCode%></a></td>
<td><%=AProductName%>
<%If AOptionsList <> "" Then%>
<br><span class="checkout-order-options"><%=AOptionsList%></span>
<%End If%>
</td>
<td style="text-align:center"><%=AQty%></td>
<td style="text-align:right"><%=APrice%></td>
<td style="text-align:right"><%=AProductTotal%></td>
<%If Not AInCheckout Then%>
<td style="text-align:center"><a href="<%=GetBuyLinkPreviousOrders(AProductCode)%>" class="btn btn-default btn-success btn-xs"><span class="glyphicon glyphicon-shopping-cart"></span>&nbsp;Buy</a></td> 
<%End If%>
</tr>
<!-- END OF ORDER ITEM DATA -->
<%
End Sub

' (SS,23/04/09) added ADiscount
' (SS,14/6/11) removed all bgcolor="#F0F4F7" and all <b>, heading cells changed from td to th
' added missing last column when not in checkout
' (SS,9/10/14) added GetDeliveryInfo
' (SS,22/4/21) replaced tr("Delivery") with GetDeliveryOptionLabel
' (SS,28/7/23) added Discount Info for voucher
Sub ShowCheckoutOrderDetailsSubtotal(ASubtotal, AVoucherCode, ADiscount, ADelivery)
  ' (SS,28/7/23)
  Dim LDiscountInfo
  LDiscountInfo = GetMessage("Voucher")
  If LDiscountInfo <> "" Then
    LDiscountInfo = " &nbsp;(" & LDiscountInfo & ")"
  End If
%>
<tr>
<td colspan="2">&nbsp;</td>
<th colspan="2" style="text-align:right"><%=tr("Subtotal")%></th>
<td style="text-align:right"><%=ASubtotal%></td>
<%If Not InCheckout Then%><td></td><%End If%>
</tr>
<%If AVoucherCode <> "" Then%>
<tr>
<td>&nbsp;</td>
<td><%=tr("Voucher Code")%>: <%=AVoucherCode%><%=LDiscountInfo%></td>
<th colspan="2" style="text-align:right"><%=tr("Discount")%></th>
<td style="text-align:right"><%=ADiscount%></td>
<%If Not InCheckout Then%><td></td><%End If%>
</tr>
<%End If%>
<tr>
<td colspan="1">&nbsp;</td>
<td colspan="1"><%=GetDeliveryInfo%></td>
<th colspan="2" style="text-align:right"><%=GetDeliveryOptionLabel%></th>
<td style="text-align:right"><%=ADelivery%></td>
<%CheckoutBlankFillLastCol%>
</tr>
<%
End Sub

' (SS,14/6/11) removed all bgcolor="#F0F4F7" and all <b>, heading cells changed from td to th
' added missing last column when not in checkout
Sub ShowCheckoutOrderDetailsVATIncluded(AVATIncluded)
%>
<tr>
<td colspan="2">&nbsp;</td>
<th colspan="2" style="text-align:right"><%=tr("VAT Included")%></th>
<td style="text-align:right"><%=AVATIncluded%></td>
<%CheckoutBlankFillLastCol%>
</tr>
<%
End Sub

' (SS,14/6/11) removed all bgcolor="#F0F4F7" and all <b>, heading cells changed from td to th
' added missing last column when not in checkout
Sub ShowCheckoutOrderDetailsVATDeducted(AVATDeducted)
%>
<tr>
<td colspan="2">&nbsp;</td>
<th colspan="2" style="text-align:right"><%=tr("VAT Deducted")%></th>
<td style="text-align:right"><%=AVATDeducted%></td>
<%CheckoutBlankFillLastCol%>
</tr>
<%
End Sub

' (SS,28/5/07) new function to replace ShowCheckoutOrderDetailsVATIncluded & ShowCheckoutOrderDetailsVATDeducted
' called only if it exists else the old ones will be used
' (SS,14/6/11) removed all bgcolor="#F0F4F7" and all <b>, heading cells changed from td to th
' added missing last column when not in checkout
Function ShowCheckoutOrderDetailsVAT(AVATLabel, AVATAmount)
%>
<tr>
<td colspan="2">&nbsp;</td>
<th colspan="2" style="text-align:right"><%=AVATLabel%></b></th>
<td style="text-align:right"><%=AVATAmount%></td>
<%CheckoutBlankFillLastCol%>
</tr>
<%
End Function

' (SS,14/6/11) removed all bgcolor="#F0F4F7" and all <b>, heading cells changed from td to th
' added missing last column when not in checkout
Sub ShowCheckoutOrderDetailsGrandTotal(AGrandTotal)
%>
<tr>
<td colspan="2">&nbsp;</td>
<th colspan="2" style="text-align:right"><%=tr("Grand Total")%></th>
<td style="text-align:right"><%=AGrandTotal%></td>
<%CheckoutBlankFillLastCol%>
</tr>
<%
End Sub

' (SS,14/6/11) added missing last blank column when not in checkout, column used for buy buttons
Sub CheckoutBlankFillLastCol
  If Not InCheckout Then
    Response.Write "<td></td>"
  End If  
End Sub

' (SS,16/11/07) added AMessage parameter
' (SS,4/6/09) added AMessageToCustomer parameter 
' (SS,20/1/11) made printer friendly format link into a button, relies on button class being defined, otherwise it'll appear as before
' (SS,14/6/11) moved printer friendly button outside of table
' (SS,17/6/11) removed message to customer, because it was also in the header, colspan is 6 for accounts history due to buy column
' (SS,12/3/13) added GetButton(GetAccountLink, "", tr("Back to My Account"), "")
' (SS,9/9/14) changes for Bootstrap, changed text "Click here to view this order in a printer friendly format" to "View order in printer friendly format" to reduce size of button
' (SS,20/9/19) change for Bootstrap 4, closing div for card in ShowCheckoutOrderDetailsMaster
Sub ShowCheckoutOrderDetailsFooter(AInCheckout, AOrderNo, AMessage, AMessageToCustomer)
%>
<%If AMessage <> "" Then%>
<tr>
<td colspan="<%=IIf(AInCheckout, "5", "6")%>"><%=AMessage%></td>
</tr>
<%End If%>
</table>

<%If Not AInCheckout Then%>
<form class="form-inline">
  <div class="form-group">
<%ShowCheckoutOrderPrinterFriendlyButton AOrderNo%>&nbsp;
  </div>
  <div class="form-group">
<%=GetButton(GetAccountLink, "", tr("Back to My Account"), "")%>
  </div>
</form>
<%End If%>

<%If AInCheckout Then ' (SS,20/9/19) closing divs for card used in checkout only in ShowCheckoutOrderDetailsMaster %>
  </div>
</div>
<%End If%>

<%
End Sub

' (SS,29/3/17) moved here from ShowCheckoutOrderDetailsFooter above, also called from Sub ShowOrderThankYou
Sub ShowCheckoutOrderPrinterFriendlyButton(AOrderNo)
  Response.Write GetButton(GetOrderDetailsURL(AOrderNo), "", tr("View order in printer friendly format"), "targetblank")
End Sub

' (SS,29/3/17) similar to ShowCheckoutOrderPrinterFriendlyButton above but this goes straight to print preview and shows "Print Order/Invoice" in caption, used in local mode
Sub ShowCheckoutPrinterOrderButton(AOrderNo)
  Response.Write GetButton(GetOrderDetailsURL(AOrderNo) & "", "", tr("Print Order/Invoice"), "targetblank")
End Sub

' (SS,11/12/07)
' (SS,17/6/11) remove the 3 leading <br>'s and replaced 2 ending ones with </li><p></p>
' (SS,5/2/15) remove bullet point tags (li)
Sub ShowCheckoutMessage
  Dim LMessage
  LMessage = GetCheckoutMessage
  If LMessage <> "" Then Response.Write(LMessage + "<p></p>")
End Sub

' (SS,17/6/11) added missing </li>'s
' (SS,23/5/12) changed "our secure server" to "a secure server"
Sub ShowCheckoutAccountsMessage()
%>
<li>Please check the details above. If you would like a printed record of your order then please print this page now. A copy of this order will be sent to you by email which you can view or print later.</li>
<br><br>
<li>To place the order on account press the "Place Order on Account" button below.
To pay for your order now using a credit card via a secure server press the "Pay Now with Credit Card" button below.</li>
<%
End Sub

' (SS,23/7/10) second section to two parts corrected plural if single button
' (SS,17/6/11) replaced <br><br> with <p></p>, added missing </li>'s
' (SS,19/1/14) removed one of the old bullet points, which is no longer appropriate, removed text from second bullet and modified slightly
' (SS,5/2/15) changes to improve the wording, removed bullet points tags (li's)
' (SS,20/4/18) new version with revised text and p tag and bold
' (SS,22/5/19) was appearing above terms and condition tick box which isn't ideal. Move to payment b
Sub ShowCheckoutSecurePaymentMessage
End Sub

' (SS,22/3/13)
' (SS,26/1/16) link changed from page=termsconditions to page=customerinfo
' replaced "I have read and agree to these terms and conditions." to "Tick to confirm you have read and agree to our terms and conditions"
' removed the text "By completing and submitting the following electronic order form you are making an offer to purchase goods which, if accepted by us, will result in a binding contract."
' also removed the <br> before form tag
' (SS,27/1/16) made bold and added "Please"
' (SS,9/12/19) modified text "Please tick to confirm you have read and agree to our terms and conditions"
' to "By leaving this ticked I confirm I have read and agree to the terms and conditions" (requested by Neil).
' (SS,11/12/19) Change to Sub ShowCheckoutTermsAndConditionsCheckBox to show same text as before for sites that don't default with checkbox ticked
' (SS,10/5/20) modified for Bootstrap 4
' (SS,29/9/20) merged changes made in Bootstrap 4 with this common version, including div class="form-check mt-4", added label
Sub ShowCheckoutTermsAndConditionsCheckBox
  Dim LChecked, LText
  If GetCheckoutTermsAndConditionsDefault Then
    LChecked = " checked"
    LText = "By leaving this ticked I confirm I have read and agree to the"
  Else
    LChecked = ""
    LText = "Please tick to confirm you have read and agree to our"
  End If
%>
  <form name="frmTermsAndConditions"> 
    <div class="<%=Bootstrap4Only("form-check mt-4")%>">
      <input class="<%=Bootstrap4Only("form-check-input")%>" type="checkbox" value="0" name="agreeterms" id="agreeterms"<%=LChecked%>> 
      <label class="form-check-label" for="agreeterms">
        <strong><%=LText%> <a href="products.asp?page=customerinfo">terms and conditions</a></strong>
      </label>
    </div>
  </form>
<%
End Sub

' (SS,13/8/05) following is shown on customer info page
Sub ShowCustomerInfoCardType(ACardType)
  Const MAX_PER_ROW = 5
  If InStr("," + GetDirectPayAllowedCardTypes + ",", "," + ACardType + ",") > 0 Then
%>
<td align=center valign=top width="240"><img src="images/cc-<%=ACardType%>.gif" border=0 hspace=0 vspace=0 align=absmiddle alt="<%=ACardType%>"><br><%=ACardType%></td>
<%
    ' move to new line if 5 reached '
    If FCardCounter Mod MAX_PER_ROW = 0 And FCardCounter > 0 Then
      Response.Write("</tr><tr>")
    End If
    FCardCounter = FCardCounter + 1

  End If
End Sub

' (SS,13/8/05) following is shown on customer info page
' (SS,18/4/18) removed call to ShowCustomerInfoDirectCardTypes for GetPaymentType = ptDirect  
Sub ShowCustomerInfoCardTypes
  If GetPaymentType = ptWorldPay Then
    ShowCustomerInfoWorldPayCardTypes
  End If
End Sub

Sub ShowCustomerInfoWorldPayCardTypes
%>
<br>
<script language="JavaScript" src="http://www.worldpay.com/cgenerator/cgenerator.php?instId=<%=GetWorldPayInstallID%>"></script>
<%
End Sub

Sub ShowCheckoutError(AColSpan, AIsError, AErrorMessage)
  If AIsError Then
  %>
    <tr>
      <td>&nbsp;</td>
      <td colspan="<%=AColSpan%>" class="errormessage"><i><%=AErrorMessage%></i></td>
    </tr>
  <%
  End If
End Sub

' (SS,29/5/09)
' (SS,17/2/12) replaced CorrectCurrency(Session("PaymentAmount") with Session("PaymentAmountFormatted")
' this fixes bug which was causing exchange rate to be applied twice, because Session("PaymentAmount") already has the exchange rate applied
' CorrectCurrency was applying it again
Sub ShowChequeConfirmationForm
%>
<table border="0" cellspacing="1" cellpadding="3" width="100%">
<tr>
<td class="headingsmall" colspan=2>Cheque Payment Confirmation</td>
</tr>
<tr>
<td colspan=2>
Please press "Confirm Order" below to confirm that you would like to pay by cheque for the amount of
<b><%=Session("PaymentAmountFormatted")%></b>.<br><br>
Your order will then be confirmed and an email sent to you. Goods will be despatched when the cheque clears.
</td>
</tr>		
</table>
<%
End Sub

' (SS,29/5/09)
' (SS,17/2/12) replaced CorrectCurrency(Session("PaymentAmount") with Session("PaymentAmountFormatted")
' this fixes bug which was causing exchange rate to be applied twice, because Session("PaymentAmount") already has the exchange rate applied
' CorrectCurrency was applying it again
Sub ShowBankTransferConfirmationForm
%>
<table border="0" cellspacing="1" cellpadding="3" width="100%">
<tr>
<td class="headingsmall" colspan=2>Bank Transfer Payment Confirmation</td>
</tr>
<tr>
<td colspan=2>
Please press "Confirm Order" below to confirm that you would like to pay by bank transfer for the amount of
<b><%=Session("PaymentAmountFormatted")%></b>.<br><br>
Your order will then be confirmed and an email sent to you. Goods will be despatched when the payment clears.
Following are the bank details to which you need to make the transfer to:<br><br>
<%=GetBankTransferDetailsAsHTML%>
</td>
</tr>		
</table>
<%
End Sub

' (SS,19/4/18) following replaces ShowCheckoutMakePayPalPaymentText
' (SS,20/4/18) further refinement to text, button caption changed from "Pay Now" to "Pay Now to Confirm Order". Please click sentence removed.
Sub ShowCheckoutMakePayPalPaymentButton(AHRef)
%>
<div class="alert alert-danger">
  <p>
  <strong>Action Required!</strong>
  </p>
  <p>
<a href="<%=AHRef%>" class="btn btn-default btn-primary btn-lg"><strong>Pay Now to Confirm Order</strong></a>
  </p>
</div>
<%
End Sub

' (SS,7/5/10) AHRef no longer applicable because GetButtonConfirmOrder now gets it in apputils 
' (SS,8/9/14) removed table HTML, replaced with divs etc for Bootstrap
' (SS,20/9/19) for bootstrap 4 replaced class="pull-right" with "float-right" and style="margin-bottom: 20px" with class "mt-3"
' (SS,27/9/19) for Bootstrap 4 replaced "col-lg-8 col-md-8 col-sm-10 col-xs-12" with "col-lg-8"
' also GetButtonProceedToNextStage button the chevron was missing, had to replace glyphicon glyphicon-chevron-right with fa fa-chevron-right
' (SS,29/9/20) modified to work for both Bootstrap 3 and 4
Sub ShowCheckoutNextStageButton(AHRef)
%>
<div class="row">
  <div class="col-lg-8<%=Bootstrap3Only(" col-md-8 col-sm-10 col-xs-12")%>">
    <div class="<%=Bootstrap3Only("pull-right")%><%=Bootstrap4Only("float-right mt-3")%>" style="<%=Bootstrap3Only("margin-bottom: 20px")%>">
    <%=GetButtonProceedToNextStage(AHRef)%>
    </div>
  </div>
</div>
<%
End Sub

Sub ShowCheckoutConfirmOrderButton(AHRef)
%>
<table>
<tr>
<td><%=GetButtonConfirmOrder(AHRef)%></td>
</tr>
</table>
<%
End Sub

Sub ShowCheckoutPlaceOrderOnAccountButton(AHRef)
%>
<table>
<tr>
<td><a href="<%=AHRef%>"><img src="images/pay-later.gif" border="0"></a></td>
</tr>
</table>
<%
End Sub

' (SS,10/9/14) replaced table with a div
Sub ShowCheckoutMakePaymentButton(AHRef)
%>
<div style="margin-top: 20px">
<%=GetButtonMakePayment(AHRef)%>
</div>
<%
End Sub

' (SS,20/4/18) added to tidy up buttons, but didn't use in the end. Kept for future use.
' (SS,22/5/18) added margin-top of 20px
Sub ShowCheckoutPaymentButtonHeader
%>
<!-- start of payment buttons -->
<div style="margin-top: 20px">
<%
  ' (SS,22/5/18) following moved here from Sub ShowCheckoutSecurePaymentMessage 
  If PaymentTypeCount > 1 then
%>
<p><strong>Please pay for your order by using one of the buttons below:</strong></p>
<%
  Else
%>  
<p><strong>Please pay for your order by using the button below:</strong></p>    
<%
  End If
End Sub

' (SS,10/11/08) following new sub works with any image, now called for Google, PayPal, DirectPay
' (SS,10/9/14) replaced table with a div with margin to space the buttons
' (SS,19/1/15) added ACaption parameter, also passed onto GetButtonPayment
' (SS,20/4/18) new version with bigger buttons, now primary instead of success, no longer calls GetButtonPayment
' (SS,16/10/19) changed colour of button from blue to green btn-primary to btn-success due to the larger contrast in Bootstrap 4
' (SS,29/09/20) made compatible with both Bootstrap 3 and 4
' (SS,20/06/22) changed max-height for logo from 70 to 26 for HF to ensure logo doesn't get too wide and wrap below button on mobile device
' (SS,20/06/22) changed min-width of button from 250 to 243
Sub ShowCheckoutPaymentButton(AHRef, ACaption, AImageFile)
  ' (SS,20/6/22) set to reduced height if it contains a <br> i.e. split over two lines, else keep to 50 as before
  Dim LMaxImageHeight
  If InStr(ACaption, "<br>") > 0 Then
    ' (SS,20/6/22) fine tune for Takepayments
    If InStr(AImageFile, "takepayments") > 0 Then
      LMaxImageHeight = 28
    Else
      LMaxImageHeight = 26
    End If
  Else
    If InStr(AImageFile, "cheque") > 0 Then      
      LMaxImageHeight = 40
    ' (SS,23/6/22) added following for single line for takepayments and clover
    ElseIf InStr(AImageFile, "takepayments") > 0 Then
      LMaxImageHeight = 28
    ElseIf InStr(AImageFile, "clover") > 0 Then    
      LMaxImageHeight = 26
    Else
      LMaxImageHeight = 50
    End If
  End If
%>
<a href="<%=AHRef%>" class="btn <%=Bootstrap3Only("btn-primary")%><%=Bootstrap4Only("btn-success")%> btn-lg" role="button" style="min-width:243px; margin-top:10px; margin-bottom:10px"><%=ACaption%></a>
<%
  ' (SS,23/6/22) added <br> for separation
  If AImageFile <> "" Then
%>  
<a href="<%=AHRef%>"><img src="<%=AImageFile%>" style="max-height:<%=LMaxImageHeight%>px; margin-left:10px; vertical-align:center" alt="<%=ACaption%>" border="0"></a>
<br>
<%
  End If
End Sub

' (SS,20/4/18) added to tidy up buttons, but didn't use in the end. Kept for future use.
Sub ShowCheckoutPaymentButtonFooter
%>
</div>
<!-- end of payment buttons -->
<%
End Sub

' (SS,5/10/16) show payment method combo box and payment reference for use in local mode
' (SS,3/8/17) improved to get values stored in settings
Sub ShowCheckoutLocalModePayment
%>
<div style="margin-top: 20px">
<%
  Dim LList
  'LList = LList & NL & "BANK TRANSFER" & NL & "CASH" & NL & "CHEQUE" & NL & "PAYPAL MANUAL" & NL & "EPDQ" & NL & "CARD OVER PHONE" & NL & "CARD IN SHOP"  & NL & "OTHER"
  ' (SS,3/8/17) replaced above with following to get from settings, replacing comma with NL
  LList = COMBO_PLEASE_SELECT & NL & ReplaceStr(GetLocalModePaymentMethods, ",", NL) 
  
  ShowFormControl "select", "LocalModePaymentMethod", "Payment Method", Session("LocalModePaymentMethod"), "", "", True, "", "list=" & LList
  ShowFormControl "text", "LocalModePaymentReference", "Payment Reference", Session("LocalModePaymentReference"), "", "50", True, "", ""
%>  
</div>
<%
End Sub 

' (SS,15/6/11) replaced table with div
Sub ShowCheckoutFooter
%>
</div> <!-- end #checkout -->
<%
End Sub

' (SS,6/4/18) added following, AMessage not currently used
' (SS,20/4/18) made button bigger and change colour. Also added button to go back to other payment options.
' (SS,23/9/20) replaced window.history.back() with LRetryURL for NetPay which uses Server Post
' (SS,21/6/22) added URL for Clover
' (SS,23/6/22) modified for Clover multiple payment methods, removed the "Go back to other payment options", added call to SetUpPaymentButtons to show the buttons here
' Changed wording "Alternatively, press the button below to go back and choose a different payment option."
' to "Alternatively, choose a different payment option below."
' Also removed the Retry button.
' Replaced AMessage with AStatus
Sub ShowPaymentFailureAlert(AStatus)
  ' (SS,23/6/22) renamed <p><strong>Payment Failure!</strong></p> to <h3 style="margin-top:0px">Payment Failed</h3>
  ' also removed the Retry button
  ' also checks for loss of order no i.e. no session, to show message instead of payment buttons
  ' different message shown if cancelled
  Dim LHeader  
  ' check for cancelled to show a different header and message line   
  If InStr(1, AStatus, "cancelled", vbTextCompare) > 0 Then
    LHeader = "Payment Cancelled"
  Else
    LHeader = "Payment Failed"
  End If 
%>
<div class="alert alert-danger">
  <h3 style="margin-top:0px"><%=LHeader%></h3>
  <p><strong><%=AStatus%></strong></p>
<%If GetOrderNo <> "" Then%>  
  <p>Please try again by choosing a payment option below.</p>
<%Else%>
  <p>Unfortunately, your order is no longer accessible.</p>
  <p>This might be due to the loss of your browser session.</p>
  <p>Please try placing your order again.</p>
  <p>Very sorry for the inconvience caused.</p>
<%End If%>  
</div>
<%
End Sub

' (SS,29/5/09) removed ACompanyName parameter, replaced with GetStoreName
' added extra details for cheque and bank transfer payments
' (SS,23/7/10) added "Your order has been received. " as requested 
' (SS,27/4/12) added break and bold after "Please send a cheque payable to"
' (SS,22/5/12) replaced CorrectCurrency(Session("PaymentAmount") with Session("PaymentAmountFormatted")
' this fixes bug which was causing exchange rate to be applied twice, because Session("PaymentAmount") already has the exchange rate applied
' CorrectCurrency was applying it again, made this changes to ShowBankTransferConfirmationForm on 17/2/12, forgot to do it here
' (SS,19/12/14) changed wording "The reference number for your order is" to "The order number is"
' added to bank transfer "We will also send an email with this info. Check your spam folder if you don�t receive it."
' replaced GetBankTransferDetailsAsHTML with Session("BankTransferDetails") 
' (SS,29/3/17) for IsLocalMode button is shown to shown order in printer friendly format
' (SS,19/1/18) replaced %Else% Details of your order have been emailed to you. %End If% Check your spam folder if you don't receive it.
' with a alert box with improved junk details, also replaced some <br>'s with <p>'s
' (SS,13/3/18) removed two preceding breaks i.e. <br><br> from before GetOrderConfirmationExtraMessage
' (SS,19/4/18) changed Important Notice alert from alert-info to alert-danger
' (SS,19/4/18) removed table i.e. <table class="checkout_bkd">. Replaced with div and p.
' (SS,13/12/18) added cancel order link to end of cheque / bank transfer payment method
Sub ShowOrderThankYou(AOrderNo, ACompanyName)
	Dim LPaymentAmount
	LPaymentAmount = Session("PaymentAmountFormatted")
%>
<div>
<p>
<strong>Order <%=AOrderNo%> received and email confirmation sent.</strong>
</p>
<p>
Thank you for shopping at <%=GetStoreName%>.
</p>
<%If IsChosenPaymentCheque Then%>
<p>
Please send a cheque payable to <%=GetChequesPayableTo%> for the amount of <b><%=LPaymentAmount%></b> to the address below.
</p>
<p>
<strong>Click <a href="<%=GetPaymentSlipURL(AOrderNo)%>" target="_blank"><u>here</u></a> to print a payment slip to send with the cheque.</strong>
</p>
<p>
<%=GetStoreAddressAsHTML%>
</p>
<%ElseIf IsChosenPaymentBankTransfer Then
  ' (SS,19/12/14) replaced bank transfer wording with Session("BankTransferPaymentLine")
%>
<p>
<%=Session("BankTransferPaymentLine")%>
</p>
<p>
<%=Session("BankTransferDetails")%>
</p>
<%End If%>
<%If IsChosenPaymentCheque Or IsChosenPaymentBankTransfer Then%>
<p>The confirmation email also includes these payment details.</p>
<p><strong>Click <a href="<%=GetCancelOrderURL(AOrderNo)%>"><u>here</u></a> to cancel this order.</strong></p>
<%End If%>

<div class="alert alert-danger">
<p>
<strong>Important Notice!</strong>
</p>
<p>
Check your junk folder if you haven't received the order confirmation email.
</p>
<p>
Please add <a href="mailto:<%=GetStoreEmail%>"><%=GetStoreEmail%></a> to your address book or safe senders list.
</p>
</div>

<% ' (SS,23/5/18) show customer subscription settings and link to opt out
  ShowCustomerSubscription(GetCustomerIDForOrder(AOrderNo))
%>

<%If GetOrderConfirmationExtraMessage <> "" Then
  Response.Write GetOrderConfirmationExtraMessage
End If%>

<% ' (SS,29/3/17) show print order/invoice button
If IsLocalMode then
  Response.Write "<br>"
  ShowCheckoutPrinterOrderButton AOrderNo
End If%>
</div>
<%
End Sub

' (SS,23/5/18) moved the subscribe me tick box here, modified to get the customer record and allow changing via link
Sub ShowCustomerSubscription(ACustomerID)
  Dim LOptedIn

  If ACustomerID = "" Or IsNull(ACustomerID) Then Exit Sub
  
  LOptedIn = IsCustomerOptedIn(ACustomerID)

%>  
  <div class="alert alert-success">
  <p>
  <strong>Newsletters and Offers</strong>
  </p>
  <p>
  You are <%=IIf(LOptedIn, "opted in to receive", "opted out from receiving")%> newsletters and offers. Click <a href="<%=GetSubscribeLink(ACustomerID, Not LOptedIn)%>">here</a> to <%=IIf(LOptedIn, "opt out", "opt in")%>.</a>
  </p>
  </div>
<%
End Sub
' --- END OF CHECKOUT TEMPLATES --- '
%>

<%
' --- JQUERY SCRIPT GOES HERE to allow jquery.js to be placed near the bottom of main template --- '

' (SS,22/2/21) moved here from above, applicable to delivery fields
Sub ScriptDelivery
%>
<script>
// (SS,30/3/17) following code shows hides VAT number depending on country chosen
// also the shows/hides the appropriate delivery checkboxes

$(document).ready(function() {
  // itp_show_hide_VAT_field();
  // (SS,11/2/21) replaced above with following
  // (SS,15/2/21) made into separate routine called ShowEORINoScript (also called from inc-template-account.asp)
  // itp_setup_EORI_check();
  
  itp_show_hide_delivery_checkboxes();
});

$("#DeliveryWillCollect").change(function() {
  $('#DeliveryAddToExistingOrder').prop('checked', false);  
  itp_show_hide_delivery_checkboxes();    
});

$("#DeliveryAddToExistingOrder").change(function() {
  $('#DeliveryWillCollect').prop('checked', false);
  itp_show_hide_delivery_checkboxes();  
});

$("#DeliveryAddressSameAsInvoice").change(function() {
  itp_show_hide_delivery_checkboxes();
});

// only show the help text when checked, also hide/show the appropriate tick boxes
function itp_show_hide_delivery_checkboxes()
{ 
  var add_to_existing_checked = false;
  var i_will_collect = false;
  
  add_to_existing_checked = $("#DeliveryAddToExistingOrder").prop('checked');
  i_will_collect = $("#DeliveryWillCollect").prop('checked');
  
  /*
  if (add_to_existing_checked) {
    $("#DeliveryAddToExistingOrder").parents('.form-group').find('.help-block').show();
  }
  else {
    $("#DeliveryAddToExistingOrder").parents('.form-group').find('.help-block').hide();
  }
  */

  if (add_to_existing_checked || i_will_collect) {
    $('#DeliveryAddressSameAsInvoice').parents('.form-group').hide();
    $('#DeliveryAddressSameAsInvoice').prop('checked', true);
  }
  else {
    $('#DeliveryAddressSameAsInvoice').parents('.form-group').show();
  }

}

</script>

<%
End Sub

' (SS,28/3/17) to hide/show appropriate fields and set priority
' (SS,22/2/21) moved here from above, applicable to local mode
Sub ScriptLocalMode
%>
<script>

$( document ).ready(function() {
  itp_show_hide_local_mode_fields();
});

$('select[id="DeliveryCostOverride"]').on('change',function() {
  itp_show_hide_local_mode_fields();
});

$("#Exchange").change(function() {
  itp_show_hide_local_mode_fields();
});

function itp_show_hide_local_mode_fields()
{
  if ($('select[id="DeliveryCostOverride"]').val()=="Other")
    $('#DeliveryCostOverrideAmount').parents('.form-group').show()
  else
    $('#DeliveryCostOverrideAmount').parents('.form-group').hide();
    
  if ($("#Exchange").prop('checked')) {
    $("#Priority").val("9");
    $('#ExchangeReason').parents('.form-group').show();  
  }
  else {
    $("#Priority").val("5");
    $('#ExchangeReason').parents('.form-group').hide();  
  }
}
</script>

<%
End Sub


' (SS,15/2/21) shows the EORI No script to show/hide appropriate fields
' also used by inc-template-account.asp
' (SS,11/2/21) configures events to show/hide EORI fields depending on company, country and postcode fields
Sub ScriptEORINo
  ' (SS,22/2/21) VAT number repalced with EORI  
  ' (SS,4/4/17) added following to show VAT Number field if not UK, not shown for UK
  ' // itp_show_hide_VAT_field();
  ' (SS,4/4/17) added following to show VAT Number field if not UK, not shown for UK
  ' same code also exists in inc-template-checkout.asp
  
'/* (SS,11/2/20) removed, no longer applicable due to Brexit
'function itp_show_hide_VAT_field()
'{
'  if ($('select[id="Country"]').val()=="United Kingdom")
'    $('#VATNumber').parents('.form-group').hide()
'  else
'    $('#VATNumber').parents('.form-group').show();
'}
' */  
  
%>
<script>

$(document).ready(function() {
  itp_setup_EORI_check();
});

$('select[id="Country"]').on('change',function() {
  itp_show_hide_EORI_fields();
});

$("#CompanyName").change(function() {
  itp_show_hide_EORI_fields();
});

$("#Postcode").change(function() {
  itp_show_hide_EORI_fields();
});

function itp_setup_EORI_check()
{
  $('select[id="Country"]').on('change',function() {
    itp_show_hide_EORI_fields();
  });

  $("#CompanyName").change(function() {
    itp_show_hide_EORI_fields();
  });

  $("#Postcode").change(function() {
    itp_show_hide_EORI_fields();
  });
  
  itp_show_hide_EORI_fields();
}


// *** what about Express Music? UK Mainland perhaps check for "UK " prefix
function itp_show_hide_EORI_fields()
{ 
  var LShowEORI = false;
  var LShowXI = false;
  var LCompanyEntered = $('#CompanyName').val().trim() != "";
  var LIsUK = $('select[id="Country"]').val() == "United Kingdom";
  var LIsNI = $('#Postcode').val().toUpperCase().substr(0, 2) == "BT";
  
  if (LCompanyEntered) {
    if (LIsUK) {
      if (LIsNI) {
        LShowEORI = true;
        LShowXI = true;
      }
    }
    else {
      LShowEORI = true;
    }
  };
  
  if (LShowEORI)
    $('#EORINumber').parents('.form-group').show()
  else
    $('#EORINumber').parents('.form-group').hide();
    
  if (LShowXI)
    $('#XIEORINumber').parents('.form-group').show()
  else
    $('#XIEORINumber').parents('.form-group').hide();
 
}

</script>
<%
End Sub

' (SS,17/5/21) ScriptHearAboutUs
' (SS,19/5/21) replaced $('#HearAboutUsOther').parents('.form-group').hide() in .ready 
' to call onChange when modifying existing form otherwise "Other" will show without HearAboutUsOther text box
' (SS,20/5/21) added line to clear other if changing from Other to another
Sub ScriptHearAboutUs
' following shows the HearAboutUsOther text field if Other selected
' also the shows/hides the appropriate delivery checkboxes
%>
<script>
$(document).ready(function() {
  $("#HearAboutUs").change(); 
  $('#HearAboutUs option:contains("Other")').text('Other (please specify below)');  
});

$("#HearAboutUs").change(function() {
  if ($('#HearAboutUs').val() == 'Other') {
    $('#HearAboutUsOther').parents('.form-group').show();
  }
  else {
    $('#HearAboutUsOther').parents('.form-group').hide();
    $('#HearAboutUsOther').val('');
  }
});
</script>
<% 
End Sub

' (SS,29/7/22) added following to show different label for County field in non UK, added for HF, customers confusing county for country and entering country in county field
' used by both inc-template-checkout.asp and inc-template-account.asp
Sub ScriptCountyLabel
%>
<script>
$(document).ready(function() {
  $("#Country").change();
  $("#DeliveryCountry").change();
});

$("#Country").change(function() {
  var LCountry = $('#Country').val();
  var LLabel = itp_get_county_label(LCountry, false);
  var LPlaceHolder = itp_get_county_placeholder(LCountry);
  $('#County').closest(".form-group").find("label").text(LLabel);
  $('#County').attr("placeholder", LPlaceHolder);
});

$("#DeliveryCountry").change(function() {
  var LCountry = $('#DeliveryCountry').val();
  var LLabel = itp_get_county_label(LCountry, true);
  var LPlaceHolder = itp_get_county_placeholder(LCountry);
  $('#DeliveryCounty').closest(".form-group").find("label").text(LLabel);
  $('#DeliveryCounty').attr("placeholder", LPlaceHolder);
});

function itp_get_county_label(ACountry, AIsDelivery)
{
  var LLabel = "";
  if (ACountry == 'United Kingdom') {
    LLabel = "County / Region";
  }
  else {
    LLabel = "State / Region";
  }
  if (AIsDelivery) {
    LLabel = "<%=IIf(InCheckout, "", "Delivery ")%>" + LLabel;
  }
  return LLabel;
}

function itp_get_county_placeholder(ACountry)
{
  if (ACountry == 'United Kingdom') {
    return "Enter county, region or state (if applicable)";
  }
  else {
    return "Enter state, region or province (if applicable)";
  }
}

</script>
<%
End Sub

' --- END OF JQUERY SCRIPT --- '

' (SS,21/6/22) for reloading page on back button, used on payment provider page if Clover is one of the options
' from https://stackoverflow.com/questions/43043113/how-to-force-reloading-a-page-when-using-browser-back-button
Sub ScriptPageReloadOnBackButton
<!-- (SS,21/6/22) for reloading page on back button -->
%>
<script>
window.addEventListener( "pageshow", function ( event ) {
  var historyTraversal = event.persisted || 
                         ( typeof window.performance != "undefined" && 
                              window.performance.navigation.type === 2 );
  if ( historyTraversal ) {
    // Handle page restore
    window.location.reload();
  }
});
</script>
<%
End Sub

%>