private void split_add_subjects(SobekCM_Item Package, string Data )
        {
            if (Data.IndexOf("--") < 0)
                Package.Bib_Info.Add_Subject(new Subject_Info_Standard(Data, null));
            else
            {
                Subject_Info_Standard subject = new Subject_Info_Standard();
                string[] splitter = Data.Split("-".ToCharArray());
                foreach (string thisSplit in splitter)
                {
                    if (thisSplit.Length == 0)
                        continue;

                    string tsl = thisSplit.ToLower().Trim();

                    // Was this geographic?
                    if ((tsl.IndexOf("county") >= 0) || (tsl.IndexOf("(nev.)") > 0) || (tsl.IndexOf("henderson") >= 0) || (tsl.IndexOf("nevada") >= 0) || (tsl.IndexOf("las vegas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0)
                        || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("los angeles") >= 0) || (tsl.IndexOf("(calif.)") >= 0) || (tsl.IndexOf("russia") >= 0) || (tsl.IndexOf("lake mead") >= 0) || (tsl.IndexOf("(ariz.)") >= 0)
                        || (tsl.IndexOf("united states") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("el paso") >= 0) || (tsl.IndexOf("texas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("boulder city") >= 0)
                        || (tsl.IndexOf("pittman") >= 0) || (tsl.IndexOf("gabbs") >= 0) || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("colorado") >= 0)
                        || (tsl.IndexOf("reno") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || ( tsl == "japan"))
                        subject.Add_Geographic(thisSplit.Trim().Replace("\"",""));
                    // Was this temporal?
                    else if ((tsl.IndexOf("20th century") >= 0) || (tsl.IndexOf("war, 19") >= 0))
                        subject.Add_Temporal(thisSplit.Trim());
                    else if (tsl.IndexOf("maps, topographic") >= 0)
                        subject.Add_Genre(thisSplit.Trim());
                    else
                        subject.Add_Topic(thisSplit.Trim());
                }

                Package.Bib_Info.Add_Subject(subject);
            }
        }
        /// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary>
        /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            string subject_text = String.Empty;

            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0)
                {
                    subject_text = HttpContext.Current.Request.Form[thisKey];
                }

                if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0)
                {
                    string subject_type = HttpContext.Current.Request.Form[thisKey];
                    Subject_Info_Standard standardSubject = new Subject_Info_Standard {Authority = "fast"};

                    if (subject_text.Trim().Length > 0)
                    {
                        switch (subject_type)
                        {
                            case "genre":
                                standardSubject.Add_Genre( subject_type );
                                break;

                            case "geographic":
                                standardSubject.Add_Geographic( subject_type );
                                break;

                            case "occupational":
                                standardSubject.Add_Occupation( subject_type );
                                break;

                            case "temporal":
                                standardSubject.Add_Temporal( subject_type );
                                break;

                            case "topic":
                                standardSubject.Add_Topic( subject_type );
                                break;
                        }

                        if ((standardSubject.Topics_Count > 0) || (standardSubject.Genres_Count > 0) || (standardSubject.Geographics_Count > 0) || (standardSubject.Occupations_Count > 0) || (standardSubject.Temporals_Count > 0))
                            Bib.Bib_Info.Add_Subject(standardSubject);
                    }

                    subject_text = String.Empty;
                }
            }
        }
        private static void Add_Subject(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, string topical_codes, string geographic_codes, string temporal_codes, string genre_codes, string occupation_codes)
        {
            // Step through all of the subjects under this tag
            int subj_index = 1;
            string source;
            foreach (MARC_Field thisRecord in record[tag])
            {
                // Only continue if there is an id in this record
                if (thisRecord.has_Subfield('a'))
                {
                    // Was there  a source?
                    source = String.Empty;
                    if (thisRecord.has_Subfield('2'))
                    {
                        source = thisRecord['2'];
                    }
                    else if ((tag != 653))
                    {
                        switch (thisRecord.Indicator2)
                        {
                            case '0':
                                source = "lcsh";
                                break;

                            case '1':
                                source = "lcshac";
                                break;

                            case '2':
                                source = "mesh";
                                break;

                            case '3':
                                source = "nal";
                                break;

                            case '5':
                                source = "csh";
                                break;

                            case '6':
                                source = "rvm";
                                break;

                            case '9':
                                source = "local";
                                break;
                        }
                    }

                    Subject_Info_Standard obj = new Subject_Info_Standard();
                    obj.Authority = source;
                    obj.ID = "SUBJ" + tag + "_" + subj_index;
                    subj_index++;

                    // Add the topics
                    foreach (char thisTopicChar in topical_codes)
                    {
                        if (thisRecord.has_Subfield(thisTopicChar))
                        {
                            string topicString = thisRecord[thisTopicChar];
                            if (topicString.IndexOf("|") > 0)
                            {
                                string[] topicStringSplit = topicString.Split("|".ToCharArray());
                                foreach (string thisTopicString in topicStringSplit)
                                    obj.Add_Topic(Remove_Trailing_Punctuation(thisTopicString));
                            }
                            else
                            {
                                obj.Add_Topic(Remove_Trailing_Punctuation(topicString));
                            }
                        }
                    }

                    // Add the temporals
                    foreach (char thisTempChar in temporal_codes)
                    {
                        if (thisRecord.has_Subfield(thisTempChar))
                        {
                            string tempString = thisRecord[thisTempChar];
                            if (tempString.IndexOf("|") > 0)
                            {
                                string[] tempStringSplit = tempString.Split("|".ToCharArray());
                                foreach (string thisTempString in tempStringSplit)
                                    obj.Add_Temporal(Remove_Trailing_Punctuation(thisTempString));
                            }
                            else
                            {
                                obj.Add_Temporal(Remove_Trailing_Punctuation(tempString));
                            }
                        }
                    }

                    // Add the geographics
                    foreach (char thisGeoChar in geographic_codes)
                    {
                        if (thisRecord.has_Subfield(thisGeoChar))
                        {
                            string geoString = thisRecord[thisGeoChar];
                            if (geoString.IndexOf("|") > 0)
                            {
                                string[] geoStringSplit = geoString.Split("|".ToCharArray());
                                foreach (string thisGeoString in geoStringSplit)
                                    obj.Add_Geographic(Remove_Trailing_Punctuation(thisGeoString));
                            }
                            else
                            {
                                obj.Add_Geographic(Remove_Trailing_Punctuation(geoString));
                            }
                        }
                    }

                    // Add the genres
                    foreach (char thisGenreChar in genre_codes)
                    {
                        if (thisRecord.has_Subfield(thisGenreChar))
                        {
                            string genreString = thisRecord[thisGenreChar];
                            if (genreString.IndexOf("|") > 0)
                            {
                                string[] genreStringSplit = genreString.Split("|".ToCharArray());
                                foreach (string thisGenreString in genreStringSplit)
                                    obj.Add_Genre(Remove_Trailing_Punctuation(thisGenreString));
                            }
                            else
                            {
                                obj.Add_Genre(Remove_Trailing_Punctuation(genreString));
                            }
                        }
                    }

                    // Add the occupations
                    foreach (char thisOccChar in occupation_codes)
                    {
                        if (thisRecord.has_Subfield(thisOccChar))
                        {
                            string occString = thisRecord[thisOccChar].Replace("--", "|");
                            if (occString.IndexOf("|") > 0)
                            {
                                string[] occStringSplit = occString.Split("|".ToCharArray());
                                foreach (string thisOccString in occStringSplit)
                                    obj.Add_Occupation(Remove_Trailing_Punctuation(thisOccString.Trim()));
                            }
                            else
                            {
                                obj.Add_Occupation(Remove_Trailing_Punctuation(occString));
                            }
                        }
                    }

                    // Add this subject
                    thisBibInfo.Add_Subject(obj);
                }
            }
        }
        /// <summary> Constructor for a new instance of the SobekCM_Item class, which imports values from a OAI record </summary>
        public SobekCM_Item(OAI_Repository_DublinCore_Record OAI_Record)
        {
            metsInfo = new METS_Header_Info();
            behaviorInfo = new Behaviors_Info();
            divInfo = new Division_Info();
            BIBInfo = new Bibliographic_Info();
            web = new Web_Info(behaviorInfo);
            analyzed_for_complex_content = false;
            contains_complex_content = false;
            using_complex_template = false;
            DiskSize_KB = 0;

            // Copy over all the data
            if (OAI_Record.hasCreators)
            {
                foreach (string thisCreator in OAI_Record.Creators)
                {
                    Bib_Info.Add_Named_Entity(thisCreator);
                }
            }
            if (OAI_Record.hasContributors)
            {
                foreach (string thisContributor in OAI_Record.Contributors)
                {
                    Bib_Info.Add_Named_Entity(thisContributor, "Contributor");
                }
            }
            if (OAI_Record.hasCoverages)
            {
                foreach (string thisCoverage in OAI_Record.Coverages)
                {
                    Subject_Info_Standard thisSubject = new Subject_Info_Standard();
                    thisSubject.Add_Geographic(thisCoverage);
                    Bib_Info.Add_Subject(thisSubject);
                }
            }
            if (OAI_Record.hasDates)
            {
                foreach (string thisDate in OAI_Record.Dates)
                {
                    Bib_Info.Origin_Info.Date_Issued = thisDate;
                }
            }
            if (OAI_Record.hasDescriptions)
            {
                foreach (string thisDescription in OAI_Record.Descriptions)
                {
                    Bib_Info.Add_Note(thisDescription);
                }
            }
            if (OAI_Record.hasFormats)
            {
                foreach (string thisFormat in OAI_Record.Formats)
                {
                    Bib_Info.Original_Description.Extent = thisFormat;
                }
            }
            if (OAI_Record.hasIdentifiers)
            {
                foreach (string thisIdentifier in OAI_Record.Identifiers)
                {
                    if (thisIdentifier.IndexOf("http://") == 0)
                    {
                        Bib_Info.Location.Other_URL = thisIdentifier;
                    }
                    else
                    {
                        Bib_Info.Add_Identifier(thisIdentifier);
                    }
                }
            }
            if (OAI_Record.hasLanguages)
            {
                foreach (string thisLanguage in OAI_Record.Languages)
                {
                    Bib_Info.Add_Language(thisLanguage);
                }
            }
            if (OAI_Record.hasPublishers)
            {
                foreach (string thisPublisher in OAI_Record.Publishers)
                {
                    Bib_Info.Add_Publisher(thisPublisher);
                }
            }
            if (OAI_Record.hasRelations)
            {
                foreach (string thisRelation in OAI_Record.Relations)
                {
                    Related_Item_Info newRelatedItem = new Related_Item_Info();
                    newRelatedItem.Main_Title.Title = thisRelation;
                    Bib_Info.Add_Related_Item(newRelatedItem);
                }
            }
            if (OAI_Record.hasRights)
            {
                foreach (string thisRights in OAI_Record.Rights)
                {
                    Bib_Info.Access_Condition.Text = thisRights;
                }
            }
            //if (OAI_Record.hasSources)
            //{
            //    foreach (string thisSource in OAI_Record.Sources)
            //    {
            //        this.Bib_Info.Source.Statement = r.Value.Trim() = thisSource;
            //    }
            //}
            if (OAI_Record.hasSubjects)
            {
                foreach (string thisSubject in OAI_Record.Subjects)
                {
                    if (thisSubject.IndexOf(";") > 0)
                    {
                        string[] splitter = thisSubject.Split(";".ToCharArray());
                        foreach (string thisSplit in splitter)
                        {
                            Bib_Info.Add_Subject(thisSplit.Trim(), String.Empty);
                        }
                    }
                    else
                    {
                        Bib_Info.Add_Subject(thisSubject, String.Empty);
                    }
                }
            }
            if (OAI_Record.hasTitles)
            {
                foreach (string thistitle in OAI_Record.Titles)
                {
                    if (Bib_Info.Main_Title.ToString().Length > 0)
                    {
                        Bib_Info.Add_Other_Title(thistitle, Title_Type_Enum.Alternative);
                    }
                    else
                    {
                        Bib_Info.Main_Title.Clear();
                        Bib_Info.Main_Title.Title = thistitle;
                    }
                }
            }
            if (OAI_Record.hasTypes)
            {
                foreach (string thisType in OAI_Record.Types)
                {
                    Bib_Info.SobekCM_Type_String = thisType;
                }
            }

            // If there is a metadata configuration which calls for a metadata
            // extension module to always be used, add it now
            if (Metadata_Configuration.Metadata_Modules_To_Include.Count > 0)
            {
                foreach (Additional_Metadata_Module_Config thisConfig in Metadata_Configuration.Metadata_Modules_To_Include)
                {
                    iMetadata_Module toInclude = thisConfig.Get_Module();
                    if (toInclude != null)
                    {
                        Add_Metadata_Module(thisConfig.Key, toInclude);
                    }
                }
            }
        }
        private static void read_subject_object(XmlReader r, Bibliographic_Info thisBibInfo)
        {
            string language = String.Empty;
            string authority = String.Empty;
            string id = String.Empty;

            if (r.MoveToAttribute("ID"))
                id = r.Value;
            if (r.MoveToAttribute("lang"))
                language = r.Value;
            if (r.MoveToAttribute("authority"))
                authority = r.Value;

            // Move to the next element
            while (r.Read())
            {
                if (r.NodeType == XmlNodeType.Element)
                    break;
            }

            // Determine the subject type
            Subject_Info_Type type = Subject_Info_Type.UNKNOWN;

            // What is the name of this node?
            switch (r.Name)
            {
                case "mods:topic":
                case "mods:geographic":
                case "mods:genre":
                case "mods:temporal":
                case "mods:occupation":
                case "topic":
                case "geographic":
                case "genre":
                case "temporal":
                case "occupation":
                    type = Subject_Info_Type.Standard;
                    break;

                case "mods:hierarchicalGeographic":
                case "hierarchicalGeographic":
                    type = Subject_Info_Type.Hierarchical_Spatial;
                    break;

                case "mods:cartographics":
                case "cartographics":
                    type = Subject_Info_Type.Cartographics;
                    break;

                case "mods:name":
                case "name":
                    type = Subject_Info_Type.Name;
                    break;

                case "mods:titleInfo":
                case "titleInfo":
                    type = Subject_Info_Type.TitleInfo;
                    break;
            }

            // If no type was determined, return null
            if (type == Subject_Info_Type.UNKNOWN)
                return;

            // Was this the standard subject object?
            if (type == Subject_Info_Type.Standard)
            {
                Subject_Info_Standard standardSubject = new Subject_Info_Standard();
                standardSubject.Language = language;
                standardSubject.Authority = authority;
                standardSubject.ID = id;

                do
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject")))
                    {
                        if ((standardSubject.Topics_Count > 0) || (standardSubject.Geographics_Count > 0) || (standardSubject.Genres_Count > 0) ||
                            (standardSubject.Temporals_Count > 0) || (standardSubject.Occupations_Count > 0))
                        {
                            thisBibInfo.Add_Subject(standardSubject);
                        }
                        return;
                    }

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "mods:topic":
                            case "topic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    standardSubject.Add_Topic(r.Value);
                                break;

                            case "mods:geographic":
                            case "geographic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    standardSubject.Add_Geographic(r.Value);
                                break;

                            case "mods:genre":
                            case "genre":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    standardSubject.Add_Genre(r.Value);
                                break;

                            case "mods:temporal":
                            case "temporal":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    standardSubject.Add_Temporal(r.Value);
                                break;

                            case "mods:occupation":
                            case "occupation":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    standardSubject.Add_Occupation(r.Value);
                                break;
                        }
                    }
                } while (r.Read());
            }

            // Was this the hierarchical geography subject?
            if (type == Subject_Info_Type.Hierarchical_Spatial)
            {
                Subject_Info_HierarchicalGeographic geoSubject = new Subject_Info_HierarchicalGeographic();
                geoSubject.Language = language;
                geoSubject.Authority = authority;
                geoSubject.ID = id;

                while (r.Read())
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject")))
                    {
                        thisBibInfo.Add_Subject(geoSubject);
                        return;
                    }

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "mods:continent":
                            case "continent":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Continent = r.Value;
                                break;

                            case "mods:country":
                            case "country":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Country = r.Value;
                                break;

                            case "mods:province":
                            case "province":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Province = r.Value;
                                break;

                            case "mods:region":
                            case "region":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Region = r.Value;
                                break;

                            case "mods:state":
                            case "state":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.State = r.Value;
                                break;

                            case "mods:territory":
                            case "territory":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Territory = r.Value;
                                break;

                            case "mods:county":
                            case "county":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.County = r.Value;
                                break;

                            case "mods:city":
                            case "city":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.City = r.Value;
                                break;

                            case "mods:citySection":
                            case "citySection":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.CitySection = r.Value;
                                break;

                            case "mods:island":
                            case "island":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Island = r.Value;
                                break;

                            case "mods:area":
                            case "area":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    geoSubject.Area = r.Value;
                                break;
                        }
                    }
                }
            }

            // Was this the cartographics subject?
            if (type == Subject_Info_Type.Cartographics)
            {
                Subject_Info_Cartographics mapSubject = new Subject_Info_Cartographics();
                mapSubject.Language = language;
                mapSubject.Authority = authority;
                mapSubject.ID = id;

                while (r.Read())
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject")))
                    {
                        if ((mapSubject.Projection.Length > 0) || (mapSubject.Coordinates.Length > 0) || (mapSubject.Scale.Length > 0))
                        {
                            thisBibInfo.Add_Subject(mapSubject);
                        }
                        return;
                    }

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "mods:coordinates":
                            case "coordinates":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    mapSubject.Coordinates = r.Value;
                                break;

                            case "mods:scale":
                            case "scale":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    mapSubject.Scale = r.Value;
                                break;

                            case "mods:projection":
                            case "projection":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    mapSubject.Projection = r.Value;
                                break;
                        }
                    }
                }
            }

            // Was this the name subject?
            if (type == Subject_Info_Type.Name)
            {
                Subject_Info_Name nameSubject = new Subject_Info_Name();
                nameSubject.Language = language;
                nameSubject.Authority = authority;
                nameSubject.ID = id;

                do
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject")))
                    {
                        thisBibInfo.Add_Subject(nameSubject);
                        return;
                    }

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "mods:name":
                            case "name":
                                Name_Info nameInfo = read_name_object(r);
                                nameSubject.Set_Internal_Name(nameInfo);
                                break;

                            case "mods:topic":
                            case "topic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    nameSubject.Add_Topic(r.Value);
                                break;

                            case "mods:geographic":
                            case "geographic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    nameSubject.Add_Geographic(r.Value);
                                break;

                            case "mods:genre":
                            case "genre":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    nameSubject.Add_Genre(r.Value);
                                break;

                            case "mods:temporal":
                            case "temporal":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    nameSubject.Add_Temporal(r.Value);
                                break;
                        }
                    }
                } while (r.Read());
            }

            // Was this the title subject?
            if (type == Subject_Info_Type.TitleInfo)
            {
                Subject_Info_TitleInfo titleSubject = new Subject_Info_TitleInfo();
                titleSubject.Language = language;
                titleSubject.Authority = authority;
                titleSubject.ID = id;

                do
                {
                    if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject")))
                    {
                        thisBibInfo.Add_Subject(titleSubject);
                        return;
                    }

                    if (r.NodeType == XmlNodeType.Element)
                    {
                        switch (r.Name)
                        {
                            case "mods:titleInfo":
                            case "titleInfo":
                                Title_Info titleInfo = read_title_object(r);
                                titleSubject.Set_Internal_Title(titleInfo);
                                break;

                            case "mods:topic":
                            case "topic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    titleSubject.Add_Topic(r.Value);
                                break;

                            case "mods:geographic":
                            case "geographic":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    titleSubject.Add_Geographic(r.Value);
                                break;

                            case "mods:genre":
                            case "genre":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    titleSubject.Add_Genre(r.Value);
                                break;

                            case "mods:temporal":
                            case "temporal":
                                r.Read();
                                if (r.NodeType == XmlNodeType.Text)
                                    titleSubject.Add_Temporal(r.Value);
                                break;
                        }
                    }
                } while (r.Read());
            }
        }
        /// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary>
        /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param>
        public override void Save_To_Bib(SobekCM_Item Bib)
        {
            string[] getKeys = HttpContext.Current.Request.Form.AllKeys;
            foreach (string thisKey in getKeys)
            {
                if (thisKey.IndexOf("formsubjecttype_") == 0)
                {
                    string diff = thisKey.Replace("formsubjecttype_","");
                    string topic1 = HttpContext.Current.Request.Form["formsubjecttopic1_" + diff].Trim();
                    string topic2 = HttpContext.Current.Request.Form["formsubjecttopic2_" + diff].Trim();
                    string topic3 = HttpContext.Current.Request.Form["formsubjecttopic3_" + diff].Trim();
                    string topic4 = HttpContext.Current.Request.Form["formsubjecttopic4_" + diff].Trim();
                    string temporal1 = HttpContext.Current.Request.Form["formsubjecttemporal1_" + diff].Trim();
                    string temporal2 = HttpContext.Current.Request.Form["formsubjecttemporal2_" + diff].Trim();
                    string geographic1 = HttpContext.Current.Request.Form["formsubjectgeo1_" + diff].Trim();
                    string geographic2 = HttpContext.Current.Request.Form["formsubjectgeo2_" + diff].Trim();
                    string genre1 = HttpContext.Current.Request.Form["formsubjectgenre1_" + diff].Trim();
                    string genre2 = HttpContext.Current.Request.Form["formsubjectgenre2_" + diff].Trim();
                    string occcupation = HttpContext.Current.Request.Form["formsubjectoccup1_" + diff].Trim();
                    string authority = HttpContext.Current.Request.Form["formsubjectauthority_" + diff].Trim();
                    string language = HttpContext.Current.Request.Form["formsubjectlanguage_" + diff].Trim();
                    string marc = HttpContext.Current.Request.Form["formsubjectmap_" + diff].Trim();

                    if ((topic1.Length > 0) || (topic2.Length > 0) || (topic3.Length > 0) || (topic4.Length > 0) ||
                        (temporal1.Length > 0) || (temporal2.Length > 0) || (geographic1.Length > 0) || (geographic2.Length > 0) ||
                        (genre1.Length > 0) || (genre2.Length > 0) || (occcupation.Length > 0))
                    {
                        Subject_Info_Standard newSubject = new Subject_Info_Standard();
                        if (topic1.Length > 0) newSubject.Add_Topic(topic1);
                        if (topic2.Length > 0) newSubject.Add_Topic(topic2);
                        if (topic3.Length > 0) newSubject.Add_Topic(topic3);
                        if (topic4.Length > 0) newSubject.Add_Topic(topic4);
                        if (temporal1.Length > 0) newSubject.Add_Temporal(temporal1);
                        if (temporal2.Length > 0) newSubject.Add_Temporal(temporal2);
                        if (geographic1.Length > 0) newSubject.Add_Geographic(geographic1);
                        if (geographic2.Length > 0) newSubject.Add_Geographic(geographic2);
                        if (genre1.Length > 0) newSubject.Add_Genre(genre1);
                        if (genre2.Length > 0) newSubject.Add_Genre(genre2);
                        if (occcupation.Length > 0) newSubject.Add_Occupation(occcupation);
                        newSubject.Authority = authority;
                        newSubject.Language = language;
                        if ((marc.Length > 0) && (marc != "none"))
                        {
                            newSubject.ID = "SUBJ" + marc + "_" + diff;
                        }
                        Bib.Bib_Info.Add_Subject(newSubject);

                    }
                }
            }
        }
        /// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="R"> XmlTextReader from which to read the dublin core data </param>
        /// <param name="BibInfo"> Digital resource object to save the data to </param>
        /// <param name="Return_Package"> The return package, if this is reading a top-level section of dublin core </param>
        public static void Read_Simple_Dublin_Core_Info(XmlReader R, Bibliographic_Info BibInfo, SobekCM_Item Return_Package )
        {
            while (R.Read())
            {
                if ((R.NodeType == XmlNodeType.EndElement) && ((R.Name == "METS:mdWrap") || (R.Name == "mdWrap")))
                    return;

                if (R.NodeType == XmlNodeType.Element)
                {
                    switch (R.Name)
                    {
                        case "dc:contributor":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Named_Entity(R.Value.Trim(), "Contributor");
                            }
                            break;

                        case "dc:coverage":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                Subject_Info_Standard thisSubject = new Subject_Info_Standard();
                                thisSubject.Add_Geographic(R.Value.Trim());
                                BibInfo.Add_Subject(thisSubject);
                            }
                            break;

                        case "dc:creator":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (BibInfo.Main_Entity_Name.hasData)
                                {
                                    BibInfo.Add_Named_Entity(R.Value.Trim());
                                }
                                else
                                {
                                    BibInfo.Main_Entity_Name.Full_Name = R.Value.Trim();
                                }
                            }
                            break;

                        case "dc:date":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Origin_Info.Date_Issued = R.Value.Trim();
                            }
                            break;

                        case "dc:description":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Note(R.Value.Trim());
                            }
                            break;

                        case "dc:format":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Original_Description.Extent = R.Value.Trim();
                            }
                            break;

                        case "dc:identifier":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Identifier(R.Value.Trim());
                            }
                            break;

                        case "dc:language":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Language(R.Value.Trim());
                            }
                            break;

                        case "dc:publisher":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Publisher(R.Value.Trim());
                            }
                            break;

                        case "dc:relation":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                Related_Item_Info newRelatedItem = new Related_Item_Info();
                                newRelatedItem.Main_Title.Title = R.Value.Trim();
                                BibInfo.Add_Related_Item(newRelatedItem);
                            }
                            break;

                        case "dc:rights":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Access_Condition.Text = R.Value.Trim();
                            }
                            break;

                        case "dc:source":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Add_Note(R.Value, Note_Type_Enum.source);
                            }
                            break;

                        case "dc:subject":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (R.Value.IndexOf(";") > 0)
                                {
                                    string[] splitter = R.Value.Split(";".ToCharArray());
                                    foreach (string thisSplit in splitter)
                                    {
                                        BibInfo.Add_Subject(thisSplit.Trim(), String.Empty);
                                    }
                                }
                                else
                                {
                                    BibInfo.Add_Subject(R.Value.Trim(), String.Empty);
                                }
                            }
                            break;

                        case "dc:title":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                if (BibInfo.Main_Title.Title.Length == 0)
                                {
                                    BibInfo.Main_Title.Title = R.Value.Trim();
                                }
                                else
                                {
                                    BibInfo.Add_Other_Title(R.Value.Trim(), Title_Type_Enum.alternative);
                                }
                            }
                            break;

                        case "dc:type":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0))
                            {
                                BibInfo.Type.Add_Uncontrolled_Type(R.Value.Trim());
                            }
                            break;

                        case "thesis.degree.name":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && ( Return_Package != null ))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Degree = R.Value.Trim();
                            }
                            break;

                        case "thesis.degree.level":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                string temp = R.Value.Trim().ToLower();
                                if ((temp == "doctorate") || (temp == "doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Doctorate;
                                if ((temp == "masters") || (temp == "master's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Masters;
                                if ((temp == "bachelors") || (temp == "bachelor's"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                                if ((temp == "post-doctorate") || (temp == "post-doctoral"))
                                    thesisInfo.Degree_Level = Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Bachelors;
                            }
                            break;

                        case "thesis.degree.discipline":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Add_Degree_Discipline(R.Value.Trim());
                            }
                            break;

                        case "thesis.degree.grantor":
                            R.Read();
                            if ((R.NodeType == XmlNodeType.Text) && (R.Value.Trim().Length > 0) && (Return_Package != null))
                            {
                                // Ensure the thesis object exists and is added
                                Thesis_Dissertation_Info thesisInfo = Return_Package.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info;
                                if (thesisInfo == null)
                                {
                                    thesisInfo = new Thesis_Dissertation_Info();
                                    Return_Package.Add_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY, thesisInfo);
                                }

                                thesisInfo.Degree_Grantor = R.Value.Trim();
                            }
                            break;
                    }
                }
            }
        }
        /// <summary> Reads the Dublin Core-compliant section of XML and stores the data in the provided digital resource </summary>
        /// <param name="r"> XmlTextReader from which to read the dublin core data </param>
        /// <param name="thisBibInfo"> Digital resource object to save the data to </param>
        public static void Read_Simple_Dublin_Core_Info(XmlReader r, Bibliographic_Info thisBibInfo)
        {
            while (r.Read())
            {
                if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "METS:mdWrap") || (r.Name == "mdWrap")))
                    return;

                if (r.NodeType == XmlNodeType.Element)
                {
                    switch (r.Name)
                    {
                        case "dc:contributor":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Named_Entity(r.Value.Trim(), "Contributor");
                            }
                            break;

                        case "dc:coverage":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                Subject_Info_Standard thisSubject = new Subject_Info_Standard();
                                thisSubject.Add_Geographic(r.Value.Trim());
                                thisBibInfo.Add_Subject(thisSubject);
                            }
                            break;

                        case "dc:creator":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                if (thisBibInfo.Main_Entity_Name.hasData)
                                {
                                    thisBibInfo.Add_Named_Entity(r.Value.Trim());
                                }
                                else
                                {
                                    thisBibInfo.Main_Entity_Name.Full_Name = r.Value.Trim();
                                }
                            }
                            break;

                        case "dc:date":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Origin_Info.Date_Issued = r.Value.Trim();
                            }
                            break;

                        case "dc:description":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Note(r.Value.Trim());
                            }
                            break;

                        case "dc:format":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Original_Description.Extent = r.Value.Trim();
                            }
                            break;

                        case "dc:identifier":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Identifier(r.Value.Trim());
                            }
                            break;

                        case "dc:language":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Language(r.Value.Trim());
                            }
                            break;

                        case "dc:publisher":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Publisher(r.Value.Trim());
                            }
                            break;

                        case "dc:relation":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                Related_Item_Info newRelatedItem = new Related_Item_Info();
                                newRelatedItem.Main_Title.Title = r.Value.Trim();
                                thisBibInfo.Add_Related_Item(newRelatedItem);
                            }
                            break;

                        case "dc:rights":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Access_Condition.Text = r.Value.Trim();
                            }
                            break;

                        case "dc:source":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Add_Note(r.Value, Note_Type_Enum.source);
                            }
                            break;

                        case "dc:subject":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                if (r.Value.IndexOf(";") > 0)
                                {
                                    string[] splitter = r.Value.Split(";".ToCharArray());
                                    foreach (string thisSplit in splitter)
                                    {
                                        thisBibInfo.Add_Subject(thisSplit.Trim(), String.Empty);
                                    }
                                }
                                else
                                {
                                    thisBibInfo.Add_Subject(r.Value.Trim(), String.Empty);
                                }
                            }
                            break;

                        case "dc:title":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                if (thisBibInfo.Main_Title.Title.Length == 0)
                                {
                                    thisBibInfo.Main_Title.Title = r.Value.Trim();
                                }
                                else
                                {
                                    thisBibInfo.Add_Other_Title(r.Value.Trim(), Title_Type_Enum.alternative);
                                }
                            }
                            break;

                        case "dc:type":
                            r.Read();
                            if ((r.NodeType == XmlNodeType.Text) && (r.Value.Trim().Length > 0))
                            {
                                thisBibInfo.Type.Add_Uncontrolled_Type(r.Value.Trim());
                            }
                            break;
                    }
                }
            }
        }
        /// <summary> Adds a new spatial subject (non-hierarchical) to this item </summary>
        /// <param name="SpatialTerm"> Term for the spatial subject </param>
        /// <returns> Subject_Info_Standard object that was created and added </returns>
        public Subject_Info_Standard Add_Spatial_Subject(string SpatialTerm)
        {
            Subject_Info_Standard returnValue = new Subject_Info_Standard();
            returnValue.Add_Geographic(SpatialTerm);
            Add_Subject(returnValue);

            return returnValue;
        }