Public Class Header
    Inherits System.Web.UI.UserControl

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents cmdAdmin As System.Web.UI.WebControls.ImageButton
    Protected WithEvents cmdTitle As System.Web.UI.WebControls.ImageButton
    Protected WithEvents cmdCalendar As System.Web.UI.WebControls.ImageButton
    Protected WithEvents hypLogout As System.Web.UI.WebControls.HyperLink
    Protected WithEvents hypDoc As System.Web.UI.WebControls.HyperLink
    Protected WithEvents hypNewOrd As System.Web.UI.WebControls.HyperLink
    Protected WithEvents hypOrdSum As System.Web.UI.WebControls.HyperLink
    Protected WithEvents pnlTitle As System.Web.UI.WebControls.Panel
    Protected WithEvents hypUsers As System.Web.UI.WebControls.HyperLink
    Protected WithEvents hypProp As System.Web.UI.WebControls.HyperLink
    Protected WithEvents hypDev As System.Web.UI.WebControls.HyperLink
    Protected WithEvents pnlAdmin As System.Web.UI.WebControls.Panel

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Session("UserId") = "" Then Response.End()


        cmdAdmin.Attributes.Add("onclick", "parent.frames['main'].location.href='Developments.aspx';")
        cmdTitle.Attributes.Add("onclick", "parent.frames['main'].location.href='ControlPanel.aspx';")
        cmdCalendar.Attributes.Add("onclick", "parent.frames['main'].location.href='clCalendar.aspx';")
        'cmdLogout.Attributes.Add("onclick", "parent.frames['main'].location.href='Logout.aspx';")

        If Session("UserCat") = 1 Then
            cmdAdmin.Enabled = True
            ButtonColorChange(cmdAdmin)
        ElseIf Session("UserCat") = 2 Then
            cmdAdmin.Enabled = True
            hypUsers.Enabled = False
            ButtonColorChange(cmdAdmin)
        Else
            cmdAdmin.Enabled = False
            cmdCalendar.Enabled = True
            hypDoc.Enabled = False
            hypNewOrd.Enabled = False
            ButtonColorChange(cmdTitle)
        End If

    End Sub

    Sub ButtonColorChange(ByVal btnActiveButton As ImageButton)
        cmdAdmin.ImageUrl = "Images/Admin1.gif"
        cmdTitle.ImageUrl = "Images/Title1.gif"
        cmdCalendar.ImageUrl = "Images/Closing1.gif"
        'cmdLogout.ImageUrl = Server.MapPath("./Images/logout1.gif")

        If btnActiveButton.AlternateText = "Administration" Then
            btnActiveButton.ImageUrl = "Images/Admin2.gif"
        ElseIf btnActiveButton.AlternateText = "Closing Calendar" Then
            btnActiveButton.ImageUrl = "Images/Closing2.gif"
        ElseIf btnActiveButton.AlternateText = "Title Docs" Then
            btnActiveButton.ImageUrl = "Images/Title2.gif"
            'ElseIf btnActiveButton.AlternateText = "Logout" Then
            'btnActiveButton.ImageUrl = Server.MapPath("./Images/Logout2.gif")
        End If


        If btnActiveButton.AlternateText = "Administration" Then
            pnlAdmin.Visible = True
            pnlTitle.Visible = False
        ElseIf btnActiveButton.AlternateText = "Title Docs" Then
            pnlAdmin.Visible = False
            pnlTitle.Visible = True
        ElseIf btnActiveButton.AlternateText = "Closing Calendar" Or btnActiveButton.AlternateText = "Logout" Then
            pnlAdmin.Visible = False
            pnlTitle.Visible = False
        End If
    End Sub

    Private Sub cmdAdmin_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdAdmin.Click
        ButtonColorChange(cmdAdmin)

    End Sub

    Private Sub cmdTitle_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdTitle.Click
        ButtonColorChange(cmdTitle)
    End Sub

    Private Sub cmdCalendar_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cmdCalendar.Click
        ButtonColorChange(cmdCalendar)
    End Sub
End Class
