/// <summary>
        /// Generate HTML SELECT and OPTION tags for events selection
        /// (count limited by the config)
        /// </summary>
        /// <param name="lang"></param>
        /// <param name="controlId"></param>
        /// <param name="selectedId"></param>
        /// <param name="eventRequired"></param>
        /// <returns></returns>
        protected string getEventOption(CmsLanguage lang, string controlId, int selectedId, bool eventRequired)
        {
            EventCalendarDb eventDb       = new EventCalendarDb();
            int             dropdownCount = CmsConfig.getConfigValue("FileLibrary.NumEventsInList", 10);
            List <EventCalendarDb.EventCalendarDetailsData> eventList = eventDb.fetchAllDetailsData(lang, selectedId, dropdownCount);
            List <CmsPage>      pageList            = new List <CmsPage>(eventList.Count);
            NameValueCollection eventPageCollection = new NameValueCollection(eventList.Count);

            for (int x = 0; x < eventList.Count; x++)
            {
                EventCalendarDb.EventCalendarDetailsData e = eventList[x];
                CmsPage p = CmsContext.getPageById(e.PageId);
                pageList.Add(p);
                eventPageCollection.Add(e.PageId.ToString(), p.getTitle(lang));
            }

            StringBuilder html      = new StringBuilder();
            string        htmlName  = controlId + "eventPageId";
            string        selectTag = "<select name=\"{0}\" id=\"{1}\" onchange=\"$('.{2}table').css('display','none'); $('#{3}table_' + this.value).fadeIn();\">" + EOL;

            html.Append(String.Format(selectTag, new string[] { htmlName, htmlName, controlId, controlId }));

            string optionTag      = "<option value=\"{0}\" {1}>{2}</option>" + EOL;
            string optionSelected = (selectedId == -1) ? "selected=\"selected\"" : "";

            if (eventRequired == false) // if event not required, provide an option to select n/a
            {
                html.Append(String.Format(optionTag, new string[] { "-1", optionSelected, "(n/a)" }));
            }

            for (int x = 0; x < eventList.Count; x++)
            {
                EventCalendarDb.EventCalendarDetailsData e = eventList[x];
                optionSelected = (selectedId == e.PageId) ? "selected=\"selected\"" : "";
                html.Append(String.Format(optionTag, new string[] { e.PageId.ToString(), optionSelected, pageList[x].getTitle(lang) }));
            }

            html.Append("</select>" + EOL);

            List <EventCalendarDb.EventCalendarCategoryData> eventCategoryList = eventDb.fetchCategoryList(lang);

            for (int x = 0; x < eventList.Count; x++)
            {
                html.Append(getEventHiddenLayer(lang, eventCategoryList, pageList[x], eventList[x], controlId, selectedId));
            }

            return(html.ToString());
        }
        /// <summary>
        /// Create table body to show the Event Calendar Category records.
        /// </summary>
        /// <param name="langArray"></param>
        /// <param name="colorArray"></param>
        /// <param name="controlId"></param>
        /// <returns></returns>
        protected string generateContent(CmsLanguage[] langArray, string[] colorArray, string controlId)
        {
            EventCalendarDb db = new EventCalendarDb();
            List <EventCalendarDb.EventCalendarCategoryData> list = db.fetchCategoryList();

            int           step = langArray.Length;
            StringBuilder html = new StringBuilder();

            for (int x = 0; x < list.Count; x = x + step)
            {
                html.Append("<tr>" + EOL);
                EventCalendarDb.EventCalendarCategoryData data1 = list[x];
                html.Append("<td>" + EOL);
                html.Append("<input class=\"" + controlId + "chgButton\" type=\"button\" value=\"Edit\" title=\"" + data1.CategoryId + "\" />" + EOL);
                html.Append("<input class=\"" + controlId + "chgSaveButton\" type=\"button\" value=\"Save\" title=\"" + data1.CategoryId + "\" />" + EOL);
                html.Append("<input class=\"" + controlId + "chgCancelButton\" type=\"button\" value=\"Cancel\" title=\"" + data1.CategoryId + "\" />" + EOL);
                html.Append("</td>" + EOL);

                html.Append("<td>" + EOL);
                html.Append("<select title=\"" + data1.ColorHex + "\" class=\"" + controlId + "chg\" disabled=\"disabled\" id=\"" + controlId + "colorHex_" + data1.CategoryId + "\" name=\"" + controlId + "colorHex\" onchange=\"this.style.backgroundColor=this.value;\">" + EOL);
                html.Append(generateColorOption(colorArray, data1.ColorHex));
                html.Append("</select>" + EOL);
                html.Append("</td>" + EOL);

                for (int y = 0; y < step; y++)
                {
                    string l = langArray[y].shortCode;
                    EventCalendarDb.EventCalendarCategoryData data2 = list[y + x];

                    string title = data2.Title;
                    html.Append("<td><div id=\"" + controlId + "title_" + l + "_" + data1.CategoryId + "\">" + title + "</div></td>" + EOL);

                    string description = StringUtils.nl2br(data2.Description);
                    html.Append("<td><div id=\"" + controlId + "description_" + l + "_" + data1.CategoryId + "\">" + description + "</div></td>" + EOL);
                }

                html.Append("</tr>" + EOL);
            }
            return(html.ToString());
        }