using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class menu : System.Web.UI.UserControl
{
    private string url;

    public delegate void del_url_valide(string url);
    public event del_url_valide OnUrlValide;

    protected void Page_Load(object sender, EventArgs e)
    {
        url = Request.Url.Segments[Request.Url.Segments.Length - 1];

        int i = url.IndexOf(".");
        url = url.Substring(0, i);

        if (OnUrlValide != null)
            OnUrlValide(url); // signaler la présence de l'URL valide

        #region "Switch(url)"
        switch (url.ToLower())
        {
            default:
                l1.Text = "Accueil";
                l2.Text = "Produits";
                l3.Text = "Services";
                break;

            case "default":
                l1.Text = "[ Accueil ]";
                l2.Text = "Produits";
                l3.Text = "Services";
                break;

            case "produits":
                l1.Text = "Accueil";
                l2.Text = "[ Produits ]";
                l3.Text = "Services";
                break;

            case "services":
                l1.Text = "Accueil";
                l2.Text = "Produits";
                l3.Text = "[ Services ]";
                break;
        }
        #endregion
    }

    public string Url
    {
        get { return url; }
    }

    public bool visible
    {
        get { return mp.Visible; }
        set { mp.Visible = value; }
    }

    protected void cmd_aff_Click(object sender, EventArgs e)
    {
        mp.Visible = !mp.Visible;
        cmd_aff.Text = (mp.Visible ? "Masquer" : "Afficher");
    }
}