using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

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

    protected void writeMenuImage(MenuItem item ) {

        switch (item.Value.ToLower())
        {
            case "home":
                item.ImageUrl = "~/Images/Nav/home.jpg";
                break;
            case "about dr. sabrin":
                item.ImageUrl = "~/Images/Nav/about.jpg";
               
                break;
            case "on the issues":
                item.ImageUrl = "~/Images/Nav/hisword.jpg";
                break;
            case "press room":
                item.ImageUrl = "~/Images/Nav/press.jpg";
                break;
            case "gallery":
                item.ImageUrl = "~/Images/Nav/gallery.jpg";
                break;
            case "contribute":
                item.ImageUrl = "~/Images/Nav/contribute.jpg";
                break;
            case "get involved":
                item.ImageUrl = "~/Images/Nav/getinvolved.jpg";
                break;
            case "contact":
                item.ImageUrl = "~/Images/Nav/contact.jpg";
                break;
        }
        item.Text = "";

        return;
    }

    protected void MenuPreRender(object sender, EventArgs e)
    {
    }

    protected void Menu1_DataBound(object sender, EventArgs e)
    { 
        //this method walks over the menu items and writes the images.
        //remember, the first node is Home, the rest of main nav are the first children
       // of the root node

        foreach (MenuItem item in Menu1.Items)
        {
//            item.nav
            writeMenuImage(item);
            foreach (MenuItem itemSub in item.ChildItems)
                writeMenuImage(itemSub);
        }

    
    }
}
