VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Begin VB.Form frmOptions 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Options"
   ClientHeight    =   6000
   ClientLeft      =   2565
   ClientTop       =   1500
   ClientWidth     =   7905
   Icon            =   "frmOptions.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   400
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   527
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton cmdApply 
      Caption         =   "Apply"
      Height          =   375
      Left            =   6630
      TabIndex        =   3
      Top             =   5535
      Width           =   1095
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   5430
      TabIndex        =   2
      Top             =   5535
      Width           =   1095
   End
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Height          =   375
      Left            =   4200
      TabIndex        =   1
      Top             =   5535
      Width           =   1095
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   4800
      Index           =   1
      Left            =   -30000
      ScaleHeight     =   320
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   507
      TabIndex        =   6
      TabStop         =   0   'False
      Tag             =   "Homeseer Setup"
      Top             =   480
      Width           =   7605
      Begin VB.Frame Frame1 
         Caption         =   "Frame1"
         Height          =   2850
         Left            =   75
         TabIndex        =   79
         Top             =   1860
         Width           =   7455
      End
      Begin VB.TextBox Section1_MainLabel 
         Height          =   300
         Left            =   1590
         TabIndex        =   77
         Top             =   150
         Width           =   5910
      End
      Begin VB.Frame fraHomeSeerGeneral 
         Caption         =   "HomeSeer General Settings"
         Height          =   975
         Left            =   75
         TabIndex        =   9
         Top             =   735
         Width           =   7455
      End
      Begin VB.Label Label26 
         Caption         =   "Lights Section Title:"
         Height          =   285
         Left            =   90
         TabIndex        =   78
         Top             =   180
         Width           =   1470
      End
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   4800
      Index           =   0
      Left            =   150
      ScaleHeight     =   320
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   507
      TabIndex        =   4
      TabStop         =   0   'False
      Tag             =   "General"
      Top             =   480
      Width           =   7605
      Begin VB.CheckBox chkFullScreen 
         Caption         =   "Full-Screen Mode"
         Height          =   255
         Left            =   120
         TabIndex        =   80
         Top             =   3960
         Width           =   1575
      End
      Begin VB.CheckBox chkDebug 
         Caption         =   "Debug Mode"
         Height          =   465
         Left            =   120
         TabIndex        =   28
         Top             =   4230
         Width           =   1245
      End
      Begin VB.TextBox RemotePort 
         Height          =   285
         Left            =   2430
         TabIndex        =   27
         Top             =   2970
         Width           =   1335
      End
      Begin VB.TextBox BindPort 
         Height          =   285
         Left            =   2430
         TabIndex        =   26
         Top             =   2640
         Width           =   1335
      End
      Begin VB.Frame fraStartupSection 
         Caption         =   "Startup Section"
         Height          =   1635
         Left            =   2940
         TabIndex        =   18
         Top             =   60
         Width           =   2625
         Begin VB.OptionButton optStartup4 
            Caption         =   "Media/IR Section"
            Height          =   195
            Left            =   240
            TabIndex        =   22
            Tag             =   "4"
            Top             =   1200
            Width           =   1965
         End
         Begin VB.OptionButton optStartup3 
            Caption         =   "Web Section"
            Height          =   225
            Left            =   240
            TabIndex        =   21
            Tag             =   "3"
            Top             =   900
            Width           =   1845
         End
         Begin VB.OptionButton optStartup2 
            Caption         =   "Music Section (Winamp)"
            Height          =   315
            Left            =   240
            TabIndex        =   20
            Tag             =   "2"
            Top             =   570
            Width           =   2145
         End
         Begin VB.OptionButton optStartup1 
            Caption         =   "Light/Homeseer Section"
            Height          =   315
            Left            =   240
            TabIndex        =   19
            Tag             =   "1"
            Top             =   270
            Width           =   2145
         End
      End
      Begin VB.ComboBox Skin 
         Height          =   315
         Left            =   990
         TabIndex        =   17
         Text            =   "Combo1"
         Top             =   1800
         Width           =   3105
      End
      Begin VB.TextBox HostName 
         Height          =   285
         Left            =   2430
         TabIndex        =   15
         Top             =   2310
         Width           =   2925
      End
      Begin VB.Frame fraEnableSections 
         Caption         =   "Enabled Sections"
         Height          =   1635
         Left            =   0
         TabIndex        =   5
         Top             =   60
         Width           =   2745
         Begin VB.CheckBox chkSection4 
            Caption         =   "Media/IR Section"
            Height          =   195
            Left            =   210
            TabIndex        =   14
            Top             =   1230
            Width           =   2115
         End
         Begin VB.CheckBox chkSection3 
            Caption         =   "Web Section"
            Height          =   195
            Left            =   210
            TabIndex        =   13
            Top             =   930
            Width           =   1665
         End
         Begin VB.CheckBox chkSection2 
            Caption         =   "Music Section (Winamp)"
            Height          =   255
            Left            =   210
            TabIndex        =   12
            Top             =   600
            Width           =   2115
         End
         Begin VB.CheckBox chkSection1 
            Caption         =   "Light/Homeseer Section"
            Height          =   285
            Left            =   210
            TabIndex        =   11
            Top             =   270
            Width           =   2205
         End
      End
      Begin VB.Label Label4 
         Caption         =   "Incoming Port:"
         Height          =   315
         Left            =   1320
         TabIndex        =   25
         Top             =   3000
         Width           =   1125
      End
      Begin VB.Label Label3 
         Caption         =   "Outgoing Port:"
         Height          =   315
         Left            =   1320
         TabIndex        =   24
         Top             =   2670
         Width           =   1125
      End
      Begin VB.Label Label2 
         Caption         =   "HomeSeer Machine Name or IP:"
         Height          =   285
         Left            =   60
         TabIndex        =   23
         Top             =   2340
         Width           =   2445
      End
      Begin VB.Label Label1 
         Caption         =   "Skin Name:"
         Height          =   315
         Left            =   60
         TabIndex        =   16
         Top             =   1830
         Width           =   945
      End
   End
   Begin MSComctlLib.TabStrip tbsOptions 
      Height          =   5295
      Left            =   60
      TabIndex        =   0
      Top             =   90
      Width           =   7785
      _ExtentX        =   13732
      _ExtentY        =   9340
      _Version        =   393216
      BeginProperty Tabs {1EFB6598-857C-11D1-B16A-00C0F0283628} 
         NumTabs         =   5
         BeginProperty Tab1 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "General"
            Key             =   "Group1"
            Object.ToolTipText     =   "Set General Program Options"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab2 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Homeseer Setup"
            Key             =   "Group2"
            Object.ToolTipText     =   "Set Homeseer Options"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab3 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "WinAmp Setup"
            Key             =   "Group3"
            Object.ToolTipText     =   "Set WinAmp Options"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab4 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Web Setup"
            Key             =   "Group4"
            Object.ToolTipText     =   "Set Web Options"
            ImageVarType    =   2
         EndProperty
         BeginProperty Tab5 {1EFB659A-857C-11D1-B16A-00C0F0283628} 
            Caption         =   "Media/IR Setup"
            Key             =   "Group5"
            Object.ToolTipText     =   "Set Media/IR Options"
            ImageVarType    =   2
         EndProperty
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   4800
      Index           =   4
      Left            =   150
      ScaleHeight     =   320
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   507
      TabIndex        =   10
      TabStop         =   0   'False
      Tag             =   "Media/IR Setup"
      Top             =   480
      Width           =   7605
      Begin VB.TextBox Section4_MainLabel 
         Height          =   300
         Left            =   1815
         TabIndex        =   75
         Top             =   105
         Width           =   5670
      End
      Begin VB.Label Label25 
         Caption         =   "Media/IR Section Title:"
         Height          =   255
         Left            =   30
         TabIndex        =   76
         Top             =   135
         Width           =   1755
      End
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   4800
      Index           =   3
      Left            =   150
      ScaleHeight     =   320
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   507
      TabIndex        =   8
      TabStop         =   0   'False
      Tag             =   "Web Setup"
      Top             =   480
      Width           =   7605
      Begin MSComctlLib.Slider Section3_NumURL 
         Height          =   450
         Left            =   1725
         TabIndex        =   72
         Tag             =   "0"
         Top             =   795
         Width           =   2490
         _ExtentX        =   4392
         _ExtentY        =   794
         _Version        =   393216
         LargeChange     =   1
         TextPosition    =   1
      End
      Begin VB.TextBox Section3_Label 
         Height          =   300
         Index           =   0
         Left            =   5475
         TabIndex        =   71
         Top             =   1200
         Visible         =   0   'False
         Width           =   1965
      End
      Begin VB.TextBox Section3_DefaultURL 
         Height          =   300
         Left            =   1530
         TabIndex        =   65
         Top             =   450
         Width           =   5910
      End
      Begin VB.TextBox Section3_MainLabel 
         Height          =   300
         Left            =   1530
         TabIndex        =   63
         Top             =   75
         Width           =   5910
      End
      Begin VB.TextBox Section3_URL 
         Height          =   300
         Index           =   0
         Left            =   825
         TabIndex        =   68
         Top             =   1200
         Visible         =   0   'False
         Width           =   3960
      End
      Begin VB.Label Label24 
         Caption         =   "10"
         Height          =   255
         Left            =   3945
         TabIndex        =   74
         Top             =   1305
         Width           =   255
      End
      Begin VB.Label Label23 
         Caption         =   "0"
         Height          =   240
         Left            =   1845
         TabIndex        =   73
         Top             =   1290
         Width           =   150
      End
      Begin VB.Label Section3_Labelx 
         Caption         =   "Label:"
         Height          =   240
         Index           =   0
         Left            =   4965
         TabIndex        =   70
         Top             =   1200
         Visible         =   0   'False
         Width           =   525
      End
      Begin VB.Label Section3_URL_Label 
         Caption         =   "URL #"
         Height          =   225
         Index           =   0
         Left            =   105
         TabIndex        =   69
         Top             =   1200
         Visible         =   0   'False
         Width           =   705
      End
      Begin VB.Label Label22 
         Caption         =   "Number of Quicklinks:"
         Height          =   270
         Left            =   105
         TabIndex        =   67
         Top             =   900
         Width           =   1605
      End
      Begin VB.Label Label21 
         Caption         =   "Default Web Page:"
         Height          =   270
         Left            =   120
         TabIndex        =   66
         Top             =   480
         Width           =   1440
      End
      Begin VB.Label Label20 
         Caption         =   "Web Section Title:"
         Height          =   270
         Left            =   120
         TabIndex        =   64
         Top             =   105
         Width           =   1440
      End
   End
   Begin VB.PictureBox picOptions 
      BorderStyle     =   0  'None
      Height          =   4800
      Index           =   2
      Left            =   150
      ScaleHeight     =   320
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   507
      TabIndex        =   7
      TabStop         =   0   'False
      Tag             =   "WinAmp Setup"
      Top             =   495
      Width           =   7605
      Begin VB.CheckBox chkSection2_Host4 
         Height          =   345
         Left            =   45
         TabIndex        =   61
         Top             =   2295
         Width           =   255
      End
      Begin VB.TextBox Section2_HostPort4 
         Height          =   300
         Left            =   6480
         TabIndex        =   57
         Top             =   2355
         Width           =   870
      End
      Begin VB.TextBox Section2_HostIP4 
         Height          =   300
         Left            =   4470
         TabIndex        =   56
         Top             =   2355
         Width           =   1470
      End
      Begin VB.TextBox Section2_HostName4 
         Height          =   300
         Left            =   1905
         TabIndex        =   55
         Top             =   2355
         Width           =   2100
      End
      Begin VB.CheckBox chkSection2_Host3 
         Height          =   345
         Left            =   45
         TabIndex        =   54
         Top             =   1875
         Width           =   255
      End
      Begin VB.TextBox Section2_HostPort3 
         Height          =   300
         Left            =   6480
         TabIndex        =   50
         Top             =   1935
         Width           =   870
      End
      Begin VB.TextBox Section2_HostIP3 
         Height          =   300
         Left            =   4470
         TabIndex        =   49
         Top             =   1935
         Width           =   1470
      End
      Begin VB.TextBox Section2_HostName3 
         Height          =   300
         Left            =   1905
         TabIndex        =   48
         Top             =   1935
         Width           =   2100
      End
      Begin VB.CheckBox chkSection2_Host2 
         Height          =   345
         Left            =   45
         TabIndex        =   47
         Top             =   1455
         Width           =   255
      End
      Begin VB.TextBox Section2_HostPort2 
         Height          =   300
         Left            =   6480
         TabIndex        =   43
         Top             =   1515
         Width           =   870
      End
      Begin VB.TextBox Section2_HostIP2 
         Height          =   300
         Left            =   4470
         TabIndex        =   42
         Top             =   1515
         Width           =   1470
      End
      Begin VB.TextBox Section2_HostName2 
         Height          =   300
         Left            =   1905
         TabIndex        =   41
         Top             =   1515
         Width           =   2100
      End
      Begin VB.CheckBox chkSection2_Host1 
         Height          =   345
         Left            =   45
         TabIndex        =   40
         Top             =   1050
         Width           =   255
      End
      Begin VB.TextBox Section2_VolumeSpeed 
         Alignment       =   1  'Right Justify
         Height          =   300
         Left            =   1815
         TabIndex        =   36
         Top             =   3315
         Width           =   780
      End
      Begin VB.TextBox Section2_HostPort1 
         Height          =   300
         Left            =   6480
         TabIndex        =   35
         Top             =   1110
         Width           =   870
      End
      Begin VB.TextBox Section2_HostIP1 
         Height          =   300
         Left            =   4470
         TabIndex        =   34
         Top             =   1110
         Width           =   1470
      End
      Begin VB.TextBox Section2_HostName1 
         BackColor       =   &H00FFFFFF&
         Height          =   300
         Left            =   1905
         TabIndex        =   33
         Top             =   1110
         Width           =   2100
      End
      Begin VB.TextBox Section2_ClientName 
         Height          =   300
         Left            =   1710
         TabIndex        =   31
         Top             =   675
         Width           =   5640
      End
      Begin VB.TextBox Section2_MainLabel 
         Height          =   300
         Left            =   1710
         TabIndex        =   29
         Top             =   240
         Width           =   5640
      End
      Begin VB.Label Label19 
         Caption         =   "Volume Change Speed:"
         Height          =   315
         Left            =   60
         TabIndex        =   62
         Top             =   3345
         Width           =   1770
      End
      Begin VB.Label Label18 
         Caption         =   "Port:"
         Height          =   315
         Left            =   6075
         TabIndex        =   60
         Top             =   2385
         Width           =   345
      End
      Begin VB.Label Label17 
         Caption         =   "IP:"
         Height          =   315
         Left            =   4170
         TabIndex        =   59
         Top             =   2385
         Width           =   270
      End
      Begin VB.Label Label16 
         Caption         =   "WinAmp Host Name:"
         Height          =   270
         Left            =   330
         TabIndex        =   58
         Top             =   1515
         Width           =   1530
      End
      Begin VB.Label Label15 
         Caption         =   "Port:"
         Height          =   315
         Left            =   6075
         TabIndex        =   53
         Top             =   1965
         Width           =   345
      End
      Begin VB.Label Label14 
         Caption         =   "IP:"
         Height          =   315
         Left            =   4170
         TabIndex        =   52
         Top             =   1965
         Width           =   270
      End
      Begin VB.Label Label13 
         Caption         =   "WinAmp Host Name:"
         Height          =   270
         Left            =   330
         TabIndex        =   51
         Top             =   1935
         Width           =   1530
      End
      Begin VB.Label Label12 
         Caption         =   "Port:"
         Height          =   315
         Left            =   6075
         TabIndex        =   46
         Top             =   1545
         Width           =   345
      End
      Begin VB.Label Label11 
         Caption         =   "IP:"
         Height          =   315
         Left            =   4170
         TabIndex        =   45
         Top             =   1545
         Width           =   270
      End
      Begin VB.Label Label10 
         Caption         =   "WinAmp Host Name:"
         Height          =   270
         Left            =   330
         TabIndex        =   44
         Top             =   2355
         Width           =   1530
      End
      Begin VB.Label Label9 
         Caption         =   "Port:"
         Height          =   315
         Left            =   6075
         TabIndex        =   39
         Top             =   1140
         Width           =   345
      End
      Begin VB.Label Label8 
         Caption         =   "IP:"
         Height          =   315
         Left            =   4170
         TabIndex        =   38
         Top             =   1140
         Width           =   270
      End
      Begin VB.Label Label7 
         Caption         =   "WinAmp Host Name:"
         Height          =   270
         Left            =   330
         TabIndex        =   37
         Top             =   1140
         Width           =   1530
      End
      Begin VB.Label Label6 
         Caption         =   "Client's Name:"
         Height          =   285
         Left            =   90
         TabIndex        =   32
         Top             =   690
         Width           =   1635
      End
      Begin VB.Label Label5 
         Caption         =   "Music Section Label:"
         Height          =   285
         Left            =   105
         TabIndex        =   30
         Top             =   270
         Width           =   1665
      End
   End
End
Attribute VB_Name = "frmOptions"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim inifile As String, imgpath As String, oldskin As String

'------------------- Start Overall Form Code -------------------
Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    LoadTags
    tbsOptions_Click
End Sub

Private Sub tbsOptions_Click()
    Dim i As Integer
    For i = 0 To tbsOptions.Tabs.Count - 1
        If i = tbsOptions.SelectedItem.Index - 1 Then
            picOptions(i).Left = Me.tbsOptions.Left + 2
            picOptions(i).Enabled = True
        Else
            picOptions(i).Left = -20000
            picOptions(i).Enabled = False
        End If
    Next
End Sub

Private Sub LoadTags()
    Dim temptag As String, b As Control, i As Integer
    Screen.MousePointer = vbHourglass
    inifile = App.Path & "\HomePanel.ini"
    imgpath = App.Path & "\images\"
    LoadSkins
    'Tab1
    fReadValue inifile, "Options", "HostName", "S", "", temptag: Me.HostName.Text = temptag
    fReadValue inifile, "Options", "BindPort", "S", "", temptag: Me.BindPort.Text = temptag
    fReadValue inifile, "Options", "RemotePort", "S", "", temptag: Me.RemotePort.Text = temptag
    fReadValue inifile, "Options", "Skin", "S", "", oldskin: Me.Skin.Text = oldskin
    fReadValue inifile, "Options", "Debug", "S", "", temptag: If SVal(temptag) Then Me.chkDebug = vbChecked
    fReadValue inifile, "Options", "FullScreen", "S", "0", temptag: If SVal(temptag) Then Me.chkFullScreen = vbChecked
    fReadValue inifile, "Options", "StartSection", "S", "1", temptag
    If Val(temptag) > 0 And Val(temptag) < 5 Then
        Set b = gc("optStartup" & temptag)
        b = True
        Me.fraStartupSection.Tag = temptag
    End If
    fReadValue inifile, "Section1", "Enabled", "S", "0", temptag: Me.chkSection1 = BVal(SVal(temptag))
    fReadValue inifile, "Section2", "Enabled", "S", "0", temptag: Me.chkSection2 = BVal(SVal(temptag))
    fReadValue inifile, "Section3", "Enabled", "S", "0", temptag: Me.chkSection3 = BVal(SVal(temptag))
    fReadValue inifile, "Section4", "Enabled", "S", "0", temptag: Me.chkSection4 = BVal(SVal(temptag))
    
    'Tab2
    fReadValue inifile, "Section1", "MainLabel", "S", "", temptag: Me.Section1_MainLabel = temptag
    
    'Tab3
    fReadValue inifile, "Section2", "MainLabel", "S", "", temptag: Me.Section2_MainLabel = temptag
    fReadValue inifile, "Section2", "ClientName", "S", "", temptag: Me.Section2_ClientName = temptag
    fReadValue inifile, "Section2", "VolumeSpeed", "S", "5", temptag: Me.Section2_VolumeSpeed = temptag
    fReadValue inifile, "Section2", "HostName1", "S", "", temptag
    If temptag <> "" Then
        Me.Section2_HostName1 = temptag: Me.chkSection2_Host1 = 1
        fReadValue inifile, "Section2", "HostIP1", "S", "", temptag: Me.Section2_HostIP1 = temptag
        fReadValue inifile, "Section2", "HostPort1", "S", "8000", temptag: Me.Section2_HostPort1 = temptag
    Else
        Me.chkSection2_Host1 = 0: Me.Section2_HostIP1.Enabled = False
        Me.Section2_HostName1.Enabled = False: Me.Section2_HostPort1.Enabled = False
        Me.Section2_HostIP1.BackColor = RGB(192, 192, 192): Me.Section2_HostName1.BackColor = RGB(192, 192, 192): Me.Section2_HostPort1.BackColor = RGB(192, 192, 192)
    End If
    fReadValue inifile, "Section2", "HostName2", "S", "", temptag
    If temptag <> "" Then
        Me.Section2_HostName2 = temptag: Me.chkSection2_Host2 = 1
        fReadValue inifile, "Section2", "HostIP2", "S", "", temptag: Me.Section2_HostIP2 = temptag
        fReadValue inifile, "Section2", "HostPort2", "S", "8000", temptag: Me.Section2_HostPort2 = temptag
    Else
        Me.chkSection2_Host2 = 0: Me.Section2_HostIP2.Enabled = False
        Me.Section2_HostName2.Enabled = False: Me.Section2_HostPort2.Enabled = False
        Me.Section2_HostIP2.BackColor = RGB(192, 192, 192): Me.Section2_HostName2.BackColor = RGB(192, 192, 192): Me.Section2_HostPort2.BackColor = RGB(192, 192, 192)
    End If
    fReadValue inifile, "Section2", "HostName3", "S", "", temptag
    If temptag <> "" Then
        Me.Section2_HostName3 = temptag: Me.chkSection2_Host3 = 1
        fReadValue inifile, "Section2", "HostIP3", "S", "", temptag: Me.Section2_HostIP3 = temptag
        fReadValue inifile, "Section2", "HostPort3", "S", "8000", temptag: Me.Section2_HostPort3 = temptag
    Else
        Me.chkSection2_Host3 = 0: Me.Section2_HostIP3.Enabled = False
        Me.Section2_HostName3.Enabled = False: Me.Section2_HostPort3.Enabled = False
        Me.Section2_HostIP3.BackColor = RGB(192, 192, 192): Me.Section2_HostName3.BackColor = RGB(192, 192, 192): Me.Section2_HostPort3.BackColor = RGB(192, 192, 192)
    End If
    fReadValue inifile, "Section2", "HostName4", "S", "", temptag
    If temptag <> "" Then
        Me.Section2_HostName4 = temptag: Me.chkSection2_Host4 = 1
        fReadValue inifile, "Section2", "HostIP4", "S", "", temptag: Me.Section2_HostIP4 = temptag
        fReadValue inifile, "Section2", "HostPort4", "S", "8000", temptag: Me.Section2_HostPort4 = temptag
    Else
        Me.chkSection2_Host4 = 0: Me.Section2_HostIP4.Enabled = False
        Me.Section2_HostName4.Enabled = False: Me.Section2_HostPort4.Enabled = False
        Me.Section2_HostIP4.BackColor = RGB(192, 192, 192): Me.Section2_HostName4.BackColor = RGB(192, 192, 192): Me.Section2_HostPort4.BackColor = RGB(192, 192, 192)
    End If
    
    'Tab4
    fReadValue inifile, "Section3", "MainLabel", "S", "", temptag: Me.Section3_MainLabel = temptag
    fReadValue inifile, "Section3", "DefaultURL", "S", "", temptag: Me.Section3_DefaultURL = temptag
    For i = 1 To 10
        fReadValue inifile, "Section3", "QuickLink" & i & "URL", "S", "", temptag
        If temptag = "" Then i = i - 1: Exit For
        CreateURL i
        Me.Section3_URL(i) = temptag
        fReadValue inifile, "Section3", "QuickLink" & i & "Label", "S", "", temptag
        Me.Section3_Label(i) = temptag
    Next i
    Me.Section3_NumURL = CStr(i): Me.Section3_NumURL.Tag = CStr(i)
    
    'Tab5
    fReadValue inifile, "Section4", "MainLabel", "S", "", temptag: Me.Section4_MainLabel = temptag
    
    Screen.MousePointer = vbDefault
End Sub

Private Sub SaveTags()
    Dim temptag As String, b As Control, i As Integer
    'Tab1
    fWriteValue inifile, "Options", "StartSection", "S", "3"
    fWriteValue inifile, "Options", "HostName", "S", Me.HostName.Text
    fWriteValue inifile, "Options", "BindPort", "S", Me.BindPort.Text
    fWriteValue inifile, "Options", "RemotePort", "S", Me.RemotePort.Text
    fWriteValue inifile, "Options", "Skin", "S", Me.Skin.Text
    fWriteValue inifile, "Options", "Debug", "S", BVal(Me.chkDebug)
    fWriteValue inifile, "Options", "FullScreen", "S", BVal(Me.chkFullScreen)
    temptag = Me.fraStartupSection.Tag
    fWriteValue inifile, "Options", "StartSection", "S", temptag
    fWriteValue inifile, "Section1", "Enabled", "S", BVal(chkSection1)
    fWriteValue inifile, "Section2", "Enabled", "S", BVal(chkSection2)
    fWriteValue inifile, "Section3", "Enabled", "S", BVal(chkSection3)
    fWriteValue inifile, "Section4", "Enabled", "S", BVal(chkSection4)

    'Tab2
    fWriteValue inifile, "Section1", "MainLabel", "S", Me.Section1_MainLabel
    
    'Tab3
    fWriteValue inifile, "Section2", "MainLabel", "S", Me.Section2_MainLabel
    fWriteValue inifile, "Section2", "ClientName", "S", Me.Section2_ClientName
    fWriteValue inifile, "Section2", "VolumeSpeed", "S", Me.Section2_VolumeSpeed
    If Me.chkSection2_Host1 = 1 Then
        fWriteValue inifile, "Section2", "HostName1", "S", Me.Section2_HostName1
        fWriteValue inifile, "Section2", "HostIP1", "S", Me.Section2_HostIP1
        fWriteValue inifile, "Section2", "HostPort1", "S", Me.Section2_HostPort1
    Else
        fDeleteValue inifile, "Section2", "HostName1"
        fDeleteValue inifile, "Section2", "HostIP1"
        fDeleteValue inifile, "Section2", "HostPort1"
    End If
    If Me.chkSection2_Host2 = 1 Then
        fWriteValue inifile, "Section2", "HostName2", "S", Me.Section2_HostName2
        fWriteValue inifile, "Section2", "HostIP2", "S", Me.Section2_HostIP2
        fWriteValue inifile, "Section2", "HostPort2", "S", Me.Section2_HostPort2
    Else
        fDeleteValue inifile, "Section2", "HostName2"
        fDeleteValue inifile, "Section2", "HostIP2"
        fDeleteValue inifile, "Section2", "HostPort2"
    End If
    If Me.chkSection2_Host3 = 1 Then
        fWriteValue inifile, "Section2", "HostName3", "S", Me.Section2_HostName3
        fWriteValue inifile, "Section2", "HostIP3", "S", Me.Section2_HostIP3
        fWriteValue inifile, "Section2", "HostPort3", "S", Me.Section2_HostPort3
    Else
        fDeleteValue inifile, "Section2", "HostName3"
        fDeleteValue inifile, "Section2", "HostIP3"
        fDeleteValue inifile, "Section2", "HostPort3"
    End If
    If Me.chkSection2_Host4 = 1 Then
        fWriteValue inifile, "Section2", "HostName4", "S", Me.Section2_HostName4
        fWriteValue inifile, "Section2", "HostIP4", "S", Me.Section2_HostIP4
        fWriteValue inifile, "Section2", "HostPort4", "S", Me.Section2_HostPort4
    Else
        fDeleteValue inifile, "Section2", "HostName4"
        fDeleteValue inifile, "Section2", "HostIP4"
        fDeleteValue inifile, "Section2", "HostPort4"
    End If
    
    'Tab4
    fWriteValue inifile, "Section3", "MainLabel", "S", Me.Section3_MainLabel
    fWriteValue inifile, "Section3", "DefaultURL", "S", Me.Section3_DefaultURL
    For i = 1 To Val(Me.Section3_NumURL)
        temptag = Me.Section3_URL(i)
        fWriteValue inifile, "Section3", "QuickLink" & i & "URL", "S", temptag
        temptag = Me.Section3_Label(i)
        fWriteValue inifile, "Section3", "QuickLink" & i & "Label", "S", temptag
    Next i
    For i = (Val(Me.Section3_NumURL) + 1) To 10
        fWriteValue inifile, "Section3", "QuickLink" & i & "URL", "S", ""
        fWriteValue inifile, "Section3", "QuickLink" & i & "Label", "S", ""
    Next i
    
    'Tab5
    fWriteValue inifile, "Section4", "MainLabel", "S", Me.Section4_MainLabel
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Dim i As Integer
    If Shift = vbCtrlMask And KeyCode = vbKeyTab Then
        i = tbsOptions.SelectedItem.Index
        If i = tbsOptions.Tabs.Count Then
            Set tbsOptions.SelectedItem = tbsOptions.Tabs(1)
        Else
            Set tbsOptions.SelectedItem = tbsOptions.Tabs(i + 1)
        End If
    End If
End Sub

Private Sub cmdApply_Click()
    SaveTags
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    SaveTags
    If oldskin <> Me.Skin.Text Then Unload frmMain: frmMain.Show
    Unload Me
End Sub
'------------------- End Overall Form Code -------------------

'------------------- Start Option Tab1 Control Code -------------------
Private Sub optStartup1_Click()
    optStartup1 = True: optStartup2 = False: optStartup3 = False: optStartup4 = False
    Me.fraStartupSection.Tag = "1"
End Sub

Private Sub optStartup2_Click()
    optStartup1 = False: optStartup2 = True: optStartup3 = False: optStartup4 = False
    Me.fraStartupSection.Tag = "2"
End Sub

Private Sub optStartup3_Click()
    optStartup1 = False: optStartup2 = False: optStartup3 = True: optStartup4 = False
    Me.fraStartupSection.Tag = "3"
End Sub

Private Sub optStartup4_Click()
    optStartup1 = False: optStartup2 = False: optStartup3 = False: optStartup4 = True
    Me.fraStartupSection.Tag = "4"
End Sub
'------------------- End of Option Tab1 Control Code -------------------


'------------------- Start Option Tab2 Control Code -------------------

'------------------- End of Option Tab2 Control Code -------------------


'------------------- Start Option Tab3 Control Code -------------------
Private Sub chkSection2_Host1_Click()
    If Me.chkSection2_Host1 = 0 Then
        Me.Section2_HostIP1.Enabled = False: Me.Section2_HostName1.Enabled = False: Me.Section2_HostPort1.Enabled = False
        Me.Section2_HostIP1.BackColor = RGB(192, 192, 192): Me.Section2_HostName1.BackColor = RGB(192, 192, 192): Me.Section2_HostPort1.BackColor = RGB(192, 192, 192)
    Else
        Me.Section2_HostIP1.Enabled = True: Me.Section2_HostName1.Enabled = True: Me.Section2_HostPort1.Enabled = True
        Me.Section2_HostIP1.BackColor = RGB(255, 255, 255): Me.Section2_HostName1.BackColor = RGB(255, 255, 255): Me.Section2_HostPort1.BackColor = RGB(255, 255, 255)
    End If
End Sub

Private Sub chkSection2_Host2_Click()
    If Me.chkSection2_Host2 = 0 Then
        Me.Section2_HostIP2.Enabled = False: Me.Section2_HostName2.Enabled = False: Me.Section2_HostPort2.Enabled = False
        Me.Section2_HostIP2.BackColor = RGB(192, 192, 192): Me.Section2_HostName2.BackColor = RGB(192, 192, 192): Me.Section2_HostPort2.BackColor = RGB(192, 192, 192)
    Else
        Me.Section2_HostIP2.Enabled = True: Me.Section2_HostName2.Enabled = True: Me.Section2_HostPort2.Enabled = True
        Me.Section2_HostIP2.BackColor = RGB(255, 255, 255): Me.Section2_HostName2.BackColor = RGB(255, 255, 255): Me.Section2_HostPort2.BackColor = RGB(255, 255, 255)
    End If
End Sub

Private Sub chkSection2_Host3_Click()
    If Me.chkSection2_Host3 = 0 Then
        Me.Section2_HostIP3.Enabled = False: Me.Section2_HostName3.Enabled = False: Me.Section2_HostPort3.Enabled = False
        Me.Section2_HostIP3.BackColor = RGB(192, 192, 192): Me.Section2_HostName3.BackColor = RGB(192, 192, 192): Me.Section2_HostPort3.BackColor = RGB(192, 192, 192)
    Else
        Me.Section2_HostIP3.Enabled = True: Me.Section2_HostName3.Enabled = True: Me.Section2_HostPort3.Enabled = True
        Me.Section2_HostIP3.BackColor = RGB(255, 255, 255): Me.Section2_HostName3.BackColor = RGB(255, 255, 255): Me.Section2_HostPort3.BackColor = RGB(255, 255, 255)
    End If
End Sub

Private Sub chkSection2_Host4_Click()
    If Me.chkSection2_Host4 = 0 Then
        Me.Section2_HostIP4.Enabled = False: Me.Section2_HostName4.Enabled = False: Me.Section2_HostPort4.Enabled = False
        Me.Section2_HostIP4.BackColor = RGB(192, 192, 192): Me.Section2_HostName4.BackColor = RGB(192, 192, 192): Me.Section2_HostPort4.BackColor = RGB(192, 192, 192)
    Else
        Me.Section2_HostIP4.Enabled = True: Me.Section2_HostName4.Enabled = True: Me.Section2_HostPort4.Enabled = True
        Me.Section2_HostIP4.BackColor = RGB(255, 255, 255): Me.Section2_HostName4.BackColor = RGB(255, 255, 255): Me.Section2_HostPort4.BackColor = RGB(255, 255, 255)
    End If
End Sub
'------------------- End of Option Tab3 Control Code -------------------


'------------------- Start Option Tab4 Control Code -------------------
Private Sub Section3_NumURL_Change()
    Dim o As Integer, n As Integer, i As Integer
    o = CInt(Me.Section3_NumURL.Tag): n = Me.Section3_NumURL
    If o = n Then Exit Sub
    If o < n Then
        For i = (o + 1) To n: CreateURL i: Next i
    Else
        For i = (n + 1) To o: RemoveURL i: Next i
    End If
    Me.Section3_NumURL.Tag = CStr(Me.Section3_NumURL)
End Sub

Private Sub CreateURL(Index As Integer)
    If Me.Section3_URL_Label.UBound < Index Then
        Load Me.Section3_URL_Label(Index)
        Load Me.Section3_URL(Index)
        Load Me.Section3_Labelx(Index)
        Load Me.Section3_Label(Index)
        Me.Section3_URL_Label(Index).Top = Me.Section3_URL_Label(Index - 1).Top + Me.Section3_URL_Label(Index - 1).Height + 4
        Me.Section3_URL_Label(Index).Caption = "URL #" & Index
        Me.Section3_URL(Index).Top = Me.Section3_URL_Label(Index).Top
        Me.Section3_Labelx(Index).Top = Me.Section3_URL_Label(Index).Top
        Me.Section3_Label(Index).Top = Me.Section3_URL_Label(Index).Top
    End If
    Me.Section3_URL_Label(Index).Visible = True
    Me.Section3_URL(Index).Visible = True
    Me.Section3_Labelx(Index).Visible = True
    Me.Section3_Label(Index).Visible = True
End Sub

Private Sub RemoveURL(Index As Integer)
    Me.Section3_URL_Label(Index).Visible = False
    Me.Section3_URL(Index).Visible = False
    Me.Section3_Labelx(Index).Visible = False
    Me.Section3_Label(Index).Visible = False
End Sub

'------------------- End of Option Tab4 Control Code -------------------


'------------------- Start Option Tab5 Control Code -------------------

'------------------- End of Option Tab5 Control Code -------------------


'------------------- Generic functions for this form -------------------
Private Sub SetControls(S As String, n As Integer, v As Variant)
    Dim o As Control, i As Integer
    For i = 1 To n
        Set o = gc(S & i): o = v
    Next i
End Sub

Public Function gc(n As String) As Control
    Dim tempctl As Control
    For Each tempctl In frmOptions
        If tempctl.Name = n Then Set gc = tempctl: Exit For
    Next tempctl
End Function

Private Function BVal(X As Boolean) As String
    BVal = "0": If X Then BVal = "1"
End Function

Private Function SVal(X As String) As Boolean
    SVal = False: If X = "True" Or X = "1" Then SVal = True
End Function

Private Sub LoadSkins()
    Dim X As Long, skins() As String
    boolGetDirectory App.Path & "\skin", skins(), vbDirectory, True
    For X = 0 To UBound(skins)
        Skin.AddItem skins(X)
    Next X
End Sub
'------------------- End of Generic functions -------------------
