<%@ Page Title="" Language="C#" MasterPageFile="~/PatientAccess/PAAdmin/AdminBase.Master" AutoEventWireup="true" CodeBehind="TemplateEditor.aspx.cs" Inherits="Axium.Web.PAAdmin.TemplateEditorTab.TemplateEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
    <script type="text/javascript">
        function resizeWindow() {
            var winW = 0;
            var winH = 0;
            if (document.body && document.body.offsetWidth) {
                winW = document.body.offsetWidth;
                winH = document.body.offsetHeight;
            }
            if (document.compatMode == 'CSS1Compat' &&
                document.documentElement &&
                document.documentElement.offsetWidth) {
                winW = document.documentElement.offsetWidth;
                winH = document.documentElement.offsetHeight;
            }
            if (window.innerWidth && window.innerHeight) {
                winW = window.innerWidth;
                winH = window.innerHeight;
            }

            var w = gup("fileType") == 'html' ? 127 : 67;

            var elmt = document.getElementById('<%=Content.ClientID%>');
            elmt.style.width = winW - 22 + 'px';
            elmt.style.height = winH - w + 'px';
        }

        function inyectarTexto(selectElm) {
            var text = selectElm.options[selectElm.selectedIndex].value;
            var elementoDom = document.getElementById('<%=Content.ClientID%>'); //document.getElementsByName('<%=Content.ClientID%>')[0];
            if (document.selection) {
                elementoDom.trigger('focus');        // AX-24898.24919.2 .focus();
                var sel = document.selection.createRange();
                sel.text = text;
                return;
            } if (elementoDom.selectionStart || elementoDom.selectionStart == "0") {
                var tStart = elementoDom.selectionStart;
                var tEnd = elementoDom.selectionEnd;
                var valStart = elementoDom.value.substring(0, tStart);
                var valEnd = elementoDom.value.substring(tEnd, elementoDom.value.length);
                elementoDom.value = valStart + text + valEnd;
            } else {
                elementoDom.value += text;
            }
        }

        $(document).ready(function () {
            resizeWindow();

            window.onresize = function () {
                resizeWindow();
            };
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Container" runat="server">
    <div class="headerRow">
        <span class="saveButton"><asp:Button ID="SaveBtn" runat="server" Text="Save" onclick="SaveBtn_Click" CssClass="ButtonGreen"/></span>
        <span class="closeButton"><asp:Button ID="CloseBtn" runat="server" Text="Close" onClientClick="window.close()" CssClass="ButtonGrey" /></span>
    </div>
    
    <asp:TextBox ID="Content" runat="server" CssClass="content" TextMode="MultiLine"></asp:TextBox>
    
    <asp:Panel runat="server" ID="FooterRow" CssClass="footerRow">
        <div class="controlBox">
            <label for="ReplacementAreaSelect">Replacement Area:</label>
            <select id="ReplacementAreaSelect">
                <option value="<!--Cascading Style Sheet Replacement Area-->">CSS</option>
                <option value="<!--Javascript Replacement Area-->">Javascript</option>
                <option value="<!--Header Content Replacement Area-->">Header</option>
                <option value="<!--Banner Content Replacement Area-->">Banner</option>
                <option value="<!--Navigation Content Replacement Area-->">Main Navigation</option>
                <option value="<!--Navigation SubMenu Replacement Area-->">Sub Navigation</option>
                <option value="<!--Left Content Replacement Area-->">Left</option>
                <option value="<!--Main Content Replacement Area-->">Main</option>
                <option value="<!--Footer Content Replacement Area-->">Footer</option>
                <option value="<!--Custom1 Content Replacement Area-->">Custom1</option>
                <option value="<!--Custom2 Content Replacement Area-->">Custom2</option>
                <option value="<!--Custom3 Content Replacement Area-->">Custom3</option>  
                <option value="<!--Custom4 Content Replacement Area-->">Custom4</option>
                <option value="<!--Custom5 Content Replacement Area-->">Custom5</option>
            </select>
            <input type="button" value="Insert" onclick="inyectarTexto(ReplacementAreaSelect);" />
        </div>
        <div class="controlBox">
            <label for="ReplacementStringSelect">Replacement String:</label>
            <select id="ReplacementStringSelect">
                <option value="<!--Logged In User Replacement String-->">Logged In User</option>
            </select>
            <input type="button" value="Insert" onclick="inyectarTexto(ReplacementStringSelect);" />
        </div>
    </asp:Panel>
</asp:Content>
