/// <summary> Write any additional values within the HTML Head of the
        /// final served page </summary>
        /// <param name="Output"> Output stream currently within the HTML head tags </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        /// <remarks> By default this does nothing, but can be overwritten by all the individual html subwriters </remarks>
        public override void Write_Within_HTML_Head(TextWriter Output, Custom_Tracer Tracer)
        {
            // Based on display mode, add ROBOT instructions
            switch (RequestSpecificValues.Current_Mode.Mode)
            {
                case Display_Mode_Enum.Search:
                    Output.WriteLine("  <meta name=\"robots\" content=\"index, follow\" />");
                    break;

                case Display_Mode_Enum.Aggregation:
                    if (( RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Home ) || ( RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Browse_Info ))
                        Output.WriteLine("  <meta name=\"robots\" content=\"index, follow\" />");
                    else
                        Output.WriteLine("  <meta name=\"robots\" content=\"noindex, nofollow\" />");
                    break;

                default:
                    Output.WriteLine("  <meta name=\"robots\" content=\"noindex, nofollow\" />");
                    break;
            }

            // If this was to display the static page, include that info in the header as well
            if (RequestSpecificValues.Static_Web_Content != null)
            {
                if ( !String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Description))
                {
                    Output.WriteLine("  <meta name=\"description\" content=\"" + RequestSpecificValues.Static_Web_Content.Description.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Keywords))
                {
                    Output.WriteLine("  <meta name=\"keywords\" content=\"" + RequestSpecificValues.Static_Web_Content.Keywords.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Author))
                {
                    Output.WriteLine("  <meta name=\"author\" content=\"" + RequestSpecificValues.Static_Web_Content.Author.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Date))
                {
                    Output.WriteLine("  <meta name=\"date\" content=\"" + RequestSpecificValues.Static_Web_Content.Date.Replace("\"", "'") + "\" />");
                }

                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Extra_Head_Info))
                {
                    Output.WriteLine("  " + RequestSpecificValues.Static_Web_Content.Extra_Head_Info.Trim());
                }
            }

            // In the home mode, add the open search XML file to allow users to add SobekCM as a default search in browsers
            if (( RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation ) && (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Home))
            {
                Output.WriteLine("  <link rel=\"search\" href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "default/opensearch.xml\" type=\"application/opensearchdescription+xml\"  title=\"Add " + RequestSpecificValues.Current_Mode.Instance_Abbreviation + " Search\" />");

                if (RequestSpecificValues.Current_Mode.Home_Type == Home_Type_Enum.Tree)
                {
                    Output.WriteLine("  <link rel=\"stylesheet\" href=\"" + Static_Resources.Jstree_Css + "\" />");
                }
            }

            // If this is to edit the home page, add the html editor
            if ((RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation) && (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Home_Edit))
            {
                // Determine the aggregation upload directory
                string aggregation_upload_dir = UI_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location + "aggregations\\" + RequestSpecificValues.Hierarchy_Object.Code + "\\uploads";
                string aggregation_upload_url = UI_ApplicationCache_Gateway.Settings.Servers.System_Base_URL + "design/aggregations/" + RequestSpecificValues.Hierarchy_Object.Code + "/uploads/";

                // Create the CKEditor object
                CKEditor.CKEditor editor = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "sbkAghsw_HomeTextEdit",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = aggregation_upload_dir,
                    UploadURL = aggregation_upload_url
                };

                // If there are existing files, add a reference to the URL for the image browser
                if ((Directory.Exists(aggregation_upload_dir)) && (Directory.GetFiles(aggregation_upload_dir).Length > 0))
                {
                    // Is there an endpoint defined for looking at uploaded files?
                    string upload_files_json_url = SobekEngineClient.Aggregations.Aggregation_Uploaded_Files_URL;
                    if (!String.IsNullOrEmpty(upload_files_json_url))
                    {
                        editor.ImageBrowser_ListUrl = String.Format(upload_files_json_url, RequestSpecificValues.Hierarchy_Object.Code);
                    }
                }

                // Add the HTML from the CKEditor object
                editor.Add_To_Stream(Output);
            }

            // If this is to edit the child page page, add the html editor
            if ((RequestSpecificValues.Current_Mode.Mode == Display_Mode_Enum.Aggregation) && (RequestSpecificValues.Current_Mode.Aggregation_Type == Aggregation_Type_Enum.Child_Page_Edit))
            {
                // Determine the aggregation upload directory
                string aggregation_upload_dir = UI_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location + "aggregations\\" + RequestSpecificValues.Hierarchy_Object.Code + "\\uploads";
                string aggregation_upload_url = UI_ApplicationCache_Gateway.Settings.Servers.System_Base_URL + "design/aggregations/" + RequestSpecificValues.Hierarchy_Object.Code + "/uploads/";

                // Create the CKEditor object
                CKEditor.CKEditor editor = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "sbkSbia_ChildTextEdit",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = aggregation_upload_dir,
                    UploadURL = aggregation_upload_url
                };

                // Should this start as SOURCE?
                // Start in source mode, if this has a script or input reference
                if ((RequestSpecificValues.Static_Web_Content != null) && (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Content)))
                {
                    if ((RequestSpecificValues.Static_Web_Content.Content.IndexOf("<script", StringComparison.OrdinalIgnoreCase) >= 0) || (RequestSpecificValues.Static_Web_Content.Content.IndexOf("<input", StringComparison.OrdinalIgnoreCase) >= 0))
                        editor.Start_In_Source_Mode = true;
                }

                // If there are existing files, add a reference to the URL for the image browser
                if ((Directory.Exists(aggregation_upload_dir)) && (Directory.GetFiles(aggregation_upload_dir).Length > 0))
                {
                    // Is there an endpoint defined for looking at uploaded files?
                    string upload_files_json_url = SobekEngineClient.Aggregations.Aggregation_Uploaded_Files_URL;
                    if (!String.IsNullOrEmpty(upload_files_json_url))
                    {
                        editor.ImageBrowser_ListUrl = String.Format(upload_files_json_url, RequestSpecificValues.Hierarchy_Object.Code);
                    }
                }

                // Add the HTML from the CKEditor object
                editor.Add_To_Stream(Output);
            }

            // If this is the thumbnails results, add the QTIP script and css
            if ((RequestSpecificValues.Results_Statistics != null ) &&
                ( RequestSpecificValues.Results_Statistics.Total_Items > 0) &&
                ( RequestSpecificValues.Current_Mode.Result_Display_Type == Result_Display_Type_Enum.Thumbnails ))
            {
                Output.WriteLine("  <script type=\"text/javascript\" src=\"" + Static_Resources.Jquery_Qtip_Js + "\"></script>");
                Output.WriteLine("  <link rel=\"stylesheet\" type=\"text/css\" href=\"" + Static_Resources.Jquery_Qtip_Css + "\" /> ");
            }

            // If this is an internal (semi-admin) view, add the admin CSS
            if ((collectionViewer != null) && (collectionViewer.Is_Internal_View))
            {
                Output.WriteLine("  <link rel=\"stylesheet\" type=\"text/css\" href=\"" + Static_Resources.Sobekcm_Admin_Css + "\" /> ");
            }

            if ((collectionViewer != null) && (collectionViewer.AggregationViewer_Behaviors.Contains(HtmlSubwriter_Behaviors_Enum.Use_Jquery_DataTables)))
            {
                Output.WriteLine("  <link href=\"" + Static_Resources.Sobekcm_Datatables_Css + "\" rel=\"stylesheet\" type=\"text/css\" />");
                Output.WriteLine("  <script type=\"text/javascript\" src=\"" + Static_Resources.Jquery_Datatables_Js + "\" ></script>");
            }
        }
        private void Add_Page_3(TextWriter Output)
        {
            Web_Language_Enum current_language = Web_Language_Enum.DEFAULT;

            if (!String.IsNullOrEmpty(HttpContext.Current.Request.QueryString["lang"]))
            {
                string current_language_code = HttpContext.Current.Request.QueryString["lang"];
                current_language = current_language_code.ToLower() == "def" ? Web_Language_Enum.DEFAULT : Web_Language_Enum_Converter.Code_To_Enum(current_language_code);
            }

            string HEADER_HELP = "Basic header is placed at the top of all non-item web pages throughout the system.";
            string FOOTER_HELP = "Basic footer is placed at the bottom of all non-item web pages throughout the system.";
            string HEADER_ITEM_HELP = "Header is placed at the top of all individual items (i.e., digital resources) views throughout the system.  Generally, this header is either the same as the header above, or a reduced height header to allow the digital resources to take over more of the screen.";
            string FOOTER_ITEM_HELP = "Footer is placed at the bottom of all individual items (i.e., digital resources) views throughout the system.  Generally, this footer is either the same as the footer above, or a reduced height footer to allow the digital resources to take over more of the screen.";
            string EXISTING_LANGUAGE_HELP = "Pick an existing language from this selection box to view and edit the headers and footers used for that language.";
            string NEW_LANGUAGE_HELP = "To add support for translations or versions of the headers and footers for a new language, select the language from the selection box and press ADD.\\n\\nSelect a current language to copy from, otherwise all the headers and footers will start blank.";

            Output.WriteLine("<table class=\"sbkAdm_PopupTable\">");

            Output.WriteLine("  <tr class=\"sbkSaav_TitleRow\"><td colspan=\"3\">Language-Specific Headers and Footers</td></tr>");
            Output.WriteLine("  <tr class=\"sbkSaav_TextRow\"><td colspan=\"3\"><p>The web skin defines the headers and footers that display at the top and bottom of every page and these can be customized for each different language you expect your users to request.</p><p>In addition, you can define a header/footer pair for most non-item pages and another pair to use when users are viewing a digital resource within your system.  This allows the item-specific headers and footers to have a smaller height, a lower profile, and work better with the full screen.</p>Your changes will not take affect until you actually click SAVE when you are done making all your changes.</p><p>NOTE: You may need to refresh your browser when you are all done for your changes to take affect.</p><p>For more information about the settings on this tab, <a href=\"" + UI_ApplicationCache_Gateway.Settings.Help_URL(RequestSpecificValues.Current_Mode.Base_URL) + "adminhelp/singleskin\" target=\"ADMIN_USER_HELP\" >click here to view the help page</a>.</p></td></tr>");

            //Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\"></tr>");

            // Find all the existing languages
            List<string> existing_languages = new List<string>();
            bool found_language = false;
            if ((webSkin.SourceFiles != null) && (webSkin.SourceFiles.Count > 0))
            {
                foreach (KeyValuePair<Web_Language_Enum, Complete_Web_Skin_Source_Files> languageSupport in webSkin.SourceFiles)
                {
                    if (languageSupport.Key == current_language)
                    {
                        found_language = true;
                    }

                    string thisLangTerm = Web_Language_Enum_Converter.Enum_To_Name(languageSupport.Key);
                    if (languageSupport.Key == Web_Language_Enum.DEFAULT)
                    {
                        thisLangTerm = "DEFAULT";
                    }
                    existing_languages.Add(thisLangTerm);
                }
            }

            if (!found_language)
                current_language = Web_Language_Enum.UNDEFINED;

            // Write the add new web skin information
            Output.WriteLine("  <tr class=\"sbkSaav_TitleRow\"><td colspan=\"3\">Add New Language</td></tr>");
            Output.WriteLine("  <tr class=\"sbkSaav_TextRow\"><td colspan=\"3\"><p>Use this option to add a new supported language to this web skin.  This allows you to customize the headers and footers for users that request this language, either explicitly or through their browser settings.</p></td></tr>");
            Output.WriteLine("  <tr class=\"sbkSaav_TallRow\">");
            Output.WriteLine("    <td style=\"width:50px\">&nbsp;</td>");
            Output.WriteLine("    <td class=\"sbkSaav_TableLabel2\" style=\"width:135px\">New Language:</td>");
            Output.WriteLine("    <td>");
            Output.WriteLine("      <table class=\"sbkSaav_InnerTable\">");
            Output.WriteLine("      <tr>");
            Output.WriteLine("        <td>");

            Output.Write("          <select class=\"sbkSaav_SelectSingle\" id=\"webskin_new_lang\" name=\"webskin_new_lang\">");

            // Add each language in the combo box
            foreach (string possible_language in Web_Language_Enum_Converter.Language_Name_Array)
            {
                if (!existing_languages.Contains(possible_language))
                    Output.Write("<option value=\"" + Web_Language_Enum_Converter.Name_To_Code(possible_language) + "\">" + HttpUtility.HtmlEncode(possible_language) + "</option>");
            }
            Output.WriteLine();
            Output.WriteLine("        </td>");
            if ((webSkin.SourceFiles != null) && (webSkin.SourceFiles.Count > 0))
            {
                Output.WriteLine("        <td style=\"padding-left:35px;\">Copy from existing: </td>");
                Output.WriteLine("        <td>");
                Output.Write("          <select id=\"webskin_new_lang_copy\" name=\"webskin_new_lang_copy\">");
                Output.Write("<option value=\"\" selected=\"selected\"></option>");

                foreach (KeyValuePair<Web_Language_Enum, Complete_Web_Skin_Source_Files> languageSupport in webSkin.SourceFiles)
                {
                    string thisLangCode = Web_Language_Enum_Converter.Enum_To_Code(languageSupport.Key);
                    string thisLangTerm = Web_Language_Enum_Converter.Enum_To_Name(languageSupport.Key);

                    if (languageSupport.Key == Web_Language_Enum.DEFAULT)
                    {
                        thisLangCode = "def";
                        thisLangTerm = "DEFAULT";
                    }

                    Output.WriteLine("          <option value=\"" + thisLangCode + "\">" + HttpUtility.HtmlEncode(thisLangTerm) + "</option>");
                }

                Output.WriteLine("</select>");
                Output.WriteLine("        </td>");
            }
            else
            {
                Output.WriteLine("        <td></td>");
                Output.WriteLine("        <td></td>");
            }

            Output.WriteLine("        <td style=\"padding-left:20px\"><button title=\"Add new language\" class=\"sbkAdm_RoundButton\" onclick=\"return add_skin_language();\">ADD</button></td>");
            Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + NEW_LANGUAGE_HELP + "');\"  title=\"" + NEW_LANGUAGE_HELP + "\" /></td></tr></table>");
            Output.WriteLine("     </td>");
            Output.WriteLine("  </tr>");
            Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\">&nbsp;</td><tr>");

            // Add the existing languages
            if ((webSkin.SourceFiles != null) && (webSkin.SourceFiles.Count > 0))
            {
                Output.WriteLine("  <tr class=\"sbkSaav_TitleRow\"><td colspan=\"3\">Existing Language Support</td></tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\">");
                Output.WriteLine("    <td style=\"width:50px\">&nbsp;</td>");
                Output.WriteLine("    <td class=\"sbkSaav_TableLabel\" style=\"width:135px\"><label for=\"webskin_existing_language\">Existing Languages:</label></td>");
                Output.WriteLine("    <td>");
                Output.WriteLine("      <table class=\"sbkSaav_InnerTable\"><tr><td>");

                Output.WriteLine("        <select class=\"sbkSav_small_input1 sbkAdmin_Focusable\" name=\"webskin_existing_language\" id=\"webskin_existing_language\" onchange=\"return new_skin_language(this);\">");

                foreach (KeyValuePair<Web_Language_Enum, Complete_Web_Skin_Source_Files> languageSupport in webSkin.SourceFiles)
                {
                    string thisLangCode = Web_Language_Enum_Converter.Enum_To_Code(languageSupport.Key);
                    string thisLangTerm = Web_Language_Enum_Converter.Enum_To_Name(languageSupport.Key);

                    if (languageSupport.Key == Web_Language_Enum.DEFAULT)
                    {
                        thisLangCode = "def";
                        thisLangTerm = "DEFAULT";
                    }

                    if (languageSupport.Key == current_language)
                    {
                        Output.WriteLine("          <option value=\"" + thisLangCode + "\" selected=\"selected\">" + HttpUtility.HtmlEncode(thisLangTerm) + "</option>");
                    }
                    else
                        Output.WriteLine("          <option value=\"" + thisLangCode + "\">" + HttpUtility.HtmlEncode(thisLangTerm) + "</option>");
                }

                Output.WriteLine("        </select></td>");
                if ((current_language != Web_Language_Enum.DEFAULT) && (webSkin.SourceFiles.Count > 1))
                {
                    Output.WriteLine("        <td style=\"padding-left:20px\"><button title=\"Remove support for this language from this web skin\" class=\"sbkAdm_RoundButton\" onclick=\"return delete_skin_language('" + Web_Language_Enum_Converter.Enum_To_Code(current_language) + "');\">REMOVE</button></td>");
                }
                Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + EXISTING_LANGUAGE_HELP + "');\"  title=\"" + EXISTING_LANGUAGE_HELP + "\" /></td></tr></table>");
                Output.WriteLine("     </td>");
                Output.WriteLine("  </tr>");
            }

            if (current_language != Web_Language_Enum.UNDEFINED)
            {

                Complete_Web_Skin_Source_Files sources = webSkin.SourceFiles[current_language];
                string header_source = get_file_source(sources.Header_Source_File);
                string footer_source = get_file_source(sources.Footer_Source_File);
                string header_item_source = get_file_source(sources.Header_Item_Source_File);
                string footer_item_source = get_file_source(sources.Footer_Item_Source_File);

                // Add the standard headers and footers
                Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\">&nbsp;</td><tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_TallRow\">");
                Output.WriteLine("    <td>&nbsp;</td>");
                Output.WriteLine("    <td class=\"sbkSaav_TableLabel2\"><label for=\"webskin_header_source\">Standard Header:</label></td>");
                Output.WriteLine("    <td>");
                Output.WriteLine("      <table class=\"sbkSaav_InnerTable2\"><tr style=\"vertical-align:top\"><td><textarea class=\"sbkSsav_html_textbox sbkAdmin_Focusable\" rows=\"30\" name=\"webskin_header_source\" id=\"webskin_header_source\">" + HttpUtility.HtmlEncode(header_source) + "</textarea></td>");
                Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + HEADER_HELP + "');\"  title=\"" + HEADER_HELP + "\" /></td></tr></table>");
                Output.WriteLine("     </td>");
                Output.WriteLine("  </tr>");

                Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\">&nbsp;</td><tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_TallRow\">");
                Output.WriteLine("    <td>&nbsp;</td>");
                Output.WriteLine("    <td class=\"sbkSaav_TableLabel2\"><label for=\"webskin_footer_source\">Standard Footer:</label></td>");
                Output.WriteLine("    <td>");
                Output.WriteLine("      <table class=\"sbkSaav_InnerTable2\"><tr style=\"vertical-align:top\"><td><textarea class=\"sbkSsav_html_textbox sbkAdmin_Focusable\" rows=\"30\" name=\"webskin_footer_source\" id=\"webskin_footer_source\">" + HttpUtility.HtmlEncode(footer_source) + "</textarea></td>");
                Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + FOOTER_HELP + "');\"  title=\"" + FOOTER_HELP + "\" /></td></tr></table>");
                Output.WriteLine("     </td>");
                Output.WriteLine("  </tr>");

                // Add the item headers and footers
                //Output.WriteLine("  <tr class=\"sbkSaav_TitleRow\"><td colspan=\"3\">Item-Specific Headers and Footers</td></tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\">&nbsp;</td><tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_TallRow\">");
                Output.WriteLine("    <td>&nbsp;</td>");
                Output.WriteLine("    <td class=\"sbkSaav_TableLabel\"><label for=\"webskin_header_item_source\">Item Header:</label></td>");
                Output.WriteLine("    <td>");
                Output.WriteLine("      <a title=\"Copy the HTML for the standard header down to this item header\" href=\"\" onclick=\"for(var i in CKEDITOR.instances) { CKEDITOR.instances[i].updateElement(); } return copy_skin_header_html();\">Copy from the standard header</a> <br />");
                Output.WriteLine("      <table class=\"sbkSaav_InnerTable2\"><tr style=\"vertical-align:top\"><td><textarea class=\"sbkSsav_html_textbox sbkAdmin_Focusable\" rows=\"30\" name=\"webskin_header_item_source\" id=\"webskin_header_item_source\">" + HttpUtility.HtmlEncode(header_item_source) + "</textarea></td>");
                Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + HEADER_ITEM_HELP + "');\"  title=\"" + HEADER_ITEM_HELP + "\" /></td></tr></table>");
                Output.WriteLine("     </td>");
                Output.WriteLine("  </tr>");

                Output.WriteLine("  <tr class=\"sbkSaav_SingleRow\"><td colspan=\"3\">&nbsp;</td><tr>");
                Output.WriteLine("  <tr class=\"sbkSaav_TallRow\">");
                Output.WriteLine("    <td>&nbsp;</td>");
                Output.WriteLine("    <td class=\"sbkSaav_TableLabel\"><label for=\"webskin_footer_item_source\">Item Footer:</label></td>");
                Output.WriteLine("    <td>");
                Output.WriteLine("      <a title=\"Copy the HTML for the standard footer down to this item footer\" href=\"\" onclick=\"for(var i in CKEDITOR.instances) { CKEDITOR.instances[i].updateElement(); } return copy_skin_footer_html();\">Copy from the standard footer</a> <br />");
                Output.WriteLine("      <table class=\"sbkSaav_InnerTable2\"><tr style=\"vertical-align:top\"><td><textarea class=\"sbkSsav_html_textbox sbkAdmin_Focusable\" rows=\"30\" name=\"webskin_footer_item_source\" id=\"webskin_footer_item_source\">" + HttpUtility.HtmlEncode(footer_item_source) + "</textarea></td>");
                Output.WriteLine("        <td><img class=\"sbkSaav_HelpButton\" src=\"" + Static_Resources.Help_Button_Jpg + "\" onclick=\"alert('" + FOOTER_ITEM_HELP + "');\"  title=\"" + FOOTER_ITEM_HELP + "\" /></td></tr></table>");
                Output.WriteLine("     </td>");
                Output.WriteLine("  </tr>");

                // Determine the aggregation upload directory
                string skin_upload_dir = skinDirectory + "\\uploads";
                string skin_upload_url = UI_ApplicationCache_Gateway.Settings.Servers.System_Base_URL + "design/skins/" + webSkin.Skin_Code + "/uploads/";

                // Create the CKEditor objects
                CKEditor.CKEditor editor1 = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "webskin_header_source",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = skin_upload_dir,
                    UploadURL = skin_upload_url,
                    Start_In_Source_Mode = true
                };
                CKEditor.CKEditor editor2 = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "webskin_footer_source",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = skin_upload_dir,
                    UploadURL = skin_upload_url,
                    Start_In_Source_Mode = true
                };
                CKEditor.CKEditor editor3 = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "webskin_header_item_source",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = skin_upload_dir,
                    UploadURL = skin_upload_url,
                    Start_In_Source_Mode = true
                };
                CKEditor.CKEditor editor4 = new CKEditor.CKEditor
                {
                    BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                    Language = RequestSpecificValues.Current_Mode.Language,
                    TextAreaID = "webskin_footer_item_source",
                    FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                    UploadPath = skin_upload_dir,
                    UploadURL = skin_upload_url,
                    Start_In_Source_Mode = true
                };

                // If there are existing files, add a reference to the URL for the image browser
                if ((Directory.Exists(skin_upload_dir)) && (Directory.GetFiles(skin_upload_dir).Length > 0))
                {
                    // Is there an endpoint defined for looking at uploaded files?
                    string upload_files_json_url = SobekEngineClient.WebSkins.WebSkin_Uploaded_Files_URL;
                    if (!String.IsNullOrEmpty(upload_files_json_url))
                    {
                        editor1.ImageBrowser_ListUrl = String.Format(upload_files_json_url, webSkin.Skin_Code);
                        editor2.ImageBrowser_ListUrl = String.Format(upload_files_json_url, webSkin.Skin_Code);
                        editor3.ImageBrowser_ListUrl = String.Format(upload_files_json_url, webSkin.Skin_Code);
                        editor4.ImageBrowser_ListUrl = String.Format(upload_files_json_url, webSkin.Skin_Code);

                    }
                }

                // Add the HTML from the CKEditor object
                editor1.Add_To_Stream(Output, true);
                editor2.Add_To_Stream(Output, false);
                editor3.Add_To_Stream(Output, false);
                editor4.Add_To_Stream(Output, false);

            }

            Output.WriteLine("</table>");
            Output.WriteLine("<br />");
        }
        /// <summary> Write any additional values within the HTML Head of the
        /// final served page </summary>
        /// <param name="Output"> Output stream currently within the HTML head tags </param>
        /// <param name="Tracer"> Trace object keeps a list of each method executed and important milestones in rendering </param>
        public override void Write_Within_HTML_Head(TextWriter Output, Custom_Tracer Tracer)
        {
            Output.WriteLine("  <meta name=\"robots\" content=\"index, nofollow\" />");

            // Add any other meta tags here as well
            if (RequestSpecificValues.Static_Web_Content != null)
            {
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Description))
                {
                    Output.WriteLine("  <meta name=\"description\" content=\"" + RequestSpecificValues.Static_Web_Content.Description.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Keywords))
                {
                    Output.WriteLine("  <meta name=\"keywords\" content=\"" + RequestSpecificValues.Static_Web_Content.Keywords.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Author))
                {
                    Output.WriteLine("  <meta name=\"author\" content=\"" + RequestSpecificValues.Static_Web_Content.Author.Replace("\"", "'") + "\" />");
                }
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Date))
                {
                    Output.WriteLine("  <meta name=\"date\" content=\"" + RequestSpecificValues.Static_Web_Content.Date.Replace("\"", "'") + "\" />");
                }
            }

            // If this is an admin and the page was not present, give some options
            if (adminMissingScreen)
            {
                Output.WriteLine("  <link href=\"" + Static_Resources.Sobekcm_Admin_Css + "\" rel=\"stylesheet\" type=\"text/css\" />");
            }
            else
            {
                // Write the style sheet to use
                Output.WriteLine("  <link href=\"" + Static_Resources.Sobekcm_Metadata_Css + "\" rel=\"stylesheet\" type=\"text/css\" />");
            }

            // Include the interface's style sheet if it has one
            if ((RequestSpecificValues.HTML_Skin != null) && (RequestSpecificValues.HTML_Skin.CSS_Style.Length > 0))
            {
                Output.WriteLine("  <link href=\"" + RequestSpecificValues.Current_Mode.Base_URL + RequestSpecificValues.HTML_Skin.CSS_Style + "\" rel=\"stylesheet\" type=\"text/css\" />");
            }

            // Add the special CSS here
            if (RequestSpecificValues.Static_Web_Content != null)
            {
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.CssFile))
                {
                    Output.WriteLine("  <link href=\"" + RequestSpecificValues.Current_Mode.Base_URL + "/design/webcontent/css/" + RequestSpecificValues.Static_Web_Content.CssFile + "\" rel=\"stylesheet\" type=\"text/css\" id=\"SobekCmControlledCss\" />");
                }

                // Add the special javascript here
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.JavascriptFile))
                {
                    Output.WriteLine("  <script type=\"text/javascript\" src=\"" + RequestSpecificValues.Current_Mode.Base_URL + "/design/webcontent/javascript/" + RequestSpecificValues.Static_Web_Content.JavascriptFile + "\" id=\"SobekCmControlledJavascript\" ></script>");
                }

                // If this is the static html web content view, add any special text which came from the original
                // static html file which was already read, which can include style sheets, etc..
                if (!String.IsNullOrEmpty(RequestSpecificValues.Static_Web_Content.Extra_Head_Info))
                {
                    Output.WriteLine("  " + RequestSpecificValues.Static_Web_Content.Extra_Head_Info.Trim());
                }

                // Add the javascript for the HTML Editor
                if ((canEdit) && (RequestSpecificValues.Current_Mode.WebContent_Type == WebContent_Type_Enum.Edit))
                {
                    // Build the folder which will include the uploads
                    HTML_Based_Content webContent = RequestSpecificValues.Static_Web_Content;
                    string urlSegments = webContent.UrlSegments;
                    string webcontent_upload_dir = UI_ApplicationCache_Gateway.Settings.Servers.Base_Design_Location + "webcontent\\" + urlSegments.Replace("/", "\\");
                    string webcontent_upload_url = UI_ApplicationCache_Gateway.Settings.Servers.System_Base_URL + "design/webcontent/" + urlSegments.Replace("\\","/") + "/";

                    // Create the CKEditor object
                    CKEditor.CKEditor editor = new CKEditor.CKEditor
                    {
                        BaseUrl = RequestSpecificValues.Current_Mode.Base_URL,
                        Language = RequestSpecificValues.Current_Mode.Language,
                        TextAreaID = "sbkWchs_TextEdit",
                        FileBrowser_ImageUploadUrl = RequestSpecificValues.Current_Mode.Base_URL + "HtmlEditFileHandler.ashx",
                        UploadPath = webcontent_upload_dir,
                        UploadURL = webcontent_upload_url
                    };

                    // If there are existing files, add a reference to the URL for the image browser
                    if ((Directory.Exists(webcontent_upload_dir)) && (Directory.GetFiles(webcontent_upload_dir).Length > 0))
                    {
                        // Is there an endpoint defined for looking at uploaded files?
                        string upload_files_json_url = SobekEngineClient.WebContent.Uploaded_Files_URL;
                        if (!String.IsNullOrEmpty(upload_files_json_url))
                        {
                            editor.ImageBrowser_ListUrl = String.Format(upload_files_json_url, urlSegments);
                        }
                    }

                    if ((RequestSpecificValues.Static_Web_Content.Content.IndexOf("<script", StringComparison.OrdinalIgnoreCase) >= 0) || (RequestSpecificValues.Static_Web_Content.Content.IndexOf("<input", StringComparison.OrdinalIgnoreCase) >= 0))
                        editor.Start_In_Source_Mode = true;

                    // Add the HTML from the CKEditor object
                    editor.Add_To_Stream(Output);
                }
            }

            // If this has a viewer than it is a special, non-public view, add the admin CSS
            if (viewer != null)
            {
                Output.WriteLine("  <link rel=\"stylesheet\" type=\"text/css\" href=\"" + Static_Resources.Sobekcm_Admin_Css + "\" /> ");
            }
        }