using System;
using System.Web;
using Telerik.Web.UI;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void rmnuMainMenu_ItemClick(object sender, Telerik.Web.UI.RadMenuEventArgs e)
    {
        // Store requested language as new culture in the session
        if (e.Item.Text == "Español" || e.Item.Text == "Spanish")
            Session["SelectedCulture"] = "es-MX";
        if (e.Item.Text == "Inglés" || e.Item.Text == "English")
            Session["SelectedCulture"] = "en-US";

        // Reload last requested page with new culture
        Server.Transfer(Request.Path);
    }

    protected void rmnuMainMenu_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
    {
        // Load the specific image for every menu item, from the Sitemap information
        e.Item.ImageUrl = ((SiteMapNode)e.Item.DataItem)["image"];

        if (e.Item.Level == 0)
        {
            RadMenuItem separator = new RadMenuItem();
            separator.IsSeparator = true;
            separator.Text = "|";
            e.Item.Owner.Items.Insert(e.Item.Index + 1, separator);
        }
    }
}