VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "PPCalc 2.2 (Nov 04, 2005)"
   ClientHeight    =   5400
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5595
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   5400
   ScaleWidth      =   5595
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command3 
      Appearance      =   0  'Flat
      Caption         =   "Update exchange rates"
      Height          =   360
      Left            =   270
      TabIndex        =   48
      Top             =   4140
      Width           =   1845
   End
   Begin VB.CommandButton Command2 
      Appearance      =   0  'Flat
      Caption         =   "Convert"
      Height          =   285
      Left            =   2625
      TabIndex        =   47
      Top             =   4365
      Width           =   885
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   6
      Left            =   5040
      TabIndex        =   45
      ToolTipText     =   "Clear"
      Top             =   4350
      Visible         =   0   'False
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Clear"
            ImageKey        =   "Clear"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   1
      Left            =   4980
      TabIndex        =   21
      ToolTipText     =   "Copy"
      Top             =   3195
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageKey        =   "Copy"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   2
      Left            =   4695
      TabIndex        =   24
      ToolTipText     =   "Copy"
      Top             =   2775
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageKey        =   "Copy"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   3
      Left            =   4620
      TabIndex        =   25
      ToolTipText     =   "Copy"
      Top             =   2595
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageKey        =   "Copy"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   4
      Left            =   5040
      TabIndex        =   26
      ToolTipText     =   "Copy"
      Top             =   3075
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageKey        =   "Copy"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   5
      Left            =   4710
      TabIndex        =   27
      ToolTipText     =   "Copy"
      Top             =   4365
      Width           =   345
      _ExtentX        =   609
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Copy"
            ImageKey        =   "Copy"
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      BorderStyle     =   0  'None
      FillColor       =   &H00FF00FF&
      FillStyle       =   0  'Solid
      Height          =   1440
      Left            =   922
      ScaleHeight     =   96
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   250
      TabIndex        =   6
      Top             =   105
      Width           =   3750
   End
   Begin VB.Frame Frame1 
      Caption         =   "Reverse PayPal Fee Calculator"
      Height          =   2775
      Left            =   142
      TabIndex        =   1
      Top             =   1950
      Width           =   5310
      Begin MSComctlLib.Toolbar Toolbar1 
         Height          =   330
         Index           =   0
         Left            =   4545
         TabIndex        =   19
         ToolTipText     =   "Copy"
         Top             =   1110
         Width           =   345
         _ExtentX        =   609
         _ExtentY        =   582
         ButtonWidth     =   609
         ButtonHeight    =   582
         Style           =   1
         ImageList       =   "imlToolbarIcons"
         _Version        =   393216
         BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
            NumButtons      =   1
            BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
               Key             =   "Copy"
               ImageKey        =   "Copy"
            EndProperty
         EndProperty
      End
      Begin VB.CheckBox Check1 
         Caption         =   "eCheck Payment?"
         Height          =   225
         Index           =   1
         Left            =   3165
         TabIndex        =   44
         Top             =   1380
         Visible         =   0   'False
         Width           =   1635
      End
      Begin VB.CheckBox Check1 
         Caption         =   "Currency Conversion Fee"
         Height          =   240
         Index           =   0
         Left            =   3165
         TabIndex        =   43
         Top             =   1650
         Visible         =   0   'False
         Width           =   2115
      End
      Begin VB.TextBox Text6 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   285
         Index           =   1
         Left            =   3600
         Locked          =   -1  'True
         TabIndex        =   42
         Top             =   2430
         Visible         =   0   'False
         Width           =   945
      End
      Begin VB.ComboBox Combo7 
         Height          =   315
         ItemData        =   "Form1.frx":33E2
         Left            =   4515
         List            =   "Form1.frx":33F8
         Style           =   2  'Dropdown List
         TabIndex        =   41
         Top             =   2070
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.ComboBox Combo6 
         Height          =   315
         ItemData        =   "Form1.frx":341A
         Left            =   3585
         List            =   "Form1.frx":3430
         Style           =   2  'Dropdown List
         TabIndex        =   40
         Top             =   2070
         Visible         =   0   'False
         Width           =   735
      End
      Begin VB.TextBox Text6 
         Appearance      =   0  'Flat
         Height          =   285
         Index           =   0
         Left            =   2640
         MaxLength       =   9
         TabIndex        =   39
         Top             =   2070
         Visible         =   0   'False
         Width           =   555
      End
      Begin VB.TextBox Text3 
         Appearance      =   0  'Flat
         Height          =   285
         Left            =   1890
         TabIndex        =   38
         Text            =   "0"
         Top             =   1650
         Visible         =   0   'False
         Width           =   1215
      End
      Begin VB.TextBox Text5 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   285
         Left            =   2715
         TabIndex        =   37
         Text            =   "0.30"
         Top             =   1305
         Visible         =   0   'False
         Width           =   390
      End
      Begin VB.TextBox Text4 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   285
         Left            =   1890
         TabIndex        =   36
         Text            =   "2.9"
         Top             =   1305
         Visible         =   0   'False
         Width           =   300
      End
      Begin VB.ComboBox Combo3 
         Appearance      =   0  'Flat
         Height          =   315
         ItemData        =   "Form1.frx":3452
         Left            =   1890
         List            =   "Form1.frx":3462
         Style           =   2  'Dropdown List
         TabIndex        =   35
         Top             =   945
         Visible         =   0   'False
         Width           =   2520
      End
      Begin VB.ComboBox Combo1 
         Appearance      =   0  'Flat
         Height          =   315
         Index           =   1
         ItemData        =   "Form1.frx":34C1
         Left            =   1890
         List            =   "Form1.frx":34DA
         Style           =   2  'Dropdown List
         TabIndex        =   34
         Top             =   600
         Visible         =   0   'False
         Width           =   1170
      End
      Begin VB.ComboBox Combo1 
         Appearance      =   0  'Flat
         Height          =   315
         Index           =   0
         ItemData        =   "Form1.frx":3510
         Left            =   1890
         List            =   "Form1.frx":3529
         Style           =   2  'Dropdown List
         TabIndex        =   33
         Top             =   255
         Visible         =   0   'False
         Width           =   1170
      End
      Begin VB.ComboBox Combo5 
         Height          =   315
         ItemData        =   "Form1.frx":355F
         Left            =   4905
         List            =   "Form1.frx":3575
         Style           =   2  'Dropdown List
         TabIndex        =   23
         Top             =   465
         Width           =   345
      End
      Begin VB.ComboBox Combo4 
         Height          =   315
         ItemData        =   "Form1.frx":3597
         Left            =   4905
         List            =   "Form1.frx":35AD
         Style           =   2  'Dropdown List
         TabIndex        =   18
         Top             =   780
         Width           =   345
      End
      Begin VB.TextBox Text11 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   285
         Left            =   5040
         Locked          =   -1  'True
         TabIndex        =   16
         Top             =   1200
         Width           =   165
      End
      Begin VB.TextBox Text10 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   240
         Left            =   4935
         Locked          =   -1  'True
         TabIndex        =   13
         Top             =   165
         Width           =   135
      End
      Begin VB.TextBox Text9 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   240
         Left            =   4470
         Locked          =   -1  'True
         TabIndex        =   12
         Top             =   195
         Width           =   135
      End
      Begin VB.TextBox Text8 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   240
         Left            =   5070
         Locked          =   -1  'True
         TabIndex        =   8
         Top             =   180
         Width           =   165
      End
      Begin VB.TextBox Text2 
         Appearance      =   0  'Flat
         BackColor       =   &H8000000F&
         Height          =   240
         Left            =   4785
         Locked          =   -1  'True
         TabIndex        =   5
         Top             =   165
         Width           =   135
      End
      Begin VB.TextBox Text1 
         Appearance      =   0  'Flat
         Height          =   240
         Left            =   4620
         TabIndex        =   4
         Top             =   180
         Width           =   120
      End
      Begin VB.Line Line1 
         Visible         =   0   'False
         X1              =   90
         X2              =   5220
         Y1              =   1995
         Y2              =   1995
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "to"
         Height          =   195
         Index           =   19
         Left            =   4335
         TabIndex        =   22
         Top             =   2130
         Width           =   135
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "%  +  $"
         Height          =   195
         Index           =   9
         Left            =   2205
         TabIndex        =   20
         Top             =   1350
         Width           =   480
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "from"
         Height          =   195
         Index           =   8
         Left            =   3225
         TabIndex        =   17
         Top             =   2115
         Width           =   300
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Convert"
         Height          =   195
         Index           =   7
         Left            =   2040
         TabIndex        =   15
         Top             =   2115
         Width           =   555
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Cost of Shipping:  $"
         Height          =   195
         Index           =   4
         Left            =   480
         TabIndex        =   14
         Top             =   1695
         Width           =   1380
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "$"
         Height          =   195
         Index           =   6
         Left            =   4665
         TabIndex        =   11
         Top             =   480
         Width           =   90
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "$"
         Height          =   195
         Index           =   5
         Left            =   3465
         TabIndex        =   10
         Top             =   2475
         Width           =   90
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "PayPal Fee Rate:"
         Height          =   195
         Index           =   3
         Left            =   435
         TabIndex        =   9
         Top             =   1350
         Width           =   1245
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Monthly Sales Volume:"
         Height          =   195
         Index           =   2
         Left            =   90
         TabIndex        =   7
         Top             =   1005
         Width           =   1605
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Destination Country:"
         Height          =   195
         Index           =   1
         Left            =   270
         TabIndex        =   3
         Top             =   660
         Width           =   1425
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Source Country:"
         Height          =   195
         Index           =   0
         Left            =   570
         TabIndex        =   2
         Top             =   300
         Width           =   1140
      End
   End
   Begin VB.CommandButton Command1 
      Appearance      =   0  'Flat
      Caption         =   "E&xit"
      Height          =   375
      Left            =   2130
      TabIndex        =   0
      Top             =   4860
      Width           =   1335
   End
   Begin MSComctlLib.ImageList imlToolbarIcons 
      Left            =   4980
      Top             =   75
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   6
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":35CF
            Key             =   "Copy"
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":36E1
            Key             =   "Clear"
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":383B
            Key             =   "Calc"
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":3995
            Key             =   "Notepad"
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":3F2F
            Key             =   "PayPal"
         EndProperty
         BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":44C9
            Key             =   "eBay"
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   330
      Index           =   7
      Left            =   135
      TabIndex        =   46
      Top             =   4755
      Width           =   1380
      _ExtentX        =   2434
      _ExtentY        =   582
      ButtonWidth     =   609
      ButtonHeight    =   582
      Style           =   1
      ImageList       =   "imlToolbarIcons"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   4
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "eBay"
            Object.ToolTipText     =   "Visit eBay"
            ImageKey        =   "eBay"
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "PayPal"
            Object.ToolTipText     =   "Visit PayPal"
            ImageKey        =   "PayPal"
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Notepad"
            Object.ToolTipText     =   "Windows Notepad"
            ImageKey        =   "Notepad"
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Key             =   "Calc"
            Object.ToolTipText     =   "Windows Calculator"
            ImageKey        =   "Calc"
         EndProperty
      EndProperty
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "About"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   10
      Left            =   4980
      TabIndex        =   49
      Tag             =   "1"
      Top             =   4770
      Width           =   420
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "|"
      Height          =   195
      Index           =   22
      Left            =   1008
      TabIndex        =   32
      Top             =   1650
      Width           =   30
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Options"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   24
      Left            =   322
      TabIndex        =   31
      Tag             =   "1"
      Top             =   1650
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "Reverse PayPal Fee Calculator"
      Height          =   195
      Index           =   23
      Left            =   3060
      TabIndex        =   30
      Tag             =   "0"
      Top             =   1650
      Width           =   2205
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "|"
      Height          =   195
      Index           =   21
      Left            =   2890
      TabIndex        =   29
      Top             =   1650
      Width           =   30
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "PayPal Fee Calculator"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FF0000&
      Height          =   195
      Index           =   20
      Left            =   1184
      TabIndex        =   28
      Tag             =   "1"
      Top             =   1650
      Width           =   1560
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private source_char As String * 1
Private dest_char As String * 1

Private Type OptionsType
 srcCountryIndex As Integer
 destCountryIndex As Integer
 monthlySalesVolumeIndex As Integer
 paypalFeeRate As String
 paypalFixedFee As String
 shippingCost As String
 echeckPayment As Byte
 currencyConversionFee As Byte
 srcCountryConversion As Integer
 destCountryConversion As Integer
End Type

Private Type PPCalcType
 IfAPersonSendsYou As String
 srcCountryIndex As Integer
 PayPalFees As String
 WouldReceive As String
 FeePercentage As String
End Type

Private Type RPPCalcType
 InOrderToReceive As String
 BuyerMustSend As String
 FeeAmount As String
 FeePercentage As String
 InOrderToCountry As Integer
 BuyerMustSendCountry As Integer
 ForYourItem As String
 SH As String
End Type

Private options_settings As OptionsType
Private ppcalc_settings As PPCalcType
Private rppcalc_settings As RPPCalcType

Private Sub Check1_Click(Index As Integer)
 options_settings.echeckPayment = Check1(1).Value
 options_settings.currencyConversionFee = Check1(0).Value
End Sub

Private Sub Combo1_Click(Index As Integer)
If Combo1(0).ListIndex <> -1 And Combo1(1).ListIndex <> -1 Then

 If Index = 0 Then '(Source Country was changed), changed the fixed fee
  options_settings.srcCountryIndex = Combo1(0).ListIndex
  Text5.MaxLength = 0
  Select Case Combo1(0).ListIndex
   Case 1
    Text5.MaxLength = 4
    Text5.Text = "0.55"
    If Label1(24).Tag = 0 Then
     source_char = "$"
     Combo5.ListIndex = 1 'CAD
    End If
   Case 2
    Text5.MaxLength = 4
    Text5.Text = "0.35"
    If Label1(24).Tag = 0 Then
     source_char = "€"
     Combo5.ListIndex = 2 'EUR
    End If
   Case 3
    Text5.MaxLength = 4
    Text5.Text = "0.20"
    If Label1(24).Tag = 0 Then
     source_char = "£"
     Combo5.ListIndex = 3 'GBP
    End If
   Case 4
    Text5.MaxLength = 4
    Text5.Text = "0.40"
    If Label1(24).Tag = 0 Then
     source_char = "$"
     Combo5.ListIndex = 4 'AUD
    End If
   Case 5
    Text5.MaxLength = 0
    Text5.Text = "40"
    If Label1(24).Tag = 0 Then
     source_char = "¥"
     Combo5.ListIndex = 5 'JPY
    End If
   Case Else
    Text5.MaxLength = 4
    Text5.Text = "0.30"
    If Label1(24).Tag = 0 Then
     source_char = "$"
     Combo5.ListIndex = 0 'USD
    End If
  End Select
  If Label1(24).Tag = 0 Then
   Label1(9).Caption = "%  +  " & source_char
  End If
 Else 'Index is 1 (Destination Country was changed)
  options_settings.destCountryIndex = Combo1(1).ListIndex
  Combo3.Clear
  Select Case Combo1(1).ListIndex
   Case 1
    Combo3.AddItem "$0.00 CAD - $3,000.00 CAD"
    Combo3.AddItem "$3,000.01 CAD - $12,000.00 CAD"
    Combo3.AddItem "$12,000.01 CAD - $125,000.00 CAD"
    Combo3.AddItem "> $125,000.01 CAD"
    Combo3.Width = 3015
    If Label1(24).Tag = 0 Then
     dest_char = "$"
     Combo4.ListIndex = 1
    End If
   Case 2
    Combo3.AddItem "€0.00 EUR - €2,500.00 EUR"
    Combo3.AddItem "€2,500.01 EUR - €10,000.00 EUR"
    Combo3.AddItem "€10,000.01 EUR - €50,000.00 EUR"
    Combo3.AddItem "€50,000.01 EUR - €100,000.00 EUR"
    Combo3.AddItem "> €100,000.01 EUR"
    Combo3.Width = 3045
    If Label1(24).Tag = 0 Then
     dest_char = "€"
     Combo4.ListIndex = 2
    End If
   Case 3
    Combo3.AddItem "£0.00 GBP - £1,500.00 GBP"
    Combo3.AddItem "£1,500.01 GBP - £6,000.00 GBP"
    Combo3.AddItem "£6,000.01 GBP - £15,000.00 GBP"
    Combo3.AddItem "£15,000.01 GBP - £55,000.00 GBP"
    Combo3.AddItem "> £55,000.01 GBP"
    Combo3.Width = 2955
    If Label1(24).Tag = 0 Then
     dest_char = "£"
     Combo4.ListIndex = 3
    End If
   Case 4
    Combo3.AddItem "$0.00 AUD - $5,000.00 AUD"
    Combo3.AddItem "$5,000.01 AUD - $15,000.00 AUD"
    Combo3.AddItem "$15,000.01 AUD - $150,000.00 AUD"
    Combo3.AddItem "> $150,000.01 AUD"
    Combo3.Width = 3045
    If Label1(24).Tag = 0 Then
     dest_char = "$"
     Combo4.ListIndex = 4
    End If
   Case Else
    Combo3.AddItem "$0 to $3,000 USD"
    Combo3.AddItem "$3,000.01 to $10,000 USD"
    Combo3.AddItem "$10,000.01 to $100,000 USD"
    Combo3.AddItem "> $100,000.01 USD"
    Combo3.Width = 2520
    If Label1(24).Tag = 0 Then
     dest_char = "$"
     Combo4.ListIndex = 0
    End If
  End Select
  
  If Combo1(1).ListIndex = 5 And Label1(24).Tag = 0 Then
   dest_char = "¥"
   Combo4.ListIndex = 5
  End If
  
  Combo3.ListIndex = 0
  
  If Label1(24).Tag = 0 Then
   Label1(4).Caption = "Cost of Shipping:  " & dest_char
  End If
 End If
 
 If Not Combo1(0).ListIndex = Combo1(1).ListIndex Then
  If Not (Combo1(0).ListIndex = 0 And Combo1(1).ListIndex = 1) Then
   Check1(0).Enabled = True
   Check1(0).Value = 1
  Else
   Check1(0).Value = 0
   Check1(0).Enabled = False
  End If
 Else
  Check1(0).Value = 0
  Check1(0).Enabled = False
 End If
 
 UpdateRate
 
 
 rppcalc_settings.BuyerMustSendCountry = Combo1(0).ListIndex
 rppcalc_settings.InOrderToCountry = Combo1(1).ListIndex
 
 ppcalc_settings.srcCountryIndex = Combo1(0).ListIndex
 
End If
End Sub
Private Sub UpdateRate()
 Dim rate_array(0 To 6, 0 To 6, 0 To 4) As Single
 Call fillArray(rate_array)
 Text4.MaxLength = 0
 Text4.Text = FormatNumber(rate_array(Combo1(0).ListIndex, Combo1(1).ListIndex, Combo3.ListIndex) * 100, 1)
End Sub
Private Sub Combo3_Click()
If Combo3.ListIndex <> -1 Then 'monthly sales volume changed
 UpdateRate
End If
 options_settings.monthlySalesVolumeIndex = Combo3.ListIndex
End Sub
Private Sub Combo4_Click()
If Label1(23).Tag = 0 Then 'reverse paypal calculator
 Select Case Combo4.ListIndex
  Case 2 'EUR
   dest_char = "€"
  Case 3 'GBP
   dest_char = "£"
  Case 5 'JPY
   dest_char = "¥"
  Case Else
   dest_char = "$"
 End Select
 Combo1(1).ListIndex = Combo4.ListIndex 'set destination country
 'options_settings.destCountryIndex = Combo1(1).ListIndex
 'options_settings.monthlySalesVolumeIndex = Combo3.ListIndex
 Label1(0).Caption = "In order for you to receive:  " & dest_char
 rppcalc_settings.InOrderToCountry = Combo4.ListIndex
 
ElseIf Label1(20).Tag = 0 Then 'paypal calculator
 Select Case Combo4.ListIndex
  Case 2 'EUR
   source_char = "€"
  Case 3 'GBP
   source_char = "£"
  Case 5 'JPY
   source_char = "¥"
  Case Else
   source_char = "$"
 End Select
 Combo1(0).ListIndex = Combo4.ListIndex 'set source country
 'options_settings.srcCountryIndex = Combo1(0).ListIndex
 'options_settings.monthlySalesVolumeIndex = Combo3.ListIndex
 Label1(0).Caption = "If a person sends you:  " & source_char
 Label1(1).Caption = "Your PayPal fees would be:  " & source_char
 Label1(19).Caption = source_char
 ppcalc_settings.srcCountryIndex = Combo4.ListIndex
End If
End Sub

Private Sub Combo5_Click()
If Label1(23).Tag = 0 Then
 Select Case Combo5.ListIndex
  Case 2 'EUR
   source_char = "€"
  Case 3 'GBP
   source_char = "£"
  Case 5 'JPY
   source_char = "¥"
  Case Else
   source_char = "$"
 End Select
 Combo1(0).ListIndex = Combo5.ListIndex 'set source country
 options_settings.srcCountryIndex = Combo1(0).ListIndex
 options_settings.monthlySalesVolumeIndex = Combo3.ListIndex
 Label1(1).Caption = "A buyer must send you exactly:  " & source_char
 Label1(2).Caption = "Which makes your fee amount:  " & source_char
 Label1(6).Caption = source_char
 Label1(7).Caption = "for your item or " & source_char
 rppcalc_settings.BuyerMustSendCountry = Combo5.ListIndex
End If
End Sub
Private Sub Combo6_Click()
 options_settings.srcCountryConversion = Combo6.ListIndex
End Sub

Private Sub Combo7_Click()
 Select Case Combo7.ListIndex
  Case 0 'USD
   Label1(5).Caption = "$"
  Case 1 'CAD
   Label1(5).Caption = "$"
  Case 2 'EUR
   Label1(5).Caption = "€"
  Case 3 'GBP
   Label1(5).Caption = "£"
  Case 4 'AUD
   Label1(5).Caption = "$"
  Case 5 'JPY
   Label1(5).Caption = "¥"
 End Select
 options_settings.destCountryConversion = Combo7.ListIndex
End Sub

Private Sub Command2_Click()
If Label1(24).Tag = 0 Then 'convert currency button clicked (in Options dialog)
 If Len(Text6(0).Text) > 0 Then
  Dim sng_array(0 To 5) As Single
  If GetSetting("PPCalc", "Settings", "USD") = "" Then
   sng_array(0) = 1
  Else
   sng_array(0) = CSng(GetSetting("PPCalc", "Settings", "USD"))
  End If
  If GetSetting("PPCalc", "Settings", "CAD") = "" Then
   sng_array(1) = 1.22655
  Else
   sng_array(1) = CSng(GetSetting("PPCalc", "Settings", "CAD"))
  End If
  If GetSetting("PPCalc", "Settings", "EUR") = "" Then
   sng_array(2) = 0.82491
  Else
   sng_array(2) = CSng(GetSetting("PPCalc", "Settings", "EUR"))
  End If
  If GetSetting("PPCalc", "Settings", "GBP") = "" Then
   sng_array(3) = 0.56886
  Else
   sng_array(3) = CSng(GetSetting("PPCalc", "Settings", "GBP"))
  End If
  If GetSetting("PPCalc", "Settings", "AUD") = "" Then
   sng_array(4) = 1.32175
  Else
   sng_array(4) = CSng(GetSetting("PPCalc", "Settings", "AUD"))
  End If
  If GetSetting("PPCalc", "Settings", "JPY") = "" Then
   sng_array(5) = 112.495
  Else
   sng_array(5) = CSng(GetSetting("PPCalc", "Settings", "JPY"))
  End If
  Text6(1).Text = FormatNumber((Val(Text6(0).Text) * (sng_array(Combo7.ListIndex) / sng_array(Combo6.ListIndex))), 2)
 'If Right$(Text6(1).Text, 3) = ".00" Then
 ' Text6(1).Text = Mid(Text6(1).Text, 1, Len(Text6(1).Text) - 3)
 'End If
 Else
  MsgBox "No amount was entered.", vbOKOnly + vbInformation, "PPCalc"
 End If
 
ElseIf Label1(23).Tag = 0 Then 'calculate button clicked (in Reverse PayPal Calculator)
 RPayPalCalculate
ElseIf Label1(20).Tag = 0 Then 'calculate button clicked (in PayPal Calculator
 PayPalCalculate
End If
End Sub

Private Sub PayPalCalculate()
 If Len(Text1.Text) > 0 Then 'only continue if the user entered something
  Dim new_value As Single
  Dim fee_25 As String
  Dim actual_amount As Single
  actual_amount = FormatNumber(Val(Text1.Text), 2)
  
  new_value = actual_amount * (Val(Text4.Text) / 100) + Val(Text5.Text)
  fee_25 = "0"
  If options_settings.currencyConversionFee = 1 And Check1(0).Enabled = True Then 'add 2.5% currency conversion
   fee_25 = CStr(actual_amount * 0.025)
  End If
  If (new_value >= findECheckFee) And (Not findECheckFee = -1) Then
   Text2.Text = FormatNumber(findECheckFee + Val(fee_25), 2, vbTrue, vbFalse, vbFalse)
  Else
   Text2.Text = FormatNumber(new_value + Val(fee_25), 2, vbTrue, vbFalse, vbFalse)
  End If
  If (actual_amount - Val(Text2.Text)) <= 0 Then
   Text8.Text = "0.00"
  Else
   Text8.Text = FormatNumber(actual_amount - Val(Text2.Text), 2, vbTrue, vbFalse, vbFalse)
  End If
  
  If Text8.Text = "0.00" Then
   Text10.Text = "100"
  Else
   Dim percentage As String
   Dim answer As Double
   If actual_amount <> 0 Then
    answer = Val(Text2.Text) / actual_amount * 100
    percentage = FormatNumber(answer, 2, vbTrue, vbFalse, vbFalse)
    If Right$(percentage, 3) = ".00" Then
     Text10.Text = Mid(percentage, 1, Len(percentage) - 3)
    ElseIf Right$(percentage, 3) = ".10" Or Right$(percentage, 3) = ".20" Or Right$(percentage, 3) = ".30" Or Right$(percentage, 3) = ".40" Or Right$(percentage, 3) = ".50" Or Right$(percentage, 3) = ".60" Or Right$(percentage, 3) = ".70" Or Right$(percentage, 3) = ".80" Or Right$(percentage, 3) = ".90" Then
     Text10.Text = Mid(percentage, 1, Len(percentage) - 1)
    Else
     Text10.Text = FormatNumber(answer, 2, vbTrue, vbFalse, vbFalse)
    End If
   Else
    Text10.Text = "100"
   End If
  End If
  
 Else 'user didn't enter anything
  MsgBox "No amount was entered.", vbOKOnly + vbInformation, "PayPal Calculator"
  Text1.SetFocus
 End If
End Sub

Private Sub RPayPalCalculate()
 If Len(Text1.Text) > 0 Then 'only continue if the user entered something
  'convert source to destination currency
  Dim sng_array(0 To 5) As Single
  If GetSetting("PPCalc", "Settings", "USD") = "" Then
   sng_array(0) = 1
  Else
   sng_array(0) = CSng(GetSetting("PPCalc", "Settings", "USD"))
  End If
  If GetSetting("PPCalc", "Settings", "CAD") = "" Then
   sng_array(1) = 1.22655
  Else
   sng_array(1) = CSng(GetSetting("PPCalc", "Settings", "CAD"))
  End If
  If GetSetting("PPCalc", "Settings", "EUR") = "" Then
   sng_array(2) = 0.82491
  Else
   sng_array(2) = CSng(GetSetting("PPCalc", "Settings", "EUR"))
  End If
  If GetSetting("PPCalc", "Settings", "GBP") = "" Then
   sng_array(3) = 0.56886
  Else
   sng_array(3) = CSng(GetSetting("PPCalc", "Settings", "GBP"))
  End If
  If GetSetting("PPCalc", "Settings", "AUD") = "" Then
   sng_array(4) = 1.32175
  Else
   sng_array(4) = CSng(GetSetting("PPCalc", "Settings", "AUD"))
  End If
  If GetSetting("PPCalc", "Settings", "JPY") = "" Then
   sng_array(5) = 112.495
  Else
   sng_array(5) = CSng(GetSetting("PPCalc", "Settings", "JPY"))
  End If
  Dim actual_amount As Single
  actual_amount = FormatNumber((Val(Text1.Text) * (sng_array(Combo5.ListIndex) / sng_array(Combo4.ListIndex))), 2)
 
  Dim new_value As Single
  If options_settings.currencyConversionFee = 1 And Check1(0).Enabled = True Then 'add 2.5% currency conversion
   new_value = (actual_amount + Val(Text5.Text)) / (1 - ((Val(Text4.Text) / 100) + 0.025))
  Else '2.5% is NOT added
   If Val(Text4.Text) <> 100 Then
    new_value = (actual_amount + Val(Text5.Text)) / (1 - (Val(Text4.Text) / 100))
   Else 'val(text4.text) is 100
    Text4.MaxLength = Len("99.99")
    Text4.Text = "99.99"
    new_value = (actual_amount + Val(Text5.Text)) / (1 - (Val(Text4.Text) / 100))
   End If
  End If
  If ((new_value - actual_amount) >= findECheckFee) And (findECheckFee <> -1) Then
   If options_settings.currencyConversionFee = 1 And Check1(0).Enabled = True Then 'add 2.5% currency conversion fee + echeck
    Text2.Text = FormatNumber((actual_amount + findECheckFee) / 0.975, 2, vbTrue, vbFalse, vbFalse)
   Else 'just add echeck
    Text2.Text = FormatNumber(actual_amount + Val(FormatNumber(findECheckFee, 2, vbFalse, vbFalse, vbFalse)), 2, vbTrue, vbFalse, vbFalse)
   End If
  Else
   Text2.Text = FormatNumber(new_value, 2, vbTrue, vbFalse, vbFalse)
  End If
  Text8.Text = FormatNumber(Val(Text2.Text) - actual_amount, 2, vbTrue, vbFalse, vbFalse)
  Dim percentage As String
  Dim answer As Double
  If actual_amount <> 0 Then
   answer = Val(Text8.Text) / Val(Text2.Text) * 100
   percentage = FormatNumber(answer, 2, vbTrue, vbFalse, vbFalse)
   If Right$(percentage, 3) = ".00" Then
    Text10.Text = Mid(percentage, 1, Len(percentage) - 3)
   ElseIf Right$(percentage, 3) = ".10" Or Right$(percentage, 3) = ".20" Or Right$(percentage, 3) = ".30" Or Right$(percentage, 3) = ".40" Or Right$(percentage, 3) = ".50" Or Right$(percentage, 3) = ".60" Or Right$(percentage, 3) = ".70" Or Right$(percentage, 3) = ".80" Or Right$(percentage, 3) = ".90" Then
    Text10.Text = Mid(percentage, 1, Len(percentage) - 1)
   Else
    Text10.Text = FormatNumber(answer, 2, vbTrue, vbFalse, vbFalse)
   End If
  Else
   Text10.Text = "100"
  End If
  Text9.Text = Text2.Text
  Text11.Text = FormatNumber(Val(options_settings.shippingCost) + Val(Text8.Text), 2, vbTrue, vbFalse, vbFalse)
  Text1.SetFocus
  
 Else 'user didn't enter anything
  MsgBox "No amount was entered.", vbOKOnly + vbInformation, "Reverse PayPal Calculator"
  Text1.SetFocus
 End If
End Sub

Private Function findECheckFee()
If Check1(1).Value = 1 Then 'if eCheck option is selected
 Select Case Combo1(0).ListIndex
  Case 0 'USA --> ...
   findECheckFee = 5
  Case 1 'CAD --> ...
   findECheckFee = 7.5
  Case 2 'EUR --> ...
   findECheckFee = 5
  Case 3 'UK --> ...
   findECheckFee = -1
  Case 4 'AUS --> ...
   findECheckFee = -1
  Case 5 'JAP --> ...
   findECheckFee = -1
  Case 6 'OTHER --> ...
   findECheckFee = 5
 End Select
Else
 findECheckFee = -1
End If
End Function

Private Sub Command3_Click()
If Command3.Caption = "Clear" Then 'Clear button pressed
 If Label1(23).Tag = 0 Then 'on reverse paypal calculator
  Text1.Text = ""
  Text2.Text = ""
  Text8.Text = ""
  Text10.Text = ""
  Text9.Text = ""
  Text11.Text = ""
  Text1.SetFocus
 ElseIf Label1(20).Tag = 0 Then 'on paypal calculator
  Text1.Text = ""
  Text2.Text = ""
  Text8.Text = ""
  Text10.Text = ""
  Text1.SetFocus
 End If
ElseIf Command3.Caption = "Update exchange rates" Then
 'download latest currency exchange rates
 Call MsgBox("This feature is no longer available.", vbInformation, "Update Exchange Rates")
End If
End Sub

Private Function verifyAllNumbers(arr() As String) As Boolean
Dim i As Integer, j As Integer
For i = LBound(arr) To UBound(arr)
 For j = 1 To Len(arr(i))
  If ((Asc(Mid(arr(i), j, 1)) < 48 Or Asc(Mid(arr(i), j, 1)) > 57) And Asc(Mid(arr(i), j, 1)) <> 46) Then
   verifyAllNumbers = False
   Exit Function
  End If
 Next
Next
verifyAllNumbers = True
End Function

Private Sub Form_Activate()
 Call setTheFocus
End Sub

Private Sub setTheFocus()
If (Label1(23).Tag = 1 Or Label1(20).Tag = 1) And Text1.Visible = True Then
 Text1.SelStart = 0
 Text1.SelLength = Len(Text1.Text)
 Text1.SetFocus
ElseIf Combo1(0).Visible = True Then
 Combo1(0).SetFocus
End If
End Sub

Private Sub Form_Load()
On Error GoTo FORM_ERROR

lHandle = LoadCursor(0, 32649&)
Dim old(0 To 1) As String

'-- load defaults
If GetSetting("PPCalc", "Settings", "CCF_Enabled") = "1" Then
 Check1(0).Enabled = True
Else
 Check1(0).Enabled = False
End If
If GetSetting("PPCalc", "Settings", "source_char") = "" Then
 source_char = "$"
Else
  source_char = GetSetting("PPCalc", "Settings", "source_char")
End If
If GetSetting("PPCalc", "Settings", "dest_char") = "" Then
 dest_char = "$"
Else
  dest_char = GetSetting("PPCalc", "Settings", "dest_char")
End If
If GetSetting("PPCalc", "Settings", "o_srcCountryIndex") = "" Then
 options_settings.srcCountryIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")) <= 6 Then
 options_settings.srcCountryIndex = CInt(Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")))
Else
 options_settings.srcCountryIndex = 0
End If
Combo1(0).ListIndex = options_settings.srcCountryIndex

If GetSetting("PPCalc", "Settings", "o_destCountryIndex") = "" Then
 options_settings.destCountryIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")) <= 6 Then
 options_settings.destCountryIndex = CInt(Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")))
Else
 options_settings.destCountryIndex = 0
End If
Combo1(1).ListIndex = options_settings.destCountryIndex
 
If GetSetting("PPCalc", "Settings", "o_msv") = "" Then
 options_settings.monthlySalesVolumeIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_msv")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_msv")) <= Combo3.ListCount - 1 Then
 options_settings.monthlySalesVolumeIndex = CInt(Val(GetSetting("PPCalc", "Settings", "o_msv")))
Else
 options_settings.monthlySalesVolumeIndex = 0
End If

Combo3.ListIndex = options_settings.monthlySalesVolumeIndex

If GetSetting("PPCalc", "Settings", "o_ppfeerate") = "" Then
 options_settings.paypalFeeRate = "2.9"
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_ppfeerate"))) > 0 Then
 options_settings.paypalFeeRate = CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_ppfeerate"))
Else
 options_settings.paypalFeeRate = "2.9"
End If
If GetSetting("PPCalc", "Settings", "o_shipping") = "" Then
 options_settings.shippingCost = "0"
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_shipping"))) > 0 Then
 options_settings.shippingCost = CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_shipping"))
Else
 options_settings.shippingCost = "0"
End If
If GetSetting("PPCalc", "Settings", "o_ppfixedfee") = "" Then
 options_settings.paypalFixedFee = "0.30"
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_ppfixedfee"))) > 0 Then
 options_settings.paypalFixedFee = CleanUpGarbage(GetSetting("PPCalc", "Settings", "o_ppfixedfee"))
Else
 options_settings.paypalFixedFee = "0.30"
End If
old(0) = options_settings.paypalFeeRate
old(1) = options_settings.paypalFixedFee

If GetSetting("PPCalc", "Settings", "o_echeck") = "1" Then
 options_settings.echeckPayment = 1
Else
 options_settings.echeckPayment = 0
End If
If GetSetting("PPCalc", "Settings", "o_ccf") = "1" Then
 options_settings.currencyConversionFee = 1
Else
 options_settings.currencyConversionFee = 0
End If
If GetSetting("PPCalc", "Settings", "o_srcCC") = "" Then
 options_settings.srcCountryConversion = 1
ElseIf Val(GetSetting("PPCalc", "Settings", "o_srcCC")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_srcCC")) <= 5 Then
 options_settings.srcCountryConversion = CInt(Val(GetSetting("PPCalc", "Settings", "o_srcCC")))
Else
 options_settings.srcCountryConversion = 1
End If

Combo6.ListIndex = options_settings.srcCountryConversion

If GetSetting("PPCalc", "Settings", "o_destCC") = "" Then
 options_settings.destCountryConversion = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_destCC")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_destCC")) <= 5 Then
 options_settings.destCountryConversion = CInt(Val(GetSetting("PPCalc", "Settings", "o_destCC")))
Else
 options_settings.destCountryConversion = 0
End If

Combo7.ListIndex = options_settings.destCountryConversion

If GetSetting("PPCalc", "Settings", "pp_IfAPersonSendsYou") = "" Then
 ppcalc_settings.IfAPersonSendsYou = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_IfAPersonSendsYou"))) > 0 Then
 ppcalc_settings.IfAPersonSendsYou = CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_IfAPersonSendsYou"))
Else
 ppcalc_settings.IfAPersonSendsYou = ""
End If
If GetSetting("PPCalc", "Settings", "pp_PayPalFees") = "" Then
 ppcalc_settings.PayPalFees = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_PayPalFees"))) > 0 Then
 ppcalc_settings.PayPalFees = CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_PayPalFees"))
Else
 ppcalc_settings.PayPalFees = ""
End If
If GetSetting("PPCalc", "Settings", "pp_WouldReceive") = "" Then
 ppcalc_settings.WouldReceive = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_WouldReceive"))) > 0 Then
 ppcalc_settings.WouldReceive = CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_WouldReceive"))
Else
 ppcalc_settings.WouldReceive = ""
End If
If GetSetting("PPCalc", "Settings", "pp_FeePercentage") = "" Then
 ppcalc_settings.FeePercentage = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_FeePercentage"))) > 0 Then
 ppcalc_settings.FeePercentage = CleanUpGarbage(GetSetting("PPCalc", "Settings", "pp_FeePercentage"))
Else
 ppcalc_settings.FeePercentage = ""
End If
If GetSetting("PPCalc", "Settings", "pp_srcCountryIndex") = "" Then
 ppcalc_settings.srcCountryIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "pp_srcCountryIndex")) >= 0 And Val(GetSetting("PPCalc", "Settings", "pp_srcCountryIndex")) <= 5 Then
 ppcalc_settings.srcCountryIndex = CInt(Val(GetSetting("PPCalc", "Settings", "pp_srcCountryIndex")))
Else
 ppcalc_settings.srcCountryIndex = 0
End If
If GetSetting("PPCalc", "Settings", "rpp_InOrderToReceive") = "" Then
 rppcalc_settings.InOrderToReceive = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_InOrderToReceive"))) > 0 Then
 rppcalc_settings.InOrderToReceive = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_InOrderToReceive"))
Else
 rppcalc_settings.InOrderToReceive = ""
End If
If GetSetting("PPCalc", "Settings", "rpp_BuyerMustSend") = "" Then
 rppcalc_settings.BuyerMustSend = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_BuyerMustSend"))) > 0 Then
 rppcalc_settings.BuyerMustSend = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_BuyerMustSend"))
Else
 rppcalc_settings.BuyerMustSend = ""
End If
If GetSetting("PPCalc", "Settings", "rpp_FeeAmount") = "" Then
 rppcalc_settings.FeeAmount = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_FeeAmount"))) > 0 Then
 rppcalc_settings.FeeAmount = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_FeeAmount"))
Else
 rppcalc_settings.FeeAmount = ""
End If
If GetSetting("PPCalc", "Settings", "rpp_FeePercentage") = "" Then
 rppcalc_settings.FeePercentage = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_FeePercentage"))) > 0 Then
 rppcalc_settings.FeePercentage = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_FeePercentage"))
Else
 rppcalc_settings.FeePercentage = ""
End If
If GetSetting("PPCalc", "Settings", "rpp_InOrderToCountry") = "" Then
 rppcalc_settings.InOrderToCountry = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "rpp_InOrderToCountry")) >= 0 And Val(GetSetting("PPCalc", "Settings", "rpp_InOrderToCountry")) <= 5 Then
 rppcalc_settings.InOrderToCountry = CInt(Val(GetSetting("PPCalc", "Settings", "rpp_InOrderToCountry")))
Else
 rppcalc_settings.InOrderToCountry = 0
End If
If GetSetting("PPCalc", "Settings", "rpp_BuyerMustSendCountry") = "" Then
 rppcalc_settings.BuyerMustSendCountry = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "rpp_BuyerMustSendCountry")) >= 0 And Val(GetSetting("PPCalc", "Settings", "rpp_BuyerMustSendCountry")) <= 5 Then
 rppcalc_settings.BuyerMustSendCountry = CInt(Val(GetSetting("PPCalc", "Settings", "rpp_BuyerMustSendCountry")))
Else
 rppcalc_settings.BuyerMustSendCountry = 0
End If
If GetSetting("PPCalc", "Settings", "rpp_ForYourItem") = "" Then
 rppcalc_settings.ForYourItem = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_ForYourItem"))) > 0 Then
 rppcalc_settings.ForYourItem = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_ForYourItem"))
Else
 rppcalc_settings.ForYourItem = ""
End If
If GetSetting("PPCalc", "Settings", "rpp_SH") = "" Then
 rppcalc_settings.SH = ""
ElseIf Len(CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_SH"))) > 0 Then
 rppcalc_settings.SH = CleanUpGarbage(GetSetting("PPCalc", "Settings", "rpp_SH"))
Else
 rppcalc_settings.SH = ""
End If

 If rppcalc_settings.InOrderToCountry < 6 Then
  Combo4.ListIndex = rppcalc_settings.InOrderToCountry
 Else
  Combo4.ListIndex = 0
 End If
 If rppcalc_settings.BuyerMustSendCountry < 6 Then
  Combo5.ListIndex = rppcalc_settings.BuyerMustSendCountry
 Else
  Combo5.ListIndex = 0
 End If
 
'repeat
If GetSetting("PPCalc", "Settings", "o_srcCountryIndex") = "" Then
 options_settings.srcCountryIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")) <= 6 Then
 options_settings.srcCountryIndex = CInt(Val(GetSetting("PPCalc", "Settings", "o_srcCountryIndex")))
Else
 options_settings.srcCountryIndex = 0
End If
Combo1(0).ListIndex = options_settings.srcCountryIndex
If GetSetting("PPCalc", "Settings", "o_destCountryIndex") = "" Then
 options_settings.destCountryIndex = 0
ElseIf Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")) >= 0 And Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")) <= 6 Then
 options_settings.destCountryIndex = CInt(Val(GetSetting("PPCalc", "Settings", "o_destCountryIndex")))
Else
 options_settings.destCountryIndex = 0
End If
Combo1(1).ListIndex = options_settings.destCountryIndex

options_settings.paypalFeeRate = old(0)
options_settings.paypalFixedFee = old(1)
'--

'if ppc_logo.png does not exist, create it
If Dir(AppPath & "ppc_logo.png", vbNormal Or vbArchive Or vbReadOnly Or vbHidden Or vbSystem) = "" Then
 Dim b() As Byte
 Dim FileNum As Integer
 b = LoadResData("LOGO", "PICS")
 FileNum = FreeFile
 Open AppPath & "ppc_logo.png" For Binary As #FileNum
  Put #FileNum, 1, b()
 Close #FileNum
 Erase b
End If

'load png if it exists
If Dir(AppPath & "ppc_logo.png", vbNormal Or vbArchive Or vbReadOnly Or vbHidden Or vbSystem) <> "" Then
 Dim pngClass As New LoadPNG
 pngClass.PicBox = Picture1 'or Picturebox
 pngClass.SetToBkgrnd True, 0, 0 'set to Background (True or false), x and y
 pngClass.BackgroundPicture = Picture1 'same Backgroundpicture
 pngClass.SetAlpha = True 'when Alpha then alpha
 pngClass.SetTrans = True 'when transparent Color then transparent Color
 pngClass.OpenPNG AppPath & "ppc_logo.png" 'Open and display Picture
End If

Me.Width = 5685
Me.Height = 5775

'exit button
Command1.Width = 1335
Command1.Height = 375
If Me.ScaleHeight = 5295 Then
 Command1.Top = 4815
ElseIf Me.ScaleHeight = 5235 Then
 Command1.Top = 4785
Else
 Command1.Top = 4860
End If
Command1.Left = 2130

Frame1.Left = 142
Frame1.Top = 1950
Frame1.Width = 5310
Frame1.Height = 2775

Call eraseEverything
Call ReversePayPalCalculatorOn

'save default settings if they don't already exist
If GetSetting("PPCalc", "Settings", "USD") = "" Then
 SaveSetting "PPCalc", "Settings", "USD", "1.00000"
End If
If GetSetting("PPCalc", "Settings", "CAD") = "" Then
 SaveSetting "PPCalc", "Settings", "CAD", "1.22655"
End If
If GetSetting("PPCalc", "Settings", "EUR") = "" Then
 SaveSetting "PPCalc", "Settings", "EUR", "0.824910"
End If
If GetSetting("PPCalc", "Settings", "GBP") = "" Then
 SaveSetting "PPCalc", "Settings", "GBP", "0.568860"
End If
If GetSetting("PPCalc", "Settings", "AUD") = "" Then
 SaveSetting "PPCalc", "Settings", "AUD", "1.32175"
End If
If GetSetting("PPCalc", "Settings", "JPY") = "" Then
 SaveSetting "PPCalc", "Settings", "JPY", "112.495"
End If

Move ((Screen.Width - Me.Width) \ 2), ((Screen.Height - Me.Height) \ 2) - 10

Exit Sub

FORM_ERROR:
 MsgBox Err.Description, vbOKOnly + vbCritical, "Error Number " & Err.Number
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
 Call DragEntireForm(Button, Shift, x, y, Me)
End Sub
Private Sub Form_Unload(Cancel As Integer)
If Check1(0).Enabled = True Then
 SaveSetting "PPCalc", "Settings", "CCF_Enabled", "1"
Else
 SaveSetting "PPCalc", "Settings", "CCF_Enabled", "0"
End If
SaveSetting "PPCalc", "Settings", "source_char", source_char
SaveSetting "PPCalc", "Settings", "dest_char", dest_char
SaveSetting "PPCalc", "Settings", "o_srcCountryIndex", CStr(options_settings.srcCountryIndex)
SaveSetting "PPCalc", "Settings", "o_destCountryIndex", CStr(options_settings.destCountryIndex)
SaveSetting "PPCalc", "Settings", "o_msv", CStr(options_settings.monthlySalesVolumeIndex)
SaveSetting "PPCalc", "Settings", "o_ppfeerate", options_settings.paypalFeeRate
SaveSetting "PPCalc", "Settings", "o_shipping", options_settings.shippingCost
SaveSetting "PPCalc", "Settings", "o_ppfixedfee", options_settings.paypalFixedFee
SaveSetting "PPCalc", "Settings", "o_echeck", CStr(options_settings.echeckPayment)
SaveSetting "PPCalc", "Settings", "o_ccf", CStr(options_settings.currencyConversionFee)
SaveSetting "PPCalc", "Settings", "o_srcCC", CStr(options_settings.srcCountryConversion)
SaveSetting "PPCalc", "Settings", "o_destCC", CStr(options_settings.destCountryConversion)
SaveSetting "PPCalc", "Settings", "pp_IfAPersonSendsYou", ppcalc_settings.IfAPersonSendsYou
SaveSetting "PPCalc", "Settings", "pp_PayPalFees", ppcalc_settings.PayPalFees
SaveSetting "PPCalc", "Settings", "pp_WouldReceive", ppcalc_settings.WouldReceive
SaveSetting "PPCalc", "Settings", "pp_FeePercentage", ppcalc_settings.FeePercentage
SaveSetting "PPCalc", "Settings", "pp_srcCountryIndex", CStr(ppcalc_settings.srcCountryIndex)
SaveSetting "PPCalc", "Settings", "rpp_InOrderToReceive", rppcalc_settings.InOrderToReceive
SaveSetting "PPCalc", "Settings", "rpp_BuyerMustSend", rppcalc_settings.BuyerMustSend
SaveSetting "PPCalc", "Settings", "rpp_FeeAmount", rppcalc_settings.FeeAmount
SaveSetting "PPCalc", "Settings", "rpp_FeePercentage", rppcalc_settings.FeePercentage
SaveSetting "PPCalc", "Settings", "rpp_InOrderToCountry", CStr(rppcalc_settings.InOrderToCountry)
SaveSetting "PPCalc", "Settings", "rpp_BuyerMustSendCountry", CStr(rppcalc_settings.BuyerMustSendCountry)
SaveSetting "PPCalc", "Settings", "rpp_ForYourItem", rppcalc_settings.ForYourItem
SaveSetting "PPCalc", "Settings", "rpp_SH", rppcalc_settings.SH

If GetSetting("PPCalc", "Settings", "timesRun") = "" Then
 SaveSetting "PPCalc", "Settings", "timesRun", "1"
ElseIf Val(GetSetting("PPCalc", "Settings", "timesRun")) <> -1 Then
 SaveSetting "PPCalc", "Settings", "timesRun", CStr(Val(GetSetting("PPCalc", "Settings", "timesRun")) + 1)
End If

If Val(GetSetting("PPCalc", "Settings", "timesRun")) > 10 Then
 SaveSetting "PPCalc", "Settings", "timesRun", "1"
 'ShellExecute 0, vbNullString, "http://www.ppcalc.com/out.php?id=19&kw=ebay", vbNullString, vbNullString, vbNormalFocus
End If
End Sub
Private Sub Frame1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
 Call DragEntireForm(Button, Shift, x, y, Me)
End Sub

Private Sub showAboutDialog()
 Dim frm1 As frmAbout
 Set frm1 = New frmAbout
 Load frm1
 frm1.Show vbModal, Me
End Sub

Private Sub eraseEverything()
Label1(0).Visible = False
Label1(1).Visible = False
Label1(2).Visible = False
Label1(3).Visible = False
Label1(4).Visible = False
'Command3.Visible = False
'Command2.Visible = False
Text1.Visible = False
Text2.Visible = False
Text8.Visible = False
Text10.Visible = False
Toolbar1(0).Visible = False
Toolbar1(1).Visible = False
Toolbar1(2).Visible = False
Toolbar1(3).Visible = False
Label1(9).Visible = False
Label1(19).Visible = False
Combo4.Visible = False
Combo5.Visible = False
Label1(5).Visible = False
Label1(6).Visible = False
Text9.Visible = False
Toolbar1(4).Visible = False
Label1(7).Visible = False
Text11.Visible = False
Toolbar1(5).Visible = False
Toolbar1(6).Visible = False
Label1(8).Visible = False

Combo1(0).Visible = False
Combo1(1).Visible = False
Combo3.Visible = False
Text4.Visible = False
Text5.Visible = False
Text3.Visible = False

Line1.Visible = False
Text6(0).Visible = False
Text6(1).Visible = False
Combo6.Visible = False
Combo7.Visible = False

Check1(0).Visible = False
Check1(1).Visible = False

Text4.Text = options_settings.paypalFeeRate
Text5.Text = options_settings.paypalFixedFee

'clean up user input
If Text4.Text = "" Then
 UpdateRate
ElseIf Mid(Text4.Text, 1, 1) = "." Then
 Text4.MaxLength = Text4.MaxLength + 1
 Text4.Text = "0" & Text4.Text
ElseIf InStr(Text4.Text, ".") > 1 Then
 Text4.MaxLength = 0
 Text4.Text = FormatNumber(Text4.Text, 2, vbTrue)
 If Right$(Text4.Text, 1) = "0" Then
  Text4.Text = Mid(Text4.Text, 1, Len(Text4.Text) - 1)
 End If
 Text4.MaxLength = Len(Text4.Text)
End If
If Text5.Text = "" Then
 Select Case Combo1(0).ListIndex
   Case 1
    Text5.Text = "0.55"
   Case 2
    Text5.Text = "0.35"
   Case 3
    Text5.Text = "0.20"
   Case 4
    Text5.Text = "0.40"
   Case 5
    Text5.Text = "40"
   Case Else
    Text5.Text = "0.30"
  End Select
ElseIf Mid(Text5.Text, 1, 1) = "." Then
 Text5.MaxLength = Text5.MaxLength + 1
 Text5.Text = "0" & Text5.Text
End If
If InStr(Text5.Text, ".") > 1 Then
 Text5.MaxLength = 0
 Text5.Text = FormatNumber(Text5.Text, 2, vbTrue)
 Text5.MaxLength = Len(Text5.Text)
End If

options_settings.paypalFeeRate = Text4.Text
options_settings.paypalFixedFee = Text5.Text
End Sub

Private Sub OptionsOn()
 Label1(20).ForeColor = &HFF0000
 Label1(20).Font.Underline = True
 Label1(20).Tag = 1
 Label1(23).ForeColor = &HFF0000
 Label1(23).Font.Underline = True
 Label1(23).Tag = 1
 Label1(24).ForeColor = &H80000012
 Label1(24).Font.Underline = False
 Label1(24).Tag = 0
 Frame1.Caption = "Options"
 Label1(0).Caption = "Source Country:"
 Label1(0).Left = 570
 Label1(0).Top = 300
 Label1(0).Visible = True
 Label1(1).Caption = "Destination Country:"
 Label1(1).Left = 270
 Label1(1).Top = 660
 Label1(1).Visible = True
 Label1(2).Caption = "Monthly Sales Volume:"
 Label1(2).Left = 90
 Label1(2).Top = 1005
 Label1(2).Visible = True
 Label1(3).Caption = "PayPal Fee Rate:"
 Label1(3).Left = 435
 Label1(3).Top = 1350
 Label1(3).Visible = True
 Label1(4).Caption = "Cost of Shipping:  " & dest_char
 Label1(4).Left = 480
 Label1(4).Top = 1695
 Label1(4).Visible = True
 Combo1(0).Left = 1890 'Source Country
 Combo1(0).Top = 255
 Combo1(0).Width = 1245
 Combo1(0).Appearance = 0
 Combo1(0).Visible = True
 Combo1(1).Left = 1890 'Destination Country
 Combo1(1).Top = 600
 Combo1(1).Width = 1245
 Combo1(1).Appearance = 0
 Combo1(1).Visible = True
 Combo3.Top = 945 'Monthly Sales Volume
 Combo3.Left = 1890
 Combo3.Width = 2520
 Combo3.Appearance = 0
 Combo3.Visible = True
 Text4.Left = 1890 'PayPal percentage
 Text4.Top = 1305
 Text4.Width = 300
 Text4.Height = 285
 Text4.BackColor = &H8000000F
 Text4.Appearance = 0
 Text4.BorderStyle = 1
 Text4.Visible = True
 Label1(9).Caption = "%  +  " & source_char
 Label1(9).Left = 2205
 Label1(9).Top = 1350
 Label1(9).Visible = True
 Text5.Left = 2715 'PayPal fixed (0.30)
 Text5.Top = 1305
 Text5.Width = 390
 Text5.Height = 285
 Text5.BackColor = &H8000000F
 Text5.Appearance = 0
 Text5.BorderStyle = 1
 Text5.Visible = True
 Text3.Left = 1890 'Cost of shipping
 Text3.Top = 1650
 Text3.Width = 1215
 Text3.Height = 285
 Text3.BorderStyle = 1
 Text3.BackColor = &H80000005
 Text3.Appearance = 0
 Text3.Visible = True
 Line1.Visible = True
 Label1(7).Left = 2040
 Label1(7).Top = 2115
 Label1(7).Caption = "Convert"
 Label1(7).Visible = True
 Label1(8).Left = 3225
 Label1(8).Top = 2115
 Label1(8).Caption = "from"
 Label1(8).Visible = True
 Combo6.Left = 3585
 Combo6.Top = 2070
 Combo6.Width = 735
 Combo6.Visible = True
 Label1(19).Left = 4335
 Label1(19).Top = 2130
 Label1(19).Caption = "to"
 Label1(19).Visible = True
 Label1(5).Left = 3465
 Label1(5).Top = 2475
 Label1(5).Caption = "$"
 Label1(5).Visible = True
 Combo7.Left = 4515
 Combo7.Top = 2070
 Combo7.Width = 735
 Combo7.Visible = True
 
 Command2.Left = Frame1.Left + 2490
 Command2.Top = Frame1.Top + 2415
 Command2.Width = 885
 Command2.Height = 285
 Command2.Caption = "Convert"
 'Command2.Visible = True
 
 Text6(0).Left = 2640
 Text6(0).Top = 2070
 Text6(0).Width = 555
 Text6(0).Height = 285
 Text6(0).Visible = True
 Text6(1).Left = 3600
 Text6(1).Top = 2430
 Text6(1).Width = 945
 Text6(1).BackColor = &H8000000F
 Text6(1).Height = 285
 Text6(1).Appearance = 0
 Text6(1).BorderStyle = 1
 Text6(1).Visible = True
 
 Toolbar1(5).Left = 4710
 Toolbar1(5).Top = 4345
 Toolbar1(5).Visible = True
 
 Toolbar1(6).Left = 5055
 Toolbar1(6).Top = 4345
 Toolbar1(6).Visible = True
 
 Command3.Top = Frame1.Top + 2175
 Command3.Left = Frame1.Left + 135
 Command3.Width = 1845
 Command3.Caption = "Update exchange rates"
 'Command3.Visible = True
 
 Check1(0).Left = 3165
 Check1(0).Top = 1650
 Check1(0).Width = 2115
 Check1(0).Height = 225
 Check1(0).Visible = True
 
 Check1(1).Left = 3165
 Check1(1).Top = 1380
 Check1(1).Width = 1635
 Check1(1).Height = 225
 Check1(1).Visible = True
 
 Dim old(0 To 1) As String
 old(0) = options_settings.paypalFeeRate
 old(1) = options_settings.paypalFixedFee
 
 'load saved settings
 Combo1(0).ListIndex = options_settings.srcCountryIndex
 Combo1(1).ListIndex = options_settings.destCountryIndex
 Combo3.ListIndex = options_settings.monthlySalesVolumeIndex
 If Combo3.List(0) = "$0.00 CAD - $3,000.00 CAD" Then
  Combo3.Width = 3015
 ElseIf Combo3.List(0) = "€0.00 EUR - €2,500.00 EUR" Then
  Combo3.Width = 3045
 ElseIf Combo3.List(0) = "£0.00 GBP - £1,500.00 GBP" Then
  Combo3.Width = 2955
 ElseIf Combo3.List(0) = "$0.00 AUD - $5,000.00 AUD" Then
  Combo3.Width = 3045
 Else
  Combo3.Width = 2520
 End If
 
 options_settings.paypalFeeRate = old(0)
 options_settings.paypalFixedFee = old(1)

 Text4.MaxLength = Len(options_settings.paypalFeeRate)
 Text4.Text = options_settings.paypalFeeRate
 Text5.MaxLength = Len(options_settings.paypalFixedFee)
 Text5.Text = options_settings.paypalFixedFee
 Text3.MaxLength = Len(options_settings.shippingCost)
 Text3.Text = options_settings.shippingCost
 Check1(1).Value = options_settings.echeckPayment
 Check1(0).Value = options_settings.currencyConversionFee
 Combo6.ListIndex = options_settings.srcCountryConversion
 Combo7.ListIndex = options_settings.destCountryConversion
 
End Sub

Private Sub PayPalCalculatorOn()
 Label1(23).ForeColor = &HFF0000
 Label1(23).Font.Underline = True
 Label1(23).Tag = 1
 Label1(24).ForeColor = &HFF0000
 Label1(24).Font.Underline = True
 Label1(24).Tag = 1
 Label1(20).ForeColor = &H80000012
 Label1(20).Font.Underline = False
 Label1(20).Tag = 0
 Frame1.Caption = "PayPal Fee Calculator"
 Frame1.Visible = True
 
 Label1(0).Caption = "If a person sends you:  " & source_char
 Label1(0).Left = 810
 Label1(0).Top = 315
 Label1(0).Visible = True
 
 Label1(1).Caption = "Your PayPal fees would be:  " & source_char
 Label1(1).Left = Label1(0).Left - 390
 Label1(1).Top = Label1(0).Top + 330
 Label1(1).Visible = True
 
 Label1(2).Caption = "And you would receive:  "
 Label1(2).Left = Label1(0).Left - 115
 Label1(2).Top = Label1(0).Top + 660
 Label1(2).Visible = True
 
 Label1(19).Caption = source_char
 Label1(19).Left = Label1(0).Left + 1650
 Label1(19).Top = Label1(2).Top
 Label1(19).Visible = True
 
 Label1(3).Caption = "Making your fee percentage:"
 Label1(3).Left = Label1(0).Left - 515
 Label1(3).Top = Label1(0).Top + 975
 Label1(3).Visible = True
 
 Label1(4).Caption = "%"
 Label1(4).Left = Label1(0).Left + 1620
 Label1(4).Top = Label1(0).Top + 1005
 Label1(4).Visible = True
 
 Command3.Caption = "Clear"
 Command3.Left = Frame1.Left + 1310
 Command3.Top = Frame1.Top + 1635
 Command3.Width = 1155
 Command3.Height = 360
 'Command3.Visible = True
 
 Command2.Caption = "Calculate" 'Calculate button on PayPal Calculator
 Command2.Left = Frame1.Left + 2545
 Command2.Top = Command3.Top
 Command2.Width = Command3.Width
 Command2.Height = Command3.Height
 'Command2.Visible = True
 
 Toolbar1(0).Left = 3750
 Toolbar1(0).Top = Label1(0).Top - 60
 Toolbar1(0).Visible = True
 Toolbar1(1).Left = 3885
 Toolbar1(1).Top = Label1(0).Top + 2220
 Toolbar1(1).Visible = True
 Toolbar1(2).Left = 3885
 Toolbar1(2).Top = Label1(0).Top + 2565
 Toolbar1(2).Visible = True
 Toolbar1(3).Left = 3885
 Toolbar1(3).Top = Label1(0).Top + 2895
 Toolbar1(3).Visible = True
 
 Label1(9).Caption = "in"
 Label1(9).Left = 4140
 Label1(9).Top = Label1(0).Top
 Label1(9).Visible = True
 
 Combo4.Left = 4410
 Combo4.Top = Label1(0).Top - 45
 Combo4.Width = 735
 Combo4.Visible = True
 
 Text1.Left = 2595 'in order to receive..text box
 Text1.Top = Label1(0).Top - 45
 Text1.Width = 1095
 Text1.Height = 285
 Text1.Visible = True
 
 Text2.Left = 2595 'a buyer must send you exactly..text box
 Text2.Top = Label1(0).Top + 285
 Text2.Width = 1095
 Text2.Height = 285
 Text2.Visible = True
 
 Text8.Left = 2595 ' which makes your fee amount..text box
 Text8.Top = Label1(0).Top + 615
 Text8.Width = 1095
 Text8.Height = 285
 Text8.Visible = True
 
 Text10.Left = 2595
 Text10.Top = Label1(0).Top + 960
 Text10.Width = 1095
 Text10.Height = 285
 Text10.Visible = True
 
 If Combo1(0).ListIndex = 6 Then
  Combo4.ListIndex = 0
 Else
  Combo4.ListIndex = Combo1(0).ListIndex
 End If
 
 'load saved settings
 Text1.MaxLength = Len(ppcalc_settings.IfAPersonSendsYou)
 Text1.Text = ppcalc_settings.IfAPersonSendsYou
 Text2.Text = ppcalc_settings.PayPalFees
 Text8.Text = ppcalc_settings.WouldReceive
 Text10.Text = ppcalc_settings.FeePercentage
  
 If ppcalc_settings.srcCountryIndex = 6 Then
  Combo4.ListIndex = 0
 Else
  Combo4.ListIndex = ppcalc_settings.srcCountryIndex
 End If
 
End Sub

Private Sub ReversePayPalCalculatorOn()
 Label1(20).ForeColor = &HFF0000
 Label1(20).Font.Underline = True
 Label1(20).Tag = 1
 Label1(24).ForeColor = &HFF0000
 Label1(24).Font.Underline = True
 Label1(24).Tag = 1
 Label1(23).ForeColor = &H80000012
 Label1(23).Font.Underline = False
 Label1(23).Tag = 0
 Frame1.Caption = "Reverse PayPal Fee Calculator"
 Frame1.Left = 142
 Frame1.Top = 1950
 Frame1.Visible = True
 Label1(0).Caption = "In order for you to receive:  " & dest_char
 Label1(0).Left = 510
 Label1(0).Top = 315
 Label1(0).Visible = True
 Label1(1).Caption = "A buyer must send you exactly:  " & source_char
 Label1(1).Left = 180
 Label1(1).Top = 645
 Label1(1).Visible = True
 Label1(2).Caption = "Which makes your fee amount:  " & source_char
 Label1(2).Left = 165
 Label1(2).Top = 975
 Label1(2).Visible = True
 Label1(3).Caption = "And your fee percentage:"
 Label1(3).Left = 555
 Label1(3).Top = 1290
 Label1(3).Visible = True
 Label1(4).Caption = "%"
 Label1(4).Left = 2430
 Label1(4).Top = 1320
 Label1(4).Visible = True
 
 Command3.Caption = "Clear"
 Command3.Left = Frame1.Left + 1310
 Command3.Top = Frame1.Top + 1635
 Command3.Width = 1155
 Command3.Height = 360
 'Command3.Visible = True
 
 Command2.Caption = "Calculate" 'Calculate button on Reverse PayPal Calculator
 Command2.Left = Frame1.Left + 2545
 Command2.Top = Command3.Top
 Command2.Width = Command3.Width
 Command2.Height = Command3.Height
 'Command2.Visible = True
 
 Label1(5).Caption = "To recover the cost of PayPal fees you must either charge"
 Label1(5).Left = 120
 Label1(5).Top = 2085
 Label1(5).Visible = True
 Label1(6).Caption = source_char
 Label1(6).Left = 150
 Label1(6).Top = 2400
 Label1(6).Visible = True
 Toolbar1(4).Left = 1260
 Toolbar1(4).Top = 4290
 Toolbar1(4).Visible = True
 Label1(7).Caption = "for your item or " & source_char
 Label1(7).Left = 1500
 Label1(7).Top = 2400
 Label1(7).Visible = True
 Toolbar1(5).Left = 3375
 Toolbar1(5).Top = 4290
 Toolbar1(5).Visible = True
 Label1(8).Caption = "for S&&H"
 Label1(8).Left = 3615
 Label1(8).Top = 2400
 Label1(8).Visible = True
 Toolbar1(0).Left = 3750
 Toolbar1(0).Top = 255
 Toolbar1(0).Visible = True
 Toolbar1(1).Left = 3885
 Toolbar1(1).Top = 2535
 Toolbar1(1).Visible = True
 Toolbar1(2).Left = 3885
 Toolbar1(2).Top = 2880
 Toolbar1(2).Visible = True
 Toolbar1(3).Left = 3885
 Toolbar1(3).Top = 3210
 Toolbar1(3).Visible = True
 Label1(9).Caption = "in"
 Label1(9).Left = 4140
 Label1(9).Top = 315
 Label1(9).Visible = True
 Label1(19).Caption = "in"
 Label1(19).Left = 4140
 Label1(19).Top = 645
 Label1(19).Visible = True
 Combo4.Left = 4410
 Combo4.Top = 270
 Combo4.Width = 735
 Combo4.Visible = True
 Combo5.Left = 4410
 Combo5.Top = 600
 Combo5.Width = 735
 Combo5.Visible = True
 Text1.Left = 2595 'in order to receive..text box
 Text1.Top = 270
 Text1.Width = 1095
 Text1.Height = 285
 Text1.Visible = True
 Text2.Left = 2595 'a buyer must send you exactly..text box
 Text2.Top = 600
 Text2.Width = 1095
 Text2.Height = 285
 Text2.Visible = True
 Text8.Left = 2595 ' which makes your fee amount..text box
 Text8.Top = 930
 Text8.Width = 1095
 Text8.Height = 285
 Text8.Visible = True
 Text9.Left = 285
 Text9.Top = 2355
 Text9.Width = 800
 Text9.Visible = True
 Text10.Left = 2595
 Text10.Top = 1275
 Text10.Width = 1095
 Text10.Height = 285
 Text10.Visible = True
 Text11.Left = 2715
 Text11.Top = 2355
 Text11.Width = 485
 Text11.Visible = True
 
 If Text3.Text = "" Then
  Text3.Text = "0"
 End If
 
 'load saved settings
 Text1.MaxLength = Len(rppcalc_settings.InOrderToReceive)
 Text1.Text = rppcalc_settings.InOrderToReceive
 Text2.Text = rppcalc_settings.BuyerMustSend
 Text8.Text = rppcalc_settings.FeeAmount
 Text10.Text = rppcalc_settings.FeePercentage
 If rppcalc_settings.InOrderToCountry = 6 Then
  Combo4.ListIndex = 0
 Else
  Combo4.ListIndex = rppcalc_settings.InOrderToCountry
 End If
 If rppcalc_settings.BuyerMustSendCountry = 6 Then
  Combo5.ListIndex = 0
 Else
  Combo5.ListIndex = rppcalc_settings.BuyerMustSendCountry
 End If
 Text9.Text = rppcalc_settings.ForYourItem
 Text11.Text = rppcalc_settings.SH
 
End Sub

Private Sub Label1_Click(Index As Integer)
Select Case Index
Case 10 'About was clicked
 Call showAboutDialog
Case 20 'PayPal Calculator was clicked
 Call eraseEverything
 Call PayPalCalculatorOn
 Call setTheFocus
Case 23 'Reverse PayPal Calculator was clicked
 Call eraseEverything
 Call ReversePayPalCalculatorOn
 Call setTheFocus
Case 24 'Options was clicked
 Call eraseEverything
 Call OptionsOn
 Call setTheFocus
End Select
End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Select Case Index
Case 20, 23, 24, 10
 If Label1(Index).Tag = 1 Then
  If (lHandle > 0) Then SetCursor lHandle
 End If
End Select


End Sub

Private Sub label1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Select Case Index
Case 20, 23, 24, 10
 If Label1(Index).Tag = 1 Then
  If (lHandle > 0) Then SetCursor lHandle
 End If
End Select
 Call DragEntireForm(Button, Shift, x, y, Me)
End Sub

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
 Call DragEntireForm(Button, Shift, x, y, Me)
End Sub

Private Sub Text1_Change()
If Label1(20).Tag = 0 Then
 ppcalc_settings.IfAPersonSendsYou = Text1.Text
ElseIf Label1(23).Tag = 0 Then
 rppcalc_settings.InOrderToReceive = Text1.Text
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
 Select Case KeyAscii
  Case 8
   'Ok to type backspace
   If InStr(Text1.Text, ".") > 0 Then 'there is already a . in there
    Text1.MaxLength = InStr(Text1.Text, ".") + 2 'max length is location of decimal point plus 2
   Else
    Text1.MaxLength = 9
   End If
  Case 13
   If Label1(23).Tag = 0 Then
    Call RPayPalCalculate
   ElseIf Label1(20).Tag = 0 Then
    Call PayPalCalculate
   End If
   KeyAscii = 0
  Case 46
   'Ok to type .
   If InStr(Text1.Text, ".") > 0 Then 'there is already a . in there
    KeyAscii = 0 'unsuccessfully tried to type .
    Text1.MaxLength = InStr(Text1.Text, ".") + 2 'max length is location of decimal point plus 2
   ElseIf Len(Text1.Text) + 3 <= Text1.MaxLength Then
    Text1.MaxLength = Len(Text1.Text) + 3 'successfully typed .
   Else
    KeyAscii = 0
   End If
  Case 48 To 57
   If InStr(Text1.Text, ".") = 0 Then 'there is NOT a . in there
    Text1.MaxLength = 9
   End If
  Case Else
   KeyAscii = 0
  End Select
End Sub

Private Sub Text10_Change()
If Label1(20).Tag = 0 Then
 ppcalc_settings.FeePercentage = Text10.Text
ElseIf Label1(23).Tag = 0 Then
 rppcalc_settings.FeePercentage = Text10.Text
End If
End Sub

Private Sub Text11_Change()
If Label1(23).Tag = 0 Then
 rppcalc_settings.SH = Text11.Text
End If
End Sub

Private Sub Text2_Change()
If Label1(20).Tag = 0 Then
 ppcalc_settings.PayPalFees = Text2.Text
ElseIf Label1(23).Tag = 0 Then
 rppcalc_settings.BuyerMustSend = Text2.Text
End If
End Sub

Private Sub Text3_Change()
 If Text3.Text <> "" Then
  options_settings.shippingCost = Text3.Text
 Else
  options_settings.shippingCost = "0"
 End If
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
 Select Case KeyAscii
  Case 8
   'Ok to type backspace
   If InStr(Text3.Text, ".") > 0 Then 'there is already a . in there
    Text3.MaxLength = InStr(Text3.Text, ".") + 2 'max length is location of decimal point plus 2
   Else
    Text3.MaxLength = 9
   End If
  Case 46
   'Ok to type .
   If InStr(Text3.Text, ".") > 0 Then 'there is already a . in there
    KeyAscii = 0 'unsuccessfully tried to type .
    Text3.MaxLength = InStr(Text3.Text, ".") + 2 'max length is location of decimal point plus 2
   ElseIf Len(Text3.Text) + 3 <= Text3.MaxLength Then
    Text3.MaxLength = Len(Text3.Text) + 3 'successfully typed .
   Else
    KeyAscii = 0
   End If
  Case 48 To 57
   If InStr(Text3.Text, ".") = 0 Then 'there is NOT a . in there
    Text3.MaxLength = 9
   End If
  Case Else
   KeyAscii = 0
  End Select
End Sub

Private Sub Text4_Change()
 options_settings.paypalFeeRate = Text4.Text
End Sub

Private Sub Text4_GotFocus()
 Text4.BackColor = &H80000005
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
 Select Case KeyAscii
  Case 8
   'Ok to type backspace
   If InStr(Text4.Text, ".") > 0 Then 'there is already a . in there
    Text4.MaxLength = InStr(Text4.Text, ".") + 2 'max length is location of decimal point plus 2
   Else
    Text4.MaxLength = 9
   End If
  Case 46
   'Ok to type .
   If InStr(Text4.Text, ".") > 0 Then 'there is already a . in there
    KeyAscii = 0 'unsuccessfully tried to type .
    Text4.MaxLength = InStr(Text4.Text, ".") + 2 'max length is location of decimal point plus 2
   ElseIf Len(Text4.Text) + 3 <= Text4.MaxLength Then
    Text4.MaxLength = Len(Text4.Text) + 3 'successfully typed .
   Else
    KeyAscii = 0
   End If
  Case 48 To 57
   If InStr(Text4.Text, ".") = 0 Then 'there is NOT a . in there
    Text4.MaxLength = 9
   End If
  Case Else
   KeyAscii = 0
  End Select
End Sub

Private Sub Text4_LostFocus()
 Text4.BackColor = &H8000000F
End Sub

Private Sub Text5_Change()
 options_settings.paypalFixedFee = Text5.Text
End Sub

Private Sub Text5_GotFocus()
 Text5.BackColor = &H80000005
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)
 Select Case KeyAscii
  Case 8
   'Ok to type backspace
   If InStr(Text5.Text, ".") > 0 Then 'there is already a . in there
    Text5.MaxLength = InStr(Text5.Text, ".") + 2 'max length is location of decimal point plus 2
   Else
    Text5.MaxLength = 9
   End If
  Case 46
   'Ok to type .
   If InStr(Text5.Text, ".") > 0 Then 'there is already a . in there
    KeyAscii = 0 'unsuccessfully tried to type .
    Text5.MaxLength = InStr(Text5.Text, ".") + 2 'max length is location of decimal point plus 2
   ElseIf Len(Text5.Text) + 3 <= Text5.MaxLength Then
    Text5.MaxLength = Len(Text5.Text) + 3 'successfully typed .
   Else
    KeyAscii = 0
   End If
  Case 48 To 57
   If InStr(Text5.Text, ".") = 0 Then 'there is NOT a . in there
    Text5.MaxLength = 9
   End If
  Case Else
   KeyAscii = 0
  End Select
  
End Sub

Private Sub Text5_LostFocus()
 Text5.BackColor = &H8000000F
 SaveSetting "PPCalc", "Settings", "o_ppfixedfee", options_settings.paypalFixedFee
End Sub

Private Sub Command1_Click()
 Call EndTheProgram
End Sub

Private Sub Text6_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If Shift = 2 Then
 If KeyCode = 65 Then 'Select All
  Text6(Index).SelStart = 0
  Text6(Index).SelLength = Len(Text6(Index).Text)
 ElseIf KeyCode = 67 Then 'copy
  Clipboard.Clear
  Clipboard.SetText Text6(Index).SelText
 End If
End If

If Index = 0 And Shift = 2 And KeyCode = 86 Then 'paste
Dim to_paste As String
to_paste = Clipboard.GetText
to_paste = CleanUpGarbage(to_paste)
 If Text6(Index).SelLength < Len(Text6(Index).Text) Then
  Dim old_pos As Integer
  old_pos = Text6(Index).SelStart
  Text6(Index).Text = Mid(Text6(Index).Text, 1, old_pos) & to_paste & Mid(Text6(Index).Text, old_pos + Text6(Index).SelLength + 1)
  Text6(Index).SelStart = old_pos + Len(to_paste)
 ElseIf Text6(Index).SelLength = Len(Text6(Index).Text) Then
  Text6(Index).Text = to_paste
  Text6(Index).SelStart = Len(Text6(Index).Text)
 End If
End If
End Sub

Private Function CleanUpGarbage(in_string As String) As String
Dim i As Integer
Dim answer As String
Dim period_put As Boolean
period_put = False

If Len(in_string) > 0 Then
For i = 1 To Len(in_string)
  If Asc(Mid(in_string, i, 1)) > 47 And Asc(Mid(in_string, i, 1)) < 58 Then '0-9
   answer = answer & Mid(in_string, i, 1)
  ElseIf Mid(in_string, i, 1) = "." Then
   If period_put = False Then
    answer = answer & "."
    period_put = True
   End If
  End If
Next
Else
 answer = ""
End If
CleanUpGarbage = answer
End Function

Private Sub Text6_KeyPress(Index As Integer, KeyAscii As Integer)
If Index = 0 Then
 Select Case KeyAscii
  Case 8
   'Ok to type backspace
   If InStr(Text6(Index).Text, ".") > 0 Then 'there is already a . in there
    Text6(Index).MaxLength = InStr(Text6(Index).Text, ".") + 2 'max length is location of decimal point plus 2
   Else
    Text6(Index).MaxLength = 9
   End If
  Case 13 'user pressed Enter
   KeyAscii = 0
   Call Command2_Click
  Case 46
   'Ok to type .
   If InStr(Text6(Index).Text, ".") > 0 Then 'there is already a . in there
    KeyAscii = 0 'unsuccessfully tried to type .
    Text6(Index).MaxLength = InStr(Text6(Index).Text, ".") + 2 'max length is location of decimal point plus 2
   ElseIf Len(Text6(Index).Text) + 3 <= Text6(Index).MaxLength Then
    Text6(Index).MaxLength = Len(Text6(Index).Text) + 3 'successfully typed .
   Else
    KeyAscii = 0
   End If
  Case 48 To 57
   If InStr(Text6(Index).Text, ".") = 0 Then 'there is NOT a . in there
    Text6(Index).MaxLength = 9
   End If
  Case Else
   KeyAscii = 0
  End Select
End If
End Sub

Private Sub Text8_Change()
If Label1(20).Tag = 0 Then
 ppcalc_settings.WouldReceive = Text8.Text
ElseIf Label1(23).Tag = 0 Then
 rppcalc_settings.FeeAmount = Text8.Text
End If
End Sub

Private Sub Text9_Change()
If Label1(23).Tag = 0 Then
 rppcalc_settings.ForYourItem = Text9.Text
End If
End Sub

Private Sub Toolbar1_ButtonClick(Index As Integer, ByVal Button As MSComCtlLib.Button)
    On Error Resume Next
    Select Case Button.Key
        Case "Copy"
         Clipboard.Clear
            Select Case Index
             Case 0
              Clipboard.SetText Text1.Text
             Case 1
              Clipboard.SetText Text2.Text
             Case 2
              Clipboard.SetText Text8.Text
             Case 3
              Clipboard.SetText Text10.Text
             Case 4
              Clipboard.SetText Text9.Text
             Case 5
              If Label1(23).Tag = 0 Then
               Clipboard.SetText Text11.Text
              Else
               Clipboard.SetText Text6(1).Text
              End If
            End Select
        Case "Clear"
         Text6(0).Text = ""
         Text6(1).Text = ""
        Case "eBay"
         ShellExecute 0, vbNullString, "http://www.ebay.com", vbNullString, vbNullString, vbNormalFocus
        Case "PayPal"
         ShellExecute 0, vbNullString, "http://www.paypal.com", vbNullString, vbNullString, vbNormalFocus
        Case "Notepad"
         ShellExecute 0, "Open", "notepad", AppPath & "paypal_fee_notes.txt", vbNullString, vbNormalFocus
        Case "Calc"
         ShellExecute 0, vbNullString, "calc", vbNullString, vbNullString, vbNormalFocus
    End Select
End Sub

Private Sub fillArray(ByRef ra() As Single)
ra(0, 0, 0) = 0.029
ra(0, 0, 1) = 0.025
ra(0, 0, 2) = 0.022
ra(0, 0, 3) = 0.019
ra(0, 0, 4) = 0
ra(0, 1, 0) = 0.039
ra(0, 1, 1) = 0.035
ra(0, 1, 2) = 0.032
ra(0, 1, 3) = 0.029
ra(0, 1, 4) = 0
ra(0, 2, 0) = 0.039
ra(0, 2, 1) = 0.034
ra(0, 2, 2) = 0.032
ra(0, 2, 3) = 0.029
ra(0, 2, 4) = 0.024
ra(0, 3, 0) = 0.039
ra(0, 3, 1) = 0.034
ra(0, 3, 2) = 0.032
ra(0, 3, 3) = 0.029
ra(0, 3, 4) = 0.024
ra(0, 4, 0) = 0.034
ra(0, 4, 1) = 0.03
ra(0, 4, 2) = 0.027
ra(0, 4, 3) = 0.024
ra(0, 4, 4) = 0
ra(0, 5, 0) = 0.039
ra(0, 5, 1) = 0.034
ra(0, 5, 2) = 0.032
ra(0, 5, 3) = 0.029
ra(0, 5, 4) = 0
ra(0, 6, 0) = 0.039
ra(0, 6, 1) = 0.034
ra(0, 6, 2) = 0.032
ra(0, 6, 3) = 0.029
ra(0, 6, 4) = 0
ra(1, 0, 0) = 0.039
ra(1, 0, 1) = 0.035
ra(1, 0, 2) = 0.032
ra(1, 0, 3) = 0.029
ra(1, 0, 4) = 0
ra(1, 1, 0) = 0.029
ra(1, 1, 1) = 0.025
ra(1, 1, 2) = 0.022
ra(1, 1, 3) = 0.019
ra(1, 1, 4) = 0
ra(1, 2, 0) = 0.039
ra(1, 2, 1) = 0.034
ra(1, 2, 2) = 0.032
ra(1, 2, 3) = 0.029
ra(1, 2, 4) = 0.024
ra(1, 3, 0) = 0.039
ra(1, 3, 1) = 0.034
ra(1, 3, 2) = 0.032
ra(1, 3, 3) = 0.029
ra(1, 3, 4) = 0.024
ra(1, 4, 0) = 0.034
ra(1, 4, 1) = 0.03
ra(1, 4, 2) = 0.027
ra(1, 4, 3) = 0.024
ra(1, 4, 4) = 0
ra(1, 5, 0) = 0.039
ra(1, 5, 1) = 0.034
ra(1, 5, 2) = 0.032
ra(1, 5, 3) = 0.029
ra(1, 5, 4) = 0
ra(1, 6, 0) = 0.039
ra(1, 6, 1) = 0.034
ra(1, 6, 2) = 0.032
ra(1, 6, 3) = 0.029
ra(1, 6, 4) = 0
ra(2, 0, 0) = 0.039
ra(2, 0, 1) = 0.035
ra(2, 0, 2) = 0.032
ra(2, 0, 3) = 0.029
ra(2, 0, 4) = 0
ra(2, 1, 0) = 0.039
ra(2, 1, 1) = 0.035
ra(2, 1, 2) = 0.032
ra(2, 1, 3) = 0.029
ra(2, 1, 4) = 0
ra(2, 2, 0) = 0.034
ra(2, 2, 1) = 0.029
ra(2, 2, 2) = 0.027
ra(2, 2, 3) = 0.024
ra(2, 2, 4) = 0.019
ra(2, 3, 0) = 0.034
ra(2, 3, 1) = 0.029
ra(2, 3, 2) = 0.027
ra(2, 3, 3) = 0.024
ra(2, 3, 4) = 0.019
ra(2, 4, 0) = 0.034
ra(2, 4, 1) = 0.03
ra(2, 4, 2) = 0.027
ra(2, 4, 3) = 0.024
ra(2, 4, 4) = 0
ra(2, 5, 0) = 0.039
ra(2, 5, 1) = 0.034
ra(2, 5, 2) = 0.032
ra(2, 5, 3) = 0.029
ra(2, 5, 4) = 0
ra(2, 6, 0) = 0.039
ra(2, 6, 1) = 0.034
ra(2, 6, 2) = 0.032
ra(2, 6, 3) = 0.029
ra(2, 6, 4) = 0
ra(3, 0, 0) = 0.039
ra(3, 0, 1) = 0.035
ra(3, 0, 2) = 0.032
ra(3, 0, 3) = 0.029
ra(3, 0, 4) = 0
ra(3, 1, 0) = 0.039
ra(3, 1, 1) = 0.035
ra(3, 1, 2) = 0.032
ra(3, 1, 3) = 0.029
ra(3, 1, 4) = 0
ra(3, 2, 0) = 0.039
ra(3, 2, 1) = 0.034
ra(3, 2, 2) = 0.032
ra(3, 2, 3) = 0.029
ra(3, 2, 4) = 0.024
ra(3, 3, 0) = 0.034
ra(3, 3, 1) = 0.029
ra(3, 3, 2) = 0.027
ra(3, 3, 3) = 0.024
ra(3, 3, 4) = 0.019
ra(3, 4, 0) = 0.034
ra(3, 4, 1) = 0.03
ra(3, 4, 2) = 0.027
ra(3, 4, 3) = 0.024
ra(3, 4, 4) = 0
ra(3, 5, 0) = 0.039
ra(3, 5, 1) = 0.034
ra(3, 5, 2) = 0.032
ra(3, 5, 3) = 0.029
ra(3, 5, 4) = 0
ra(3, 6, 0) = 0.039
ra(3, 6, 1) = 0.034
ra(3, 6, 2) = 0.032
ra(3, 6, 3) = 0.029
ra(3, 6, 4) = 0
ra(4, 0, 0) = 0.039
ra(4, 0, 1) = 0.035
ra(4, 0, 2) = 0.032
ra(4, 0, 3) = 0.029
ra(4, 0, 4) = 0
ra(4, 1, 0) = 0.039
ra(4, 1, 1) = 0.035
ra(4, 1, 2) = 0.032
ra(4, 1, 3) = 0.029
ra(4, 1, 4) = 0
ra(4, 2, 0) = 0.039
ra(4, 2, 1) = 0.034
ra(4, 2, 2) = 0.032
ra(4, 2, 3) = 0.029
ra(4, 2, 4) = 0.024
ra(4, 3, 0) = 0.039
ra(4, 3, 1) = 0.034
ra(4, 3, 2) = 0.032
ra(4, 3, 3) = 0.029
ra(4, 3, 4) = 0.024
ra(4, 4, 0) = 0.024
ra(4, 4, 1) = 0.02
ra(4, 4, 2) = 0.017
ra(4, 4, 3) = 0.014
ra(4, 4, 4) = 0
ra(4, 5, 0) = 0.039
ra(4, 5, 1) = 0.034
ra(4, 5, 2) = 0.032
ra(4, 5, 3) = 0.029
ra(4, 5, 4) = 0
ra(4, 6, 0) = 0.039
ra(4, 6, 1) = 0.034
ra(4, 6, 2) = 0.032
ra(4, 6, 3) = 0.029
ra(4, 6, 4) = 0
ra(5, 0, 0) = 0.039
ra(5, 0, 1) = 0.035
ra(5, 0, 2) = 0.032
ra(5, 0, 3) = 0.029
ra(5, 0, 4) = 0
ra(5, 1, 0) = 0.039
ra(5, 1, 1) = 0.035
ra(5, 1, 2) = 0.032
ra(5, 1, 3) = 0.029
ra(5, 1, 4) = 0
ra(5, 2, 0) = 0.039
ra(5, 2, 1) = 0.034
ra(5, 2, 2) = 0.032
ra(5, 2, 3) = 0.029
ra(5, 2, 4) = 0.024
ra(5, 3, 0) = 0.039
ra(5, 3, 1) = 0.034
ra(5, 3, 2) = 0.032
ra(5, 3, 3) = 0.029
ra(5, 3, 4) = 0.024
ra(5, 4, 0) = 0.034
ra(5, 4, 1) = 0.03
ra(5, 4, 2) = 0.027
ra(5, 4, 3) = 0.024
ra(5, 4, 4) = 0
ra(5, 5, 0) = 0.039
ra(5, 5, 1) = 0.034
ra(5, 5, 2) = 0.032
ra(5, 5, 3) = 0.029
ra(5, 5, 4) = 0
ra(5, 6, 0) = 0.039
ra(5, 6, 1) = 0.034
ra(5, 6, 2) = 0.032
ra(5, 6, 3) = 0.029
ra(5, 6, 4) = 0
ra(6, 0, 0) = 0.039
ra(6, 0, 1) = 0.035
ra(6, 0, 2) = 0.032
ra(6, 0, 3) = 0.029
ra(6, 0, 4) = 0
ra(6, 1, 0) = 0.039
ra(6, 1, 1) = 0.035
ra(6, 1, 2) = 0.032
ra(6, 1, 3) = 0.029
ra(6, 1, 4) = 0
ra(6, 2, 0) = 0.039
ra(6, 2, 1) = 0.034
ra(6, 2, 2) = 0.032
ra(6, 2, 3) = 0.029
ra(6, 2, 4) = 0.024
ra(6, 3, 0) = 0.039
ra(6, 3, 1) = 0.034
ra(6, 3, 2) = 0.032
ra(6, 3, 3) = 0.029
ra(6, 3, 4) = 0.024
ra(6, 4, 0) = 0.034
ra(6, 4, 1) = 0.03
ra(6, 4, 2) = 0.027
ra(6, 4, 3) = 0.024
ra(6, 4, 4) = 0
ra(6, 5, 0) = 0.039
ra(6, 5, 1) = 0.034
ra(6, 5, 2) = 0.032
ra(6, 5, 3) = 0.029
ra(6, 5, 4) = 0
ra(6, 6, 0) = 0.039
ra(6, 6, 1) = 0.034
ra(6, 6, 2) = 0.032
ra(6, 6, 3) = 0.029
ra(6, 6, 4) = 0
End Sub