Imports System.Collections.Generic
Imports System.Web
Imports System.Net

Partial Class Controls_ContactUs
    Inherits System.Web.UI.UserControl
    Private _chatcategory As String
    Private _ShowOrderHelpChatLive As Boolean
    Private _Show_pnlOrderHelpChatLive As Boolean
    Public Property Show_pnlOrderHelpChatLive() As Boolean
        Get
            Return _Show_pnlOrderHelpChatLive
        End Get
        Set(ByVal value As Boolean)
            _Show_pnlOrderHelpChatLive = value
        End Set
    End Property

    Public Property ShowOrderHelpChatLive() As Boolean
        Get
            Return _ShowOrderHelpChatLive
        End Get

        Set(ByVal value As Boolean)
            _ShowOrderHelpChatLive = value
        End Set
    End Property

    Public Property Item() As MenuItem
        Get
            If ViewState(Me.ID & "_Item") Is Nothing Then
                Return MenuItem.Unspecified
            Else
                Return CType(ViewState(Me.ID & "_Item"), MenuItem)
            End If
        End Get

        Set(ByVal value As MenuItem)
            ViewState(Me.ID & "_Item") = value
        End Set
    End Property

    Public Property Chatcategory() As String
        Get
            Return _chatcategory
        End Get
        Set(ByVal value As String)
            _chatcategory = value
        End Set
    End Property

    Public Property ShowTitleEmail() As Boolean
        Get
            Return CType(ViewState(Me.ID & "_ShowTitleEmail"), Boolean)
        End Get

        Set(ByVal value As Boolean)
            ViewState(Me.ID & "_ShowTitleEmail") = value
        End Set
    End Property

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
        ChatNow_Click(Nothing, Nothing)
        Me.pnlOrderHelpChatLive.Visible = Show_pnlOrderHelpChatLive()
    End Sub

    Protected Sub ChatNow_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)

        Dim chatmapping As String = ""
        Dim strBSN As String = "0"
        Dim flag As Boolean = False
        Dim _catgr As StringBuilder = New StringBuilder
        Dim sb As New StringBuilder()
        Dim _actualCategory = _catgr.ToString()
        Dim url As String = Request.Url.ToString().ToLower()
        Try
            _chatcategory = "CHATWINDOW"
            If url.Contains("support.aspx") Then
                If url.Contains("menuitem=2") Or Item = MenuItem.CableTV Then
                    _chatcategory = "DIGCABLE"
                    flag = True
                ElseIf url.Contains("menuitem=3") Or url.Contains("nonproductitem=303") Or url.Contains("nonproductitem=304") Or Item = MenuItem.Internet Or Item = MenuItem.Email Then
                    _chatcategory = "HSI"
                    flag = True
                ElseIf url.Contains("menuitem=4") Or Item = MenuItem.Telephone Then
                    _chatcategory = "TELEPHONE"
                    flag = True
                ElseIf url.Contains("menuitem=8") Or Item = MenuItem.MyAccount Then
                    '_chatcategory = "BILLING"
                    _chatcategory = "Q_23170"
                    flag = True
                End If
            ElseIf url.Contains("finishorder.aspx") Then
                _chatcategory = "FINISH"
            Else

                '#####################################################################
                'MODIFICATION   ROD COPELAND    FEB 13, 2008    ISSUE ID 3301
                '#####################################################################
                'IT LOOKS LIKE THE BUSINESS HAS ADDED SOME NEW QUEUES THAT DIDNT 
                'EXIST AT THE TIME OF THE ASA CHAT ROLLOUT.  THE ISSUE ID HAS 
                'PROVIDED SPECIFIC URLS THAT SHOULD ROUTE TRAFFIC TO THE NEW QUEUES.
                '#####################################################################
                Select Case True
                    Case url.Contains("order/localize.aspx?targetpage=../order/alloffers.aspx")
                        '#####################################################################
                        'MODIFICATION   ROD COPELAND    FEB 25, 2008    ISSUE ID 3373
                        '#####################################################################
                        'IT LOOKS LIKE THE BUSINESS HAS ADDED SOME NEW QUEUES THAT DIDNT 
                        'EXIST AT THE TIME OF THE ASA CHAT ROLLOUT.  THE ISSUE ID HAS 
                        'PROVIDED SPECIFIC URLS THAT SHOULD ROUTE TRAFFIC TO THE NEW QUEUES.
                        '#####################################################################
                        _chatcategory = "Q_21853"
                    Case url.Contains("order/offers.aspx?productitem=1")
                        _chatcategory = "SALES_Q_21790"
                    Case url.Contains("order/offers.aspx?productitem=2")
                        _chatcategory = "SALES_Q_21791"
                    Case url.Contains("order/offers.aspx?productitem=3")
                        _chatcategory = "SALES_Q_21792"

                    Case url.Contains("visitors/products.aspx?menuitem=2")
                        _chatcategory = "SALES_Q_21790"
                    Case url.Contains("visitors/products.aspx?menuitem=3")
                        _chatcategory = "SALES_Q_21791"
                    Case url.Contains("visitors/products.aspx?menuitem=4")
                        _chatcategory = "SALES_Q_21792"

                        '#####################################################################
                        'MODIFICATION   Jonathan Parks    7/22/2008    ISSUE ID 4279
                        '#####################################################################
                        'MORE SPECIFIC URLS THAT SHOULD ROUTE TRAFFIC TO NEW QUEUES.
                        '#####################################################################
                    Case url.Contains("visitors/products.aspx?productitem=4")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=5")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=6")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=7")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=8")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=9")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/products.aspx?productitem=10")
                        _chatcategory = "Q_21853"

                    Case url.Contains("visitors/channels.aspx")
                        _chatcategory = "Q_21853"

                    Case url.Contains("visitors/frequentquestions.aspx?productitem=1")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/frequentquestions.aspx?productitem=2")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/frequentquestions.aspx?productitem=3")
                        _chatcategory = "Q_21853"

                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=61")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=62")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=63")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=64")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=65")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=66")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=68")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=81")
                        _chatcategory = "Q_21853"
                    Case url.Contains("visitors/nonproducts.aspx?nonproductitem=83")
                        _chatcategory = "Q_21853"

                        '#####################################################################

                    Case Else
                        _chatcategory = "SALES"
                End Select
                '#####################################################################

            End If

            'if it is the new OrderHelpChat button then hide everything and show that
            If ShowOrderHelpChatLive Then
                pnlASAAvailable.Visible = False
                pnlASANotAvailable.Visible = False
                pnlOrderHelpChatLive.Visible = True
            End If

        Catch ex As Exception
        End Try

    End Sub
End Class
