<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="templatesadd.aspx.cs"
    Inherits="Focus.Admin.templatesadd" %>

<%@ Register Assembly="Focus.Control" Namespace="Focus.Control" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>新建文档</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="styles/style.css" type="text/css" rel="stylesheet" />
    <meta content="MSHTML 6.00.3790.0" name="GENERATOR" />

    <script language="javascript" type="text/javascript" src="js/main.js"></script>

    <script language="JavaScript" src="dialog/dialog.js"></script>

    <script type="text/javascript">     
        var n = 0;         
        function HighlightAll(obj) {
	        obj.focus();
	        obj.select();
	        if (document.getElementById("Content")) {
		        obj.createTextRange().execCommand("Copy");
		        window.status = '将文档内容复制到剪贴板';
		        setTimeout("window.status=''", 1800);
	        }
        }
        
        function findInPage(obj, str) {
        try
        {
	        var txt, i, found;
	        if (str == "") {
		        return false;
	        }
	        if (document.layers) {
		        if (!obj.find(str)) {
			        while(obj.find(str, false, true)) {
				        n++;
			        }
		        } else {
			        n++;
		        }
		        if (n == 0) {
			        alert("未找到指定字串. ");
		        }
	        }
	        if (document.getElementById("Content")) {
		        txt = obj.createTextRange();
		        for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			        txt.moveStart('character', 1);
			        txt.moveEnd('textedit');
		        }
		        if (found) {
			        txt.moveStart('character', -1);
			        txt.findText(str);
			        txt.select();
			        txt.scrollIntoView();
			        n++;
		        } else {
			        if (n > 0) {
				        n = 0;
				        findInPage(str);
			        } else {
				        alert("未找到指定字串. ");
			        }
		        }
	        }
	        return false;
        }
        catch(error)
        {
	        alert("已经到达文件尾！");
        }
        }
    </script>

    <%=script%>
</head>
<body leftmargin="5" topmargin="5" rightmargin="5" bottommargin="5" background="images/main_bg.gif">
    <form id="Form1" runat="server">
    <table class="TdBg" cellspacing="1" cellpadding="0" width="100%" border="0">
        <tbody>
            <tr valign="middle">
                <td class="Tdimg" style="padding-left: 10px" height="28">
                    <img height="18" src="images/bbs_find.gif" width="18" align="absMiddle" border="0">
                    <strong>新建文档，<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></strong>
                </td>
            </tr>
            <tr class="TdBgL">
                <td>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td style="padding-right: 10px; width: 110px; border-right-width: 1px; border-right-color: #a4b6d7;
                                border-right-style: solid" height="30" align="right" width="110">
                                文档名称：
                            </td>
                            <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px">
                                <cc1:TextBox ID="m_filename" runat="server" Width="300"></cc1:TextBox>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr class="TdBgL">
                <td style="padding-right: 3px; padding-left: 3px; padding-bottom: 3px; padding-top: 3px;
                    height: 400px;" align="center">
                    <div id="dvUI" style="float: left;">
                        <table cellpadding="0" cellspacing="2" border="0" align="left">
                            <tr>
                                <td valign="middle" width="150" height="35">
                                    <input name="search" type="text" accesskey="t" size="20" onchange="n=0;" />&nbsp;
                                </td>
                                <td valign="middle">
                                    <button type="button" class="ManagerButton" accesskey="f" onclick="findInPage(this.form.Content, this.form.search.value)">
                                        <img src="images/search.gif" />搜索
                                    </button>
                                </td>
                                <td>
                                    <button type="button" class="ManagerButton" accesskey="c" onclick="HighlightAll(this.form.Content,'')">
                                        <img src="images/copy.gif" />复制
                                    </button>
                                    &nbsp;
                                </td>
                            </tr>
                        </table>
                    </div>
                    <textarea id="Content" name="Content" runat="server" style="height: 353px; width: 99%;"></textarea>
                    <div id="divEditor" style="height: 0px; width: 99.3%; float: inherit; border-top: #a4b6d7	1px solid;
                        border-left: #a4b6d7	1px solid; border-bottom: #a4b6d7	1px solid; border-right: #a4b6d7	1px solid;
                        display: none;">
                        <iframe style="height: 0px; width: 99.3%;" frameborder="0" marginheight="0" marginwidth="0"
                            src="" id="HtmlEditor" name="HtmlEditor"></iframe>
                    </div>
                </td>
            </tr>
            <tr class="TdBgL">
                <td>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <td height="35" style="padding-right: 10px; width: 110px; border-right-width: 1px;
                                border-right-color: #a4b6d7; border-right-style: solid">
                                &nbsp;
                            </td>
                            <td style="padding-left: 10px;">
                                <cc1:Button ID="Button1" runat="server" Text="保 存" OnClick="Button1_Click" />&nbsp;&nbsp;
                                <button class="ManagerButton" type="button" onclick="javascript:window.location.href='templatetree.aspx?path=<%=path%>&dirpath=<%=dirpath%>';">
                                    <img src="images/arrow_undo.gif" />返 回</button>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>
    </form>
</body>
</html>
