Public Class TopMenu
	Inherits System.Web.UI.UserControl

	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

		Me.Menu()
		Me.Submenu()

	End Sub

#Region "  MENU  "

	Sub Menu()

		Dim s As String = ""
		Dim sAdresa As String = ""

		phSubmenuContainer.Visible = False

		sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.UvodniStrana) & "';"""
		If gTopMenuSelected = _TopMenu.UvodniStrana Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
		s &= "Úvodní strana</li>"

		sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Aktuality) & "';"""
		If gTopMenuSelected = _TopMenu.Aktuality Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
		s &= "Aktuality</li>"

        sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Projekty) & "';"""
        If gTopMenuSelected = _TopMenu.Projekty Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
        s &= "Reference</li>"

        sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Sluzby) & "';"""
        If gTopMenuSelected = _TopMenu.Sluzby Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
        s &= "Služby</li>"

        sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Onas) & "';"""
        If gTopMenuSelected = _TopMenu.Onas Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
        s &= "O nás</li>"

        sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Kontakt) & "';"""
        If gTopMenuSelected = _TopMenu.Kontakt Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
        s &= "Kontakt</li>"

        sAdresa = " onclick=""location.href='" & GetLink(_TopMenu.Nastaveni) & "';"""
		If gTopMenuSelected = _TopMenu.Nastaveni Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
		s &= "Nastavení</li>"

		phMenu.Controls.Add(New LiteralControl(s))

	End Sub

#End Region

#Region "  PODMENU  "

	Sub Submenu()

		Dim s As String = ""
		Dim sAdresa As String = ""

		Dim sID As String = Request.QueryString("id")

        If gTopMenuSelected = _TopMenu.UvodniStrana And gSubMenuSelected > 0 Then '# UVODNI STRANA ---------------------------------

            phSubmenuContainer.Visible = True

            sAdresa = " onclick=""location.href='" & gadrUvodniStrana & "';"""
            If gSubMenuSelected = _SubMenu.UvodniStrana_Zaznam Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Stránka</li>"

            sAdresa = " onclick=""location.href='" & gadrUvodniStrana_Slider & "';"""
            If gSubMenuSelected = _SubMenu.UvodniStrana_Slider Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Slider</li>"

        ElseIf gTopMenuSelected = _TopMenu.Projekty And gSubMenuSelected > 0 Then '# PROJEKTY ---------------------------------

            phSubmenuContainer.Visible = True

            sAdresa = " onclick=""location.href='" & gadrProjekty_seznam & "';"""
            If gSubMenuSelected = _SubMenu.Projekty_zaznamy Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Seznam referencí</li>"

            sAdresa = " onclick=""location.href='" & gadrProjekty_kategorie_seznam & "';"""
            If gSubMenuSelected = _SubMenu.Projekty_roky Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Kategorie</li>"

        ElseIf gTopMenuSelected = _TopMenu.Kontakt And gSubMenuSelected > 0 Then '# KONTAKTY ---------------------------------

            phSubmenuContainer.Visible = True

            sAdresa = " onclick=""location.href='" & gadrKontakt & "';"""
            If gSubMenuSelected = _SubMenu.Kontakt_kontaktni_udaje Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Kontaktní údaje</li>"

            sAdresa = " onclick=""location.href='" & gadrLide_seznam & "';"""
            If gSubMenuSelected = _SubMenu.Kontakt_lide Then s &= "<li class=""selected""" & sAdresa & ">" Else s &= "<li" & sAdresa & ">"
            s &= "Lidé</li>"

        End If

		phSubmenu.Controls.Add(New LiteralControl(s))

	End Sub

#End Region

End Class