/// <summary> Checks the appropriate design folders to add any existing browse or info pages to the item aggregation </summary>
        /// <param name="thisObject"> Item aggregation object to add the browse and info pages to</param>
        /// <param name="tracer"> Trace object keeps a list of each method executed and important milestones in rendering</param>
        /// <remarks>This method is only called if the item aggregation does not have an existing XML configuration file.</remarks>
        protected static void Add_Browse_Files( Item_Aggregation thisObject, Custom_Tracer tracer  )
        {
            // Collect the list of items in the browse folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/browse"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/browse", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the new browse info object
                    Item_Aggregation_Browse_Info newBrowse = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, tracer);
                    if (newBrowse != null)
                    {
                        thisObject.Add_Browse_Info(newBrowse);
                    }
                }
            }

            // Collect the list of items in the info folder
            if (Directory.Exists(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/info"))
            {
                string[] files = Directory.GetFiles(SobekCM_Library_Settings.Base_Design_Location + thisObject.objDirectory + "html/info", "*.htm*");
                foreach (string thisFile in files)
                {
                    // Get the title for this file
                    // Get the new browse info object
                    Item_Aggregation_Browse_Info newInfo = Get_Item_Aggregation_Browse_Info(thisFile, Item_Aggregation_Browse_Info.Browse_Info_Type.Info, tracer);
                    if (newInfo != null)
                    {
                        thisObject.Add_Browse_Info(newInfo);
                    }
                }
            }
        }
        private static void read_browse(bool browse, XmlNodeReader nodeReader, Item_Aggregation hierarchyObject )
        {
            // Create a new browse/info object
            Item_Aggregation_Browse_Info newBrowse = new Item_Aggregation_Browse_Info
                                {
                                    Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home,
                                    Source = Item_Aggregation_Browse_Info.Source_Type.Static_HTML,
                                    Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Text
                                };

            bool isDefault = false;

            string code = String.Empty;

            // Determine which XML node name to look for and set browse v. info
            string lastName = "HI:BROWSE";
            if (!browse)
            {
                lastName = "HI:INFO";
                newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Info;
            }

            // Check for the attributes
            if (nodeReader.HasAttributes)
            {
                if (nodeReader.MoveToAttribute("location"))
                {
                    if (nodeReader.Value == "BROWSEBY")
                        newBrowse.Browse_Type = Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By;
                }
                if (nodeReader.MoveToAttribute("default"))
                {
                    if (nodeReader.Value == "DEFAULT")
                        isDefault = true;
                }
            }

            // Step through the XML and build this browse/info object
            while (nodeReader.Read())
            {
                // If this is the beginning tag for an element, assign the next values accordingly
                if (nodeReader.NodeType == XmlNodeType.Element)
                {
                    // Get the node name, trimmed and to upper
                    string nodeName = nodeReader.Name.Trim().ToUpper();

                    // switch the rest based on the tag name
                    switch (nodeName)
                    {
                        case "HI:METADATA":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            newBrowse.Source = Item_Aggregation_Browse_Info.Source_Type.Database;
                            newBrowse.Data_Type = Item_Aggregation_Browse_Info.Result_Data_Type.Table;
                            break;

                        case "HI:CODE":
                            nodeReader.Read();
                            newBrowse.Code = nodeReader.Value.ToLower();
                            break;

                        case "HI:TITLE":
                            // Look for a language attached to this title
                            string titleLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && ( nodeReader.MoveToAttribute("lang")))
                            {
                                titleLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            newBrowse.Add_Label( nodeReader.Value, Web_Language_Enum_Converter.Code_To_Enum(titleLanguage));
                            break;

                        case "HI:BODY":
                            // Look for a language attached to this title
                            string bodyLanguage = String.Empty;
                            if ((nodeReader.HasAttributes) && (nodeReader.MoveToAttribute("lang")))
                            {
                                bodyLanguage = nodeReader.GetAttribute("lang");
                            }

                            // read and save the title
                            nodeReader.Read();
                            string bodySource = nodeReader.Value;
                            newBrowse.Add_Static_HTML_Source(bodySource, Web_Language_Enum_Converter.Code_To_Enum(bodyLanguage));
                            break;
                    }
                }

                if (nodeReader.NodeType == XmlNodeType.EndElement)
                {
                    if (nodeReader.Name.Trim().ToUpper() == lastName )
                    {
                        hierarchyObject.Add_Browse_Info(newBrowse);

                        // If this set the default browse by save that information
                        if ((newBrowse.Browse_Type == Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_By) && (isDefault))
                        {
                            hierarchyObject.Default_BrowseBy = newBrowse.Code;
                        }

                        return;
                    }
                }
            }
        }
        /// <summary> Adds the ALL ITEMS and NEW ITEMS browses to the item aggregation, if the display options and last added
        /// item date call for it </summary>
        /// <param name="thisObject"> Item aggregation to which to add the ALL ITEMS and NEW ITEMS browse</param>
        /// <remarks>This method is always called while building an item aggregation, irregardless of whether there is an
        /// item aggregation configuration XML file or not.</remarks>
        protected static void Add_All_New_Browses(Item_Aggregation thisObject)
        {
            // If this is the main home page for this site, do not show ALL since we cannot browse ALL items
            if (!thisObject.Can_Browse_Items )
                return;

            // If this is in the display options, and the item browses
            if ((thisObject.Display_Options.Length == 0) || (thisObject.Display_Options.IndexOf("I") >= 0))
            {
                // Add the ALL browse, if there should be one
                thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, "all", String.Empty, "All Items");

                // Add the NEW search, if the ALL search exists
                if ((thisObject.Get_Browse_Info_Object("all") != null) && (thisObject.Show_New_Item_Browse))
                {
                    thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Browse_Home, "new", String.Empty, "Recently Added Items");
                }
            }
            else
            {
                // Add the ALL browse as an info
                thisObject.Add_Browse_Info(Item_Aggregation_Browse_Info.Browse_Info_Type.Info, "all", String.Empty, "All Items");
            }
        }