
Partial Class Controls_PayYourBill
    Inherits System.Web.UI.UserControl

    Private _HBXPageName As String = ""
    Private _HBXCategory As String = ""

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        '#######################
        'ASSIGN DEFAULT VALUES
        '#######################
        _HBXPageName = "LandingPage"
        _HBXCategory = Request.RawUrl.ToUpper().Replace("/UI", "").ToUpper()

    End Sub

    Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender

        '######################################################################################################
        'ROD COPELAND 8/2/2007  M O D I F I C A T I O N
        '######################################################################################################
        'BECAUSE THIS CONTROL IS USED FROM THE PAYYOURBILL.ASPX TRANSFER, MY ACCOUNT LANDING PAGE, OR 
        'QUICKPAY PAGE, DO A CHECK TO DETERMINE HOW TO LOAD THE HBX SCRIPT IN THE PAGE.  THERE CURRENTLY 
        'IS A BUG ON THE SITE.MASTER.VB FILE THAT DOESNT RENDER HBX SCRIPT IN THE PAGE WHEN A POST BACK 
        'HAPPENS, THIS WORKS FOR THE MOST PART UP UNTIL WE NEED TO DISPLAY DIFFERENT HBX VALUES DEPENDING 
        'UPON WHAT PANEL IS SHOWING ON THE SAME PAGE.  WHEN THIS HAPPENED, THE OLD HBX MODEL WENT OUT THE 
        'WINDOW.  WE CURRENTLY DONT HAVE TIME TO EVALUATE THE IMPACTS ON THE ENTIRE SITE, THE NOT 
        'GENERATING THE HBX SCRIPT ON POST BACK.  THERE IS A CHANCE THIS WILL BE AN ISSUE OF NOT TRACKING 
        'ANYTHING FOR PAGES THAT USE PANELS AND POST BACKS.  IN THE CASE OF QUICKPAY, THIS BUG WAS 
        'ACTUALLY KEEPING THE SCRIPT FROM EVER HITTING THE PAGE AT ALL.  ONE CAVEAT TO THIS IS THAT 
        'QUICK PAY RECEIVES A SERVER.TRANSFER FROM THE PAY YOUR BILL.ASPX PAGE.  TIME WILL TELL.
        '######################################################################################################
        If Request.Path.ToLower().Contains("quickpay.aspx") Or Request.Path.ToLower().Contains("myaccount.aspx") Or Request.Path.ToLower().Contains("payyourbill.aspx") Then
            Page.ClientScript.RegisterStartupScript(Me.GetType, "HBXQuickPayScript", GenerateHBXPageScript())
        End If

    End Sub

    Private Function GenerateHBXPageScript() As String
        Try
            Dim strTemp As New StringBuilder()

            strTemp.AppendLine("<script type=""text/javascript"">")
            strTemp.AppendLine("var utag_data = {")
            strTemp.AppendLine("page_level2:         '" & _HBXPageName & "',")
            strTemp.AppendLine("page_level1:        '" & _HBXCategory & "'")
            strTemp.AppendLine("}")
            strTemp.AppendLine("</script>")
            strTemp.AppendLine("<script type=""text/javascript"" src=""//tealium.hs.llnwd.net/o43/utag/charter/main/prod/utag.js""></script>")

            'strTemp.AppendLine("<SCRIPT>")
            'strTemp.AppendLine("var hbxObj = new Object();")
            'strTemp.AppendLine("hbxObj.pn ='" & _HBXPageName & "';")
            'strTemp.AppendLine("hbxObj.mlc = '" & _HBXCategory & "';")
            'strTemp.AppendLine("hbxObj.pr = '';")
            'strTemp.AppendLine("hbxObj.ca = '';")
            'strTemp.AppendLine("hbxObj.pc = '';")
            'strTemp.AppendLine("hbxObj.qn = '';")
            'strTemp.AppendLine("hbxObj.st = 1;")
            'strTemp.AppendLine("hbxObj.sp = 0;")
            'strTemp.AppendLine("hbxObj.sr = 1;")
            'strTemp.AppendLine("hbxObj.oi = '';")
            'strTemp.AppendLine("hbxObj.sk = '';")
            'strTemp.AppendLine("hbxObj.po = '';")
            'strTemp.AppendLine("hbxObj.ds = 0;")
            'strTemp.AppendLine("hbxObj.ci = '';")
            'strTemp.AppendLine("</script>")
            'strTemp.AppendLine("<script language=""javascript"" type=""text/javascript"" src=""../Scripts/hbx_pagecode.js""></script>")
            'strTemp.AppendLine("<script language=""javascript"" type=""text/javascript"" src=""../Scripts/hbx.js""></script>")
            Return strTemp.ToString
        Catch ex As Exception
            Throw ex
        End Try
    End Function


    Protected Sub btnContinue_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnContinue.Click
        Server.Transfer("QuickPay.aspx", True)
    End Sub
End Class
