/// <summary>
        /// Load event of the page
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //Load the menu mapping the first time it is loaded
                if (!IsPostBack)
                {
                    //if the user has no rihts the whole menu is disabled
                    if (SessionManager.GetSessionValueNoRedirect((IndBasePage)this.Page, SessionStrings.CURRENT_USER) == null)
                    {
                        mnuMain.Enabled = false;
                        return;
                    }
                }

                LoadReportMenu();

                //If no project has been selected
                if (SessionManager.GetSessionValueNoRedirect((IndBasePage)this.Page, SessionStrings.CURRENT_PROJECT) == null)
                {
                    //Add an onclick client event handler to show the project selector popup window. A project must be selected before the
                    //project core team is displayed
                    IndMenuItem menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_CORE_TEAM);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_TIMING_INTERCO);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_WORK_PACKAGE);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_INITIAL);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_REVISED);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_FOLLOW_UP);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_REFORECAST);
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByValue("mnuExtract"); // already exists an menu item that contains word Extract
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");

                    menuItem = (IndMenuItem)mnuMain.FindItemByValue("mnuInitialBudget");
                    menuItem.Attributes.Add("onclick", "if (!ShowPopUpWithoutPostBackWithDirtyCheck('" + ResolveUrl("~/UserControls/ProjectSelector/SelectProject.aspx") + "',0,540, '" + ResolveUrl("~/Default.aspx?SessionExpired=1") + "')) return false;");
                }
                else
                {
                    IndMenuItem menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_CORE_TEAM);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_TIMING_INTERCO);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_WORK_PACKAGE);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_INITIAL);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_REVISED);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_FOLLOW_UP);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_REFORECAST);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_EXTRACT);
                    menuItem.Attributes.Clear();

                    menuItem = (IndMenuItem)mnuMain.FindItemByText(ApplicationMessages.MENU_UPLOAD_INITIAL_BUDGET);
                    menuItem.Attributes.Clear();
                }
            }
            catch (IndException ex)
            {
                ReportControlError(ex);
                return;
            }
            catch (XmlException ex)
            {
                ReportControlError(new IndException("MenuReporting notice: " + ex.Message));
                return;
            }
            catch (Exception ex)
            {
                ReportControlError(new IndException(ex));
                return;
            }
        }
        private void AddItemsToMenu(XPathNavigator xmlNavigator, string parentValue, string cssClass)
        {
            levelCount++;

            //check to see if the number of levels is not over the maximum
            if (levelCount > ApplicationConstants.REPORTING_MAXIMUM_LEVEL)
            {
                throw new XmlException(string.Format("A maximum of '{0}' menu levels is permitted. Level {1} is beyond this limit.",
                                                     ApplicationConstants.REPORTING_MAXIMUM_LEVEL, xmlNavigator.GetAttribute("Text", "")));
            }

            string navigatorText = xmlNavigator.GetAttribute("Text", "");

            //check not to allow nodes without Text attribute
            if (string.IsNullOrEmpty(navigatorText))
            {
                throw new XmlException("Text attribute cannot be empty.");
            }


            //on level 2 we should have only nodes
            if (levelCount == 2 && !string.IsNullOrEmpty(xmlNavigator.GetAttribute("NavigateUrl", "")))
            {
                throw new XmlException(string.Format("Node '{0}' must be a parent MenuItem because it is a level 2 node.", navigatorText));
            }


            //Check not to allow leaf not to have a NavigateUrl attribute. Except level 2.
            if (levelCount > 2 &&
                !xmlNavigator.HasChildren &&
                string.IsNullOrEmpty(xmlNavigator.GetAttribute("NavigateUrl", "")))
            {
                throw new XmlException(string.Format("NavigateUrl attribute is empty for node '{0}'. This is not allowed for a leaf MenuItem.",
                                                     navigatorText));
            }

            //Navigate url must be empty for a parent MenuItems.
            if (xmlNavigator.HasChildren &&
                !string.IsNullOrEmpty(xmlNavigator.GetAttribute("NavigateUrl", "")))
            {
                throw new XmlException(string.Format("NavigateUrl attribute is NOT empty for node '{0}'. This is not allowed for a parent MenuItem.",
                                                     navigatorText));
            }
            //Window must be empty for a parent MenuItems.
            if (xmlNavigator.HasChildren &&
                !string.IsNullOrEmpty(xmlNavigator.GetAttribute("Window", "")))
            {
                throw new XmlException(string.Format("Window attribute is NOT empty for node '{0}'. This is not allowed for a parent MenuItem.",
                                                     navigatorText));
            }

            //********* make the breadcrumb************************
            repBreadCrumb += " > " + navigatorText;
            //*****************************************************

            EncryptingSupport encryptingSupport = new EncryptingSupport();
            IndMenuItem       itemToAdd         = new IndMenuItem();
            string            newValue          = encryptingSupport.GetUniqueKey();

            itemToAdd.Value = newValue;
            itemToAdd.Text  = navigatorText;

            String window      = xmlNavigator.GetAttribute("Window", "");
            String urlType     = xmlNavigator.GetAttribute("UrlType", "");
            String navigateUrl = xmlNavigator.GetAttribute("NavigateUrl", "");

            if (window == "new")
            {
                itemToAdd.Target = "newINDev3Window";
            }


            String navigateUrlToSet;

            if (!string.IsNullOrEmpty(navigateUrl))
            {
                if (urlType == "absolute")
                {
                    navigateUrlToSet = navigateUrl;
                }
                else
                {
                    //we remove any HTTP text to avoid some fatal error
                    navigateUrl = navigateUrl.Replace("http://", "");

                    navigateUrlToSet = "~/ReportPlaceHolder.aspx?Code=" + navigateUrl
                                       + "&nav=" + repBreadCrumb;
                }

                itemToAdd.NavigateUrl = Server.UrlDecode(navigateUrlToSet);
            }

            itemToAdd.CssClass = cssClass;

            //Add to menu
            RadMenuItem item = mnuMain.FindItemByValue(parentValue);

            item.Items.Add(itemToAdd);

            //if has children append this function again
            XPathNodeIterator NodeItererator = xmlNavigator.Select("MenuItem");

            int iterator = 0;

            while (NodeItererator.MoveNext())
            {
                string css = getCssClass(NodeItererator.Count, iterator);
                AddItemsToMenu(NodeItererator.Current, newValue, css);

                iterator++;
                levelCount--;

                //***********reset the breadcrumb because navigator enters another branch *************
                repBreadCrumb = repBreadCrumb.Remove(repBreadCrumb.LastIndexOf(" > "));
                //*************************************************************************************
            }
        }